diff --git a/.gitignore b/.gitignore index cd72efb10..380a02850 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,12 @@ +// Our automatic versioning scheme generates the following file +// NEVER put it in the repository +_Version.h + +// All of the following OS, IDE and compiler generated file +// references should be moved from this file +// They are needed, but they belong in your global .gitignore +// rather than in a per-project file such as this + *.o applet/ *~ diff --git a/ArduinoAddons/Arduino_1.5.x/hardware/marlin/avr/platform.local.txt b/ArduinoAddons/Arduino_1.5.x/hardware/marlin/avr/platform.local.txt new file mode 100644 index 000000000..ff2ad5d22 --- /dev/null +++ b/ArduinoAddons/Arduino_1.5.x/hardware/marlin/avr/platform.local.txt @@ -0,0 +1 @@ +compiler.cpp.extra_flags=-DHAS_AUTOMATIC_VERSIONING diff --git a/Documentation/GCodes.md b/Documentation/GCodes.md index 57b95cdee..c05be6198 100644 --- a/Documentation/GCodes.md +++ b/Documentation/GCodes.md @@ -1,108 +1,176 @@ -# Implemented G Codes +## Implemented G Codes -## G Codes +### Movement G and M Codes +``` +G0 -> G1 +G1 - Coordinated Movement X Y Z E +G2 - CW ARC +G3 - CCW ARC +G4 - Dwell S[seconds] or P[milliseconds] +G92 - Set the "current position" to coordinates: X Y Z E +M0 - Wait for user, with optional prompt message (requires LCD controller) + M0 Click When Ready ; show "Click When Ready" until the button is pressed. +M1 - Same as M0 +M400 - Finish all moves +M999 - Restart after being stopped by error +``` +### SD Card M Codes +``` +M20 - List SD card +M21 - Init SD card +M22 - Release SD card +M23 - Select SD file (M23 filename.g) +M24 - Start/resume SD print +M25 - Pause SD print +M26 - Set SD position in bytes (M26 S12345) +M27 - Report SD print status +M28 - Start SD write (M28 filename.g) +M29 - Stop SD write +M30 - Delete file from SD (M30 filename.g) +M31 - Output time since last M109 or SD card start to serial +M32 - Select file and start SD print (Can be used _while_ printing from SD card files): + syntax "M32 /path/filename#", or "M32 S !filename#" + Call gcode file : "M32 P !filename#" and return to caller file after finishing (similar to #include). + The '#' is necessary when calling from within sd files, as it stops buffer prereading +M540 - Enable/Disable "Stop SD Print on Endstop Hit" (req. ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) + M540 S<0|1> +M928 - Start SD logging (M928 filename.g) - ended by M29 +``` +### Hardware Control +``` +M42 - Change pin status via gcode: P S. If P is omitted the onboard LED pin will be used. + M42 P9 S1 ; set PIN 9 to 1. +M80 - Turn on Power Supply +M81 - Turn off Power Supply +M84 - Disable steppers until next move, + or use S to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout. +M85 - Set inactivity shutdown timer with parameter S. Disable with "M85" or "M85 S0". +M112 - Emergency stop. Requires hardware reset!! +M226 - Wait for a pin to be in some state: P S +``` +### Temperature M Codes +``` +M104 - Set extruder target temp +M105 - Read current temp +M106 - Fan on +M107 - Fan off +M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating + Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling + IF AUTOTEMP is enabled, S B F. Exit autotemp by any M109 without F +M140 - Set bed target temp +M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating + Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling +M301 - Set PID parameters P I and D +M302 - Allow cold extrudes, or set the minimum extrude S. +M303 - PID relay autotune S sets the target temperature. (default target temperature = 150C) +M304 - Set bed PID parameters P I and D +``` +### Message M Codes +``` +M114 - Output current position to serial port +M115 - Capabilities string +M117 - Display message text on the LCD +M119 - Output Endstop status to serial port +``` +### Endstops M Codes +``` +M120 - Enable endstop detection +M121 - Disable endstop detection +``` +### Special Features M Codes +``` +M126 - Solenoid Air Valve Open (BariCUDA support by jmil) +M127 - Solenoid Air Valve Closed (BariCUDA vent to atmospheric pressure by jmil) +M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil) +M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil) +M150 - Set BlinkM Color: R U B via I2C. Range: 0-255 +M240 - Trigger a camera to take a photograph. (Add to your per-layer GCode.) +M250 - Set LCD contrast: C<0-63> +M280 - Set servo position absolute. P S +M300 - Play beep sound S P +M380 - Activate solenoid on active extruder +M381 - Disable all solenoids +M600 - Pause for filament change X Y Z E L +``` +### Units and Measures G and M Codes +``` +G90 - Use Absolute Coordinates +G91 - Use Relative Coordinates +M82 - Set E codes absolute (default) +M83 - Set E codes relative while in Absolute Coordinates (G90) mode +M92 - Set axis_steps_per_unit - same syntax as G92 +M200 - Set filament diameter and set E axis units to mm^3 (use S0 to set back to mm).: D +M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000) +M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!! +M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec +M204 - Set default acceleration: P for Printing moves, R for Retract only (no X, Y, Z) moves and T for Travel (non printing) moves (ex. M204 P800 T3000 R9000) in mm/sec^2 +M205 - Advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X=maximum xy jerk, Z=maximum Z jerk, E=maximum E jerk +M206 - Set additional homing offset +M218 - Set hotend offset (in mm): T X Y +M220 - Set speed factor override percentage: S +M221 - Set extrude factor override percentage: S +``` +### Firmware Retraction G and M Codes +``` +G10 - Retract filament according to settings of M207 +G11 - Retract recover filament according to settings of M208 +M207 - Set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop], stays in mm regardless of M200 setting +M208 - Set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/s] +M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction +``` +### Z Probe G and M Codes +``` +G28 - Home all Axis +G29 - Detailed Z-Probe, probes the bed at 3 or more points. The printer must be homed with G28 before G29. +G30 - Single Z Probe, probes bed at current XY location. +G31 - Dock Z Probe sled (if enabled) +G32 - Undock Z Probe sled (if enabled) +M48 - Measure Z_Probe repeatability: P X Y V E=engage L + As with G29, the E flag causes the probe to stow after each probe. +M401 - Lower Z-probe (if present) +M402 - Raise Z-probe (if present) +``` +### Filament Diameter M Codes +``` +M404 - Set (or display) Nominal Filament Diameter in mm: [N] (e.g., 3mm or 1.75mm) +M405 - Turn on Filament Sensor extrusion control: [D] to set distance (in cm) from sensor to extruder +M406 - Turn off Filament Sensor extrusion control +M407 - Display measured Filament Diameter +``` +### EEPROM Settings M Codes +``` +M500 - Store parameters in EEPROM +M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily). +M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. +M503 - Print the current settings (from memory not from EEPROM). Use S0 to leave off headings. +``` +### Delta M Codes +``` +M665 - Set Delta configurations: L R S +M666 - Set Delta endstop adjustment: X Y Z +M605 - Set dual x-carriage movement mode: S [ X R ] +``` +### Stepper Driver M Codes +``` +M17 - Enable/Power all stepper motors +M18 - Disable all stepper motors. (same as M84) +M907 - Set digital trimpot motor current using axis codes. +M908 - Control digital trimpot directly. +M350 - Set microstepping mode. +M351 - Toggle MS1 MS2 pins directly. +``` +### SCARA M-Codes +__May change to suit future G-code standards__ +``` +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) +M362 - SCARA calibration: Move to cal-position PsiA (0 deg calibration) +M363 - SCARA calibration: Move to cal-position PsiB (90 deg calibration - steps per degree) +M364 - SCARA calibration: Move to cal-position PSIC (90 deg to Theta calibration position) +M365 - SCARA calibration: Scaling factor, X, Y, Z axis +``` -* G0 -> G1 -* G1 - Coordinated Movement X Y Z E -* G2 - CW ARC -* G3 - CCW ARC -* G4 - Dwell S[seconds] or P[milliseconds] -* G10 - retract filament according to settings of M207 -* G11 - retract recover filament according to settings of M208 -* G28 - Home all Axis -* G29 - Detailed Z-Probe, probes the bed at 3 points. You must be at the home position for this to work correctly. -* G30 - Single Z Probe, probes bed at current XY location. -* G31 - Dock Z Probe sled (if enabled) -* G32 - Undock Z Probe sled (if enabled) -* G90 - Use Absolute Coordinates -* G91 - Use Relative Coordinates -* G92 - Set current position to cordinates given - -## M Codes -* M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled) -* M1 - Same as M0 -* M17 - Enable/Power all stepper motors -* M18 - Disable all stepper motors; same as M84 -* M20 - List SD card -* M21 - Init SD card -* M22 - Release SD card -* M23 - Select SD file (M23 filename.g) -* M24 - Start/resume SD print -* M25 - Pause SD print -* M26 - Set SD position in bytes (M26 S12345) -* M27 - Report SD print status -* M28 - Start SD write (M28 filename.g) -* M29 - Stop SD write -* M30 - Delete file from SD (M30 filename.g) -* M31 - Output time since last M109 or SD card start to serial -* M32 - Select file and start SD print (Can be used when printing from SD card) -* M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used. -* M80 - Turn on Power Supply -* M81 - Turn off Power Supply -* M82 - Set E codes absolute (default) -* M83 - Set E codes relative while in Absolute Coordinates (G90) mode -* M84 - Disable steppers until next move, or use S[seconds] to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout. -* M85 - Set inactivity shutdown timer with parameter S[seconds]. To disable set zero (default) -* M92 - Set axis_steps_per_unit - same syntax as G92 -* M104 - Set extruder target temp -* M105 - Read current temp -* M106 - Fan on -* M107 - Fan off -* M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating -* Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling -* M112 - Emergency stop -* M114 - Output current position to serial port -* M115 - Capabilities string -* M117 - display message -* M119 - Output Endstop status to serial port -* M126 - Solenoid Air Valve Open (BariCUDA support by jmil) -* M127 - Solenoid Air Valve Closed (BariCUDA vent to atmospheric pressure by jmil) -* M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil) -* M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil) -* M140 - Set bed target temp -* M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating -* Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling -* M200 - D[millimeters]- set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters). -* M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000) -* M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!! -* M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec -* M204 - Set default acceleration: P for Printing moves, R for Retract only (no X, Y, Z) moves and T for Travel (non printing) moves (ex. M204 P800 T3000 R9000) in mm/sec^2 -* M205 - advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk, E=maximum E jerk -* M206 - set additional homing offset -* M207 - set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop], stays in mm regardless of M200 setting -* M208 - set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/min] -* M209 - S[1=true/0=false] enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction. -* M218 - set hotend offset (in mm): T[extruder_number] X[offset_on_X] Y[offset_on_Y] -* M220 - S[factor in percent] - set speed factor override percentage -* M221 - S[factor in percent] - set extrude factor override percentage -* M240 - Trigger a camera to take a photograph -* M280 - Position an RC Servo P[index] S[angle/microseconds], ommit S to report back current angle -* M300 - Play beep sound S[frequency Hz] P[duration ms] -* M301 - Set PID parameters P I and D -* M302 - Allow cold extrudes -* M303 - PID relay autotune S[temperature] sets the target temperature. (default target temperature = 150C) -* M304 - Set bed PID parameters P I and D -* M350 - Set microstepping mode. -* M351 - Toggle MS1 MS2 pins directly. -* M400 - Finish all moves -* M401 - Lower z-probe if present -* M402 - Raise z-probe if present -* M404 - N[dia in mm] Enter the nominal filament width (3mm, 1.75mm) or will display nominal filament width without parameters -* M405 - Turn on Filament Sensor extrusion control. Optional D[delay in cm] to set delay in centimeters between sensor and extruder -* M406 - Turn off Filament Sensor extrusion control -* M407 - Displays measured filament diameter -* M500 - stores paramters 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. -* M503 - print the current settings (from memory not from EEPROM) -* M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) -* M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] -* M907 - Set digital trimpot motor current using axis codes. -* M908 - Control digital trimpot directly. -* M928 - Start SD logging (M928 filename.g) - ended by M29 -* M999 - Restart after being stopped by error - -# Comments +## Comments Comments start at a `;` (semicolon) and end with the end of the line: @@ -122,4 +190,4 @@ If you need to use a literal `;` somewhere (for example within `M117`), you can M117 backslash: \\;and a comment -Please note that hosts should strip any comments before sending GCODE to the printer in order to save bandwidth. \ No newline at end of file +Please note that hosts should strip any comments before sending GCODE to the printer in order to save bandwidth. diff --git a/Documentation/LCDLanguageFont.md b/Documentation/LCDLanguageFont.md new file mode 100644 index 000000000..a1acfb63f --- /dev/null +++ b/Documentation/LCDLanguageFont.md @@ -0,0 +1,145 @@ +# LCD Language Font System + +We deal with a variety of different displays. +And we try to display a lot of different languages in different scripts on them. +This system is ought to solve some of the related problems. + +## The Displays +We have two different technologies for the displays: + +* Character based displays: + Have a fixed set of symbols (charset - font) in their ROM. + All of them have a similar but not identical symbol set at the positions 0 to 127 similar to US-ASCII. + On the other hand symbols at places higher than 127 have mayor differences. + Until now we know of (and support): + * 1.) HD44780 and similar with Kana charset A00 https://www.sparkfun.com/datasheets/LCD/HD44780.pdf Page 17 + These are very common, but sadly not very useful when writing in European languages. + * 2.) HD44780 and similar with Western charset A02 https://www.sparkfun.com/datasheets/LCD/HD44780.pdf Page 18 + These are rare, but fairly useful for European languages. Also a limited number of Cyrillic symbols is available. + * 3.) HD44780 and similar with Cyrillic charset http://store.comet.bg/download-file.php?id=466 Page 14 + Some of our Russian friends use them. + + At all of them you can define 8 different symbols by yourself. In Marlin they are used for the Feedrate-, Thermometer-, ... symbols + +* Full graphic displays: + Where we have the full freedom to display whatever we want, when we can make a program for it. + Currently we deal with 128x64 Pixel Displays and divide this area in about 5 Lines with about 22 columns. + Therefore we need fonts with a bounding box of about 6x10. + Until now we used a + * 1.) Marlin-font similar to ISO10646-1 but with special Symbols at the end, what made 'ü' and 'ä' inaccessible, in the size 6x10. + * 2.) Because these letters where to big for some locations on the info-screen we use a full ISO10646-1 font in the size of 6x9.(3200 byte) + * 3.) When we define USE_BIG_EDIT_FONT we use an additional ISO10646-1 font with 9x18, eating up another 3120 bytes of progmem - but readable without glasses. + +## The Languages + For the moment Marlin wants to support a lot of languages: + * en English + * pl Polish + * fr French + * de German + * es Spanish + * ru Russian + * it Italian + * pt Portuguese + * pt-br Portuguese (Brazil) + * fi Finnish + * an Aragonese + * nl Dutch + * ca Catalan + * eu Basque-Euskera + + and recently on [Thingiverse](http://www.thingiverse.com/) a new port to + * jp [Japanese](http://www.thingiverse.com/thing:664397) + + appeared. + +## The Problem + All of this languages, except the English, normally use extended symbol sets, not contained in US-ASCII. + Even the English translation uses some Symbols not in US-ASCII. ( '\002' for Thermometer, STR_h3 for '³') + And worse, in the code itself symbols are used, not taking in account, on what display they are written. [(This is true only for Displays with Japanese charset](https://github.com/MarlinFirmware/Marlin/blob/Development/Marlin/ultralcd_implementation_hitachi_HD44780.h#L218) on Western displays you'll see a '~' and on Cyrillic an 'arrow coming from top - pointing to left', what is quite the opposite of what the programmer wanted.) + The Germans want to use "ÄäÖöÜüß" the Finnish at least "äö". Other European languages want to see their accents on their letters. + For other scripts like Cyrillic, Japanese, Greek, Hebrew, ... you have to find totally different symbol sets. + + Until now the problems where ignored widely. + The German translation used utf8 'ä' and 'ö' and did not care about showing garbage on ALL displays. + The Russian translators new that their system only works on the Cyrillic character displays and relied on special LCD routines (LiquidCrystalRus.cpp) to handle UTF8 but missed to implement a proper strlen(). + The Japanese translator dealed with to scripts. He introduced a very special font for the full graphic displays and made use of the Japanese version of the character displays. Therefore he ended up with two pretty unreadable language.h files full of '\xxx' definitions. + Other languages ether tried to avoid wording with their special symbols or ignored the problem at all and used the basic symbols without the accents, dots, ... whatever. + +## The (partial) Solution + On a 'perfect' system like Windows or Linux we'd dig out unifont.ttf and some code from the libraries and they'd do what we want. But we are on a embedded system with very limited resources. So we had to find ways to limit the used space (Alone unifont.ttf is about 12MB) and have to make some compromise. + +### Aims: + * 1.) Make the input for translators as convenient as possible. (Unicode UTF8) + * 2.) Make the displays show the scripts as good as they can. (fonts, mapping tables) + * 3.) Don't destroy the existing language files. + * 3.) Don't loose to much speed + * 4.) Don't loose to much memory. + +### Actions: + * a.) Declare the display hardware we use. (Configuration.h) + * b.) Declare the language ore script we use. (Configuration.h) + * c.) Declare the kind of input we use. Ether direct pointers to the font (\xxx) or UTF8 and the font to use on graphic displays. (language_xx.h) + * d.) Declare the needed translations. (language_xx.h) + * e.) Make strlen() work with UTF8. (ultralcd.cpp) + * f.) Seperate the Marlin Symbols to their own font. (dogm_font_data_Marlin_symbols.h) + * g.) Make the fontswitch function remember the last used font. (dogm_lcd_implementation.h) + * h.) Make output functions that count the number of written chars and switch the font to Marlin symbols and back when needed. (dogm_lcd_implementation.h) (ultralcd_implementation_hitachi_HD44780.h) + * i.) Make three fonts to simulate the HD44780 charsets on dogm-displays. With this fonts the translator can check how his translation will look on the character based displays. + * j.) Make ISO fonts for Cyrillic and Katakana because they do not need a mapping table and are faster to deal with and have a better charset (less compromises) than the HD44780 fonts. + * k.) Make mapping functions and tables to convert from UTF8 to the fonts and integrate in the new output functions. (utf_mapper.h) + * l.) Delete the not needed any more 'LiquidCrystalRus.xxx' files and their calls in 'ultralcd_implementation_hitachi_HD44780.h'. + * m.) Split 'dogm_font_data_Marlin.h' into separate fonts and delete. (+dogm_font_data_6x9_marlin.h , +dogm_font_data_Marlin_symbols.h, -dogm_font_data_Marlin.h) + * n.) Do a bit of preprocessor magic to match displays - fonts and mappers in 'utf_mapper.h'. + +## Translators handbook + * a.) Check is there already is a language_xx.h file for your language (-> b.) or not (-> e.) + * b.) Ether their is declared MAPPER_NON (-> c.) or an other mapper (-> d.) + * c.) Symbols outside the normal ASCII-range (32-128) are written as "\xxx" and point directly into the font of the hardware you declared in 'Configuration.h' + This is one of the three fonts of the character based Hitachi displays (DISPLAY_CHARSET_HD44780_JAPAN, DISPLAY_CHARSET_HD44780_WEST, DISPLAY_CHARSET_HD44780_CYRILIC). + Even on the full graphic displays one of these will be used when SIMULATE_ROMFONT is defined. + If you don't make use of the extended character set your file will look like 'language_en.h' and your language file will work on all the displays. + If you make intensive use, your file will look like 'language_kana.h' and your language file will only work on one of displays. (in this case DISPLAY_CHARSET_HD44780_JAPAN) + Be careful with the characters 0x5c = '\', and 0x7b - 0x7f. "{|}"These are not the same on all variants. + MAPPER_NON is the fastest an least memory consuming variant. + If you want to make use of more than a view symbols outside standard ASCII or want to improve the portability to more different types of displays use UTF8 input. That means define an other mapper. + * d.) With a mapper different to MAPPER_NON UTF8 input is used. Instead of "\xe1" (on a display with Japanese font) or STR_ae simply use "ä". When the string is read byte by byte , the "ä" will expand to "\0xc3\0xa4" or "Я" will expand to "0xd0\0xaf" or "ホ" will expand to "\0xe3\0x83\0x9b" + To limit the used memory we can't use all the possibilities UTF8 gives at the same time. We define a subset matching to the language or script we use. + * MAPPER_C2C3 correspondents good with west European languages the possible symbols are listed at (http://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)) + * MAPPER_D0D1 correspondents well with the Cyrillic languages. See (http://en.wikipedia.org/wiki/Cyrillic_(Unicode_block)) + * MAPPER_E382E383 works with the Japanese Katakana script. See (http://en.wikipedia.org/wiki/Katakana_(Unicode_block)) + + The mapper functions will only catch the 'lead in' described in the mappers name. If the input they get does not match they'll put out a '?' or garbage. + The last byte in the sequence ether points directly into a matching ISO10646 font or via a mapper_table into one of the HD44780 fonts. + The mapper_tables do their best to find a similar symbol in the HD44780_fonts. For example replacing small letters with the matching capital letters. But they may fail to find something matching and will output a '?'. There are combinations of language and display what simply have no corresponding symbols - like Cyrillic on a Japanese display or visa versa - than the compiler will throw an error. + In short: Chose a Mapper working with the symbols you want to use. Use only symbols matching the mapper. On FULL graphic displays all will be fine, but check for daring replacements or question-marks in the output of character based displays by defining SIMULATE_ROMFONT and trying the different variants. + If you get a lot of question-marks on the Hitachi based displays with your new translation, maybe creating an additional language file with the format 'language_xx_utf8.h' is the way to go. + * MAPPER_NON is the fastest and least memory consuming variant. + * Mappers together with a ISO10646_font are the second best choice regarding speed and memory consumption. Only a few more decisions are mad per character. + * Mappers together with the HD44780_fonts use about additional 128 bytes for the mapping_table. + * e.) Creating a new language file is not a big thing. Just make a new file with the format 'language_xx.h' or maybe 'language.xx.utf8.h', define a mapper and a font in there and translate some of the strings defined in language_en.h. You can drop the surrounding #ifndef #endif. You don't have to translate all the stings - the missing one will be added by language_en.h - in English - of cause. + * f.) If you cant find a matching mapper things will be a bit more complex. With the Hitachi based displays you will not have big chance to make something useful unless you have one with a matching charset. For a full graphic display - lets explain with - let's say Greece. + Find a matching charset. (http://en.wikipedia.org/wiki/Greek_and_Coptic) + Provide a font containing the symbols in the right size. Normal ASCII in the lower 127 places, the upper with your selection. + Write a mapper catching, in this case, 0xcd to 0xcf and add it to 'utf_mapper.h'. + In case of a ISO10646 font we have a MAPPER_ONE_TO_ONE and don't have to make a table. + * g.) If you discover enough useful symbols in one of the HD44780 fonts you can provide a mapping table. For example HD44780_WEST contains 'alpha', 'beta', 'pi', 'Sigma', 'omega' 'My' - what is not enough to make USEFUL table - I think. + * h.) If you want to integrate an entirely new variant of a Hitachi based display. + Add it in 'Configuration.h'. Define mapper tables in 'utf_mapper.h'. Maybe you need a new mapper function. + + The length of the strings is limited. '17 chars' was crude rule of thumb. Obviously 17 is to long for the 16x2 displays. A more exact rule would be max_strlen = Displaywidth - 2 - strlen(value to display behind). This is a bit complicated. So try and count is my rule of thumb. + + On the 16x2 displays the strings are cut at the end to fit on the display. So it's a good idea to make them differ early. ('Somverylongoptionname x' -> 'x Somverylongoptionname') + + You'll find all translatable strings in 'language_en.h'. Please don't translate any strings from 'language.h', this may break the serial protocol. + +## User Instructions + Define your hardware and the wanted language in 'Configuration.h'. + To find out what charset your hardware is, define language 'test' and compile. In the menu you will see two lines from the upper half of the charset. + * DISPLAY_CHARSET_HD44780_JAPAN locks like "バパヒビピフブプヘベペホボポマミ" + * DISPLAY_CHARSET_HD44780_WESTERN locks like "ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß" + * DISPLAY_CHARSET_HD44780_CYRILIC locks like "РСТУФХЦЧШЩЪЫЬЭЮЯ" + + If you get an error about missing mappers during compilation - lie about your displays hardware font to see at lest some garbage, or select an other language. + + English works on all hardware. + diff --git a/Documentation/MeshBedLeveling.md b/Documentation/MeshBedLeveling.md new file mode 100644 index 000000000..09c1ec948 --- /dev/null +++ b/Documentation/MeshBedLeveling.md @@ -0,0 +1,82 @@ +============================================== +Instructions for configuring Mesh Bed Leveling +============================================== + +Background +---------- + +This mesh based method of leveling/compensating can compensate for an non-flat bed. There are various opinions about doing this. It was primarily written to compensate a RigidBot BIG bed (40x30cm) that was somewhat bent. + +Currently there is no automatic way to probe the bed like the Auto Bed Leveling feature. So, you can not enable `ENABLE_AUTO_BED_LEVELING` at the same time. This might soon be implemented though, stay tuned. + +Theory +------ + +The bed is manually probed in a grid maner. During a print the Z axis compensation will be interpolated within each square using a bi-linear method. Because the grid squares can be tilting in different directions a printing move can be split on the borders of the grid squares. During fast travel moves one can sometimes notice a de-acceleration on these borders. + +Mesh point probing can either be carried out from the display, or by issuing `G29` commands. + +The Z-endstop should be set slightly above the bed. An opto endstop is preferable but a switch with a metal arm that allow some travel though should also work. + +Configuration +------------- + +In `Configuration.h` there are two options that can be enabled. + +`MESH_BED_LEVELING` will enable mesh bed leveling.
+`MANUAL_BED_LEVELING` will add the menu option for bed leveling. + +There are also some values that can be set. + +The following will set the step distance used when manually turning the display encoder. Default is 0.025 + +`MBL_Z_STEP` + +Following four define the area to cover. Default 10mm from max bed size + +`MESH_MIN_X`
+`MESH_MAX_X`
+`MESH_MIN_Y`
+`MESH_MAX_Y` + +Following two define the number of points to probe, total number will be these two multiplied. Default is 3x3 points. Don't probe more than 7x7 points (software limited) + +`MESH_NUM_X_POINTS`
+`MESH_NUM_Y_POINTS`
+ +The following will set the Z-endstop height during probing. When initiating a bed leveling probing, a homing will take place and the Z-endstop will be set to this height so lowering through the endstop can take place and the bed should be within this distance. Default is 4mm + +`MESH_HOME_SEARCH_Z` + +The probed points will also be saved in the EEPROM if it has been enables. Otherwise a new probe sequence needs to be made next time the printer has been turned on. + +Probing the bed with the display +-------------------------------- + +If `MANUAL_BED_LEVELING` has been enabled then will a `Level bed` menu option be available in the `Prepare` menu. + +When selecting this option the printer will first do a homing, and then travel to the first probe point. There it will wait. By turning the encoder on the display the hotend can now be lowered until it touches the bed. Using a paper to feel the distance when it gets close. Pressing the encoder/button will store this point and then travel to the next point. Repeating this until all points have been probed. + +If the EEPROM has been enable it can be good to issue a `M500` to get these points saved. + +Issuing a `G29` will return the state of the mesh leveling and report the probed points. + +Probing the bed with G-codes +---------------------------- + +Probing the bed by G-codes follows the sequence much like doing it with the display. + +`G29` or `G29 S0` will return the state of the bed leveling and report the probed points. Where X=1 Y=1 is the top-left value and X=MESH_NUM_X_POINTS Y=MESH_NUM_Y_POINTS is bottom-right value. X per column and Y per row. + +`G29 S1` will initiate the bed leveling, homing and traveling to the first point to probe. + +Then use your preferred Printer controller program, i.e. Printrun, to lower the hotend until it touches the bed. Using a paper to feel the distance when it gets close. + +`G29 S2` will store the point and travel to the next point until last point has been probed. + +`G29 S3 Xn Yn Zn.nn` will modify a single probed point. This can be used to tweak a badly probed point. Specify probe point where `Xn` and `Yn`, where `n` in `Xn` is between 1 and `MESH_NUM_X_POINTS`. Likewise for `Yn`. `Zn.nn` is the new Z value in that probed point. + +Note +---- + +Depending how firm feel you aim for on the paper you can use the `Z offset` option in Slic3r to compensate a slight height diff. (I like the paper loose so I needed to put `-0.05` in Slic3r) \ No newline at end of file diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index fc6d6573e..fa574083d 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -4,8 +4,14 @@ */ #ifndef CONDITIONALS_H +#ifndef M_PI + #define M_PI 3.1415926536 +#endif + #ifndef CONFIGURATION_LCD // Get the LCD defines which are needed first + #define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0) + #define CONFIGURATION_LCD #if defined(MAKRPANEL) @@ -124,7 +130,6 @@ #define NEWPANEL #endif - #ifdef ULTIPANEL #define NEWPANEL //enable this if you have a click-encoder panel #define SDSUPPORT @@ -138,16 +143,45 @@ #endif #else //no panel but just LCD #ifdef ULTRA_LCD - #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display - #define LCD_WIDTH 22 - #define LCD_HEIGHT 5 - #else - #define LCD_WIDTH 16 - #define LCD_HEIGHT 2 - #endif + #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display + #define LCD_WIDTH 22 + #define LCD_HEIGHT 5 + #else + #define LCD_WIDTH 16 + #define LCD_HEIGHT 2 + #endif #endif #endif + #ifdef DOGLCD + /* Custom characters defined in font font_6x10_marlin_symbols */ + // \x00 intentionally skipped to avoid problems in strings + #define LCD_STR_REFRESH "\x01" + #define LCD_STR_FOLDER "\x02" + #define LCD_STR_ARROW_RIGHT "\x03" + #define LCD_STR_UPLEVEL "\x04" + #define LCD_STR_CLOCK "\x05" + #define LCD_STR_FEEDRATE "\x06" + #define LCD_STR_BEDTEMP "\x07" + #define LCD_STR_THERMOMETER "\x08" + #define LCD_STR_DEGREE "\x09" + + #define LCD_STR_SPECIAL_MAX '\x09' + // Maximum here is 0x1f because 0x20 is ' ' (space) and the normal charsets begin. + // Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here. + #else + /* Custom characters defined in the first 8 characters of the LCD */ + #define LCD_STR_BEDTEMP "\x00" // this will have 'unexpected' results when used in a string! + #define LCD_STR_DEGREE "\x01" + #define LCD_STR_THERMOMETER "\x02" + #define LCD_STR_UPLEVEL "\x03" + #define LCD_STR_REFRESH "\x04" + #define LCD_STR_FOLDER "\x05" + #define LCD_STR_FEEDRATE "\x06" + #define LCD_STR_CLOCK "\x07" + #define LCD_STR_ARROW_RIGHT ">" /* from the default character set */ + #endif + /** * Default LCD contrast for dogm-like LCD displays */ @@ -155,6 +189,13 @@ #define DEFAULT_LCD_CONTRAST 32 #endif + #ifdef DOGLCD + #define HAS_LCD_CONTRAST + #ifdef U8GLIB_ST7920 + #undef HAS_LCD_CONTRAST + #endif + #endif + #else // CONFIGURATION_LCD #define CONDITIONALS_H @@ -185,6 +226,9 @@ #define ENDSTOPPULLUP_YMIN #define ENDSTOPPULLUP_ZMIN #endif + #ifndef DISABLE_Z_PROBE_ENDSTOP + #define ENDSTOPPULLUP_ZPROBE + #endif #endif /** @@ -252,12 +296,12 @@ * Advance calculated values */ #ifdef ADVANCE - #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) + #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * M_PI) #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS] / EXTRUSION_AREA) #endif #ifdef ULTIPANEL - #undef SDCARDDETECTINVERTED + #undef SDCARDDETECTINVERTED #endif // Power Signal Control Definitions @@ -265,16 +309,14 @@ #ifndef POWER_SUPPLY #define POWER_SUPPLY 1 #endif - // 1 = ATX - #if (POWER_SUPPLY == 1) + #if (POWER_SUPPLY == 1) // 1 = ATX #define PS_ON_AWAKE LOW #define PS_ON_ASLEEP HIGH - #endif - // 2 = X-Box 360 203W - #if (POWER_SUPPLY == 2) + #elif (POWER_SUPPLY == 2) // 2 = X-Box 360 203W #define PS_ON_AWAKE HIGH #define PS_ON_ASLEEP LOW #endif + #define HAS_POWER_SWITCH (POWER_SUPPLY > 0 && PIN_EXISTS(PS_ON)) /** * Temp Sensor defines @@ -345,25 +387,81 @@ #endif /** - * Shorthand for pin tests, for temperature.cpp + * Shorthand for pin tests, used wherever needed */ - #define HAS_TEMP_0 (defined(TEMP_0_PIN) && TEMP_0_PIN >= 0) - #define HAS_TEMP_1 (defined(TEMP_1_PIN) && TEMP_1_PIN >= 0) - #define HAS_TEMP_2 (defined(TEMP_2_PIN) && TEMP_2_PIN >= 0) - #define HAS_TEMP_3 (defined(TEMP_3_PIN) && TEMP_3_PIN >= 0) - #define HAS_TEMP_BED (defined(TEMP_BED_PIN) && TEMP_BED_PIN >= 0) - #define HAS_FILAMENT_SENSOR (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) - #define HAS_HEATER_0 (defined(HEATER_0_PIN) && HEATER_0_PIN >= 0) - #define HAS_HEATER_1 (defined(HEATER_1_PIN) && HEATER_1_PIN >= 0) - #define HAS_HEATER_2 (defined(HEATER_2_PIN) && HEATER_2_PIN >= 0) - #define HAS_HEATER_3 (defined(HEATER_3_PIN) && HEATER_3_PIN >= 0) - #define HAS_HEATER_BED (defined(HEATER_BED_PIN) && HEATER_BED_PIN >= 0) - #define HAS_AUTO_FAN_0 (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN >= 0) - #define HAS_AUTO_FAN_1 (defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN >= 0) - #define HAS_AUTO_FAN_2 (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN >= 0) - #define HAS_AUTO_FAN_3 (defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN >= 0) - #define HAS_AUTO_FAN HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3 - #define HAS_FAN (defined(FAN_PIN) && FAN_PIN >= 0) + #define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 != -2) + #define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0) + #define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0) + #define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0) + #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0) + #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0)) + #define HAS_HEATER_1 (PIN_EXISTS(HEATER_1)) + #define HAS_HEATER_2 (PIN_EXISTS(HEATER_2)) + #define HAS_HEATER_3 (PIN_EXISTS(HEATER_3)) + #define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED)) + #define HAS_AUTO_FAN_0 (PIN_EXISTS(EXTRUDER_0_AUTO_FAN)) + #define HAS_AUTO_FAN_1 (PIN_EXISTS(EXTRUDER_1_AUTO_FAN)) + #define HAS_AUTO_FAN_2 (PIN_EXISTS(EXTRUDER_2_AUTO_FAN)) + #define HAS_AUTO_FAN_3 (PIN_EXISTS(EXTRUDER_3_AUTO_FAN)) + #define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3) + #define HAS_FAN (PIN_EXISTS(FAN)) + #define HAS_CONTROLLERFAN (PIN_EXISTS(CONTROLLERFAN)) + #define HAS_SERVO_0 (PIN_EXISTS(SERVO0)) + #define HAS_SERVO_1 (PIN_EXISTS(SERVO1)) + #define HAS_SERVO_2 (PIN_EXISTS(SERVO2)) + #define HAS_SERVO_3 (PIN_EXISTS(SERVO3)) + #define HAS_FILAMENT_SENSOR (defined(FILAMENT_SENSOR) && PIN_EXISTS(FILWIDTH)) + #define HAS_FILRUNOUT (PIN_EXISTS(FILRUNOUT)) + #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_X_MIN (PIN_EXISTS(X_MIN)) + #define HAS_X_MAX (PIN_EXISTS(X_MAX)) + #define HAS_Y_MIN (PIN_EXISTS(Y_MIN)) + #define HAS_Y_MAX (PIN_EXISTS(Y_MAX)) + #define HAS_Z_MIN (PIN_EXISTS(Z_MIN)) + #define HAS_Z_MAX (PIN_EXISTS(Z_MAX)) + #define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN)) + #define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX)) + #define HAS_Z_PROBE (PIN_EXISTS(Z_PROBE)) + #define HAS_SOLENOID_1 (PIN_EXISTS(SOL1)) + #define HAS_SOLENOID_2 (PIN_EXISTS(SOL2)) + #define HAS_SOLENOID_3 (PIN_EXISTS(SOL3)) + #define HAS_MICROSTEPS (PIN_EXISTS(X_MS1)) + #define HAS_MICROSTEPS_E0 (PIN_EXISTS(E0_MS1)) + #define HAS_MICROSTEPS_E1 (PIN_EXISTS(E1_MS1)) + #define HAS_MICROSTEPS_E2 (PIN_EXISTS(E2_MS1)) + #define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE)) + #define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE)) + #define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE)) + #define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE)) + #define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE)) + #define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE)) + #define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE)) + #define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE)) + #define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE)) + #define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE)) + #define HAS_X_DIR (PIN_EXISTS(X_DIR)) + #define HAS_X2_DIR (PIN_EXISTS(X2_DIR)) + #define HAS_Y_DIR (PIN_EXISTS(Y_DIR)) + #define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR)) + #define HAS_Z_DIR (PIN_EXISTS(Z_DIR)) + #define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR)) + #define HAS_E0_DIR (PIN_EXISTS(E0_DIR)) + #define HAS_E1_DIR (PIN_EXISTS(E1_DIR)) + #define HAS_E2_DIR (PIN_EXISTS(E2_DIR)) + #define HAS_E3_DIR (PIN_EXISTS(E3_DIR)) + #define HAS_X_STEP (PIN_EXISTS(X_STEP)) + #define HAS_X2_STEP (PIN_EXISTS(X2_STEP)) + #define HAS_Y_STEP (PIN_EXISTS(Y_STEP)) + #define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP)) + #define HAS_Z_STEP (PIN_EXISTS(Z_STEP)) + #define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP)) + #define HAS_E0_STEP (PIN_EXISTS(E0_STEP)) + #define HAS_E1_STEP (PIN_EXISTS(E1_STEP)) + #define HAS_E2_STEP (PIN_EXISTS(E2_STEP)) + #define HAS_E3_STEP (PIN_EXISTS(E3_STEP)) /** * Helper Macros for heaters and extruder fan @@ -390,16 +488,5 @@ #define WRITE_FAN(v) WRITE(FAN_PIN, v) #endif - /** - * Sampling period of the temperature routine - * This override comes originally from temperature.cpp - * The Configuration.h option is basically ignored. - */ - #ifdef PID_dT - #undef PID_dT - #endif - #define PID_dT ((OVERSAMPLENR * 12.0)/(F_CPU / 64.0 / 256.0)) - - #endif //CONFIGURATION_LCD #endif //CONDITIONALS_H diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index f5a36e6b9..f48646ac7 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -31,26 +31,32 @@ Here are some standard links for getting your machine calibrated: //=========================================================================== //============================= SCARA Printer =============================== //=========================================================================== -// For a Delta printer replace the configuration files with the files in the +// For a Scara printer replace the configuration files with the files in the // example_configurations/SCARA directory. // +// @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_VERSION "1.0.2" +#define STRING_VERSION "1.0.3 dev" #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. #define STRING_SPLASH_LINE1 "v" STRING_VERSION // will be shown during bootup in line 1 //#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H // will be shown during bootup in line2 +// @section machine + // SERIAL_PORT selects which serial port should be used for communication with the host. // This allows the connection of wireless adapters (for instance) to non-default port pins. // Serial port 0 is still used by the Arduino bootloader regardless of this setting. +// :[0,1,2,3,4,5,6,7] #define SERIAL_PORT 0 // This determines the communication speed of the printer +// :[2400,9600,19200,38400,57600,115200,250000] #define BAUDRATE 250000 // This enables the serial port associated to the Bluetooth interface @@ -62,25 +68,36 @@ Here are some standard links for getting your machine calibrated: #define MOTHERBOARD BOARD_RAMPS_13_EFB #endif -// Define this to set a custom name for your generic Mendel, -// #define CUSTOM_MENDEL_NAME "This Mendel" +// 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" // This defines the number of extruders +// :[1,2,3,4] #define EXTRUDERS 1 +// 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 EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis +//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis + //// The following define selects which power supply you have. Please choose the one that matches your setup // 1 = ATX // 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC) +// :{1:'ATX',2:'X-Box 360'} #define POWER_SUPPLY 1 // Define this to have the electronics keep the power supply off on startup. If you don't know what this is leave it. // #define PS_DEFAULT_OFF +// @section temperature + //=========================================================================== //============================= Thermal Settings ============================ //=========================================================================== @@ -104,7 +121,7 @@ Here are some standard links for getting your machine calibrated: // 10 is 100k RS thermistor 198-961 (4.7k pullup) // 11 is 100k beta 3950 1% thermistor (4.7k pullup) // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) -// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" // 20 is the PT100 circuit found in the Ultimainboard V2.x // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // @@ -118,11 +135,11 @@ Here are some standard links for getting your machine calibrated: // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup // 110 is Pt100 with 1k pullup (non standard) -// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. +// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. // Use it for Testing or Development purposes. NEVER for production machine. // #define DUMMY_THERMISTOR_998_VALUE 25 // #define DUMMY_THERMISTOR_999_VALUE 100 - +// :{ '0': "Not used", '4': "10k !! do not use for a hotend. Bad resolution at high temp. !!", '1': "100k / 4.7k - EPCOS", '51': "100k / 1k - EPCOS", '6': "100k / 4.7k EPCOS - Not as accurate as Table 1", '5': "100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '7': "100k / 4.7k Honeywell 135-104LAG-J01", '71': "100k / 4.7k Honeywell 135-104LAF-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'", '60': "100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '55': "100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '2': "200k / 4.7k - ATC Semitec 204GT-2", '52': "200k / 1k - ATC Semitec 204GT-2", '-2': "Thermocouple + MAX6675 (only for sensor 0)", '-1': "Thermocouple + AD595", '3': "Mendel-parts / 4.7k", '1047': "Pt1000 / 4.7k", '1010': "Pt1000 / 1k (non standard)", '20': "PT100 (Ultimainboard V2.x)", '147': "Pt100 / 4.7k", '110': "Pt100 / 1k (non-standard)", '998': "Dummy 1", '999': "Dummy 2" } #define TEMP_SENSOR_0 1 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 @@ -184,7 +201,6 @@ Here are some standard links for getting your machine calibrated: // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term #define K1 0.95 //smoothing factor within the PID - #define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // Ultimaker @@ -209,7 +225,7 @@ Here are some standard links for getting your machine calibrated: // Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis // // Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. -// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// If your PID_dT is the default, and correct for your hardware/configuration, that means 7.689Hz, // which is fine for driving a square wave into a resistive load and does not significantly impact you 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, you probably @@ -243,6 +259,7 @@ Here are some standard links for getting your machine calibrated: // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. #endif // PIDTEMPBED +// @section extruder //this prevents dangerous Extruder moves, i.e. if the temperature is under the limit //can be software-disabled for whatever purposes by @@ -265,15 +282,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua The system will turn the heater on forever, burning up the filament and anything else around. -After the temperature reaches the target for the first time, this feature will -start measuring for how long the current temperature stays below the target +After the temperature reaches the target for the first time, this feature will +start measuring for how long the current temperature stays below the target minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS). If it stays longer than _PERIOD, it means the thermistor temperature cannot catch up with the target, so something *may be* wrong. Then, to be on the safe side, the system will he halt. -Bear in mind the count down will just start AFTER the first time the +Bear in mind the count down will just start AFTER the first time the thermistor temperature is over the target, so you will have no problem if your extruder heater takes 2 minutes to hit the target on heating. @@ -297,19 +314,29 @@ your extruder heater takes 2 minutes to hit the target on heating. //============================= Mechanical Settings ========================= //=========================================================================== +// @section machine + // Uncomment this option to enable CoreXY kinematics // #define COREXY // Enable this option for Toshiba steppers // #define CONFIG_STEPPERS_TOSHIBA -// The pullups are needed if you directly connect a mechanical endstop between the signal and ground pins. -#define ENDSTOPPULLUP_XMAX -#define ENDSTOPPULLUP_YMAX -#define ENDSTOPPULLUP_ZMAX -#define ENDSTOPPULLUP_XMIN -#define ENDSTOPPULLUP_YMIN -#define ENDSTOPPULLUP_ZMIN +// @section homing + +// coarse Endstop Settings +#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors + +#ifndef ENDSTOPPULLUPS + // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined + // #define ENDSTOPPULLUP_XMAX + // #define ENDSTOPPULLUP_YMAX + // #define ENDSTOPPULLUP_ZMAX + // #define ENDSTOPPULLUP_XMIN + // #define ENDSTOPPULLUP_YMIN + // #define ENDSTOPPULLUP_ZMIN + // #define ENDSTOPPULLUP_ZPROBE +#endif // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. @@ -318,10 +345,19 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. //#define DISABLE_MAX_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS +// @section machine +// If you want to enable the Z Probe pin, but disable its use, uncomment the line below. +// This only affects a Z Probe Endstop if you have separate Z min endstop as well and have +// activated Z_PROBE_ENDSTOP below. If you are using the Z Min endstop on your Z Probe, +// this has no effect. +//#define DISABLE_Z_PROBE_ENDSTOP + // 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 @@ -331,20 +367,32 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z false + +// @section extruder + #define DISABLE_E false // For all extruders #define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled -// If you motor turns to wrong direction, you can invert it here: +// @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 +// @section homing + // ENDSTOP SETTINGS: // Sets 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 @@ -352,6 +400,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. #define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. +// @section machine + // Travel limits after homing (units are in mm) #define X_MIN_POS 0 #define Y_MIN_POS 0 @@ -371,13 +421,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o //#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined. //=========================================================================== -//============================ Manual Bed Leveling ========================== +//============================ Mesh Bed Leveling ============================ //=========================================================================== // #define MANUAL_BED_LEVELING // Add display menu option for bed leveling // #define MESH_BED_LEVELING // Enable mesh bed leveling -#if defined(MESH_BED_LEVELING) +#ifdef MANUAL_BED_LEVELING + #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis +#endif // MANUAL_BED_LEVELING + +#ifdef MESH_BED_LEVELING #define MESH_MIN_X 10 #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MIN_Y 10 @@ -391,6 +445,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o //============================= Bed Auto Leveling =========================== //=========================================================================== +// @section bedlevel + //#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line) #define Z_PROBE_REPEATABILITY_TEST // If not commented out, Z-Probe Repeatability test will be included if Auto Bed Leveling is Enabled. @@ -417,14 +473,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 #define BACK_PROBE_BED_POSITION 170 - + #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this // Set the number of grid points per dimension // You probably don't need more than 3 (squared=9) #define AUTO_BED_LEVELING_GRID_POINTS 2 - #else // !AUTO_BED_LEVELING_GRID // Arbitrary points to probe. A simple cross-product @@ -438,7 +493,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #endif // AUTO_BED_LEVELING_GRID - // Offsets to the probe relative to the extruder tip (Hotend - Probe) // X and Y offsets must be integers #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // Probe on: -left +right @@ -450,7 +504,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min - #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. + #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points #define Z_RAISE_AFTER_PROBING 15 //How much the extruder will be raised after the last probing point. @@ -484,9 +538,25 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #endif + // Support for a dedicated Z PROBE endstop separate from the Z MIN endstop. + // If you would like to use both a Z PROBE and a Z MIN endstop together or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP and read the instructions below. + // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. + // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. + // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 + // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. + // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. + // D32 is currently selected in the RAMPS 1.3/1.4 pin file. All other boards will need changes to the respective pins_XXXXX.h file. + // WARNING: Setting the wrong pin may have unexpected and potentially disastrous outcomes. Use with caution and do your homework. + + //#define Z_PROBE_ENDSTOP + #endif // ENABLE_AUTO_BED_LEVELING +// @section homing + // The position of the homing switches //#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) @@ -500,8 +570,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. #endif -//// MOVEMENT SETTINGS -#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E +// @section movement + +/** + * MOVEMENT SETTINGS + */ + #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0} // set the homing speeds (mm/min) // default settings @@ -514,12 +588,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration in mm/s^2 for retracts #define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves -// 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 EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis -// #define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis - // The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously) #define DEFAULT_XYJERK 20.0 // (mm/sec) #define DEFAULT_ZJERK 0.4 // (mm/sec) @@ -530,14 +598,19 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o //============================= Additional Features =========================== //============================================================================= +// @section more + // Custom M code points #define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES - #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 - #define Z_PROBE_OFFSET_RANGE_MIN -15 - #define Z_PROBE_OFFSET_RANGE_MAX -5 + #ifdef ENABLE_AUTO_BED_LEVELING + #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 + #define Z_PROBE_OFFSET_RANGE_MIN -20 + #define Z_PROBE_OFFSET_RANGE_MAX 20 + #endif #endif +// @section extras // EEPROM // The microcontroller can store settings in the EEPROM, e.g. max velocity... @@ -546,9 +619,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. //define this to enable EEPROM support //#define EEPROM_SETTINGS -//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: -// please keep turned on if you can. -//#define EEPROM_CHITCHAT + +#ifdef EEPROM_SETTINGS + // To disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: + #define EEPROM_CHITCHAT // please keep turned on if you can. +#endif + + +// @section temperature // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 180 @@ -560,15 +638,19 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define ABS_PREHEAT_FAN_SPEED 0 // Insert Value between 0 and 255 //==============================LCD and SD support============================= +// @section lcd // Define your display language below. Replace (en) with your language code and uncomment. -// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu +// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu, kana, kana_utf8, test // See also language.h -//#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) +#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) -// Character based displays can have different extended charsets. -#define DISPLAY_CHARSET_HD44780_JAPAN // "ääööüüß23°" -//#define DISPLAY_CHARSET_HD44780_WESTERN // "ÄäÖöÜüß²³°" if you see a '~' instead of a 'arrow_right' at the right of submenuitems - this is the right one. +// Choose ONE of these 3 charsets. This has to match your hardware. Ignored for full graphic display. +// To find out what type you have - compile with (test) - upload - click to get the menu. You'll see two typical lines from the upper half of the charset. +// See also documentation/LCDLanguageFont.md + #define DISPLAY_CHARSET_HD44780_JAPAN // this is the most common hardware + //#define DISPLAY_CHARSET_HD44780_WESTERN + //#define DISPLAY_CHARSET_HD44780_CYRILLIC //#define ULTRA_LCD //general LCD support, also 16x2 //#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) @@ -581,6 +663,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o //#define ULTIPANEL //the UltiPanel as on Thingiverse //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click + // 0 to disable buzzer feedback // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne @@ -635,15 +718,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o // Shift register panels // --------------------- // 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection //#define SAV_3DLCD +// @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 ass annoying as with the hardware PWM. On the other hand, if this 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 @@ -662,7 +747,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o // Data from: http://www.doc-diy.net/photo/rc-1_hacked/ // #define PHOTOGRAPH_PIN 23 -// SF send wrong arc g-codes when using Arc Point as fillet procedure +// SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX // Support for the BariCUDA Paste Extruder. @@ -688,7 +773,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o // Servo Endstops // // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. -// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. +// Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500. // //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles @@ -697,9 +782,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o * Support for a filament diameter sensor * Also allows adjustment of diameter at print time (vs at slicing) * Single extruder only at this point (extruder 0) - * + * * Motherboards - * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector + * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E) * 301 - Rambo - uses Analog input 3 * Note may require analog pins to be defined for different motherboards @@ -716,7 +801,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define MAX_MEASUREMENT_DELAY 20 //delay buffer size in bytes (1 byte = 1cm)- limits maximum measurement delay allowable (must be larger than MEASUREMENT_DELAY_CM and lower number saves RAM) //defines used in the code -#define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA //set measured to nominal initially +#define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA //set measured to nominal initially //When using an LCD, uncomment the line below to display the Filament sensor data on the last line instead of status. Status will appear for 5 sec. //#define FILAMENT_LCD_DISPLAY diff --git a/Marlin/ConfigurationStore.cpp b/Marlin/ConfigurationStore.cpp index fc485e226..0154691de 100644 --- a/Marlin/ConfigurationStore.cpp +++ b/Marlin/ConfigurationStore.cpp @@ -3,7 +3,21 @@ * * Configuration and EEPROM storage * - * V16 EEPROM Layout: + * IMPORTANT: Whenever there are changes made to the variables stored in EEPROM + * in the functions below, also increment the version number. This makes sure that + * the default values are used whenever there is a change to the data, to prevent + * wrong data being written to the variables. + * + * ALSO: Variables in the Store and Retrieve sections must be in the same order. + * If a feature is disabled, some data must still be written that, when read, + * either sets a Sane Default, or results in No Change to the existing value. + * + */ + +#define EEPROM_VERSION "V19" + +/** + * V19 EEPROM Layout: * * ver * axis_steps_per_unit (x4) @@ -11,7 +25,7 @@ * max_acceleration_units_per_sq_second (x4) * acceleration * retract_acceleration - * travel_aceeleration + * travel_acceleration * minimumfeedrate * mintravelfeedrate * minsegmenttime @@ -25,6 +39,7 @@ * mesh_num_x * mesh_num_y * z_values[][] + * zprobe_zoffset * * DELTA: * endstop_adj (x3) @@ -39,7 +54,6 @@ * absPreheatHotendTemp * absPreheatHPBTemp * absPreheatFanSpeed - * zprobe_zoffset * * PIDTEMP: * Kp[0], Ki[0], Kd[0], Kc[0] @@ -47,6 +61,9 @@ * Kp[2], Ki[2], Kd[2], Kc[2] * Kp[3], Ki[3], Kd[3], Kc[3] * + * PIDTEMPBED: + * bedKp, bedKi, bedKd + * * DOGLCD: * lcd_contrast * @@ -78,7 +95,7 @@ #include "ultralcd.h" #include "ConfigurationStore.h" -#if defined(MESH_BED_LEVELING) +#ifdef MESH_BED_LEVELING #include "mesh_bed_leveling.h" #endif // MESH_BED_LEVELING @@ -111,15 +128,6 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) { #define EEPROM_OFFSET 100 - -// IMPORTANT: Whenever there are changes made to the variables stored in EEPROM -// in the functions below, also increment the version number. This makes sure that -// the default values are used whenever there is a change to the data, to prevent -// wrong data being written to the variables. -// ALSO: always make sure the variables in the Store and retrieve sections are in the same order. - -#define EEPROM_VERSION "V17" - #ifdef EEPROM_SETTINGS void Config_StoreSettings() { @@ -143,7 +151,7 @@ void Config_StoreSettings() { uint8_t mesh_num_x = 3; uint8_t mesh_num_y = 3; - #if defined(MESH_BED_LEVELING) + #ifdef MESH_BED_LEVELING // Compile time test that sizeof(mbl.z_values) is as expected typedef char c_assert[(sizeof(mbl.z_values) == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS*sizeof(dummy)) ? 1 : -1]; mesh_num_x = MESH_NUM_X_POINTS; @@ -161,7 +169,12 @@ void Config_StoreSettings() { for (int q=0; q 1 @@ -713,20 +764,20 @@ void Config_PrintSettings(bool forReplay) { SERIAL_ECHOLNPGM("Filament settings:"); SERIAL_ECHO_START; } - SERIAL_ECHOPAIR(" M200 D", filament_size[0]); + SERIAL_ECHOPAIR(" M200 D", filament_size[0]); SERIAL_EOL; #if EXTRUDERS > 1 SERIAL_ECHO_START; - SERIAL_ECHOPAIR(" M200 T1 D", filament_size[1]); + SERIAL_ECHOPAIR(" M200 T1 D", filament_size[1]); SERIAL_EOL; #if EXTRUDERS > 2 SERIAL_ECHO_START; - SERIAL_ECHOPAIR(" M200 T2 D", filament_size[2]); + SERIAL_ECHOPAIR(" M200 T2 D", filament_size[2]); SERIAL_EOL; #if EXTRUDERS > 3 SERIAL_ECHO_START; - SERIAL_ECHOPAIR(" M200 T3 D", filament_size[3]); + SERIAL_ECHOPAIR(" M200 T3 D", filament_size[3]); SERIAL_EOL; #endif #endif @@ -738,15 +789,20 @@ void Config_PrintSettings(bool forReplay) { } } - #ifdef CUSTOM_M_CODES + #ifdef ENABLE_AUTO_BED_LEVELING SERIAL_ECHO_START; - if (!forReplay) { - SERIAL_ECHOLNPGM("Z-Probe Offset (mm):"); - SERIAL_ECHO_START; - } - SERIAL_ECHO(" M"); - SERIAL_ECHO(CUSTOM_M_CODE_SET_Z_PROBE_OFFSET); - SERIAL_ECHOPAIR(" Z", -zprobe_zoffset); + #ifdef CUSTOM_M_CODES + if (!forReplay) { + SERIAL_ECHOLNPGM("Z-Probe Offset (mm):"); + SERIAL_ECHO_START; + } + SERIAL_ECHOPAIR(" M", (unsigned long)CUSTOM_M_CODE_SET_Z_PROBE_OFFSET); + SERIAL_ECHOPAIR(" Z", -zprobe_zoffset); + #else + if (!forReplay) { + SERIAL_ECHOPAIR("Z-Probe Offset (mm):", -zprobe_zoffset); + } + #endif SERIAL_EOL; #endif } diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 721074e23..6478eb923 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -3,6 +3,8 @@ #include "Conditionals.h" +// @section temperature + //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== @@ -46,6 +48,8 @@ //The M105 command return, besides traditional information, the ADC value read from temperature sensors. //#define SHOW_TEMP_ADC_VALUES +// @section extruder + // extruder run-out prevention. //if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded //#define EXTRUDER_RUNOUT_PREVENT @@ -55,6 +59,8 @@ #define EXTRUDER_RUNOUT_SPEED 1500. //extrusion speed #define EXTRUDER_RUNOUT_EXTRUDE 100 +// @section temperature + //These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements. //The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET" #define TEMP_SENSOR_AD595_OFFSET 0.0 @@ -72,6 +78,8 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// @section extruder + // Extruder cooling fans // Configure fan pin outputs to automatically turn on/off when the associated // extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. @@ -89,8 +97,12 @@ //=============================Mechanical Settings=========================== //=========================================================================== +// @section homing + #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing +// @section extras + //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. // A single Z stepper driver is usually used to drive 2 stepper motors. @@ -98,32 +110,31 @@ // Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used // to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards. // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. -#define Z_DUAL_STEPPER_DRIVERS +//#define Z_DUAL_STEPPER_DRIVERS #ifdef Z_DUAL_STEPPER_DRIVERS -// Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper. -// That way the machine is capable to align the bed during home, since both Z steppers are homed. -// There is also an implementation of M666 (software endstops adjustment) to this feature. -// After Z homing, this adjustment is applied to just one of the steppers in order to align the bed. -// One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2. -// If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive. -// Play a little bit with small adjustments (0.5mm) and check the behaviour. -// The M119 (endstops report) will start reporting the Z2 Endstop as well. - -#define Z_DUAL_ENDSTOPS - -#ifdef Z_DUAL_ENDSTOPS - #define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis. - #define Z2_DIR_PIN E2_DIR_PIN - #define Z2_ENABLE_PIN E2_ENABLE_PIN - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. -#endif - + // Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper. + // That way the machine is capable to align the bed during home, since both Z steppers are homed. + // There is also an implementation of M666 (software endstops adjustment) to this feature. + // After Z homing, this adjustment is applied to just one of the steppers in order to align the bed. + // One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2. + // If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive. + // Play a little bit with small adjustments (0.5mm) and check the behaviour. + // The M119 (endstops report) will start reporting the Z2 Endstop as well. + + #define Z_DUAL_ENDSTOPS + + #ifdef Z_DUAL_ENDSTOPS + #define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis. + #define Z2_DIR_PIN E2_DIR_PIN + #define Z2_ENABLE_PIN E2_ENABLE_PIN + #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) + const bool Z2_MAX_ENDSTOP_INVERTING = false; + #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #endif -#endif +#endif // Z_DUAL_STEPPER_DRIVERS // Same again but for Y Axis. //#define Y_DUAL_STEPPER_DRIVERS @@ -175,15 +186,21 @@ #endif //DUAL_X_CARRIAGE +// @section homing + //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: -#define X_HOME_RETRACT_MM 5 -#define Y_HOME_RETRACT_MM 5 -#define Z_HOME_RETRACT_MM 2 -#define HOMING_BUMP_DIVISOR {10, 10, 20} // Re-Bump Speed Divisor (Divides the Homing Feedrate) +#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 this is defined, if both x and y are to be homed, a diagonal move will be performed initially. +// @section machine + #define AXIS_RELATIVE_MODES {false, false, false, false} +// @section machine + //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 @@ -196,11 +213,15 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +// @section lcd + #ifdef ULTIPANEL #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel #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 @@ -242,27 +263,41 @@ //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again -#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? -#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. - -#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. -// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. -// using: -//#define MENU_ADDAUTOSTART - -// Show a progress bar on HD44780 LCDs for SD printing -//#define LCD_PROGRESS_BAR - -#ifdef LCD_PROGRESS_BAR - // Amount of time (ms) to show the bar - #define PROGRESS_BAR_BAR_TIME 2000 - // Amount of time (ms) to show the status message - #define PROGRESS_BAR_MSG_TIME 3000 - // Amount of time (ms) to retain the status message (0=forever) - #define PROGRESS_MSG_EXPIRE 0 - // Enable this to show messages for MSG_TIME then hide them - //#define PROGRESS_MSG_ONCE -#endif +// @section lcd + +#ifdef SDSUPPORT + + // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted + // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT + // in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should + // be commented out otherwise + #define SDCARDDETECTINVERTED + + #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + + #define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. + // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. + // using: + //#define MENU_ADDAUTOSTART + + // Show a progress bar on HD44780 LCDs for SD printing + //#define LCD_PROGRESS_BAR + + #ifdef LCD_PROGRESS_BAR + // Amount of time (ms) to show the bar + #define PROGRESS_BAR_BAR_TIME 2000 + // Amount of time (ms) to show the status message + #define PROGRESS_BAR_MSG_TIME 3000 + // Amount of time (ms) to retain the status message (0=forever) + #define PROGRESS_MSG_EXPIRE 0 + // Enable this to show messages for MSG_TIME then hide them + //#define PROGRESS_MSG_ONCE + #endif + +#endif // SDSUPPORT + +// @section more // 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 @@ -277,6 +312,8 @@ // Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled. //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED +// @section lcd + // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process // it can e.g. be used to change z-positions in the print startup phase in real-time // does not respect endstops! @@ -287,12 +324,14 @@ #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements #endif +// @section extruder + // extruder advance constant (s2/mm3) // // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2 // -// Hooke's law says: force = k * distance -// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant +// Hooke's law says: force = k * distance +// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant // so: v ^ 2 is proportional to number of steps we advance the extruder //#define ADVANCE @@ -300,7 +339,9 @@ #define EXTRUDER_ADVANCE_K .0 #define D_FILAMENT 2.85 #define STEPS_MM_E 836 -#endif // ADVANCE +#endif + +// @section extras // Arc interpretation settings: #define MM_PER_ARC_SEGMENT 1 @@ -308,11 +349,7 @@ const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement -// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted -// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT -// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should -// be commented out otherwise -#define SDCARDDETECTINVERTED +// @section temperature // Control heater 0 and heater 1 in parallel. //#define HEATERS_PARALLEL @@ -321,6 +358,8 @@ const unsigned int dropsegments=5; //everything with less than this number of st //=============================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, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. #ifdef SDSUPPORT @@ -329,11 +368,13 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define BLOCK_BUFFER_SIZE 16 // maximize block buffer #endif +// @section more //The ASCII buffer for receiving from the serial: #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// @section fwretract // Firmware based and LCD controlled retract // M207 and M208 can be used to define parameters for the retraction. @@ -370,58 +411,60 @@ const unsigned int dropsegments=5; //everything with less than this number of st * you need to import the TMC26XStepper library into the arduino IDE for this ******************************************************************************/ +// @section tmc + //#define HAVE_TMCDRIVER #ifdef HAVE_TMCDRIVER -// #define X_IS_TMC - #define X_MAX_CURRENT 1000 //in mA - #define X_SENSE_RESISTOR 91 //in mOhms - #define X_MICROSTEPS 16 //number of microsteps - -// #define X2_IS_TMC - #define X2_MAX_CURRENT 1000 //in mA - #define X2_SENSE_RESISTOR 91 //in mOhms - #define X2_MICROSTEPS 16 //number of microsteps - -// #define Y_IS_TMC - #define Y_MAX_CURRENT 1000 //in mA - #define Y_SENSE_RESISTOR 91 //in mOhms - #define Y_MICROSTEPS 16 //number of microsteps - -// #define Y2_IS_TMC - #define Y2_MAX_CURRENT 1000 //in mA - #define Y2_SENSE_RESISTOR 91 //in mOhms - #define Y2_MICROSTEPS 16 //number of microsteps - -// #define Z_IS_TMC - #define Z_MAX_CURRENT 1000 //in mA - #define Z_SENSE_RESISTOR 91 //in mOhms - #define Z_MICROSTEPS 16 //number of microsteps - -// #define Z2_IS_TMC - #define Z2_MAX_CURRENT 1000 //in mA - #define Z2_SENSE_RESISTOR 91 //in mOhms - #define Z2_MICROSTEPS 16 //number of microsteps - -// #define E0_IS_TMC - #define E0_MAX_CURRENT 1000 //in mA - #define E0_SENSE_RESISTOR 91 //in mOhms - #define E0_MICROSTEPS 16 //number of microsteps - -// #define E1_IS_TMC - #define E1_MAX_CURRENT 1000 //in mA - #define E1_SENSE_RESISTOR 91 //in mOhms - #define E1_MICROSTEPS 16 //number of microsteps - -// #define E2_IS_TMC - #define E2_MAX_CURRENT 1000 //in mA - #define E2_SENSE_RESISTOR 91 //in mOhms - #define E2_MICROSTEPS 16 //number of microsteps - -// #define E3_IS_TMC - #define E3_MAX_CURRENT 1000 //in mA - #define E3_SENSE_RESISTOR 91 //in mOhms - #define E3_MICROSTEPS 16 //number of microsteps +// #define X_IS_TMC + #define X_MAX_CURRENT 1000 //in mA + #define X_SENSE_RESISTOR 91 //in mOhms + #define X_MICROSTEPS 16 //number of microsteps + +// #define X2_IS_TMC + #define X2_MAX_CURRENT 1000 //in mA + #define X2_SENSE_RESISTOR 91 //in mOhms + #define X2_MICROSTEPS 16 //number of microsteps + +// #define Y_IS_TMC + #define Y_MAX_CURRENT 1000 //in mA + #define Y_SENSE_RESISTOR 91 //in mOhms + #define Y_MICROSTEPS 16 //number of microsteps + +// #define Y2_IS_TMC + #define Y2_MAX_CURRENT 1000 //in mA + #define Y2_SENSE_RESISTOR 91 //in mOhms + #define Y2_MICROSTEPS 16 //number of microsteps + +// #define Z_IS_TMC + #define Z_MAX_CURRENT 1000 //in mA + #define Z_SENSE_RESISTOR 91 //in mOhms + #define Z_MICROSTEPS 16 //number of microsteps + +// #define Z2_IS_TMC + #define Z2_MAX_CURRENT 1000 //in mA + #define Z2_SENSE_RESISTOR 91 //in mOhms + #define Z2_MICROSTEPS 16 //number of microsteps + +// #define E0_IS_TMC + #define E0_MAX_CURRENT 1000 //in mA + #define E0_SENSE_RESISTOR 91 //in mOhms + #define E0_MICROSTEPS 16 //number of microsteps + +// #define E1_IS_TMC + #define E1_MAX_CURRENT 1000 //in mA + #define E1_SENSE_RESISTOR 91 //in mOhms + #define E1_MICROSTEPS 16 //number of microsteps + +// #define E2_IS_TMC + #define E2_MAX_CURRENT 1000 //in mA + #define E2_SENSE_RESISTOR 91 //in mOhms + #define E2_MICROSTEPS 16 //number of microsteps + +// #define E3_IS_TMC + #define E3_MAX_CURRENT 1000 //in mA + #define E3_SENSE_RESISTOR 91 //in mOhms + #define E3_MICROSTEPS 16 //number of microsteps #endif @@ -430,72 +473,74 @@ const unsigned int dropsegments=5; //everything with less than this number of st * you need to import the L6470 library into the arduino IDE for this ******************************************************************************/ +// @section l6470 + //#define HAVE_L6470DRIVER #ifdef HAVE_L6470DRIVER -// #define X_IS_L6470 - #define X_MICROSTEPS 16 //number of microsteps - #define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high - #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_IS_L6470 - #define X2_MICROSTEPS 16 //number of microsteps - #define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high - #define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off - #define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall - -// #define Y_IS_L6470 - #define Y_MICROSTEPS 16 //number of microsteps - #define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high - #define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off - #define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall - -// #define Y2_IS_L6470 - #define Y2_MICROSTEPS 16 //number of microsteps - #define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high - #define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off - #define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall - -// #define Z_IS_L6470 - #define Z_MICROSTEPS 16 //number of microsteps - #define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high - #define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off - #define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall - -// #define Z2_IS_L6470 - #define Z2_MICROSTEPS 16 //number of microsteps - #define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high - #define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off - #define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall - -// #define E0_IS_L6470 - #define E0_MICROSTEPS 16 //number of microsteps - #define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high - #define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off - #define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall - -// #define E1_IS_L6470 - #define E1_MICROSTEPS 16 //number of microsteps - #define E1_MICROSTEPS 16 //number of microsteps - #define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high - #define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off - #define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall - -// #define E2_IS_L6470 - #define E2_MICROSTEPS 16 //number of microsteps - #define E2_MICROSTEPS 16 //number of microsteps - #define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high - #define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off - #define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall - -// #define E3_IS_L6470 - #define E3_MICROSTEPS 16 //number of microsteps - #define E3_MICROSTEPS 16 //number of microsteps - #define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high - #define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off - #define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall - +// #define X_IS_L6470 + #define X_MICROSTEPS 16 //number of microsteps + #define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #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_IS_L6470 + #define X2_MICROSTEPS 16 //number of microsteps + #define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y_IS_L6470 + #define Y_MICROSTEPS 16 //number of microsteps + #define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y2_IS_L6470 + #define Y2_MICROSTEPS 16 //number of microsteps + #define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z_IS_L6470 + #define Z_MICROSTEPS 16 //number of microsteps + #define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z2_IS_L6470 + #define Z2_MICROSTEPS 16 //number of microsteps + #define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E0_IS_L6470 + #define E0_MICROSTEPS 16 //number of microsteps + #define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E1_IS_L6470 + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E2_IS_L6470 + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E3_IS_L6470 + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall + #endif #include "Conditionals.h" diff --git a/Marlin/LiquidCrystalRus.cpp b/Marlin/LiquidCrystalRus.cpp deleted file mode 100644 index c74146236..000000000 --- a/Marlin/LiquidCrystalRus.cpp +++ /dev/null @@ -1,393 +0,0 @@ -#include "LiquidCrystalRus.h" - -#include -#include -#include -#include - -#if defined(ARDUINO) && ARDUINO >= 100 - #include "Arduino.h" -#else - #include "WProgram.h" -#endif - -// it is a Russian alphabet translation -// except 0401 --> 0xa2 = ╗, 0451 --> 0xb5 -const PROGMEM uint8_t utf_recode[] = - { 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4, - 0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,0xa8, - 0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab, - 0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1, - 0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7, - 0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f,0xbe, - 0x70,0x63,0xbf,0x79,0xe4,0x78,0xe5,0xc0, - 0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7 - }; - -// When the display powers up, it is configured as follows: -// -// 1. Display clear -// 2. Function set: -// DL = 1; 8-bit interface data -// N = 0; 1-line display -// F = 0; 5x8 dot character font -// 3. Display on/off control: -// D = 0; Display off -// C = 0; Cursor off -// B = 0; Blinking off -// 4. Entry mode set: -// I/D = 1; Increment by 1 -// S = 0; No shift -// -// Note, however, that resetting the Arduino doesn't reset the LCD, so we -// can't assume that it's in that state when a sketch starts (and the -// LiquidCrystal constructor is called). -// -// modified 27 Jul 2011 -// by Ilya V. Danilov http://mk90.ru/ - - -LiquidCrystalRus::LiquidCrystalRus(uint8_t rs, uint8_t rw, uint8_t enable, - uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, - uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7) -{ - init(0, rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7); -} - -LiquidCrystalRus::LiquidCrystalRus(uint8_t rs, uint8_t enable, - uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, - uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7) -{ - init(0, rs, 255, enable, d0, d1, d2, d3, d4, d5, d6, d7); -} - -LiquidCrystalRus::LiquidCrystalRus(uint8_t rs, uint8_t rw, uint8_t enable, - uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3) -{ - init(1, rs, rw, enable, d0, d1, d2, d3, 0, 0, 0, 0); -} - -LiquidCrystalRus::LiquidCrystalRus(uint8_t rs, uint8_t enable, - uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3) -{ - init(1, rs, 255, enable, d0, d1, d2, d3, 0, 0, 0, 0); -} - -void LiquidCrystalRus::init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable, - uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, - uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7) -{ - _rs_pin = rs; - _rw_pin = rw; - _enable_pin = enable; - - _data_pins[0] = d0; - _data_pins[1] = d1; - _data_pins[2] = d2; - _data_pins[3] = d3; - _data_pins[4] = d4; - _data_pins[5] = d5; - _data_pins[6] = d6; - _data_pins[7] = d7; - - pinMode(_rs_pin, OUTPUT); - // we can save 1 pin by not using RW. Indicate by passing 255 instead of pin# - if (_rw_pin != 255) { - pinMode(_rw_pin, OUTPUT); - } - pinMode(_enable_pin, OUTPUT); - - if (fourbitmode) - _displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS; - else - _displayfunction = LCD_8BITMODE | LCD_1LINE | LCD_5x8DOTS; - - begin(16, 1); -} - -void LiquidCrystalRus::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) { - if (lines > 1) { - _displayfunction |= LCD_2LINE; - } - _numlines = lines; - _currline = 0; - - // for some 1 line displays you can select a 10 pixel high font - if ((dotsize != 0) && (lines == 1)) { - _displayfunction |= LCD_5x10DOTS; - } - - // SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION! - // according to datasheet, we need at least 40ms after power rises above 2.7V - // before sending commands. Arduino can turn on way before 4.5V so we'll wait 50 - delayMicroseconds(50000); - // Now we pull both RS and R/W low to begin commands - digitalWrite(_rs_pin, LOW); - digitalWrite(_enable_pin, LOW); - if (_rw_pin != 255) { - digitalWrite(_rw_pin, LOW); - } - - //put the LCD into 4 bit or 8 bit mode - if (! (_displayfunction & LCD_8BITMODE)) { - // this is according to the Hitachi HD44780 datasheet - // figure 24, pg 46 - - // we start in 8bit mode, try to set 4 bit mode - writeNbits(0x03,4); - delayMicroseconds(4500); // wait min 4.1ms - - // second try - writeNbits(0x03,4); - delayMicroseconds(4500); // wait min 4.1ms - - // third go! - writeNbits(0x03,4); - delayMicroseconds(150); - - // finally, set to 8-bit interface - writeNbits(0x02,4); - } else { - // this is according to the Hitachi HD44780 datasheet - // page 45 figure 23 - - // Send function set command sequence - command(LCD_FUNCTIONSET | _displayfunction); - delayMicroseconds(4500); // wait more than 4.1ms - - // second try - command(LCD_FUNCTIONSET | _displayfunction); - delayMicroseconds(150); - - // third go - command(LCD_FUNCTIONSET | _displayfunction); - } - - // finally, set # lines, font size, etc. - command(LCD_FUNCTIONSET | _displayfunction); - - // turn the display on with no cursor or blinking default - _displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF; - display(); - - // clear it off - clear(); - - // Initialize to default text direction (for romance languages) - _displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT; - // set the entry mode - command(LCD_ENTRYMODESET | _displaymode); - -} - -void LiquidCrystalRus::setDRAMModel(uint8_t model) { - _dram_model = model; -} - -/********** high level commands, for the user! */ -void LiquidCrystalRus::clear() -{ - command(LCD_CLEARDISPLAY); // clear display, set cursor position to zero - delayMicroseconds(2000); // this command takes a long time! -} - -void LiquidCrystalRus::home() -{ - command(LCD_RETURNHOME); // set cursor position to zero - delayMicroseconds(2000); // this command takes a long time! -} - -void LiquidCrystalRus::setCursor(uint8_t col, uint8_t row) -{ - int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 }; - if ( row >= _numlines ) { - row = _numlines-1; // we count rows starting w/0 - } - - command(LCD_SETDDRAMADDR | (col + row_offsets[row])); -} - -// Turn the display on/off (quickly) -void LiquidCrystalRus::noDisplay() { - _displaycontrol &= ~LCD_DISPLAYON; - command(LCD_DISPLAYCONTROL | _displaycontrol); -} -void LiquidCrystalRus::display() { - _displaycontrol |= LCD_DISPLAYON; - command(LCD_DISPLAYCONTROL | _displaycontrol); -} - -// Turns the underline cursor on/off -void LiquidCrystalRus::noCursor() { - _displaycontrol &= ~LCD_CURSORON; - command(LCD_DISPLAYCONTROL | _displaycontrol); -} -void LiquidCrystalRus::cursor() { - _displaycontrol |= LCD_CURSORON; - command(LCD_DISPLAYCONTROL | _displaycontrol); -} - -// Turn on and off the blinking cursor -void LiquidCrystalRus::noBlink() { - _displaycontrol &= ~LCD_BLINKON; - command(LCD_DISPLAYCONTROL | _displaycontrol); -} -void LiquidCrystalRus::blink() { - _displaycontrol |= LCD_BLINKON; - command(LCD_DISPLAYCONTROL | _displaycontrol); -} - -// These commands scroll the display without changing the RAM -void LiquidCrystalRus::scrollDisplayLeft(void) { - command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVELEFT); -} -void LiquidCrystalRus::scrollDisplayRight(void) { - command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVERIGHT); -} - -// This is for text that flows Left to Right -void LiquidCrystalRus::leftToRight(void) { - _displaymode |= LCD_ENTRYLEFT; - command(LCD_ENTRYMODESET | _displaymode); -} - -// This is for text that flows Right to Left -void LiquidCrystalRus::rightToLeft(void) { - _displaymode &= ~LCD_ENTRYLEFT; - command(LCD_ENTRYMODESET | _displaymode); -} - -// This will 'right justify' text from the cursor -void LiquidCrystalRus::autoscroll(void) { - _displaymode |= LCD_ENTRYSHIFTINCREMENT; - command(LCD_ENTRYMODESET | _displaymode); -} - -// This will 'left justify' text from the cursor -void LiquidCrystalRus::noAutoscroll(void) { - _displaymode &= ~LCD_ENTRYSHIFTINCREMENT; - command(LCD_ENTRYMODESET | _displaymode); -} - -// Allows us to fill the first 8 CGRAM locations -// with custom characters -void LiquidCrystalRus::createChar(uint8_t location, uint8_t charmap[]) { - location &= 0x7; // we only have 8 locations 0-7 - command(LCD_SETCGRAMADDR | (location << 3)); - for (int i=0; i<8; i++) { - write(charmap[i]); - } -} - -/*********** mid level commands, for sending data/cmds */ - -inline void LiquidCrystalRus::command(uint8_t value) { - send(value, LOW); -} - -#if defined(ARDUINO) && ARDUINO >= 100 - size_t LiquidCrystalRus::write(uint8_t value) -#else - void LiquidCrystalRus::write(uint8_t value) -#endif -{ - uint8_t out_char=value; - - if (_dram_model == LCD_DRAM_WH1601) { - uint8_t ac=recv(LOW) & 0x7f; - if (ac>7 && ac<0x14) command(LCD_SETDDRAMADDR | (0x40+ac-8)); - } - - if (value>=0x80) { // UTF-8 handling - if (value >= 0xc0) { - utf_hi_char = value - 0xd0; - } else { - value &= 0x3f; - if (!utf_hi_char && (value == 1)) - send(0xa2,HIGH); // ╗ - else if ((utf_hi_char == 1) && (value == 0x11)) - send(0xb5,HIGH); // ╦ - else - send(pgm_read_byte_near(utf_recode + value + (utf_hi_char<<6) - 0x10), HIGH); - } - } else send(out_char, HIGH); -#if defined(ARDUINO) && ARDUINO >= 100 - return 1; // assume success -#endif -} - -/************ low level data pushing commands **********/ - -// write either command or data, with automatic 4/8-bit selection -void LiquidCrystalRus::send(uint8_t value, uint8_t mode) { - digitalWrite(_rs_pin, mode); - - // if there is a RW pin indicated, set it low to Write - if (_rw_pin != 255) { - digitalWrite(_rw_pin, LOW); - } - - if (_displayfunction & LCD_8BITMODE) { - writeNbits(value,8); - } else { - writeNbits(value>>4,4); - writeNbits(value,4); - } -} - -// read data, with automatic 4/8-bit selection -uint8_t LiquidCrystalRus::recv(uint8_t mode) { - uint8_t retval; - digitalWrite(_rs_pin, mode); - - // if there is a RW pin indicated, set it low to Write - if (_rw_pin != 255) { - digitalWrite(_rw_pin, HIGH); - } - - if (_displayfunction & LCD_8BITMODE) { - retval = readNbits(8); - } else { - retval = readNbits(4) << 4; - retval |= readNbits(4); - } - return retval; -} -void LiquidCrystalRus::pulseEnable() { - digitalWrite(_enable_pin, LOW); - delayMicroseconds(1); - digitalWrite(_enable_pin, HIGH); - delayMicroseconds(1); // enable pulse must be >450ns - digitalWrite(_enable_pin, LOW); - delayMicroseconds(100); // commands need > 37us to settle -} - -void LiquidCrystalRus::writeNbits(uint8_t value, uint8_t n) { - for (int i = 0; i < n; i++) { - pinMode(_data_pins[i], OUTPUT); - digitalWrite(_data_pins[i], (value >> i) & 0x01); - } - - pulseEnable(); -} - -uint8_t LiquidCrystalRus::readNbits(uint8_t n) { - uint8_t retval=0; - for (int i = 0; i < n; i++) { - pinMode(_data_pins[i], INPUT); - } - - digitalWrite(_enable_pin, LOW); - delayMicroseconds(1); - digitalWrite(_enable_pin, HIGH); - delayMicroseconds(1); // enable pulse must be >450ns - - for (int i = 0; i < n; i++) { - retval |= (digitalRead(_data_pins[i]) == HIGH)?(1 << i):0; - } - - digitalWrite(_enable_pin, LOW); - - return retval; -} - diff --git a/Marlin/LiquidCrystalRus.h b/Marlin/LiquidCrystalRus.h deleted file mode 100644 index ad85394ae..000000000 --- a/Marlin/LiquidCrystalRus.h +++ /dev/null @@ -1,129 +0,0 @@ -// -// based on LiquidCrystal library from ArduinoIDE, see http://arduino.cc -// modified 27 Jul 2011 -// by Ilya V. Danilov http://mk90.ru/ -// - -#ifndef LiquidCrystalRus_h -#define LiquidCrystalRus_h - -#include -#include "Print.h" - -// commands -#define LCD_CLEARDISPLAY 0x01 -#define LCD_RETURNHOME 0x02 -#define LCD_ENTRYMODESET 0x04 -#define LCD_DISPLAYCONTROL 0x08 -#define LCD_CURSORSHIFT 0x10 -#define LCD_FUNCTIONSET 0x20 -#define LCD_SETCGRAMADDR 0x40 -#define LCD_SETDDRAMADDR 0x80 - -// flags for display entry mode -#define LCD_ENTRYRIGHT 0x00 -#define LCD_ENTRYLEFT 0x02 -#define LCD_ENTRYSHIFTINCREMENT 0x01 -#define LCD_ENTRYSHIFTDECREMENT 0x00 - -// flags for display on/off control -#define LCD_DISPLAYON 0x04 -#define LCD_DISPLAYOFF 0x00 -#define LCD_CURSORON 0x02 -#define LCD_CURSOROFF 0x00 -#define LCD_BLINKON 0x01 -#define LCD_BLINKOFF 0x00 - -// flags for display/cursor shift -#define LCD_DISPLAYMOVE 0x08 -#define LCD_CURSORMOVE 0x00 -#define LCD_MOVERIGHT 0x04 -#define LCD_MOVELEFT 0x00 - -// flags for function set -#define LCD_8BITMODE 0x10 -#define LCD_4BITMODE 0x00 -#define LCD_2LINE 0x08 -#define LCD_1LINE 0x00 -#define LCD_5x10DOTS 0x04 -#define LCD_5x8DOTS 0x00 - -// enum for -#define LCD_DRAM_Normal 0x00 -#define LCD_DRAM_WH1601 0x01 - - -class LiquidCrystalRus : public Print { -public: - LiquidCrystalRus(uint8_t rs, uint8_t enable, - uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, - uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7); - LiquidCrystalRus(uint8_t rs, uint8_t rw, uint8_t enable, - uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, - uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7); - LiquidCrystalRus(uint8_t rs, uint8_t rw, uint8_t enable, - uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3); - LiquidCrystalRus(uint8_t rs, uint8_t enable, - uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3); - - void init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable, - uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, - uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7); - - void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS); - - void clear(); - void home(); - - void noDisplay(); - void display(); - void noBlink(); - void blink(); - void noCursor(); - void cursor(); - void scrollDisplayLeft(); - void scrollDisplayRight(); - void leftToRight(); - void rightToLeft(); - void autoscroll(); - void noAutoscroll(); - - void createChar(uint8_t, uint8_t[]); - void setCursor(uint8_t, uint8_t); - -#if defined(ARDUINO) && ARDUINO >= 100 - virtual size_t write(uint8_t); - using Print::write; -#else - virtual void write(uint8_t); -#endif - - void command(uint8_t); - - void setDRAMModel(uint8_t); - -private: - void send(uint8_t, uint8_t); - void writeNbits(uint8_t, uint8_t); - uint8_t recv(uint8_t); - uint8_t readNbits(uint8_t); - void pulseEnable(); - - uint8_t _rs_pin; // LOW: command. HIGH: character. - uint8_t _rw_pin; // LOW: write to LCD. HIGH: read from LCD. - uint8_t _enable_pin; // activated by a HIGH pulse. - uint8_t _data_pins[8]; - - uint8_t _displayfunction; - uint8_t _displaycontrol; - uint8_t _displaymode; - - uint8_t _initialized; - - uint8_t _numlines,_currline; - - uint8_t _dram_model; - uint8_t utf_hi_char; // UTF-8 high part -}; - -#endif diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index bbd7ac3db..0158a1d71 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -29,6 +29,12 @@ #define BIT(b) (1<<(b)) #define TEST(n,b) (((n)&BIT(b))!=0) +#define RADIANS(d) ((d)*M_PI/180.0) +#define DEGREES(r) ((d)*180.0/M_PI) +#define NOLESS(v,n) do{ if (v < n) v = n; }while(0) +#define NOMORE(v,n) do{ if (v > n) v = n; }while(0) + +typedef unsigned long millis_t; // Arduino < 1.0.0 does not define this, so we need to do it ourselves #ifndef analogInputToDigitalPin @@ -60,59 +66,57 @@ #define MYSERIAL MSerial #endif -#define SERIAL_PROTOCOL(x) (MYSERIAL.print(x)) -#define SERIAL_PROTOCOL_F(x,y) (MYSERIAL.print(x,y)) -#define SERIAL_PROTOCOLPGM(x) (serialprintPGM(PSTR(x))) -#define SERIAL_PROTOCOLLN(x) (MYSERIAL.print(x),MYSERIAL.write('\n')) -#define SERIAL_PROTOCOLLNPGM(x) (serialprintPGM(PSTR(x)),MYSERIAL.write('\n')) +#define SERIAL_CHAR(x) MYSERIAL.write(x) +#define SERIAL_EOL SERIAL_CHAR('\n') + +#define SERIAL_PROTOCOLCHAR(x) SERIAL_CHAR(x) +#define SERIAL_PROTOCOL(x) MYSERIAL.print(x) +#define SERIAL_PROTOCOL_F(x,y) MYSERIAL.print(x,y) +#define SERIAL_PROTOCOLPGM(x) serialprintPGM(PSTR(x)) +#define SERIAL_PROTOCOLLN(x) do{ MYSERIAL.print(x),MYSERIAL.write('\n'); }while(0) +#define SERIAL_PROTOCOLLNPGM(x) do{ serialprintPGM(PSTR(x)),MYSERIAL.write('\n'); }while(0) extern const char errormagic[] PROGMEM; extern const char echomagic[] PROGMEM; -#define SERIAL_ERROR_START (serialprintPGM(errormagic)) +#define SERIAL_ERROR_START serialprintPGM(errormagic) #define SERIAL_ERROR(x) SERIAL_PROTOCOL(x) #define SERIAL_ERRORPGM(x) SERIAL_PROTOCOLPGM(x) #define SERIAL_ERRORLN(x) SERIAL_PROTOCOLLN(x) #define SERIAL_ERRORLNPGM(x) SERIAL_PROTOCOLLNPGM(x) -#define SERIAL_ECHO_START (serialprintPGM(echomagic)) +#define SERIAL_ECHO_START serialprintPGM(echomagic) #define SERIAL_ECHO(x) SERIAL_PROTOCOL(x) #define SERIAL_ECHOPGM(x) SERIAL_PROTOCOLPGM(x) #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x) #define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x) -#define SERIAL_ECHOPAIR(name,value) (serial_echopair_P(PSTR(name),(value))) - -#define SERIAL_EOL MYSERIAL.write('\n') +#define SERIAL_ECHOPAIR(name,value) do{ serial_echopair_P(PSTR(name),(value)); }while(0) void serial_echopair_P(const char *s_P, float v); void serial_echopair_P(const char *s_P, double v); void serial_echopair_P(const char *s_P, unsigned long v); -//Things to write to serial from Program memory. Saves 400 to 2k of RAM. -FORCE_INLINE void serialprintPGM(const char *str) -{ - char ch=pgm_read_byte(str); - while(ch) - { +// Things to write to serial from Program memory. Saves 400 to 2k of RAM. +FORCE_INLINE void serialprintPGM(const char *str) { + char ch; + while ((ch = pgm_read_byte(str))) { MYSERIAL.write(ch); - ch=pgm_read_byte(++str); + str++; } } - void get_command(); void process_commands(); void manage_inactivity(bool ignore_stepper_queue=false); -#if defined(DUAL_X_CARRIAGE) && defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1 \ - && defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1 +#if defined(DUAL_X_CARRIAGE) && HAS_X_ENABLE && 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); axis_known_position[X_AXIS] = false; } while (0) -#elif defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1 +#elif HAS_X_ENABLE #define enable_x() X_ENABLE_WRITE( X_ENABLE_ON) #define disable_x() { X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } #else @@ -120,7 +124,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); #define disable_x() ; #endif -#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1 +#if HAS_Y_ENABLE #ifdef Y_DUAL_STEPPER_DRIVERS #define enable_y() { Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); } #define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; } @@ -133,7 +137,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); #define disable_y() ; #endif -#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1 +#if HAS_Z_ENABLE #ifdef Z_DUAL_STEPPER_DRIVERS #define enable_z() { Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); } #define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; } @@ -146,40 +150,53 @@ void manage_inactivity(bool ignore_stepper_queue=false); #define disable_z() ; #endif -#if defined(E0_ENABLE_PIN) && (E0_ENABLE_PIN > -1) - #define enable_e0() E0_ENABLE_WRITE(E_ENABLE_ON) +#if HAS_E0_ENABLE + #define enable_e0() E0_ENABLE_WRITE( E_ENABLE_ON) #define disable_e0() E0_ENABLE_WRITE(!E_ENABLE_ON) #else #define enable_e0() /* nothing */ #define disable_e0() /* nothing */ #endif -#if (EXTRUDERS > 1) && defined(E1_ENABLE_PIN) && (E1_ENABLE_PIN > -1) - #define enable_e1() E1_ENABLE_WRITE(E_ENABLE_ON) +#if (EXTRUDERS > 1) && HAS_E1_ENABLE + #define enable_e1() E1_ENABLE_WRITE( E_ENABLE_ON) #define disable_e1() E1_ENABLE_WRITE(!E_ENABLE_ON) #else #define enable_e1() /* nothing */ #define disable_e1() /* nothing */ #endif -#if (EXTRUDERS > 2) && defined(E2_ENABLE_PIN) && (E2_ENABLE_PIN > -1) - #define enable_e2() E2_ENABLE_WRITE(E_ENABLE_ON) +#if (EXTRUDERS > 2) && HAS_E2_ENABLE + #define enable_e2() E2_ENABLE_WRITE( E_ENABLE_ON) #define disable_e2() E2_ENABLE_WRITE(!E_ENABLE_ON) #else #define enable_e2() /* nothing */ #define disable_e2() /* nothing */ #endif -#if (EXTRUDERS > 3) && defined(E3_ENABLE_PIN) && (E3_ENABLE_PIN > -1) - #define enable_e3() E3_ENABLE_WRITE(E_ENABLE_ON) +#if (EXTRUDERS > 3) && HAS_E3_ENABLE + #define enable_e3() E3_ENABLE_WRITE( E_ENABLE_ON) #define disable_e3() E3_ENABLE_WRITE(!E_ENABLE_ON) #else #define enable_e3() /* nothing */ #define disable_e3() /* nothing */ #endif +/** + * The axis order in all axis related arrays is X, Y, Z, E + */ +#define NUM_AXIS 4 + +/** + * Axis indices as enumerated constants + * + * A_AXIS and B_AXIS are used by COREXY printers + * X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots. + */ enum AxisEnum {X_AXIS=0, Y_AXIS=1, A_AXIS=0, B_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5}; -//X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots. + +void enable_all_steppers(); +void disable_all_steppers(); void FlushSerialRequestResend(); void ClearToSend(); @@ -192,7 +209,6 @@ void get_coordinates(); void adjust_delta(float cartesian[3]); #endif extern float delta[3]; - void prepare_move_raw(); #endif #ifdef SCARA void calculate_delta(float cartesian[3]); @@ -207,15 +223,18 @@ void Stop(); void filrunout(); #endif -bool IsStopped(); +extern bool Running; +inline bool IsRunning() { return Running; } +inline bool IsStopped() { return !Running; } -bool enquecommand(const char *cmd); //put a single ASCII command at the end of the current buffer or return false when it is full -void enquecommands_P(const char *cmd); //put one or many ASCII commands at the end of the current buffer, read from flash +bool enqueuecommand(const char *cmd); //put a single ASCII command at the end of the current buffer or return false when it is full +void enqueuecommands_P(const char *cmd); //put one or many ASCII commands at the end of the current buffer, read from flash void prepare_arc_move(char isclockwise); void clamp_to_software_endstops(float target[3]); -void refresh_cmd_timeout(void); +extern millis_t previous_cmd_ms; +inline void refresh_cmd_timeout() { previous_cmd_ms = millis(); } #ifdef FAST_PWM_FAN void setPwmFrequency(uint8_t pin, int val); @@ -224,18 +243,18 @@ void refresh_cmd_timeout(void); #ifndef CRITICAL_SECTION_START #define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli(); #define CRITICAL_SECTION_END SREG = _sreg; -#endif //CRITICAL_SECTION_START +#endif extern float homing_feedrate[]; extern bool axis_relative_modes[]; -extern int feedmultiply; -extern int extrudemultiply; // Sets extrude multiply factor (in percent) for all extruders +extern int feedrate_multiplier; extern bool volumetric_enabled; extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder. extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner -extern float current_position[NUM_AXIS] ; +extern float current_position[NUM_AXIS]; extern float home_offset[3]; + #ifdef DELTA extern float endstop_adj[3]; extern float delta_radius; @@ -243,16 +262,27 @@ extern float home_offset[3]; extern float delta_segments_per_second; void recalc_delta_settings(float radius, float diagonal_rod); #elif defined(Z_DUAL_ENDSTOPS) -extern float z_endstop_adj; + extern float z_endstop_adj; #endif + #ifdef SCARA extern float axis_scaling[3]; // Build size scaling #endif + extern float min_pos[3]; extern float max_pos[3]; extern bool axis_known_position[3]; -extern float zprobe_zoffset; + +#ifdef ENABLE_AUTO_BED_LEVELING + extern float zprobe_zoffset; +#endif + +#ifdef PREVENT_DANGEROUS_EXTRUDE + extern float extrude_min_temp; +#endif + extern int fanSpeed; + #ifdef BARICUDA extern int ValvePressure; extern int EtoPPressure; @@ -279,8 +309,8 @@ extern int fanSpeed; extern float retract_recover_length, retract_recover_length_swap, retract_recover_feedrate; #endif -extern unsigned long starttime; -extern unsigned long stoptime; +extern millis_t print_job_start_ms; +extern millis_t print_job_stop_ms; // Handling multiple extruders pins extern uint8_t active_extruder; diff --git a/Marlin/MarlinSerial.cpp b/Marlin/MarlinSerial.cpp index d8477b6db..dc36e14c6 100644 --- a/Marlin/MarlinSerial.cpp +++ b/Marlin/MarlinSerial.cpp @@ -268,8 +268,7 @@ void MarlinSerial::printFloat(double number, uint8_t digits) { print(int_part); // Print the decimal point, but only if there are digits beyond - if (digits > 0) - print("."); + if (digits > 0) print('.'); // Extract digits from the remainder one at a time while (digits-- > 0) { @@ -288,7 +287,6 @@ MarlinSerial MSerial; #endif // !AT90USB // For AT90USB targets use the UART for BT interfacing -#if defined(AT90USB) && defined (BTENABLED) - HardwareSerial bt; +#if defined(AT90USB) && defined(BTENABLED) + HardwareSerial bt; #endif - diff --git a/Marlin/MarlinSerial.h b/Marlin/MarlinSerial.h index b56880c23..dbad3fd76 100644 --- a/Marlin/MarlinSerial.h +++ b/Marlin/MarlinSerial.h @@ -153,8 +153,8 @@ extern MarlinSerial MSerial; #endif // !AT90USB // Use the UART for BT in AT90USB configurations -#if defined(AT90USB) && defined (BTENABLED) - extern HardwareSerial bt; +#if defined(AT90USB) && defined(BTENABLED) + extern HardwareSerial bt; #endif #endif diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index b3235f559..475362f2c 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -36,11 +36,11 @@ #endif #endif // ENABLE_AUTO_BED_LEVELING -#define SERVO_LEVELING defined(ENABLE_AUTO_BED_LEVELING) && PROBE_SERVO_DEACTIVATION_DELAY > 0 +#define SERVO_LEVELING (defined(ENABLE_AUTO_BED_LEVELING) && PROBE_SERVO_DEACTIVATION_DELAY > 0) -#if defined(MESH_BED_LEVELING) +#ifdef MESH_BED_LEVELING #include "mesh_bed_leveling.h" -#endif // MESH_BED_LEVELING +#endif #include "ultralcd.h" #include "planner.h" @@ -67,221 +67,232 @@ #include #endif -// look here for descriptions of G-codes: http://linuxcnc.org/handbook/gcode/g-code.html -// http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes - -//Implemented Codes -//------------------- -// G0 -> G1 -// G1 - Coordinated Movement X Y Z E -// G2 - CW ARC -// G3 - CCW ARC -// G4 - Dwell S or P -// G10 - retract filament according to settings of M207 -// G11 - retract recover filament according to settings of M208 -// G28 - Home all Axis -// G29 - Detailed Z-Probe, probes the bed at 3 or more points. Will fail if you haven't homed yet. -// G30 - Single Z Probe, probes bed at current XY location. -// G31 - Dock sled (Z_PROBE_SLED only) -// G32 - Undock sled (Z_PROBE_SLED only) -// G90 - Use Absolute Coordinates -// G91 - Use Relative Coordinates -// G92 - Set current position to coordinates given - -// M Codes -// M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled) -// M1 - Same as M0 -// M17 - Enable/Power all stepper motors -// M18 - Disable all stepper motors; same as M84 -// M20 - List SD card -// M21 - Init SD card -// M22 - Release SD card -// M23 - Select SD file (M23 filename.g) -// M24 - Start/resume SD print -// M25 - Pause SD print -// M26 - Set SD position in bytes (M26 S12345) -// M27 - Report SD print status -// M28 - Start SD write (M28 filename.g) -// M29 - Stop SD write -// M30 - Delete file from SD (M30 filename.g) -// M31 - Output time since last M109 or SD card start to serial -// M32 - Select file and start SD print (Can be used _while_ printing from SD card files): -// syntax "M32 /path/filename#", or "M32 S !filename#" -// Call gcode file : "M32 P !filename#" and return to caller file after finishing (similar to #include). -// The '#' is necessary when calling from within sd files, as it stops buffer prereading -// M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used. -// M80 - Turn on Power Supply -// M81 - Turn off Power Supply -// M82 - Set E codes absolute (default) -// M83 - Set E codes relative while in Absolute Coordinates (G90) mode -// M84 - Disable steppers until next move, -// or use S to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout. -// M85 - Set inactivity shutdown timer with parameter S. To disable set zero (default) -// M92 - Set axis_steps_per_unit - same syntax as G92 -// M104 - Set extruder target temp -// M105 - Read current temp -// M106 - Fan on -// M107 - Fan off -// M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating -// Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling -// IF AUTOTEMP is enabled, S B F. Exit autotemp by any M109 without F -// M112 - Emergency stop -// M114 - Output current position to serial port -// M115 - Capabilities string -// M117 - display message -// M119 - Output Endstop status to serial port -// M120 - Enable endstop detection -// M121 - Disable endstop detection -// M126 - Solenoid Air Valve Open (BariCUDA support by jmil) -// M127 - Solenoid Air Valve Closed (BariCUDA vent to atmospheric pressure by jmil) -// M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil) -// M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil) -// M140 - Set bed target temp -// M150 - Set BlinkM Color Output R: Red<0-255> U(!): Green<0-255> B: Blue<0-255> over i2c, G for green does not work. -// M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating -// Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling -// M200 D- set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters). -// M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000) -// M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!! -// M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec -// M204 - Set default acceleration: P for Printing moves, R for Retract only (no X, Y, Z) moves and T for Travel (non printing) moves (ex. M204 P800 T3000 R9000) in mm/sec^2 -// M205 - advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk, E=maximum E jerk -// M206 - Set additional homing offset -// M207 - Set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop], stays in mm regardless of M200 setting -// M208 - Set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/sec] -// M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction. -// M218 - Set hotend offset (in mm): T X Y -// M220 S- set speed factor override percentage -// M221 S- set extrude factor override percentage -// M226 P S- Wait until the specified pin reaches the state required -// M240 - Trigger a camera to take a photograph -// M250 - Set LCD contrast C (value 0..63) -// M280 - Set servo position absolute. P: servo index, S: angle or microseconds -// M300 - Play beep sound S P -// M301 - Set PID parameters P I and D -// M302 - Allow cold extrudes, or set the minimum extrude S. -// M303 - PID relay autotune S sets the target temperature. (default target temperature = 150C) -// M304 - Set bed PID parameters P I and D -// M380 - Activate solenoid on active extruder -// M381 - Disable all solenoids -// M400 - Finish all moves -// M401 - Lower z-probe if present -// M402 - Raise z-probe if present -// M404 - N Enter the nominal filament width (3mm, 1.75mm ) or will display nominal filament width without parameters -// M405 - Turn on Filament Sensor extrusion control. Optional D to set delay in centimeters between sensor and extruder -// M406 - Turn off Filament Sensor extrusion control -// M407 - Displays measured filament diameter -// M500 - Store parameters in EEPROM -// M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily). -// M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. -// M503 - Print the current settings (from memory not from EEPROM). Use S0 to leave off headings. -// M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) -// M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] -// M665 - Set delta configurations -// M666 - Set delta endstop adjustment -// M605 - Set dual x-carriage movement mode: S [ X R ] -// M907 - Set digital trimpot motor current using axis codes. -// M908 - Control digital trimpot directly. -// M350 - Set microstepping mode. -// M351 - Toggle MS1 MS2 pins directly. - -// ************ SCARA Specific - This can change to suit future G-code regulations -// 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) -// M362 - SCARA calibration: Move to cal-position PsiA (0 deg calibration) -// M363 - SCARA calibration: Move to cal-position PsiB (90 deg calibration - steps per degree) -// M364 - SCARA calibration: Move to cal-position PSIC (90 deg to Theta calibration position) -// M365 - SCARA calibration: Scaling factor, X, Y, Z axis -//************* SCARA End *************** - -// M928 - Start SD logging (M928 filename.g) - ended by M29 -// M999 - Restart after being stopped by error +/** + * Look here for descriptions of G-codes: + * - http://linuxcnc.org/handbook/gcode/g-code.html + * - http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes + * + * Help us document these G-codes online: + * - http://reprap.org/wiki/G-code + * - https://github.com/MarlinFirmware/Marlin/wiki/Marlin-G-Code + */ + +/** + * Implemented Codes + * ------------------- + * + * "G" Codes + * + * G0 -> G1 + * G1 - Coordinated Movement X Y Z E + * G2 - CW ARC + * G3 - CCW ARC + * G4 - Dwell S or P + * G10 - retract filament according to settings of M207 + * G11 - retract recover filament according to settings of M208 + * G28 - Home one or more axes + * G29 - Detailed Z-Probe, probes the bed at 3 or more points. Will fail if you haven't homed yet. + * G30 - Single Z Probe, probes bed at current XY location. + * G31 - Dock sled (Z_PROBE_SLED only) + * G32 - Undock sled (Z_PROBE_SLED only) + * G90 - Use Absolute Coordinates + * G91 - Use Relative Coordinates + * G92 - Set current position to coordinates given + * + * "M" Codes + * + * M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled) + * M1 - Same as M0 + * M17 - Enable/Power all stepper motors + * M18 - Disable all stepper motors; same as M84 + * M20 - List SD card + * M21 - Init SD card + * M22 - Release SD card + * M23 - Select SD file (M23 filename.g) + * M24 - Start/resume SD print + * M25 - Pause SD print + * M26 - Set SD position in bytes (M26 S12345) + * M27 - Report SD print status + * M28 - Start SD write (M28 filename.g) + * M29 - Stop SD write + * M30 - Delete file from SD (M30 filename.g) + * M31 - Output time since last M109 or SD card start to serial + * M32 - Select file and start SD print (Can be used _while_ printing from SD card files): + * syntax "M32 /path/filename#", or "M32 S !filename#" + * Call gcode file : "M32 P !filename#" and return to caller file after finishing (similar to #include). + * The '#' is necessary when calling from within sd files, as it stops buffer prereading + * M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used. + * M48 - Measure Z_Probe repeatability. M48 [n # of points] [X position] [Y position] [V_erboseness #] [E_ngage Probe] [L # of legs of travel] + * M80 - Turn on Power Supply + * M81 - Turn off Power Supply + * M82 - Set E codes absolute (default) + * M83 - Set E codes relative while in Absolute Coordinates (G90) mode + * M84 - Disable steppers until next move, + * or use S to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout. + * M85 - Set inactivity shutdown timer with parameter S. To disable set zero (default) + * M92 - Set axis_steps_per_unit - same syntax as G92 + * M104 - Set extruder target temp + * M105 - Read current temp + * M106 - Fan on + * M107 - Fan off + * M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating + * Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling + * IF AUTOTEMP is enabled, S B F. Exit autotemp by any M109 without F + * M112 - Emergency stop + * M114 - Output current position to serial port + * M115 - Capabilities string + * M117 - display message + * M119 - Output Endstop status to serial port + * M120 - Enable endstop detection + * M121 - Disable endstop detection + * M126 - Solenoid Air Valve Open (BariCUDA support by jmil) + * M127 - Solenoid Air Valve Closed (BariCUDA vent to atmospheric pressure by jmil) + * M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil) + * M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil) + * M140 - Set bed target temp + * M150 - Set BlinkM Color Output R: Red<0-255> U(!): Green<0-255> B: Blue<0-255> over i2c, G for green does not work. + * M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating + * Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling + * M200 - set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).:D- + * M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000) + * M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!! + * M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec + * M204 - Set default acceleration: P for Printing moves, R for Retract only (no X, Y, Z) moves and T for Travel (non printing) moves (ex. M204 P800 T3000 R9000) in mm/sec^2 + * M205 - advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk, E=maximum E jerk + * M206 - Set additional homing offset + * M207 - Set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop], stays in mm regardless of M200 setting + * M208 - Set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/sec] + * M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction. + * M218 - Set hotend offset (in mm): T X Y + * M220 - Set speed factor override percentage: S + * M221 - Set extrude factor override percentage: S + * M226 - Wait until the specified pin reaches the state required: P S + * M240 - Trigger a camera to take a photograph + * M250 - Set LCD contrast C (value 0..63) + * M280 - Set servo position absolute. P: servo index, S: angle or microseconds + * M300 - Play beep sound S P + * M301 - Set PID parameters P I and D + * M302 - Allow cold extrudes, or set the minimum extrude S. + * M303 - PID relay autotune S sets the target temperature. (default target temperature = 150C) + * M304 - Set bed PID parameters P I and D + * M380 - Activate solenoid on active extruder + * M381 - Disable all solenoids + * M400 - Finish all moves + * M401 - Lower z-probe if present + * M402 - Raise z-probe if present + * M404 - N Enter the nominal filament width (3mm, 1.75mm ) or will display nominal filament width without parameters + * M405 - Turn on Filament Sensor extrusion control. Optional D to set delay in centimeters between sensor and extruder + * M406 - Turn off Filament Sensor extrusion control + * M407 - Display measured filament diameter + * M500 - Store parameters in EEPROM + * M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily). + * M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. + * M503 - Print the current settings (from memory not from EEPROM). Use S0 to leave off headings. + * M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) + * M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] + * M665 - Set delta configurations: L R S + * M666 - Set delta endstop adjustment + * M605 - Set dual x-carriage movement mode: S [ X R ] + * M907 - Set digital trimpot motor current using axis codes. + * M908 - Control digital trimpot directly. + * M350 - Set microstepping mode. + * M351 - Toggle MS1 MS2 pins directly. + * + * ************ SCARA Specific - This can change to suit future G-code regulations + * 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) + * M362 - SCARA calibration: Move to cal-position PsiA (0 deg calibration) + * M363 - SCARA calibration: Move to cal-position PsiB (90 deg calibration - steps per degree) + * M364 - SCARA calibration: Move to cal-position PSIC (90 deg to Theta calibration position) + * M365 - SCARA calibration: Scaling factor, X, Y, Z axis + * ************* SCARA End *************** + * + * M928 - Start SD logging (M928 filename.g) - ended by M29 + * M999 - Restart after being stopped by error + */ #ifdef SDSUPPORT CardReader card; #endif +bool Running = true; + +static float feedrate = 1500.0, next_feedrate, saved_feedrate; +float current_position[NUM_AXIS] = { 0.0 }; +static float destination[NUM_AXIS] = { 0.0 }; +bool axis_known_position[3] = { false }; + +static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0; + +static int cmd_queue_index_r = 0; +static int cmd_queue_index_w = 0; +static int commands_in_queue = 0; +static char command_queue[BUFSIZE][MAX_CMD_SIZE]; + float homing_feedrate[] = HOMING_FEEDRATE; -#ifdef ENABLE_AUTO_BED_LEVELING -int xy_travel_speed = XY_TRAVEL_SPEED; -#endif -int homing_bump_divisor[] = HOMING_BUMP_DIVISOR; bool axis_relative_modes[] = AXIS_RELATIVE_MODES; -int feedmultiply = 100; //100->1 200->2 -int saved_feedmultiply; -int extrudemultiply = 100; //100->1 200->2 -int extruder_multiply[EXTRUDERS] = { 100 - #if EXTRUDERS > 1 - , 100 - #if EXTRUDERS > 2 - , 100 - #if EXTRUDERS > 3 - , 100 - #endif - #endif - #endif -}; +int feedrate_multiplier = 100; //100->1 200->2 +int saved_feedrate_multiplier; +int extruder_multiply[EXTRUDERS] = ARRAY_BY_EXTRUDERS(100, 100, 100, 100); bool volumetric_enabled = false; -float filament_size[EXTRUDERS] = { DEFAULT_NOMINAL_FILAMENT_DIA - #if EXTRUDERS > 1 - , DEFAULT_NOMINAL_FILAMENT_DIA - #if EXTRUDERS > 2 - , DEFAULT_NOMINAL_FILAMENT_DIA - #if EXTRUDERS > 3 - , DEFAULT_NOMINAL_FILAMENT_DIA - #endif - #endif - #endif -}; -float volumetric_multiplier[EXTRUDERS] = {1.0 - #if EXTRUDERS > 1 - , 1.0 - #if EXTRUDERS > 2 - , 1.0 - #if EXTRUDERS > 3 - , 1.0 - #endif - #endif - #endif -}; -float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 }; -float home_offset[3] = { 0, 0, 0 }; -#ifdef DELTA - float endstop_adj[3] = { 0, 0, 0 }; -#elif defined(Z_DUAL_ENDSTOPS) - float z_endstop_adj = 0; -#endif - +float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS(DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA, DEFAULT_NOMINAL_FILAMENT_DIA); +float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS(1.0, 1.0, 1.0, 1.0); +float home_offset[3] = { 0 }; float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS }; float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS }; -bool axis_known_position[3] = { false, false, false }; -float zprobe_zoffset; -// Extruder offset -#if EXTRUDERS > 1 -#ifndef DUAL_X_CARRIAGE - #define NUM_EXTRUDER_OFFSETS 2 // only in XY plane -#else - #define NUM_EXTRUDER_OFFSETS 3 // supports offsets in XYZ plane +uint8_t active_extruder = 0; +int fanSpeed = 0; +bool cancel_heatup = false; + +const char errormagic[] PROGMEM = "Error:"; +const char echomagic[] PROGMEM = "echo:"; +const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'}; + +static float offset[3] = { 0 }; +static bool relative_mode = false; //Determines Absolute or Relative Coordinates +static char serial_char; +static int serial_count = 0; +static boolean comment_mode = false; +static char *strchr_pointer; ///< A pointer to find chars in the command string (X, Y, Z, E, etc.) +const char* queued_commands_P= NULL; /* pointer to the current line in the active sequence of commands, or NULL when none */ +const int sensitive_pins[] = SENSITIVE_PINS; ///< Sensitive pin list for M42 +// Inactivity shutdown +millis_t previous_cmd_ms = 0; +static millis_t max_inactive_time = 0; +static millis_t stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME * 1000L; +millis_t print_job_start_ms = 0; ///< Print job start time +millis_t print_job_stop_ms = 0; ///< Print job stop time +static uint8_t target_extruder; +bool no_wait_for_cooling = true; +bool target_direction; + +#ifdef ENABLE_AUTO_BED_LEVELING + int xy_travel_speed = XY_TRAVEL_SPEED; + float zprobe_zoffset = -Z_PROBE_OFFSET_FROM_EXTRUDER; #endif -float extruder_offset[NUM_EXTRUDER_OFFSETS][EXTRUDERS] = { - #if defined(EXTRUDER_OFFSET_X) - EXTRUDER_OFFSET_X - #else - 0 + +#if defined(Z_DUAL_ENDSTOPS) && !defined(DELTA) + float z_endstop_adj = 0; +#endif + +// Extruder offsets +#if EXTRUDERS > 1 + #ifndef EXTRUDER_OFFSET_X + #define EXTRUDER_OFFSET_X { 0 } #endif - , - #if defined(EXTRUDER_OFFSET_Y) - EXTRUDER_OFFSET_Y - #else - 0 + #ifndef EXTRUDER_OFFSET_Y + #define EXTRUDER_OFFSET_Y { 0 } #endif -}; + float extruder_offset[][EXTRUDERS] = { + EXTRUDER_OFFSET_X, + EXTRUDER_OFFSET_Y + #ifdef DUAL_X_CARRIAGE + , { 0 } // supports offsets in XYZ plane + #endif + }; #endif -uint8_t active_extruder = 0; -int fanSpeed = 0; - #ifdef SERVO_ENDSTOPS int servo_endstops[] = SERVO_ENDSTOPS; int servo_endstop_angles[] = SERVO_ENDSTOP_ANGLES; @@ -295,28 +306,8 @@ int fanSpeed = 0; #ifdef FWRETRACT bool autoretract_enabled = false; - bool retracted[EXTRUDERS] = { false - #if EXTRUDERS > 1 - , false - #if EXTRUDERS > 2 - , false - #if EXTRUDERS > 3 - , false - #endif - #endif - #endif - }; - bool retracted_swap[EXTRUDERS] = { false - #if EXTRUDERS > 1 - , false - #if EXTRUDERS > 2 - , false - #if EXTRUDERS > 3 - , false - #endif - #endif - #endif - }; + bool retracted[EXTRUDERS] = { false }; + bool retracted_swap[EXTRUDERS] = { false }; float retract_length = RETRACT_LENGTH; float retract_length_swap = RETRACT_LENGTH_SWAP; @@ -328,7 +319,7 @@ int fanSpeed = 0; #endif // FWRETRACT -#ifdef ULTIPANEL +#if defined(ULTIPANEL) && HAS_POWER_SWITCH bool powersupply = #ifdef PS_DEFAULT_OFF false @@ -339,9 +330,10 @@ int fanSpeed = 0; #endif #ifdef DELTA - float delta[3] = { 0, 0, 0 }; + float delta[3] = { 0 }; #define SIN_60 0.8660254037844386 #define COS_60 0.5 + float endstop_adj[3] = { 0 }; // these are the default values, can be overriden with M665 float delta_radius = DELTA_RADIUS; float delta_tower1_x = -SIN_60 * delta_radius; // front left tower @@ -354,99 +346,61 @@ int fanSpeed = 0; float delta_diagonal_rod_2 = sq(delta_diagonal_rod); float delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND; #ifdef ENABLE_AUTO_BED_LEVELING + int delta_grid_spacing[2] = { 0, 0 }; float bed_level[AUTO_BED_LEVELING_GRID_POINTS][AUTO_BED_LEVELING_GRID_POINTS]; #endif +#else + static bool home_all_axis = true; #endif #ifdef SCARA + static float delta[3] = { 0 }; float axis_scaling[3] = { 1, 1, 1 }; // Build size scaling, default to 1 - static float delta[3] = { 0, 0, 0 }; -#endif - -bool cancel_heatup = false; +#endif #ifdef FILAMENT_SENSOR - //Variables for Filament Sensor input - float filament_width_nominal=DEFAULT_NOMINAL_FILAMENT_DIA; //Set nominal filament width, can be changed with M404 - bool filament_sensor=false; //M405 turns on filament_sensor control, M406 turns it off - float filament_width_meas=DEFAULT_MEASURED_FILAMENT_DIA; //Stores the measured filament diameter - signed char measurement_delay[MAX_MEASUREMENT_DELAY+1]; //ring buffer to delay measurement store extruder factor after subtracting 100 - int delay_index1=0; //index into ring buffer - int delay_index2=-1; //index into ring buffer - set to -1 on startup to indicate ring buffer needs to be initialized - float delay_dist=0; //delay distance counter + //Variables for Filament Sensor input + float filament_width_nominal = DEFAULT_NOMINAL_FILAMENT_DIA; //Set nominal filament width, can be changed with M404 + bool filament_sensor = false; //M405 turns on filament_sensor control, M406 turns it off + float filament_width_meas = DEFAULT_MEASURED_FILAMENT_DIA; //Stores the measured filament diameter + signed char measurement_delay[MAX_MEASUREMENT_DELAY+1]; //ring buffer to delay measurement store extruder factor after subtracting 100 + int delay_index1 = 0; //index into ring buffer + int delay_index2 = -1; //index into ring buffer - set to -1 on startup to indicate ring buffer needs to be initialized + float delay_dist = 0; //delay distance counter int meas_delay_cm = MEASUREMENT_DELAY_CM; //distance delay setting #endif #ifdef FILAMENT_RUNOUT_SENSOR - static bool filrunoutEnqued = false; + static bool filrunoutEnqueued = false; #endif -const char errormagic[] PROGMEM = "Error:"; -const char echomagic[] PROGMEM = "echo:"; - -const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'}; -static float destination[NUM_AXIS] = { 0, 0, 0, 0 }; - -static float offset[3] = { 0, 0, 0 }; -static bool home_all_axis = true; -static float feedrate = 1500.0, next_feedrate, saved_feedrate; -static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0; - -static bool relative_mode = false; //Determines Absolute or Relative Coordinates - -static char cmdbuffer[BUFSIZE][MAX_CMD_SIZE]; -static bool fromsd[BUFSIZE]; -static int bufindr = 0; -static int bufindw = 0; -static int buflen = 0; - -static char serial_char; -static int serial_count = 0; -static boolean comment_mode = false; -static char *strchr_pointer; ///< A pointer to find chars in the command string (X, Y, Z, E, etc.) - -const char* queued_commands_P= NULL; /* pointer to the current line in the active sequence of commands, or NULL when none */ - -const int sensitive_pins[] = SENSITIVE_PINS; ///< Sensitive pin list for M42 - -// Inactivity shutdown -static unsigned long previous_millis_cmd = 0; -static unsigned long max_inactive_time = 0; -static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000l; - -unsigned long starttime = 0; ///< Print job start time -unsigned long stoptime = 0; ///< Print job stop time - -static uint8_t tmp_extruder; - - -bool Stopped = false; +#ifdef SDSUPPORT + static bool fromsd[BUFSIZE]; +#endif #if NUM_SERVOS > 0 - Servo servos[NUM_SERVOS]; + Servo servo[NUM_SERVOS]; #endif -bool CooldownNoWait = true; -bool target_direction; - #ifdef CHDK unsigned long chdkHigh = 0; boolean chdkActive = false; #endif //=========================================================================== -//=============================Routines====================================== +//================================ Functions ================================ //=========================================================================== void get_arc_coordinates(); bool setTargetedHotend(int code); -void serial_echopair_P(const char *s_P, float v) - { serialprintPGM(s_P); SERIAL_ECHO(v); } -void serial_echopair_P(const char *s_P, double v) - { serialprintPGM(s_P); SERIAL_ECHO(v); } -void serial_echopair_P(const char *s_P, unsigned long v) - { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_P(const char *s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_P(const char *s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_P(const char *s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } + +#ifdef PREVENT_DANGEROUS_EXTRUDE + float extrude_min_temp = EXTRUDE_MINTEMP; +#endif #ifdef SDSUPPORT #include "SdFatUtil.h" @@ -470,106 +424,101 @@ void serial_echopair_P(const char *s_P, unsigned long v) } #endif //!SDSUPPORT -//Injects the next command from the pending sequence of commands, when possible -//Return false if and only if no command was pending -static bool drain_queued_commands_P() -{ - char cmd[30]; - if(!queued_commands_P) - return false; +/** + * Inject the next command from the command queue, when possible + * Return false only if no command was pending + */ +static bool drain_queued_commands_P() { + if (!queued_commands_P) return false; + // Get the next 30 chars from the sequence of gcodes to run - strncpy_P(cmd, queued_commands_P, sizeof(cmd)-1); - cmd[sizeof(cmd)-1]= 0; + char cmd[30]; + strncpy_P(cmd, queued_commands_P, sizeof(cmd) - 1); + cmd[sizeof(cmd) - 1] = '\0'; + // Look for the end of line, or the end of sequence - size_t i= 0; + size_t i = 0; char c; - while( (c= cmd[i]) && c!='\n' ) - ++i; // look for the end of this gcode command - cmd[i]= 0; - if(enquecommand(cmd)) // buffer was not full (else we will retry later) - { - if(c) - queued_commands_P+= i+1; // move to next command + while((c = cmd[i]) && c != '\n') i++; // find the end of this gcode command + cmd[i] = '\0'; + if (enqueuecommand(cmd)) { // buffer was not full (else we will retry later) + if (c) + queued_commands_P += i + 1; // move to next command else - queued_commands_P= NULL; // will have no more commands in the sequence + queued_commands_P = NULL; // will have no more commands in the sequence } return true; } -//Record one or many commands to run from program memory. -//Aborts the current queue, if any. -//Note: drain_queued_commands_P() must be called repeatedly to drain the commands afterwards -void enquecommands_P(const char* pgcode) -{ - queued_commands_P= pgcode; - drain_queued_commands_P(); // first command exectuted asap (when possible) +/** + * Record one or many commands to run from program memory. + * Aborts the current queue, if any. + * Note: drain_queued_commands_P() must be called repeatedly to drain the commands afterwards + */ +void enqueuecommands_P(const char* pgcode) { + queued_commands_P = pgcode; + drain_queued_commands_P(); // first command executed asap (when possible) } -//adds a single command to the main command buffer, from RAM -//that is really done in a non-safe way. -//needs overworking someday -//Returns false if it failed to do so -bool enquecommand(const char *cmd) -{ - if(*cmd==';') - return false; - if(buflen >= BUFSIZE) - return false; - //this is dangerous if a mixing of serial and this happens - strcpy(&(cmdbuffer[bufindw][0]),cmd); +/** + * Copy a command directly into the main command buffer, from RAM. + * + * This is done in a non-safe way and needs a rework someday. + * Returns false if it doesn't add any command + */ +bool enqueuecommand(const char *cmd) { + + if (*cmd == ';' || commands_in_queue >= BUFSIZE) return false; + + // This is dangerous if a mixing of serial and this happens + char *command = command_queue[cmd_queue_index_w]; + strcpy(command, cmd); SERIAL_ECHO_START; - SERIAL_ECHOPGM(MSG_Enqueing); - SERIAL_ECHO(cmdbuffer[bufindw]); + SERIAL_ECHOPGM(MSG_Enqueueing); + SERIAL_ECHO(command); SERIAL_ECHOLNPGM("\""); - bufindw= (bufindw + 1)%BUFSIZE; - buflen += 1; + cmd_queue_index_w = (cmd_queue_index_w + 1) % BUFSIZE; + commands_in_queue++; return true; } - - -void setup_killpin() -{ - #if defined(KILL_PIN) && KILL_PIN > -1 +void setup_killpin() { + #if HAS_KILL SET_INPUT(KILL_PIN); - WRITE(KILL_PIN,HIGH); + WRITE(KILL_PIN, HIGH); #endif } -void setup_filrunoutpin() -{ -#if defined(FILRUNOUT_PIN) && FILRUNOUT_PIN > -1 - pinMode(FILRUNOUT_PIN,INPUT); - #if defined(ENDSTOPPULLUP_FIL_RUNOUT) - WRITE(FILLRUNOUT_PIN,HIGH); - #endif -#endif +void setup_filrunoutpin() { + #if HAS_FILRUNOUT + pinMode(FILRUNOUT_PIN, INPUT); + #ifdef ENDSTOPPULLUP_FIL_RUNOUT + WRITE(FILLRUNOUT_PIN, HIGH); + #endif + #endif } // Set home pin -void setup_homepin(void) -{ -#if defined(HOME_PIN) && HOME_PIN > -1 - SET_INPUT(HOME_PIN); - WRITE(HOME_PIN,HIGH); -#endif +void setup_homepin(void) { + #if HAS_HOME + SET_INPUT(HOME_PIN); + WRITE(HOME_PIN, HIGH); + #endif } -void setup_photpin() -{ - #if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1 +void setup_photpin() { + #if HAS_PHOTOGRAPH OUT_WRITE(PHOTOGRAPH_PIN, LOW); #endif } -void setup_powerhold() -{ - #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1 +void setup_powerhold() { + #if HAS_SUICIDE OUT_WRITE(SUICIDE_PIN, HIGH); #endif - #if defined(PS_ON_PIN) && PS_ON_PIN > -1 - #if defined(PS_DEFAULT_OFF) + #if HAS_POWER_SWITCH + #ifdef PS_DEFAULT_OFF OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP); #else OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE); @@ -577,50 +526,58 @@ void setup_powerhold() #endif } -void suicide() -{ - #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1 +void suicide() { + #if HAS_SUICIDE OUT_WRITE(SUICIDE_PIN, LOW); #endif } -void servo_init() -{ - #if (NUM_SERVOS >= 1) && defined(SERVO0_PIN) && (SERVO0_PIN > -1) - servos[0].attach(SERVO0_PIN); - #endif - #if (NUM_SERVOS >= 2) && defined(SERVO1_PIN) && (SERVO1_PIN > -1) - servos[1].attach(SERVO1_PIN); +void servo_init() { + #if NUM_SERVOS >= 1 && HAS_SERVO_0 + servo[0].attach(SERVO0_PIN); #endif - #if (NUM_SERVOS >= 3) && defined(SERVO2_PIN) && (SERVO2_PIN > -1) - servos[2].attach(SERVO2_PIN); + #if NUM_SERVOS >= 2 && HAS_SERVO_1 + servo[1].attach(SERVO1_PIN); #endif - #if (NUM_SERVOS >= 4) && defined(SERVO3_PIN) && (SERVO3_PIN > -1) - servos[3].attach(SERVO3_PIN); + #if NUM_SERVOS >= 3 && HAS_SERVO_2 + servo[2].attach(SERVO2_PIN); #endif - #if (NUM_SERVOS >= 5) - #error "TODO: enter initalisation code for more servos" + #if NUM_SERVOS >= 4 && HAS_SERVO_3 + servo[3].attach(SERVO3_PIN); #endif // Set position of Servo Endstops that are defined #ifdef SERVO_ENDSTOPS - for(int8_t i = 0; i < 3; i++) - { - if(servo_endstops[i] > -1) { - servos[servo_endstops[i]].write(servo_endstop_angles[i * 2 + 1]); - } - } + for (int i = 0; i < 3; i++) + if (servo_endstops[i] >= 0) + servo[servo_endstops[i]].write(servo_endstop_angles[i * 2 + 1]); #endif #if SERVO_LEVELING delay(PROBE_SERVO_DEACTIVATION_DELAY); - servos[servo_endstops[Z_AXIS]].detach(); + servo[servo_endstops[Z_AXIS]].detach(); #endif } - -void setup() -{ +/** + * Marlin entry-point: Set up before the program loop + * - Set up the kill pin, filament runout, power hold + * - Start the serial port + * - Print startup messages and diagnostics + * - Get EEPROM or default settings + * - Initialize managers for: + * • temperature + * • planner + * • watchdog + * • stepper + * • photo pin + * • servos + * • LCD controller + * • Digipot I2C + * • Z probe sled + * • status LEDs + */ +void setup() { setup_killpin(); setup_filrunoutpin(); setup_powerhold(); @@ -630,15 +587,16 @@ void setup() // Check startup - does nothing if bootloader sets MCUSR to 0 byte mcu = MCUSR; - if(mcu & 1) SERIAL_ECHOLNPGM(MSG_POWERUP); - if(mcu & 2) SERIAL_ECHOLNPGM(MSG_EXTERNAL_RESET); - if(mcu & 4) SERIAL_ECHOLNPGM(MSG_BROWNOUT_RESET); - if(mcu & 8) SERIAL_ECHOLNPGM(MSG_WATCHDOG_RESET); - if(mcu & 32) SERIAL_ECHOLNPGM(MSG_SOFTWARE_RESET); - MCUSR=0; + if (mcu & 1) SERIAL_ECHOLNPGM(MSG_POWERUP); + if (mcu & 2) SERIAL_ECHOLNPGM(MSG_EXTERNAL_RESET); + if (mcu & 4) SERIAL_ECHOLNPGM(MSG_BROWNOUT_RESET); + if (mcu & 8) SERIAL_ECHOLNPGM(MSG_WATCHDOG_RESET); + if (mcu & 32) SERIAL_ECHOLNPGM(MSG_SOFTWARE_RESET); + MCUSR = 0; SERIAL_ECHOPGM(MSG_MARLIN); - SERIAL_ECHOLNPGM(STRING_VERSION); + SERIAL_ECHOLNPGM(" " STRING_VERSION); + #ifdef STRING_VERSION_CONFIG_H #ifdef STRING_CONFIG_H_AUTHOR SERIAL_ECHO_START; @@ -650,15 +608,16 @@ void setup() SERIAL_ECHOLNPGM(__DATE__); #endif // STRING_CONFIG_H_AUTHOR #endif // STRING_VERSION_CONFIG_H + SERIAL_ECHO_START; SERIAL_ECHOPGM(MSG_FREE_MEMORY); SERIAL_ECHO(freeMemory()); SERIAL_ECHOPGM(MSG_PLANNER_BUFFER_BYTES); SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE); - for(int8_t i = 0; i < BUFSIZE; i++) - { - fromsd[i] = false; - } + + #ifdef SDSUPPORT + for (int8_t i = 0; i < BUFSIZE; i++) fromsd[i] = false; + #endif // loads data from EEPROM if available else uses defaults (and resets step acceleration rate) Config_RetrieveSettings(); @@ -669,108 +628,125 @@ void setup() st_init(); // Initialize stepper, this enables interrupts! setup_photpin(); servo_init(); - lcd_init(); _delay_ms(1000); // wait 1sec to display the splash screen - #if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1 + #if HAS_CONTROLLERFAN SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan #endif #ifdef DIGIPOT_I2C digipot_i2c_init(); #endif -#ifdef Z_PROBE_SLED - pinMode(SERVO0_PIN, OUTPUT); - digitalWrite(SERVO0_PIN, LOW); // turn it off -#endif // Z_PROBE_SLED + + #ifdef Z_PROBE_SLED + pinMode(SERVO0_PIN, OUTPUT); + digitalWrite(SERVO0_PIN, LOW); // turn it off + #endif // Z_PROBE_SLED + setup_homepin(); -#ifdef STAT_LED_RED - pinMode(STAT_LED_RED, OUTPUT); - digitalWrite(STAT_LED_RED, LOW); // turn it off -#endif -#ifdef STAT_LED_BLUE - pinMode(STAT_LED_BLUE, OUTPUT); - digitalWrite(STAT_LED_BLUE, LOW); // turn it off -#endif + #ifdef STAT_LED_RED + pinMode(STAT_LED_RED, OUTPUT); + digitalWrite(STAT_LED_RED, LOW); // turn it off + #endif + + #ifdef STAT_LED_BLUE + pinMode(STAT_LED_BLUE, OUTPUT); + digitalWrite(STAT_LED_BLUE, LOW); // turn it off + #endif } +/** + * The main Marlin program loop + * + * - Save or log commands to SD + * - Process available commands (if not saving) + * - Call heater manager + * - Call inactivity manager + * - Call endstop manager + * - Call LCD update + */ +void loop() { + if (commands_in_queue < BUFSIZE - 1) get_command(); -void loop() -{ - if(buflen < (BUFSIZE-1)) - get_command(); #ifdef SDSUPPORT - card.checkautostart(false); + card.checkautostart(false); #endif - if(buflen) - { + + if (commands_in_queue) { + #ifdef SDSUPPORT - if(card.saving) - { - if(strstr_P(cmdbuffer[bufindr], PSTR("M29")) == NULL) - { - card.write_command(cmdbuffer[bufindr]); - if(card.logging) - { - process_commands(); - } - else - { - SERIAL_PROTOCOLLNPGM(MSG_OK); - } - } - else - { + + if (card.saving) { + char *command = command_queue[cmd_queue_index_r]; + if (strstr_P(command, PSTR("M29"))) { + // M29 closes the file card.closefile(); SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED); } + else { + // Write the string from the read buffer to SD + card.write_command(command); + if (card.logging) + process_commands(); // The card is saving because it's logging + else + SERIAL_PROTOCOLLNPGM(MSG_OK); + } } else - { process_commands(); - } + #else + process_commands(); - #endif //SDSUPPORT - buflen = (buflen-1); - bufindr = (bufindr + 1)%BUFSIZE; + + #endif // SDSUPPORT + + commands_in_queue--; + cmd_queue_index_r = (cmd_queue_index_r + 1) % BUFSIZE; } - //check heater every n milliseconds + // Check heater every n milliseconds manage_heater(); manage_inactivity(); checkHitEndstops(); lcd_update(); } -void get_command() -{ - if(drain_queued_commands_P()) // priority is given to non-serial commands - return; +/** + * Add to the circular command queue the next command from: + * - The command-injection queue (queued_commands_P) + * - The active serial input (usually USB) + * - The SD card file being actively printed + */ +void get_command() { + + if (drain_queued_commands_P()) return; // priority is given to non-serial commands - while( MYSERIAL.available() > 0 && buflen < BUFSIZE) { + while (MYSERIAL.available() > 0 && commands_in_queue < BUFSIZE) { + serial_char = MYSERIAL.read(); - if(serial_char == '\n' || - serial_char == '\r' || - serial_count >= (MAX_CMD_SIZE - 1) ) - { + + if (serial_char == '\n' || serial_char == '\r' || + serial_count >= (MAX_CMD_SIZE - 1) + ) { // end of line == end of comment comment_mode = false; - if(!serial_count) { - // short cut for empty lines - return; - } - cmdbuffer[bufindw][serial_count] = 0; //terminate string + if (!serial_count) return; // shortcut for empty lines - fromsd[bufindw] = false; - if(strchr(cmdbuffer[bufindw], 'N') != NULL) - { - strchr_pointer = strchr(cmdbuffer[bufindw], 'N'); + char *command = command_queue[cmd_queue_index_w]; + command[serial_count] = 0; // terminate string + + #ifdef SDSUPPORT + fromsd[cmd_queue_index_w] = false; + #endif + + if (strchr(command, 'N') != NULL) { + strchr_pointer = strchr(command, 'N'); gcode_N = (strtol(strchr_pointer + 1, NULL, 10)); - if(gcode_N != gcode_LastN+1 && (strstr_P(cmdbuffer[bufindw], PSTR("M110")) == NULL) ) { + if (gcode_N != gcode_LastN + 1 && strstr_P(command, PSTR("M110")) == NULL) { SERIAL_ERROR_START; SERIAL_ERRORPGM(MSG_ERR_LINE_NO); SERIAL_ERRORLN(gcode_LastN); @@ -780,14 +756,13 @@ void get_command() return; } - if(strchr(cmdbuffer[bufindw], '*') != NULL) - { + if (strchr(command, '*') != NULL) { byte checksum = 0; byte count = 0; - while(cmdbuffer[bufindw][count] != '*') checksum = checksum^cmdbuffer[bufindw][count++]; - strchr_pointer = strchr(cmdbuffer[bufindw], '*'); + while (command[count] != '*') checksum ^= command[count++]; + strchr_pointer = strchr(command, '*'); - if(strtol(strchr_pointer + 1, NULL, 10) != checksum) { + if (strtol(strchr_pointer + 1, NULL, 10) != checksum) { SERIAL_ERROR_START; SERIAL_ERRORPGM(MSG_ERR_CHECKSUM_MISMATCH); SERIAL_ERRORLN(gcode_LastN); @@ -797,8 +772,7 @@ void get_command() } //if no errors, continue parsing } - else - { + else { SERIAL_ERROR_START; SERIAL_ERRORPGM(MSG_ERR_NO_CHECKSUM); SERIAL_ERRORLN(gcode_LastN); @@ -810,10 +784,8 @@ void get_command() gcode_LastN = gcode_N; //if no errors, continue parsing } - else // if we don't receive 'N' but still see '*' - { - if((strchr(cmdbuffer[bufindw], '*') != NULL)) - { + else { // if we don't receive 'N' but still see '*' + if ((strchr(command, '*') != NULL)) { SERIAL_ERROR_START; SERIAL_ERRORPGM(MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM); SERIAL_ERRORLN(gcode_LastN); @@ -821,127 +793,125 @@ void get_command() return; } } - if((strchr(cmdbuffer[bufindw], 'G') != NULL)){ - strchr_pointer = strchr(cmdbuffer[bufindw], 'G'); - switch(strtol(strchr_pointer + 1, NULL, 10)){ - case 0: - case 1: - case 2: - case 3: - if (Stopped == true) { - SERIAL_ERRORLNPGM(MSG_ERR_STOPPED); - LCD_MESSAGEPGM(MSG_STOPPED); - } - break; - default: - break; - } + if (strchr(command, 'G') != NULL) { + strchr_pointer = strchr(command, 'G'); + switch (strtol(strchr_pointer + 1, NULL, 10)) { + case 0: + case 1: + case 2: + case 3: + if (IsStopped()) { + SERIAL_ERRORLNPGM(MSG_ERR_STOPPED); + LCD_MESSAGEPGM(MSG_STOPPED); + } + break; + default: + break; + } } - //If command was e-stop process now - if(strcmp(cmdbuffer[bufindw], "M112") == 0) - kill(); + // If command was e-stop process now + if (strcmp(command, "M112") == 0) kill(); - bufindw = (bufindw + 1)%BUFSIZE; - buflen += 1; + cmd_queue_index_w = (cmd_queue_index_w + 1) % BUFSIZE; + commands_in_queue += 1; serial_count = 0; //clear buffer } - else if(serial_char == '\\') { //Handle escapes - - if(MYSERIAL.available() > 0 && buflen < BUFSIZE) { - // if we have one more character, copy it over - serial_char = MYSERIAL.read(); - cmdbuffer[bufindw][serial_count++] = serial_char; - } - - //otherwise do nothing + else if (serial_char == '\\') { // Handle escapes + if (MYSERIAL.available() > 0 && commands_in_queue < BUFSIZE) { + // if we have one more character, copy it over + serial_char = MYSERIAL.read(); + command_queue[cmd_queue_index_w][serial_count++] = serial_char; + } + // otherwise do nothing } else { // its not a newline, carriage return or escape char - if(serial_char == ';') comment_mode = true; - if(!comment_mode) cmdbuffer[bufindw][serial_count++] = serial_char; + if (serial_char == ';') comment_mode = true; + if (!comment_mode) command_queue[cmd_queue_index_w][serial_count++] = serial_char; } } - #ifdef SDSUPPORT - if(!card.sdprinting || serial_count!=0){ - return; - } - //'#' stops reading from SD to the buffer prematurely, so procedural macro calls are possible - // if it occurs, stop_buffering is triggered and the buffer is ran dry. - // this character _can_ occur in serial com, due to checksums. however, no checksums are used in SD printing - - static bool stop_buffering=false; - if(buflen==0) stop_buffering=false; - - while( !card.eof() && buflen < BUFSIZE && !stop_buffering) { - int16_t n=card.get(); - serial_char = (char)n; - if(serial_char == '\n' || - serial_char == '\r' || - (serial_char == '#' && comment_mode == false) || - (serial_char == ':' && comment_mode == false) || - serial_count >= (MAX_CMD_SIZE - 1)||n==-1) - { - if(card.eof()){ - SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED); - stoptime=millis(); - char time[30]; - unsigned long t=(stoptime-starttime)/1000; - int hours, minutes; - minutes=(t/60)%60; - hours=t/60/60; - sprintf_P(time, PSTR("%i hours %i minutes"),hours, minutes); - SERIAL_ECHO_START; - SERIAL_ECHOLN(time); - lcd_setstatus(time); - card.printingHasFinished(); - card.checkautostart(true); + #ifdef SDSUPPORT - } - if(serial_char=='#') - stop_buffering=true; + if (!card.sdprinting || serial_count) return; + + // '#' stops reading from SD to the buffer prematurely, so procedural macro calls are possible + // if it occurs, stop_buffering is triggered and the buffer is ran dry. + // this character _can_ occur in serial com, due to checksums. however, no checksums are used in SD printing + + static bool stop_buffering = false; + if (commands_in_queue == 0) stop_buffering = false; + + while (!card.eof() && commands_in_queue < BUFSIZE && !stop_buffering) { + int16_t n = card.get(); + serial_char = (char)n; + if (serial_char == '\n' || serial_char == '\r' || + ((serial_char == '#' || serial_char == ':') && !comment_mode) || + serial_count >= (MAX_CMD_SIZE - 1) || n == -1 + ) { + if (card.eof()) { + SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED); + print_job_stop_ms = millis(); + char time[30]; + millis_t t = (print_job_stop_ms - print_job_start_ms) / 1000; + int hours = t / 60 / 60, minutes = (t / 60) % 60; + sprintf_P(time, PSTR("%i " MSG_END_HOUR " %i " MSG_END_MINUTE), hours, minutes); + SERIAL_ECHO_START; + SERIAL_ECHOLN(time); + lcd_setstatus(time, true); + card.printingHasFinished(); + card.checkautostart(true); + } + if (serial_char == '#') stop_buffering = true; - if(!serial_count) - { + if (!serial_count) { + comment_mode = false; //for new command + return; //if empty line + } + command_queue[cmd_queue_index_w][serial_count] = 0; //terminate string + // if (!comment_mode) { + fromsd[cmd_queue_index_w] = true; + commands_in_queue += 1; + cmd_queue_index_w = (cmd_queue_index_w + 1) % BUFSIZE; + // } comment_mode = false; //for new command - return; //if empty line + serial_count = 0; //clear buffer + } + else { + if (serial_char == ';') comment_mode = true; + if (!comment_mode) command_queue[cmd_queue_index_w][serial_count++] = serial_char; } - cmdbuffer[bufindw][serial_count] = 0; //terminate string -// if(!comment_mode){ - fromsd[bufindw] = true; - buflen += 1; - bufindw = (bufindw + 1)%BUFSIZE; -// } - comment_mode = false; //for new command - serial_count = 0; //clear buffer - } - else - { - if(serial_char == ';') comment_mode = true; - if(!comment_mode) cmdbuffer[bufindw][serial_count++] = serial_char; } - } - - #endif //SDSUPPORT + #endif // SDSUPPORT } - -float code_value() -{ - return (strtod(strchr_pointer + 1, NULL)); +bool code_has_value() { + char c = strchr_pointer[1]; + return (c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.'; } -long code_value_long() -{ - return (strtol(strchr_pointer + 1, NULL, 10)); +float code_value() { + float ret; + char *e = strchr(strchr_pointer, 'E'); + if (e) { + *e = 0; + ret = strtod(strchr_pointer+1, NULL); + *e = 'E'; + } + else + ret = strtod(strchr_pointer+1, NULL); + return ret; } -bool code_seen(char code) -{ - strchr_pointer = strchr(cmdbuffer[bufindr], code); +long code_value_long() { return strtol(strchr_pointer + 1, NULL, 10); } + +int16_t code_value_short() { return (int16_t)strtol(strchr_pointer + 1, NULL, 10); } + +bool code_seen(char code) { + strchr_pointer = strchr(command_queue[cmd_queue_index_r], code); return (strchr_pointer != NULL); //Return True if a character was found } @@ -958,12 +928,12 @@ static const PROGMEM type array##_P[3] = \ static inline type array(int axis) \ { return pgm_read_any(&array##_P[axis]); } -XYZ_CONSTS_FROM_CONFIG(float, base_min_pos, MIN_POS); -XYZ_CONSTS_FROM_CONFIG(float, base_max_pos, MAX_POS); -XYZ_CONSTS_FROM_CONFIG(float, base_home_pos, HOME_POS); -XYZ_CONSTS_FROM_CONFIG(float, max_length, MAX_LENGTH); -XYZ_CONSTS_FROM_CONFIG(float, home_retract_mm, HOME_RETRACT_MM); -XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR); +XYZ_CONSTS_FROM_CONFIG(float, base_min_pos, MIN_POS); +XYZ_CONSTS_FROM_CONFIG(float, base_max_pos, MAX_POS); +XYZ_CONSTS_FROM_CONFIG(float, base_home_pos, HOME_POS); +XYZ_CONSTS_FROM_CONFIG(float, max_length, MAX_LENGTH); +XYZ_CONSTS_FROM_CONFIG(float, home_bump_mm, HOME_BUMP_MM); +XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR); #ifdef DUAL_X_CARRIAGE @@ -975,7 +945,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR); static float x_home_pos(int extruder) { if (extruder == 0) - return base_home_pos(X_AXIS) + home_offset[X_AXIS]; + return base_home_pos(X_AXIS) + home_offset[X_AXIS]; else // In dual carriage mode the extruder offset provides an override of the // second X-carriage offset when homed - otherwise X2_HOME_POS is used. @@ -991,7 +961,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR); static float inactive_extruder_x_pos = X2_MAX_POS; // used in mode 0 & 1 static bool active_extruder_parked = false; // used in mode 1 & 2 static float raised_parked_position[NUM_AXIS]; // used in mode 1 - static unsigned long delayed_move_time = 0; // used in mode 1 + static millis_t delayed_move_time = 0; // used in mode 1 static float duplicate_extruder_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2 static float duplicate_extruder_temp_offset = 0; // used in mode 2 bool extruder_duplication_enabled = false; // used in mode 2 @@ -999,638 +969,697 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR); #endif //DUAL_X_CARRIAGE static void axis_is_at_home(int axis) { -#ifdef DUAL_X_CARRIAGE - if (axis == X_AXIS) { - if (active_extruder != 0) { - current_position[X_AXIS] = x_home_pos(active_extruder); - min_pos[X_AXIS] = X2_MIN_POS; - max_pos[X_AXIS] = max(extruder_offset[X_AXIS][1], X2_MAX_POS); - return; - } - else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) { - current_position[X_AXIS] = base_home_pos(X_AXIS) + home_offset[X_AXIS]; - min_pos[X_AXIS] = base_min_pos(X_AXIS) + home_offset[X_AXIS]; - max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + home_offset[X_AXIS], - max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset); - return; + + #ifdef DUAL_X_CARRIAGE + if (axis == X_AXIS) { + if (active_extruder != 0) { + current_position[X_AXIS] = x_home_pos(active_extruder); + min_pos[X_AXIS] = X2_MIN_POS; + max_pos[X_AXIS] = max(extruder_offset[X_AXIS][1], X2_MAX_POS); + return; + } + else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) { + float xoff = home_offset[X_AXIS]; + current_position[X_AXIS] = base_home_pos(X_AXIS) + xoff; + min_pos[X_AXIS] = base_min_pos(X_AXIS) + xoff; + max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + xoff, max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset); + return; + } } - } -#endif -#ifdef SCARA - float homeposition[3]; - char i; - - if (axis < 2) - { + #endif + + #ifdef SCARA + float homeposition[3]; - for (i=0; i<3; i++) - { - homeposition[i] = base_home_pos(i); - } - // SERIAL_ECHOPGM("homeposition[x]= "); SERIAL_ECHO(homeposition[0]); - // SERIAL_ECHOPGM("homeposition[y]= "); SERIAL_ECHOLN(homeposition[1]); - // Works out real Homeposition angles using inverse kinematics, - // and calculates homing offset using forward kinematics - calculate_delta(homeposition); + if (axis < 2) { + + for (int i = 0; i < 3; i++) homeposition[i] = base_home_pos(i); + + // SERIAL_ECHOPGM("homeposition[x]= "); SERIAL_ECHO(homeposition[0]); + // SERIAL_ECHOPGM("homeposition[y]= "); SERIAL_ECHOLN(homeposition[1]); + // Works out real Homeposition angles using inverse kinematics, + // and calculates homing offset using forward kinematics + calculate_delta(homeposition); - // SERIAL_ECHOPGM("base Theta= "); SERIAL_ECHO(delta[X_AXIS]); - // SERIAL_ECHOPGM(" base Psi+Theta="); SERIAL_ECHOLN(delta[Y_AXIS]); + // SERIAL_ECHOPGM("base Theta= "); SERIAL_ECHO(delta[X_AXIS]); + // SERIAL_ECHOPGM(" base Psi+Theta="); SERIAL_ECHOLN(delta[Y_AXIS]); - for (i=0; i<2; i++) - { - delta[i] -= home_offset[i]; - } + for (int i = 0; i < 2; i++) delta[i] -= home_offset[i]; - // SERIAL_ECHOPGM("addhome X="); SERIAL_ECHO(home_offset[X_AXIS]); - // SERIAL_ECHOPGM(" addhome Y="); SERIAL_ECHO(home_offset[Y_AXIS]); - // SERIAL_ECHOPGM(" addhome Theta="); SERIAL_ECHO(delta[X_AXIS]); - // SERIAL_ECHOPGM(" addhome Psi+Theta="); SERIAL_ECHOLN(delta[Y_AXIS]); + // SERIAL_ECHOPGM("addhome X="); SERIAL_ECHO(home_offset[X_AXIS]); + // SERIAL_ECHOPGM(" addhome Y="); SERIAL_ECHO(home_offset[Y_AXIS]); + // SERIAL_ECHOPGM(" addhome Theta="); SERIAL_ECHO(delta[X_AXIS]); + // SERIAL_ECHOPGM(" addhome Psi+Theta="); SERIAL_ECHOLN(delta[Y_AXIS]); - calculate_SCARA_forward_Transform(delta); + calculate_SCARA_forward_Transform(delta); - // SERIAL_ECHOPGM("Delta X="); SERIAL_ECHO(delta[X_AXIS]); - // SERIAL_ECHOPGM(" Delta Y="); SERIAL_ECHOLN(delta[Y_AXIS]); + // SERIAL_ECHOPGM("Delta X="); SERIAL_ECHO(delta[X_AXIS]); + // SERIAL_ECHOPGM(" Delta Y="); SERIAL_ECHOLN(delta[Y_AXIS]); - current_position[axis] = delta[axis]; + current_position[axis] = delta[axis]; - // SCARA home positions are based on configuration since the actual limits are determined by the - // inverse kinematic transform. - min_pos[axis] = base_min_pos(axis); // + (delta[axis] - base_home_pos(axis)); - max_pos[axis] = base_max_pos(axis); // + (delta[axis] - base_home_pos(axis)); - } - else - { + // SCARA home positions are based on configuration since the actual limits are determined by the + // inverse kinematic transform. + min_pos[axis] = base_min_pos(axis); // + (delta[axis] - base_home_pos(axis)); + max_pos[axis] = base_max_pos(axis); // + (delta[axis] - base_home_pos(axis)); + } + else { current_position[axis] = base_home_pos(axis) + home_offset[axis]; - min_pos[axis] = base_min_pos(axis) + home_offset[axis]; - max_pos[axis] = base_max_pos(axis) + home_offset[axis]; - } -#else - current_position[axis] = base_home_pos(axis) + home_offset[axis]; - min_pos[axis] = base_min_pos(axis) + home_offset[axis]; - max_pos[axis] = base_max_pos(axis) + home_offset[axis]; -#endif + min_pos[axis] = base_min_pos(axis) + home_offset[axis]; + max_pos[axis] = base_max_pos(axis) + home_offset[axis]; + } + #else + current_position[axis] = base_home_pos(axis) + home_offset[axis]; + min_pos[axis] = base_min_pos(axis) + home_offset[axis]; + max_pos[axis] = base_max_pos(axis) + home_offset[axis]; + #endif +} + +/** + * Some planner shorthand inline functions + */ +inline void set_homing_bump_feedrate(AxisEnum axis) { + const int homing_bump_divisor[] = HOMING_BUMP_DIVISOR; + if (homing_bump_divisor[axis] >= 1) + feedrate = homing_feedrate[axis] / homing_bump_divisor[axis]; + else { + feedrate = homing_feedrate[axis] / 10; + SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less than 1"); + } +} +inline void line_to_current_position() { + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder); +} +inline void line_to_z(float zPosition) { + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder); +} +inline void line_to_destination(float mm_m) { + plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], mm_m/60, active_extruder); +} +inline void line_to_destination() { + line_to_destination(feedrate); } +inline void sync_plan_position() { + plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); +} +#if defined(DELTA) || defined(SCARA) + inline void sync_plan_position_delta() { + calculate_delta(current_position); + plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]); + } +#endif +inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); } +inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); } #ifdef ENABLE_AUTO_BED_LEVELING -#ifdef AUTO_BED_LEVELING_GRID -#ifndef DELTA -static void set_bed_level_equation_lsq(double *plane_equation_coefficients) -{ - vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1); - planeNormal.debug("planeNormal"); - plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal); - //bedLevel.debug("bedLevel"); + #ifdef DELTA + /** + * Calculate delta, start a line, and set current_position to destination + */ + void prepare_move_raw() { + refresh_cmd_timeout(); + calculate_delta(destination); + plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], (feedrate/60)*(feedrate_multiplier/100.0), active_extruder); + set_current_to_destination(); + } + #endif - //plan_bed_level_matrix.debug("bed level before"); - //vector_3 uncorrected_position = plan_get_position_mm(); - //uncorrected_position.debug("position before"); + #ifdef AUTO_BED_LEVELING_GRID - vector_3 corrected_position = plan_get_position(); -// corrected_position.debug("position after"); - current_position[X_AXIS] = corrected_position.x; - current_position[Y_AXIS] = corrected_position.y; - current_position[Z_AXIS] = corrected_position.z; + #ifndef DELTA - // put the bed at 0 so we don't go below it. - current_position[Z_AXIS] = zprobe_zoffset; // in the lsq we reach here after raising the extruder due to the loop structure + static void set_bed_level_equation_lsq(double *plane_equation_coefficients) { + vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1); + planeNormal.debug("planeNormal"); + plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal); + //bedLevel.debug("bedLevel"); - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); -} -#endif + //plan_bed_level_matrix.debug("bed level before"); + //vector_3 uncorrected_position = plan_get_position_mm(); + //uncorrected_position.debug("position before"); -#else // not AUTO_BED_LEVELING_GRID + vector_3 corrected_position = plan_get_position(); + //corrected_position.debug("position after"); + current_position[X_AXIS] = corrected_position.x; + current_position[Y_AXIS] = corrected_position.y; + current_position[Z_AXIS] = corrected_position.z; -static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) { + sync_plan_position(); + } - plan_bed_level_matrix.set_to_identity(); + #endif // !DELTA - vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1); - vector_3 pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2); - vector_3 pt3 = vector_3(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, z_at_pt_3); + #else // !AUTO_BED_LEVELING_GRID - vector_3 from_2_to_1 = (pt1 - pt2).get_normal(); - vector_3 from_2_to_3 = (pt3 - pt2).get_normal(); - vector_3 planeNormal = vector_3::cross(from_2_to_1, from_2_to_3).get_normal(); - planeNormal = vector_3(planeNormal.x, planeNormal.y, abs(planeNormal.z)); + static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) { - plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal); + plan_bed_level_matrix.set_to_identity(); - vector_3 corrected_position = plan_get_position(); - current_position[X_AXIS] = corrected_position.x; - current_position[Y_AXIS] = corrected_position.y; - current_position[Z_AXIS] = corrected_position.z; + vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1); + vector_3 pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2); + vector_3 pt3 = vector_3(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, z_at_pt_3); + vector_3 planeNormal = vector_3::cross(pt1 - pt2, pt3 - pt2).get_normal(); - // put the bed at 0 so we don't go below it. - current_position[Z_AXIS] = zprobe_zoffset; + if (planeNormal.z < 0) { + planeNormal.x = -planeNormal.x; + planeNormal.y = -planeNormal.y; + planeNormal.z = -planeNormal.z; + } - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); + plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal); -} + vector_3 corrected_position = plan_get_position(); + current_position[X_AXIS] = corrected_position.x; + current_position[Y_AXIS] = corrected_position.y; + current_position[Z_AXIS] = corrected_position.z; -#endif // AUTO_BED_LEVELING_GRID + sync_plan_position(); + } -static void run_z_probe() { - #ifdef DELTA - - float start_z = current_position[Z_AXIS]; - long start_steps = st_get_position(Z_AXIS); - - // move down slowly until you find the bed - feedrate = homing_feedrate[Z_AXIS] / 4; - destination[Z_AXIS] = -10; - prepare_move_raw(); - st_synchronize(); - endstops_hit_on_purpose(); + #endif // !AUTO_BED_LEVELING_GRID + + static void run_z_probe() { + + #ifdef DELTA - // we have to let the planner know where we are right now as it is not where we said to go. - long stop_steps = st_get_position(Z_AXIS); - float mm = start_z - float(start_steps - stop_steps) / axis_steps_per_unit[Z_AXIS]; - current_position[Z_AXIS] = mm; - calculate_delta(current_position); - plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]); + float start_z = current_position[Z_AXIS]; + long start_steps = st_get_position(Z_AXIS); - #else + // move down slowly until you find the bed + feedrate = homing_feedrate[Z_AXIS] / 4; + destination[Z_AXIS] = -10; + prepare_move_raw(); // this will also set_current_to_destination + st_synchronize(); + endstops_hit_on_purpose(); // clear endstop hit flags + + // we have to let the planner know where we are right now as it is not where we said to go. + long stop_steps = st_get_position(Z_AXIS); + float mm = start_z - float(start_steps - stop_steps) / axis_steps_per_unit[Z_AXIS]; + current_position[Z_AXIS] = mm; + sync_plan_position_delta(); + + #else // !DELTA - plan_bed_level_matrix.set_to_identity(); - feedrate = homing_feedrate[Z_AXIS]; + plan_bed_level_matrix.set_to_identity(); + feedrate = homing_feedrate[Z_AXIS]; - // move down until you find the bed - float zPosition = -10; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder); - st_synchronize(); + // move down until you find the bed + float zPosition = -10; + line_to_z(zPosition); + st_synchronize(); - // we have to let the planner know where we are right now as it is not where we said to go. - zPosition = st_get_position_mm(Z_AXIS); - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS]); + // we have to let the planner know where we are right now as it is not where we said to go. + zPosition = st_get_position_mm(Z_AXIS); + plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS]); - // move up the retract distance - zPosition += home_retract_mm(Z_AXIS); - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder); - st_synchronize(); + // move up the retract distance + zPosition += home_bump_mm(Z_AXIS); + line_to_z(zPosition); + st_synchronize(); + endstops_hit_on_purpose(); // clear endstop hit flags - // move back down slowly to find bed - - if (homing_bump_divisor[Z_AXIS] >= 1) - { - feedrate = homing_feedrate[Z_AXIS]/homing_bump_divisor[Z_AXIS]; - } - else - { - feedrate = homing_feedrate[Z_AXIS]/10; - SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less then 1"); - } + // move back down slowly to find bed + set_homing_bump_feedrate(Z_AXIS); - - zPosition -= home_retract_mm(Z_AXIS) * 2; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder); - st_synchronize(); + zPosition -= home_bump_mm(Z_AXIS) * 2; + line_to_z(zPosition); + st_synchronize(); + endstops_hit_on_purpose(); // clear endstop hit flags - current_position[Z_AXIS] = st_get_position_mm(Z_AXIS); - // make sure the planner knows where we are as it may be a bit different than we last said to move to - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); - - #endif -} + current_position[Z_AXIS] = st_get_position_mm(Z_AXIS); + // make sure the planner knows where we are as it may be a bit different than we last said to move to + sync_plan_position(); + + #endif // !DELTA + } -static void do_blocking_move_to(float x, float y, float z) { + /** + * Plan a move to (X, Y, Z) and set the current_position + * The final current_position may not be the one that was requested + */ + static void do_blocking_move_to(float x, float y, float z) { float oldFeedRate = feedrate; -#ifdef DELTA + #ifdef DELTA - feedrate = XY_TRAVEL_SPEED; - - destination[X_AXIS] = x; - destination[Y_AXIS] = y; - destination[Z_AXIS] = z; - prepare_move_raw(); - st_synchronize(); + feedrate = XY_TRAVEL_SPEED; + + destination[X_AXIS] = x; + destination[Y_AXIS] = y; + destination[Z_AXIS] = z; + prepare_move_raw(); // this will also set_current_to_destination + st_synchronize(); -#else + #else - feedrate = homing_feedrate[Z_AXIS]; + feedrate = homing_feedrate[Z_AXIS]; - current_position[Z_AXIS] = z; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder); - st_synchronize(); + current_position[Z_AXIS] = z; + line_to_current_position(); + st_synchronize(); - feedrate = xy_travel_speed; + feedrate = xy_travel_speed; - current_position[X_AXIS] = x; - current_position[Y_AXIS] = y; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder); - st_synchronize(); + current_position[X_AXIS] = x; + current_position[Y_AXIS] = y; + line_to_current_position(); + st_synchronize(); -#endif + #endif feedrate = oldFeedRate; -} - -static void do_blocking_move_relative(float offset_x, float offset_y, float offset_z) { - do_blocking_move_to(current_position[X_AXIS] + offset_x, current_position[Y_AXIS] + offset_y, current_position[Z_AXIS] + offset_z); -} + } -static void setup_for_endstop_move() { + static void setup_for_endstop_move() { saved_feedrate = feedrate; - saved_feedmultiply = feedmultiply; - feedmultiply = 100; - previous_millis_cmd = millis(); - + saved_feedrate_multiplier = feedrate_multiplier; + feedrate_multiplier = 100; + refresh_cmd_timeout(); enable_endstops(true); -} - -static void clean_up_after_endstop_move() { -#ifdef ENDSTOPS_ONLY_FOR_HOMING - enable_endstops(false); -#endif + } + static void clean_up_after_endstop_move() { + #ifdef ENDSTOPS_ONLY_FOR_HOMING + enable_endstops(false); + #endif feedrate = saved_feedrate; - feedmultiply = saved_feedmultiply; - previous_millis_cmd = millis(); -} + feedrate_multiplier = saved_feedrate_multiplier; + refresh_cmd_timeout(); + } -static void engage_z_probe() { - // Engage Z Servo endstop if enabled - #ifdef SERVO_ENDSTOPS - if (servo_endstops[Z_AXIS] > -1) { - #if SERVO_LEVELING - servos[servo_endstops[Z_AXIS]].attach(0); - #endif - servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2]); - #if SERVO_LEVELING - delay(PROBE_SERVO_DEACTIVATION_DELAY); - servos[servo_endstops[Z_AXIS]].detach(); - #endif - } - #elif defined(Z_PROBE_ALLEN_KEY) - feedrate = homing_feedrate[X_AXIS]; - - // Move to the start position to initiate deployment - destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_X; - destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_Y; - destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_Z; - prepare_move_raw(); - - // Home X to touch the belt - feedrate = homing_feedrate[X_AXIS]/10; - destination[X_AXIS] = 0; - prepare_move_raw(); - - // Home Y for safety - feedrate = homing_feedrate[X_AXIS]/2; - destination[Y_AXIS] = 0; - prepare_move_raw(); - - st_synchronize(); - - bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); - if (z_min_endstop) - { - if (!Stopped) - { - SERIAL_ERROR_START; - SERIAL_ERRORLNPGM("Z-Probe failed to engage!"); - LCD_ALERTMESSAGEPGM("Err: ZPROBE"); + static void deploy_z_probe() { + + #ifdef SERVO_ENDSTOPS + + // Engage Z Servo endstop if enabled + if (servo_endstops[Z_AXIS] >= 0) { + #if SERVO_LEVELING + servo[servo_endstops[Z_AXIS]].attach(0); + #endif + servo[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2]); + #if SERVO_LEVELING + delay(PROBE_SERVO_DEACTIVATION_DELAY); + servo[servo_endstops[Z_AXIS]].detach(); + #endif + } + + #elif defined(Z_PROBE_ALLEN_KEY) + + feedrate = homing_feedrate[X_AXIS]; + + // Move to the start position to initiate deployment + destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_X; + destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_Y; + destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_Z; + prepare_move_raw(); // this will also set_current_to_destination + + // Home X to touch the belt + feedrate = homing_feedrate[X_AXIS]/10; + destination[X_AXIS] = 0; + prepare_move_raw(); // this will also set_current_to_destination + + // Home Y for safety + feedrate = homing_feedrate[X_AXIS]/2; + destination[Y_AXIS] = 0; + prepare_move_raw(); // this will also set_current_to_destination + + st_synchronize(); + + #ifdef Z_PROBE_ENDSTOP + bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING); + if (z_probe_endstop) + #else + bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); + if (z_min_endstop) + #endif + { + if (IsRunning()) { + SERIAL_ERROR_START; + SERIAL_ERRORLNPGM("Z-Probe failed to engage!"); + LCD_ALERTMESSAGEPGM("Err: ZPROBE"); } Stop(); - } - #endif + } -} + #endif // Z_PROBE_ALLEN_KEY -static void retract_z_probe() { - // Retract Z Servo endstop if enabled - #ifdef SERVO_ENDSTOPS - if (servo_endstops[Z_AXIS] > -1) - { - #if Z_RAISE_AFTER_PROBING > 0 - do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_AFTER_PROBING); - st_synchronize(); - #endif - - #if SERVO_LEVELING - servos[servo_endstops[Z_AXIS]].attach(0); - #endif - servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]); - #if SERVO_LEVELING - delay(PROBE_SERVO_DEACTIVATION_DELAY); - servos[servo_endstops[Z_AXIS]].detach(); - #endif - } - #elif defined(Z_PROBE_ALLEN_KEY) - // Move up for safety - feedrate = homing_feedrate[X_AXIS]; - destination[Z_AXIS] = current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING; - prepare_move_raw(); - - // Move to the start position to initiate retraction - destination[X_AXIS] = Z_PROBE_ALLEN_KEY_RETRACT_X; - destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_RETRACT_Y; - destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_RETRACT_Z; - prepare_move_raw(); - - // Move the nozzle down to push the probe into retracted position - feedrate = homing_feedrate[Z_AXIS]/10; - destination[Z_AXIS] = current_position[Z_AXIS] - Z_PROBE_ALLEN_KEY_RETRACT_DEPTH; - prepare_move_raw(); - - // Move up for safety - feedrate = homing_feedrate[Z_AXIS]/2; - destination[Z_AXIS] = current_position[Z_AXIS] + Z_PROBE_ALLEN_KEY_RETRACT_DEPTH * 2; - prepare_move_raw(); - - // Home XY for safety - feedrate = homing_feedrate[X_AXIS]/2; - destination[X_AXIS] = 0; - destination[Y_AXIS] = 0; - prepare_move_raw(); - - st_synchronize(); - - bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); - if (!z_min_endstop) - { - if (!Stopped) - { - SERIAL_ERROR_START; - SERIAL_ERRORLNPGM("Z-Probe failed to retract!"); - LCD_ALERTMESSAGEPGM("Err: ZPROBE"); + } + + static void stow_z_probe() { + + #ifdef SERVO_ENDSTOPS + + // Retract Z Servo endstop if enabled + if (servo_endstops[Z_AXIS] >= 0) { + + #if Z_RAISE_AFTER_PROBING > 0 + do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING); // this also updates current_position + st_synchronize(); + #endif + + #if SERVO_LEVELING + servo[servo_endstops[Z_AXIS]].attach(0); + #endif + + servo[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]); + + #if SERVO_LEVELING + delay(PROBE_SERVO_DEACTIVATION_DELAY); + servo[servo_endstops[Z_AXIS]].detach(); + #endif + } + + #elif defined(Z_PROBE_ALLEN_KEY) + + // Move up for safety + feedrate = homing_feedrate[X_AXIS]; + destination[Z_AXIS] = current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING; + prepare_move_raw(); // this will also set_current_to_destination + + // Move to the start position to initiate retraction + destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_X; + destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_Y; + destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_Z; + prepare_move_raw(); // this will also set_current_to_destination + + // Move the nozzle down to push the probe into retracted position + feedrate = homing_feedrate[Z_AXIS]/10; + destination[Z_AXIS] = current_position[Z_AXIS] - Z_PROBE_ALLEN_KEY_STOW_DEPTH; + prepare_move_raw(); // this will also set_current_to_destination + + // Move up for safety + feedrate = homing_feedrate[Z_AXIS]/2; + destination[Z_AXIS] = current_position[Z_AXIS] + Z_PROBE_ALLEN_KEY_STOW_DEPTH * 2; + prepare_move_raw(); // this will also set_current_to_destination + + // Home XY for safety + feedrate = homing_feedrate[X_AXIS]/2; + destination[X_AXIS] = 0; + destination[Y_AXIS] = 0; + prepare_move_raw(); // this will also set_current_to_destination + + st_synchronize(); + + #ifdef Z_PROBE_ENDSTOP + bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING); + if (!z_probe_endstop) + #else + bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); + if (!z_min_endstop) + #endif + { + if (IsRunning()) { + SERIAL_ERROR_START; + SERIAL_ERRORLNPGM("Z-Probe failed to retract!"); + LCD_ALERTMESSAGEPGM("Err: ZPROBE"); } Stop(); - } - #endif + } -} + #endif -enum ProbeAction { - ProbeStay = 0, - ProbeEngage = BIT(0), - ProbeRetract = BIT(1), - ProbeEngageAndRetract = (ProbeEngage | ProbeRetract) -}; - -/// Probe bed height at position (x,y), returns the measured z value -static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageAndRetract, int verbose_level=1) { - // move to right place - do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before); - do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]); - - #if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY) - if (retract_action & ProbeEngage) engage_z_probe(); - #endif + } - run_z_probe(); - float measured_z = current_position[Z_AXIS]; + enum ProbeAction { + ProbeStay = 0, + ProbeDeploy = BIT(0), + ProbeStow = BIT(1), + ProbeDeployAndStow = (ProbeDeploy | ProbeStow) + }; - #if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY) - if (retract_action & ProbeRetract) retract_z_probe(); - #endif + // Probe bed height at position (x,y), returns the measured z value + static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeDeployAndStow, int verbose_level=1) { + // move to right place + do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before); // this also updates current_position + do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]); // this also updates current_position - if (verbose_level > 2) { - SERIAL_PROTOCOLPGM(MSG_BED); - SERIAL_PROTOCOLPGM(" X: "); - SERIAL_PROTOCOL(x + 0.0001); - SERIAL_PROTOCOLPGM(" Y: "); - SERIAL_PROTOCOL(y + 0.0001); - SERIAL_PROTOCOLPGM(" Z: "); - SERIAL_PROTOCOL(measured_z + 0.0001); - SERIAL_EOL; - } - return measured_z; -} + #if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY) + if (retract_action & ProbeDeploy) deploy_z_probe(); + #endif -#ifdef DELTA -static void extrapolate_one_point(int x, int y, int xdir, int ydir) { - if (bed_level[x][y] != 0.0) { - return; // Don't overwrite good values. - } - float a = 2*bed_level[x+xdir][y] - bed_level[x+xdir*2][y]; // Left to right. - float b = 2*bed_level[x][y+ydir] - bed_level[x][y+ydir*2]; // Front to back. - float c = 2*bed_level[x+xdir][y+ydir] - bed_level[x+xdir*2][y+ydir*2]; // Diagonal. - float median = c; // Median is robust (ignores outliers). - if (a < b) { - if (b < c) median = b; - if (c < a) median = a; - } else { // b <= a - if (c < b) median = b; - if (a < c) median = a; - } - bed_level[x][y] = median; -} + run_z_probe(); + float measured_z = current_position[Z_AXIS]; -// Fill in the unprobed points (corners of circular print surface) -// using linear extrapolation, away from the center. -static void extrapolate_unprobed_bed_level() { - int half = (AUTO_BED_LEVELING_GRID_POINTS-1)/2; - for (int y = 0; y <= half; y++) { - for (int x = 0; x <= half; x++) { - if (x + y < 3) continue; - extrapolate_one_point(half-x, half-y, x>1?+1:0, y>1?+1:0); - extrapolate_one_point(half+x, half-y, x>1?-1:0, y>1?+1:0); - extrapolate_one_point(half-x, half+y, x>1?+1:0, y>1?-1:0); - extrapolate_one_point(half+x, half+y, x>1?-1:0, y>1?-1:0); + #if Z_RAISE_BETWEEN_PROBINGS > 0 + if (retract_action == ProbeStay) { + do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS); // this also updates current_position + st_synchronize(); + } + #endif + + #if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY) + if (retract_action & ProbeStow) stow_z_probe(); + #endif + + if (verbose_level > 2) { + SERIAL_PROTOCOLPGM("Bed"); + SERIAL_PROTOCOLPGM(" X: "); + SERIAL_PROTOCOL_F(x, 3); + SERIAL_PROTOCOLPGM(" Y: "); + SERIAL_PROTOCOL_F(y, 3); + SERIAL_PROTOCOLPGM(" Z: "); + SERIAL_PROTOCOL_F(measured_z, 3); + SERIAL_EOL; } + return measured_z; } -} -// Print calibration results for plotting or manual frame adjustment. -static void print_bed_level() { - for (int y = 0; y < AUTO_BED_LEVELING_GRID_POINTS; y++) { - for (int x = 0; x < AUTO_BED_LEVELING_GRID_POINTS; x++) { - SERIAL_PROTOCOL_F(bed_level[x][y], 2); - SERIAL_PROTOCOLPGM(" "); + #ifdef DELTA + + /** + * All DELTA leveling in the Marlin uses NONLINEAR_BED_LEVELING + */ + + static void extrapolate_one_point(int x, int y, int xdir, int ydir) { + if (bed_level[x][y] != 0.0) { + return; // Don't overwrite good values. + } + float a = 2*bed_level[x+xdir][y] - bed_level[x+xdir*2][y]; // Left to right. + float b = 2*bed_level[x][y+ydir] - bed_level[x][y+ydir*2]; // Front to back. + float c = 2*bed_level[x+xdir][y+ydir] - bed_level[x+xdir*2][y+ydir*2]; // Diagonal. + float median = c; // Median is robust (ignores outliers). + if (a < b) { + if (b < c) median = b; + if (c < a) median = a; + } else { // b <= a + if (c < b) median = b; + if (a < c) median = a; + } + bed_level[x][y] = median; } - SERIAL_ECHOLN(""); - } -} -// Reset calibration results to zero. -void reset_bed_level() { - for (int y = 0; y < AUTO_BED_LEVELING_GRID_POINTS; y++) { - for (int x = 0; x < AUTO_BED_LEVELING_GRID_POINTS; x++) { - bed_level[x][y] = 0.0; + // Fill in the unprobed points (corners of circular print surface) + // using linear extrapolation, away from the center. + static void extrapolate_unprobed_bed_level() { + int half = (AUTO_BED_LEVELING_GRID_POINTS-1)/2; + for (int y = 0; y <= half; y++) { + for (int x = 0; x <= half; x++) { + if (x + y < 3) continue; + extrapolate_one_point(half-x, half-y, x>1?+1:0, y>1?+1:0); + extrapolate_one_point(half+x, half-y, x>1?-1:0, y>1?+1:0); + extrapolate_one_point(half-x, half+y, x>1?+1:0, y>1?-1:0); + extrapolate_one_point(half+x, half+y, x>1?-1:0, y>1?-1:0); + } + } } - } -} -#endif // DELTA + // Print calibration results for plotting or manual frame adjustment. + static void print_bed_level() { + for (int y = 0; y < AUTO_BED_LEVELING_GRID_POINTS; y++) { + for (int x = 0; x < AUTO_BED_LEVELING_GRID_POINTS; x++) { + SERIAL_PROTOCOL_F(bed_level[x][y], 2); + SERIAL_PROTOCOLCHAR(' '); + } + SERIAL_EOL; + } + } + + // Reset calibration results to zero. + void reset_bed_level() { + for (int y = 0; y < AUTO_BED_LEVELING_GRID_POINTS; y++) { + for (int x = 0; x < AUTO_BED_LEVELING_GRID_POINTS; x++) { + bed_level[x][y] = 0.0; + } + } + } + + #endif // DELTA #endif // ENABLE_AUTO_BED_LEVELING -static void homeaxis(int axis) { -#define HOMEAXIS_DO(LETTER) \ - ((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1)) +/** + * Home an individual axis + */ - if (axis==X_AXIS ? HOMEAXIS_DO(X) : - axis==Y_AXIS ? HOMEAXIS_DO(Y) : - axis==Z_AXIS ? HOMEAXIS_DO(Z) : - 0) { - int axis_home_dir = home_dir(axis); -#ifdef DUAL_X_CARRIAGE - if (axis == X_AXIS) - axis_home_dir = x_home_dir(active_extruder); -#endif +#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS) - current_position[axis] = 0; - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); +static void homeaxis(AxisEnum axis) { + #define HOMEAXIS_DO(LETTER) \ + ((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1)) + + if (axis == X_AXIS ? HOMEAXIS_DO(X) : axis == Y_AXIS ? HOMEAXIS_DO(Y) : axis == Z_AXIS ? HOMEAXIS_DO(Z) : 0) { + + int axis_home_dir; + + #ifdef DUAL_X_CARRIAGE + if (axis == X_AXIS) axis_home_dir = x_home_dir(active_extruder); + #else + axis_home_dir = home_dir(axis); + #endif + // Set the axis position as setup for the move + current_position[axis] = 0; + sync_plan_position(); -#ifndef Z_PROBE_SLED // Engage Servo endstop if enabled - #ifdef SERVO_ENDSTOPS + #if defined(SERVO_ENDSTOPS) && !defined(Z_PROBE_SLED) + #if SERVO_LEVELING - if (axis==Z_AXIS) { - engage_z_probe(); - } - else + if (axis == Z_AXIS) deploy_z_probe(); else #endif - if (servo_endstops[axis] > -1) { - servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]); - } - #endif -#endif // Z_PROBE_SLED + { + if (servo_endstops[axis] > -1) + servo[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]); + } + + #endif // SERVO_ENDSTOPS && !Z_PROBE_SLED + #ifdef Z_DUAL_ENDSTOPS - if (axis==Z_AXIS) In_Homing_Process(true); + if (axis == Z_AXIS) In_Homing_Process(true); #endif + + // Move towards the endstop until an endstop is triggered destination[axis] = 1.5 * max_length(axis) * axis_home_dir; feedrate = homing_feedrate[axis]; - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); + line_to_destination(); st_synchronize(); + // Set the axis position as setup for the move current_position[axis] = 0; - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); - destination[axis] = -home_retract_mm(axis) * axis_home_dir; - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); - st_synchronize(); + sync_plan_position(); - destination[axis] = 2*home_retract_mm(axis) * axis_home_dir; + // Move away from the endstop by the axis HOME_BUMP_MM + destination[axis] = -home_bump_mm(axis) * axis_home_dir; + line_to_destination(); + st_synchronize(); - if (homing_bump_divisor[axis] >= 1) - { - feedrate = homing_feedrate[axis]/homing_bump_divisor[axis]; - } - else - { - feedrate = homing_feedrate[axis]/10; - SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less then 1"); - } + // Slow down the feedrate for the next move + set_homing_bump_feedrate(axis); - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); + // Move slowly towards the endstop until triggered + destination[axis] = 2 * home_bump_mm(axis) * axis_home_dir; + line_to_destination(); st_synchronize(); + #ifdef Z_DUAL_ENDSTOPS - if (axis==Z_AXIS) - { - feedrate = homing_feedrate[axis]; - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); - if (axis_home_dir > 0) - { - destination[axis] = (-1) * fabs(z_endstop_adj); - if (z_endstop_adj > 0) Lock_z_motor(true); else Lock_z2_motor(true); - } else { - destination[axis] = fabs(z_endstop_adj); - if (z_endstop_adj < 0) Lock_z_motor(true); else Lock_z2_motor(true); + if (axis == Z_AXIS) { + float adj = fabs(z_endstop_adj); + bool lockZ1; + if (axis_home_dir > 0) { + adj = -adj; + lockZ1 = (z_endstop_adj > 0); } - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); + else + lockZ1 = (z_endstop_adj < 0); + + if (lockZ1) Lock_z_motor(true); else Lock_z2_motor(true); + sync_plan_position(); + + // Move to the adjusted endstop height + feedrate = homing_feedrate[axis]; + destination[Z_AXIS] = adj; + line_to_destination(); st_synchronize(); - Lock_z_motor(false); - Lock_z2_motor(false); + + if (lockZ1) Lock_z_motor(false); else Lock_z2_motor(false); In_Homing_Process(false); + } // Z_AXIS + #endif + + #ifdef DELTA + // retrace by the amount specified in endstop_adj + if (endstop_adj[axis] * axis_home_dir < 0) { + sync_plan_position(); + destination[axis] = endstop_adj[axis]; + line_to_destination(); + st_synchronize(); } #endif -#ifdef DELTA - // retrace by the amount specified in endstop_adj - if (endstop_adj[axis] * axis_home_dir < 0) { - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); - destination[axis] = endstop_adj[axis]; - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); - st_synchronize(); - } -#endif + // Set the axis position to its home position (plus home offsets) axis_is_at_home(axis); + destination[axis] = current_position[axis]; feedrate = 0.0; - endstops_hit_on_purpose(); + endstops_hit_on_purpose(); // clear endstop hit flags axis_known_position[axis] = true; // Retract Servo endstop if enabled #ifdef SERVO_ENDSTOPS - if (servo_endstops[axis] > -1) { - servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2 + 1]); - } + if (servo_endstops[axis] > -1) + servo[servo_endstops[axis]].write(servo_endstop_angles[axis * 2 + 1]); #endif -#if SERVO_LEVELING - #ifndef Z_PROBE_SLED - if (axis==Z_AXIS) retract_z_probe(); - #endif -#endif - } -} -#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS) + #if SERVO_LEVELING && !defined(Z_PROBE_SLED) + if (axis == Z_AXIS) stow_z_probe(); + #endif -void refresh_cmd_timeout(void) -{ - previous_millis_cmd = millis(); + } } #ifdef FWRETRACT + void retract(bool retracting, bool swapretract = false) { - if(retracting && !retracted[active_extruder]) { - destination[X_AXIS]=current_position[X_AXIS]; - destination[Y_AXIS]=current_position[Y_AXIS]; - destination[Z_AXIS]=current_position[Z_AXIS]; - destination[E_AXIS]=current_position[E_AXIS]; - if (swapretract) { - current_position[E_AXIS]+=retract_length_swap/volumetric_multiplier[active_extruder]; - } else { - current_position[E_AXIS]+=retract_length/volumetric_multiplier[active_extruder]; - } + + if (retracting == retracted[active_extruder]) return; + + float oldFeedrate = feedrate; + + set_destination_to_current(); + + if (retracting) { + + feedrate = retract_feedrate * 60; + current_position[E_AXIS] += (swapretract ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder]; plan_set_e_position(current_position[E_AXIS]); - float oldFeedrate = feedrate; - feedrate=retract_feedrate*60; - retracted[active_extruder]=true; prepare_move(); - if(retract_zlift > 0.01) { - current_position[Z_AXIS]-=retract_zlift; -#ifdef DELTA - calculate_delta(current_position); // change cartesian kinematic to delta kinematic; - plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]); -#else - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); -#endif - prepare_move(); - } - feedrate = oldFeedrate; - } else if(!retracting && retracted[active_extruder]) { - destination[X_AXIS]=current_position[X_AXIS]; - destination[Y_AXIS]=current_position[Y_AXIS]; - destination[Z_AXIS]=current_position[Z_AXIS]; - destination[E_AXIS]=current_position[E_AXIS]; - if(retract_zlift > 0.01) { - current_position[Z_AXIS]+=retract_zlift; -#ifdef DELTA - calculate_delta(current_position); // change cartesian kinematic to delta kinematic; - plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]); -#else - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); -#endif - //prepare_move(); + + if (retract_zlift > 0.01) { + current_position[Z_AXIS] -= retract_zlift; + #ifdef DELTA + sync_plan_position_delta(); + #else + sync_plan_position(); + #endif + prepare_move(); } - if (swapretract) { - current_position[E_AXIS]-=(retract_length_swap+retract_recover_length_swap)/volumetric_multiplier[active_extruder]; - } else { - current_position[E_AXIS]-=(retract_length+retract_recover_length)/volumetric_multiplier[active_extruder]; + } + else { + + if (retract_zlift > 0.01) { + current_position[Z_AXIS] += retract_zlift; + #ifdef DELTA + sync_plan_position_delta(); + #else + sync_plan_position(); + #endif + //prepare_move(); } + + feedrate = retract_recover_feedrate * 60; + float move_e = swapretract ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length; + current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder]; plan_set_e_position(current_position[E_AXIS]); - float oldFeedrate = feedrate; - feedrate=retract_recover_feedrate*60; - retracted[active_extruder]=false; prepare_move(); - feedrate = oldFeedrate; } - } //retract -#endif //FWRETRACT + + feedrate = oldFeedrate; + retracted[active_extruder] = retracting; + + } // retract() + +#endif // FWRETRACT #ifdef Z_PROBE_SLED @@ -1638,40 +1667,32 @@ void refresh_cmd_timeout(void) #define SLED_DOCKING_OFFSET 0 #endif -// -// Method to dock/undock a sled designed by Charles Bell. -// -// dock[in] If true, move to MAX_X and engage the electromagnet -// offset[in] The additional distance to move to adjust docking location -// -static void dock_sled(bool dock, int offset=0) { - int z_loc; - - if (!((axis_known_position[X_AXIS]) && (axis_known_position[Y_AXIS]))) { - LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN); - SERIAL_ECHO_START; - SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN); - return; - } - - if (dock) { - do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, - current_position[Y_AXIS], - current_position[Z_AXIS]); - // turn off magnet - digitalWrite(SERVO0_PIN, LOW); - } else { - if (current_position[Z_AXIS] < (Z_RAISE_BEFORE_PROBING + 5)) - z_loc = Z_RAISE_BEFORE_PROBING; - else - z_loc = current_position[Z_AXIS]; - do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, - Y_PROBE_OFFSET_FROM_EXTRUDER, z_loc); - // turn on magnet - digitalWrite(SERVO0_PIN, HIGH); - } -} -#endif + /** + * Method to dock/undock a sled designed by Charles Bell. + * + * dock[in] If true, move to MAX_X and engage the electromagnet + * offset[in] The additional distance to move to adjust docking location + */ + static void dock_sled(bool dock, int offset=0) { + if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) { + LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN); + SERIAL_ECHO_START; + SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN); + return; + } + + if (dock) { + do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, current_position[Y_AXIS], current_position[Z_AXIS]); // this also updates current_position + digitalWrite(SERVO0_PIN, LOW); // turn off magnet + } else { + float z_loc = current_position[Z_AXIS]; + if (z_loc < Z_RAISE_BEFORE_PROBING + 5) z_loc = Z_RAISE_BEFORE_PROBING; + do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, Y_PROBE_OFFSET_FROM_EXTRUDER, z_loc); // this also updates current_position + digitalWrite(SERVO0_PIN, HIGH); // turn on magnet + } + } + +#endif // Z_PROBE_SLED /** * @@ -1683,11 +1704,12 @@ static void dock_sled(bool dock, int offset=0) { * G0, G1: Coordinated movement of X Y Z E axes */ inline void gcode_G0_G1() { - if (!Stopped) { + if (IsRunning()) { get_coordinates(); // For X Y Z E F + #ifdef FWRETRACT - if (autoretract_enabled) - if (!(code_seen('X') || code_seen('Y') || code_seen('Z')) && code_seen('E')) { + + if (autoretract_enabled && !(code_seen('X') || code_seen('Y') || code_seen('Z')) && code_seen('E')) { float echange = destination[E_AXIS] - current_position[E_AXIS]; // Is this move an attempt to retract or recover? if ((echange < -MIN_RETRACT && !retracted[active_extruder]) || (echange > MIN_RETRACT && retracted[active_extruder])) { @@ -1697,7 +1719,9 @@ inline void gcode_G0_G1() { return; } } + #endif //FWRETRACT + prepare_move(); //ClearToSend(); } @@ -1708,7 +1732,7 @@ inline void gcode_G0_G1() { * G3: Counterclockwise Arc */ inline void gcode_G2_G3(bool clockwise) { - if (!Stopped) { + if (IsRunning()) { get_arc_coordinates(); prepare_arc_move(clockwise); } @@ -1718,7 +1742,7 @@ inline void gcode_G2_G3(bool clockwise) { * G4: Dwell S or P */ inline void gcode_G4() { - unsigned long codenum=0; + millis_t codenum = 0; LCD_MESSAGEPGM(MSG_DWELL); @@ -1726,9 +1750,9 @@ inline void gcode_G4() { if (code_seen('S')) codenum = code_value_long() * 1000; // seconds to wait st_synchronize(); - previous_millis_cmd = millis(); - codenum += previous_millis_cmd; // keep track of when we started waiting - while(millis() < codenum) { + refresh_cmd_timeout(); + codenum += previous_cmd_ms; // keep track of when we started waiting + while (millis() < codenum) { manage_heater(); manage_inactivity(); lcd_update(); @@ -1744,7 +1768,7 @@ inline void gcode_G4() { inline void gcode_G10_G11(bool doRetract=false) { #if EXTRUDERS > 1 if (doRetract) { - retracted_swap[active_extruder] = (code_seen('S') && code_value_long() == 1); // checks for swap retract argument + retracted_swap[active_extruder] = (code_seen('S') && code_value_short() == 1); // checks for swap retract argument } #endif retract(doRetract @@ -1757,30 +1781,50 @@ inline void gcode_G4() { #endif //FWRETRACT /** - * G28: Home all axes, one at a time + * G28: Home all axes according to settings + * + * Parameters + * + * None Home to all axes with no parameters. + * With QUICK_HOME enabled XY will home together, then Z. + * + * Cartesian parameters + * + * X Home to the X endstop + * Y Home to the Y endstop + * Z Home to the Z endstop + * + * If numbers are included with XYZ set the position as with G92 + * Currently adds the home_offset, which may be wrong and removed soon. + * + * Xn Home X, setting X to n + home_offset[X_AXIS] + * Yn Home Y, setting Y to n + home_offset[Y_AXIS] + * Zn Home Z, setting Z to n + home_offset[Z_AXIS] */ inline void gcode_G28() { + + // For auto bed leveling, clear the level matrix #ifdef ENABLE_AUTO_BED_LEVELING + plan_bed_level_matrix.set_to_identity(); #ifdef DELTA reset_bed_level(); - #else - plan_bed_level_matrix.set_to_identity(); //Reset the plane ("erase" all leveling data) #endif #endif - #if defined(MESH_BED_LEVELING) + // For manual bed leveling deactivate the matrix temporarily + #ifdef MESH_BED_LEVELING uint8_t mbl_was_active = mbl.active; mbl.active = 0; - #endif // MESH_BED_LEVELING + #endif saved_feedrate = feedrate; - saved_feedmultiply = feedmultiply; - feedmultiply = 100; - previous_millis_cmd = millis(); + saved_feedrate_multiplier = feedrate_multiplier; + feedrate_multiplier = 100; + refresh_cmd_timeout(); enable_endstops(true); - for (int i = X_AXIS; i <= NUM_AXIS; i++) destination[i] = current_position[i]; + set_destination_to_current(); feedrate = 0.0; @@ -1788,15 +1832,16 @@ inline void gcode_G28() { // A delta can only safely home all axis at the same time // all axis have to home at the same time - // Move all carriages up together until the first endstop is hit. + // Pretend the current position is 0,0,0 for (int i = X_AXIS; i <= Z_AXIS; i++) current_position[i] = 0; - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); + sync_plan_position(); + // Move all carriages up together until the first endstop is hit. for (int i = X_AXIS; i <= Z_AXIS; i++) destination[i] = 3 * Z_MAX_LENGTH; feedrate = 1.732 * homing_feedrate[X_AXIS]; - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); + line_to_destination(); st_synchronize(); - endstops_hit_on_purpose(); + endstops_hit_on_purpose(); // clear endstop hit flags // Destination reached for (int i = X_AXIS; i <= Z_AXIS; i++) current_position[i] = destination[i]; @@ -1806,52 +1851,69 @@ inline void gcode_G28() { HOMEAXIS(Y); HOMEAXIS(Z); - calculate_delta(current_position); - plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]); + sync_plan_position_delta(); + + #else // NOT DELTA + + bool homeX = code_seen(axis_codes[X_AXIS]), + homeY = code_seen(axis_codes[Y_AXIS]), + homeZ = code_seen(axis_codes[Z_AXIS]); - #else // NOT DELTA + home_all_axis = !(homeX || homeY || homeZ) || (homeX && homeY && homeZ); + + if (home_all_axis || homeZ) { - home_all_axis = !(code_seen(axis_codes[X_AXIS]) || code_seen(axis_codes[Y_AXIS]) || code_seen(axis_codes[Z_AXIS])); + #if Z_HOME_DIR > 0 // If homing away from BED do Z first - #if Z_HOME_DIR > 0 // If homing away from BED do Z first - if (home_all_axis || code_seen(axis_codes[Z_AXIS])) { HOMEAXIS(Z); - } - #endif + + #elif !defined(Z_SAFE_HOMING) && defined(Z_RAISE_BEFORE_HOMING) && Z_RAISE_BEFORE_HOMING > 0 + + // Raise Z before homing any other axes + // (Does this need to be "negative home direction?" Why not just use Z_RAISE_BEFORE_HOMING?) + destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); + feedrate = max_feedrate[Z_AXIS] * 60; + line_to_destination(); + st_synchronize(); + + #endif + + } // home_all_axis || homeZ #ifdef QUICK_HOME - if (home_all_axis || code_seen(axis_codes[X_AXIS] && code_seen(axis_codes[Y_AXIS]))) { //first diagonal move + + if (home_all_axis || (homeX && homeY)) { // First diagonal move + current_position[X_AXIS] = current_position[Y_AXIS] = 0; - #ifndef DUAL_X_CARRIAGE - int x_axis_home_dir = home_dir(X_AXIS); - #else + #ifdef DUAL_X_CARRIAGE int x_axis_home_dir = x_home_dir(active_extruder); extruder_duplication_enabled = false; + #else + int x_axis_home_dir = home_dir(X_AXIS); #endif - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); - destination[X_AXIS] = 1.5 * max_length(X_AXIS) * x_axis_home_dir; - destination[Y_AXIS] = 1.5 * max_length(Y_AXIS) * home_dir(Y_AXIS); - feedrate = homing_feedrate[X_AXIS]; - if (homing_feedrate[Y_AXIS] < feedrate) feedrate = homing_feedrate[Y_AXIS]; - if (max_length(X_AXIS) > max_length(Y_AXIS)) { - feedrate *= sqrt(pow(max_length(Y_AXIS) / max_length(X_AXIS), 2) + 1); - } else { - feedrate *= sqrt(pow(max_length(X_AXIS) / max_length(Y_AXIS), 2) + 1); - } - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); + sync_plan_position(); + + float mlx = max_length(X_AXIS), mly = max_length(Y_AXIS), + mlratio = mlx>mly ? mly/mlx : mlx/mly; + + destination[X_AXIS] = 1.5 * mlx * x_axis_home_dir; + destination[Y_AXIS] = 1.5 * mly * home_dir(Y_AXIS); + feedrate = min(homing_feedrate[X_AXIS], homing_feedrate[Y_AXIS]) * sqrt(mlratio * mlratio + 1); + line_to_destination(); st_synchronize(); axis_is_at_home(X_AXIS); axis_is_at_home(Y_AXIS); - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); + sync_plan_position(); + destination[X_AXIS] = current_position[X_AXIS]; destination[Y_AXIS] = current_position[Y_AXIS]; - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); + line_to_destination(); feedrate = 0.0; st_synchronize(); - endstops_hit_on_purpose(); + endstops_hit_on_purpose(); // clear endstop hit flags current_position[X_AXIS] = destination[X_AXIS]; current_position[Y_AXIS] = destination[Y_AXIS]; @@ -1859,9 +1921,11 @@ inline void gcode_G28() { current_position[Z_AXIS] = destination[Z_AXIS]; #endif } - #endif //QUICK_HOME - if ((home_all_axis) || (code_seen(axis_codes[X_AXIS]))) { + #endif // QUICK_HOME + + // Home X + if (home_all_axis || homeX) { #ifdef DUAL_X_CARRIAGE int tmp_extruder = active_extruder; extruder_duplication_enabled = false; @@ -1879,221 +1943,277 @@ inline void gcode_G28() { #endif } - if (home_all_axis || code_seen(axis_codes[Y_AXIS])) HOMEAXIS(Y); + // Home Y + if (home_all_axis || homeY) HOMEAXIS(Y); - if (code_seen(axis_codes[X_AXIS])) { - if (code_value_long() != 0) { - current_position[X_AXIS] = code_value() - #ifndef SCARA - + home_offset[X_AXIS] - #endif - ; - } - } + // Set the X position, if included + if (code_seen(axis_codes[X_AXIS]) && code_has_value()) + current_position[X_AXIS] = code_value(); - if (code_seen(axis_codes[Y_AXIS]) && code_value_long() != 0) { - current_position[Y_AXIS] = code_value() - #ifndef SCARA - + home_offset[Y_AXIS] - #endif - ; - } + // Set the Y position, if included + if (code_seen(axis_codes[Y_AXIS]) && code_has_value()) + current_position[Y_AXIS] = code_value(); - #if Z_HOME_DIR < 0 // If homing towards BED do Z last + // Home Z last if homing towards the bed + #if Z_HOME_DIR < 0 - #ifndef Z_SAFE_HOMING + if (home_all_axis || homeZ) { - if (home_all_axis || code_seen(axis_codes[Z_AXIS])) { - #if defined(Z_RAISE_BEFORE_HOMING) && Z_RAISE_BEFORE_HOMING > 0 - destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); // Set destination away from bed - feedrate = max_feedrate[Z_AXIS]; - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder); - st_synchronize(); - #endif - HOMEAXIS(Z); - } + #ifdef Z_SAFE_HOMING - #else // Z_SAFE_HOMING + if (home_all_axis) { - if (home_all_axis) { - destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - X_PROBE_OFFSET_FROM_EXTRUDER); - destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - Y_PROBE_OFFSET_FROM_EXTRUDER); - destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); // Set destination away from bed - feedrate = XY_TRAVEL_SPEED / 60; - current_position[Z_AXIS] = 0; + current_position[Z_AXIS] = 0; + sync_plan_position(); - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder); - st_synchronize(); - current_position[X_AXIS] = destination[X_AXIS]; - current_position[Y_AXIS] = destination[Y_AXIS]; + // + // Set the probe (or just the nozzle) destination to the safe homing point + // + // NOTE: If current_position[X_AXIS] or current_position[Y_AXIS] were set above + // then this may not work as expected. + destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - X_PROBE_OFFSET_FROM_EXTRUDER); + destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - Y_PROBE_OFFSET_FROM_EXTRUDER); + destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); // Set destination away from bed + feedrate = XY_TRAVEL_SPEED; + // This could potentially move X, Y, Z all together + line_to_destination(); + st_synchronize(); - HOMEAXIS(Z); - } + // Set current X, Y is the Z_SAFE_HOMING_POINT minus PROBE_OFFSET_FROM_EXTRUDER + current_position[X_AXIS] = destination[X_AXIS]; + current_position[Y_AXIS] = destination[Y_AXIS]; - // Let's see if X and Y are homed and probe is inside bed area. - if (code_seen(axis_codes[Z_AXIS])) { - - if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) { - - float cpx = current_position[X_AXIS], cpy = current_position[Y_AXIS]; - if ( cpx >= X_MIN_POS - X_PROBE_OFFSET_FROM_EXTRUDER - && cpx <= X_MAX_POS - X_PROBE_OFFSET_FROM_EXTRUDER - && cpy >= Y_MIN_POS - Y_PROBE_OFFSET_FROM_EXTRUDER - && cpy <= Y_MAX_POS - Y_PROBE_OFFSET_FROM_EXTRUDER) { - current_position[Z_AXIS] = 0; - plan_set_position(cpx, cpy, current_position[Z_AXIS], current_position[E_AXIS]); - destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); // Set destination away from bed - feedrate = max_feedrate[Z_AXIS]; - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder); - st_synchronize(); - HOMEAXIS(Z); - } - else { + // Home the Z axis + HOMEAXIS(Z); + } + + else if (homeZ) { // Don't need to Home Z twice + + // Let's see if X and Y are homed + if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) { + + // Make sure the probe is within the physical limits + // NOTE: This doesn't necessarily ensure the probe is also within the bed! + float cpx = current_position[X_AXIS], cpy = current_position[Y_AXIS]; + if ( cpx >= X_MIN_POS - X_PROBE_OFFSET_FROM_EXTRUDER + && cpx <= X_MAX_POS - X_PROBE_OFFSET_FROM_EXTRUDER + && cpy >= Y_MIN_POS - Y_PROBE_OFFSET_FROM_EXTRUDER + && cpy <= Y_MAX_POS - Y_PROBE_OFFSET_FROM_EXTRUDER) { + // Set the plan current position to X, Y, 0 + current_position[Z_AXIS] = 0; + plan_set_position(cpx, cpy, 0, current_position[E_AXIS]); // = sync_plan_position + + // Set Z destination away from bed and raise the axis + // NOTE: This should always just be Z_RAISE_BEFORE_HOMING unless...??? + destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); + feedrate = max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s) + line_to_destination(); + st_synchronize(); + + // Home the Z axis + HOMEAXIS(Z); + } + else { LCD_MESSAGEPGM(MSG_ZPROBE_OUT); SERIAL_ECHO_START; SERIAL_ECHOLNPGM(MSG_ZPROBE_OUT); + } + } + else { + LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN); + SERIAL_ECHO_START; + SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN); } - } - else { - LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN); - SERIAL_ECHO_START; - SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN); - } - } - #endif // Z_SAFE_HOMING + } // !home_all_axes && homeZ - #endif // Z_HOME_DIR < 0 + #else // !Z_SAFE_HOMING + + HOMEAXIS(Z); + #endif // !Z_SAFE_HOMING - if (code_seen(axis_codes[Z_AXIS]) && code_value_long() != 0) - current_position[Z_AXIS] = code_value() + home_offset[Z_AXIS]; + } // home_all_axis || homeZ + + #endif // Z_HOME_DIR < 0 + + // Set the Z position, if included + if (code_seen(axis_codes[Z_AXIS]) && code_has_value()) + current_position[Z_AXIS] = code_value(); #if defined(ENABLE_AUTO_BED_LEVELING) && (Z_HOME_DIR < 0) - if (home_all_axis || code_seen(axis_codes[Z_AXIS])) - current_position[Z_AXIS] += zprobe_zoffset; //Add Z_Probe offset (the distance is negative) + if (home_all_axis || homeZ) current_position[Z_AXIS] += zprobe_zoffset; // Add Z_Probe offset (the distance is negative) #endif - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); + + sync_plan_position(); #endif // else DELTA #ifdef SCARA - calculate_delta(current_position); - plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]); + sync_plan_position_delta(); #endif #ifdef ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false); #endif - #if defined(MESH_BED_LEVELING) + // For manual leveling move back to 0,0 + #ifdef MESH_BED_LEVELING if (mbl_was_active) { current_position[X_AXIS] = mbl.get_x(0); current_position[Y_AXIS] = mbl.get_y(0); - destination[X_AXIS] = current_position[X_AXIS]; - destination[Y_AXIS] = current_position[Y_AXIS]; - destination[Z_AXIS] = current_position[Z_AXIS]; - destination[E_AXIS] = current_position[E_AXIS]; + set_destination_to_current(); feedrate = homing_feedrate[X_AXIS]; - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder); + line_to_destination(); st_synchronize(); current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); + sync_plan_position(); mbl.active = 1; } #endif feedrate = saved_feedrate; - feedmultiply = saved_feedmultiply; - previous_millis_cmd = millis(); - endstops_hit_on_purpose(); + feedrate_multiplier = saved_feedrate_multiplier; + refresh_cmd_timeout(); + endstops_hit_on_purpose(); // clear endstop hit flags } -#if defined(MESH_BED_LEVELING) +#ifdef MESH_BED_LEVELING + enum MeshLevelingState { MeshReport, MeshStart, MeshNext, MeshSet }; + + /** + * G29: Mesh-based Z-Probe, probes a grid and produces a + * mesh to compensate for variable bed height + * + * Parameters With MESH_BED_LEVELING: + * + * S0 Produce a mesh report + * S1 Start probing mesh points + * S2 Probe the next mesh point + * S3 Xn Yn Zn.nn Manually modify a single point + * + * The S0 report the points as below + * + * +----> X-axis + * | + * | + * v Y-axis + * + */ inline void gcode_G29() { + static int probe_point = -1; - int state = 0; - if (code_seen('S') || code_seen('s')) { - state = code_value_long(); - if (state < 0 || state > 2) { - SERIAL_PROTOCOLPGM("S out of range (0-2).\n"); - return; - } + MeshLevelingState state = code_seen('S') || code_seen('s') ? (MeshLevelingState)code_value_short() : MeshReport; + if (state < 0 || state > 3) { + SERIAL_PROTOCOLLNPGM("S out of range (0-3)."); + return; } - if (state == 0) { // Dump mesh_bed_leveling - if (mbl.active) { - SERIAL_PROTOCOLPGM("Num X,Y: "); - SERIAL_PROTOCOL(MESH_NUM_X_POINTS); - SERIAL_PROTOCOLPGM(","); - SERIAL_PROTOCOL(MESH_NUM_Y_POINTS); - SERIAL_PROTOCOLPGM("\nZ search height: "); - SERIAL_PROTOCOL(MESH_HOME_SEARCH_Z); - SERIAL_PROTOCOLPGM("\nMeasured points:\n"); - for (int y=0; y= MESH_NUM_X_POINTS) { + SERIAL_PROTOCOLPGM("X out of range (1-" STRINGIFY(MESH_NUM_X_POINTS) ").\n"); + return; + } + } else { + SERIAL_PROTOCOLPGM("X not entered.\n"); + return; } - mbl.set_z(ix, iy, current_position[Z_AXIS]); - current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[X_AXIS]/60, active_extruder); - st_synchronize(); - } - if (probe_point == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) { - SERIAL_PROTOCOLPGM("Mesh done.\n"); - probe_point = -1; - mbl.active = 1; - enquecommands_P(PSTR("G28")); - return; - } - ix = probe_point % MESH_NUM_X_POINTS; - iy = probe_point / MESH_NUM_X_POINTS; - if (iy&1) { // Zig zag - ix = (MESH_NUM_X_POINTS - 1) - ix; - } - current_position[X_AXIS] = mbl.get_x(ix); - current_position[Y_AXIS] = mbl.get_y(iy); - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[X_AXIS]/60, active_extruder); - st_synchronize(); - probe_point++; - } - } + if (code_seen('Y') || code_seen('y')) { + iy = code_value_long()-1; + if (iy < 0 || iy >= MESH_NUM_Y_POINTS) { + SERIAL_PROTOCOLPGM("Y out of range (1-" STRINGIFY(MESH_NUM_Y_POINTS) ").\n"); + return; + } + } else { + SERIAL_PROTOCOLPGM("Y not entered.\n"); + return; + } + if (code_seen('Z') || code_seen('z')) { + z = code_value(); + } else { + SERIAL_PROTOCOLPGM("Z not entered.\n"); + return; + } + mbl.z_values[iy][ix] = z; -#endif + } // switch(state) + } -#ifdef ENABLE_AUTO_BED_LEVELING +#elif defined(ENABLE_AUTO_BED_LEVELING) /** * G29: Detailed Z-Probe, probes the bed at 3 or more points. @@ -2109,6 +2229,10 @@ inline void gcode_G28() { * * S Set the XY travel speed between probe points (in mm/min) * + * D Dry-Run mode. Just evaluate the bed Topology - Don't apply + * or clean the rotation Matrix. Useful to check the topology + * after a first run of G29. + * * V Set the verbose level (0-4). Example: "G29 V3" * * T Generate a Bed Topology Report. Example: "G29 P5 T" for a detailed report. @@ -2123,15 +2247,15 @@ inline void gcode_G28() { * * Global Parameters: * - * E/e By default G29 engages / disengages the probe for each point. - * Include "E" to engage and disengage the probe just once. + * E/e By default G29 will engage the probe, test the bed, then disengage. + * Include "E" to engage/disengage the probe for each sample. * There's no extra effect if you have a fixed probe. * Usage: "G29 E" or "G29 e" * */ inline void gcode_G29() { - // Prevent user from running a G29 without first homing in X and Y + // Don't allow auto-leveling without homing first if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) { LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN); SERIAL_ECHO_START; @@ -2139,43 +2263,41 @@ inline void gcode_G28() { return; } - int verbose_level = 1; - float x_tmp, y_tmp, z_tmp, real_z; - - if (code_seen('V') || code_seen('v')) { - verbose_level = code_value_long(); - if (verbose_level < 0 || verbose_level > 4) { - SERIAL_PROTOCOLPGM("?(V)erbose Level is implausible (0-4).\n"); - return; - } + int verbose_level = code_seen('V') || code_seen('v') ? code_value_short() : 1; + if (verbose_level < 0 || verbose_level > 4) { + SERIAL_ECHOLNPGM("?(V)erbose Level is implausible (0-4)."); + return; } - bool enhanced_g29 = code_seen('E') || code_seen('e'); + bool dryrun = code_seen('D') || code_seen('d'), + deploy_probe_for_each_reading = code_seen('E') || code_seen('e'); #ifdef AUTO_BED_LEVELING_GRID - #ifndef DELTA - bool do_topography_map = verbose_level > 2 || code_seen('T') || code_seen('t'); - #endif + #ifndef DELTA + bool do_topography_map = verbose_level > 2 || code_seen('T') || code_seen('t'); + #endif - if (verbose_level > 0) + if (verbose_level > 0) { SERIAL_PROTOCOLPGM("G29 Auto Bed Leveling\n"); + if (dryrun) SERIAL_ECHOLNPGM("Running in DRY-RUN mode"); + } int auto_bed_leveling_grid_points = AUTO_BED_LEVELING_GRID_POINTS; #ifndef DELTA - if (code_seen('P')) auto_bed_leveling_grid_points = code_value_long(); + if (code_seen('P')) auto_bed_leveling_grid_points = code_value_short(); if (auto_bed_leveling_grid_points < 2) { SERIAL_PROTOCOLPGM("?Number of probed (P)oints is implausible (2 minimum).\n"); return; } #endif - xy_travel_speed = code_seen('S') ? code_value_long() : XY_TRAVEL_SPEED; + xy_travel_speed = code_seen('S') ? code_value_short() : XY_TRAVEL_SPEED; - int left_probe_bed_position = code_seen('L') ? code_value_long() : LEFT_PROBE_BED_POSITION, - right_probe_bed_position = code_seen('R') ? code_value_long() : RIGHT_PROBE_BED_POSITION, - front_probe_bed_position = code_seen('F') ? code_value_long() : FRONT_PROBE_BED_POSITION, - back_probe_bed_position = code_seen('B') ? code_value_long() : BACK_PROBE_BED_POSITION; + int left_probe_bed_position = code_seen('L') ? code_value_short() : LEFT_PROBE_BED_POSITION, + right_probe_bed_position = code_seen('R') ? code_value_short() : RIGHT_PROBE_BED_POSITION, + front_probe_bed_position = code_seen('F') ? code_value_short() : FRONT_PROBE_BED_POSITION, + back_probe_bed_position = code_seen('B') ? code_value_short() : BACK_PROBE_BED_POSITION; bool left_out_l = left_probe_bed_position < MIN_PROBE_X, left_out = left_out_l || left_probe_bed_position > right_probe_bed_position - MIN_PROBE_EDGE, @@ -2210,27 +2332,29 @@ inline void gcode_G28() { #ifdef Z_PROBE_SLED dock_sled(false); // engage (un-dock) the probe - #elif defined(Z_PROBE_ALLEN_KEY) - engage_z_probe(); + #elif defined(Z_PROBE_ALLEN_KEY) //|| defined(SERVO_LEVELING) + deploy_z_probe(); #endif st_synchronize(); - #ifdef DELTA - reset_bed_level(); - #else + if (!dryrun) { + // make sure the bed_level_rotation_matrix is identity or the planner will get it wrong + plan_bed_level_matrix.set_to_identity(); - // make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly - //vector_3 corrected_position = plan_get_position_mm(); - //corrected_position.debug("position before G29"); - plan_bed_level_matrix.set_to_identity(); - vector_3 uncorrected_position = plan_get_position(); - //uncorrected_position.debug("position during G29"); - current_position[X_AXIS] = uncorrected_position.x; - current_position[Y_AXIS] = uncorrected_position.y; - current_position[Z_AXIS] = uncorrected_position.z; - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); - #endif + #ifdef DELTA + reset_bed_level(); + #else //!DELTA + //vector_3 corrected_position = plan_get_position_mm(); + //corrected_position.debug("position before G29"); + vector_3 uncorrected_position = plan_get_position(); + //uncorrected_position.debug("position during G29"); + current_position[X_AXIS] = uncorrected_position.x; + current_position[Y_AXIS] = uncorrected_position.y; + current_position[Z_AXIS] = uncorrected_position.z; + sync_plan_position(); + #endif // !DELTA + } setup_for_endstop_move(); @@ -2239,29 +2363,27 @@ inline void gcode_G28() { #ifdef AUTO_BED_LEVELING_GRID // probe at the points of a lattice grid - const int xGridSpacing = (right_probe_bed_position - left_probe_bed_position) / (auto_bed_leveling_grid_points-1); - const int yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points-1); - - #ifndef DELTA - // solve the plane equation ax + by + d = z - // A is the matrix with rows [x y 1] for all the probed points - // B is the vector of the Z positions - // the normal vector to the plane is formed by the coefficients of the plane equation in the standard form, which is Vx*x+Vy*y+Vz*z+d = 0 - // so Vx = -a Vy = -b Vz = 1 (we want the vector facing towards positive Z - - int abl2 = auto_bed_leveling_grid_points * auto_bed_leveling_grid_points; + const int xGridSpacing = (right_probe_bed_position - left_probe_bed_position) / (auto_bed_leveling_grid_points - 1), + yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points - 1); - double eqnAMatrix[abl2 * 3], // "A" matrix of the linear system of equations - eqnBVector[abl2], // "B" vector of Z points - mean = 0.0; - - #else - delta_grid_spacing[0] = xGridSpacing; - delta_grid_spacing[1] = yGridSpacing; - - float z_offset = Z_PROBE_OFFSET_FROM_EXTRUDER; - if (code_seen(axis_codes[Z_AXIS])) z_offset += code_value(); - #endif + #ifdef DELTA + delta_grid_spacing[0] = xGridSpacing; + delta_grid_spacing[1] = yGridSpacing; + float z_offset = Z_PROBE_OFFSET_FROM_EXTRUDER; + if (code_seen(axis_codes[Z_AXIS])) z_offset += code_value(); + #else // !DELTA + // solve the plane equation ax + by + d = z + // A is the matrix with rows [x y 1] for all the probed points + // B is the vector of the Z positions + // the normal vector to the plane is formed by the coefficients of the plane equation in the standard form, which is Vx*x+Vy*y+Vz*z+d = 0 + // so Vx = -a Vy = -b Vz = 1 (we want the vector facing towards positive Z + + int abl2 = auto_bed_leveling_grid_points * auto_bed_leveling_grid_points; + + double eqnAMatrix[abl2 * 3], // "A" matrix of the linear system of equations + eqnBVector[abl2], // "B" vector of Z points + mean = 0.0; + #endif // !DELTA int probePointCounter = 0; bool zig = true; @@ -2292,156 +2414,160 @@ inline void gcode_G28() { // raise extruder float measured_z, - z_before = probePointCounter == 0 ? Z_RAISE_BEFORE_PROBING : current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS; + z_before = probePointCounter ? Z_RAISE_BETWEEN_PROBINGS + current_position[Z_AXIS] : Z_RAISE_BEFORE_PROBING; - #ifdef DELTA - // Avoid probing the corners (outside the round or hexagon print surface) on a delta printer. - float distance_from_center = sqrt(xProbe*xProbe + yProbe*yProbe); - if (distance_from_center > DELTA_PROBABLE_RADIUS) - continue; - #endif //DELTA + #ifdef DELTA + // Avoid probing the corners (outside the round or hexagon print surface) on a delta printer. + float distance_from_center = sqrt(xProbe*xProbe + yProbe*yProbe); + if (distance_from_center > DELTA_PROBABLE_RADIUS) continue; + #endif //DELTA - // Enhanced G29 - Do not retract servo between probes ProbeAction act; - if (enhanced_g29) { - if (yProbe == front_probe_bed_position && xCount == 0) - act = ProbeEngage; - else if (yProbe == front_probe_bed_position + (yGridSpacing * (auto_bed_leveling_grid_points - 1)) && xCount == auto_bed_leveling_grid_points - 1) - act = ProbeRetract; - else - act = ProbeStay; - } + if (deploy_probe_for_each_reading) // G29 E - Stow between probes + act = ProbeDeployAndStow; + else if (yCount == 0 && xCount == xStart) + act = ProbeDeploy; + else if (yCount == auto_bed_leveling_grid_points - 1 && xCount == xStop - xInc) + act = ProbeStow; else - act = ProbeEngageAndRetract; + act = ProbeStay; measured_z = probe_pt(xProbe, yProbe, z_before, act, verbose_level); - #ifndef DELTA - mean += measured_z; + #ifndef DELTA + mean += measured_z; - eqnBVector[probePointCounter] = measured_z; - eqnAMatrix[probePointCounter + 0 * abl2] = xProbe; - eqnAMatrix[probePointCounter + 1 * abl2] = yProbe; - eqnAMatrix[probePointCounter + 2 * abl2] = 1; - #else - bed_level[xCount][yCount] = measured_z + z_offset; - #endif + eqnBVector[probePointCounter] = measured_z; + eqnAMatrix[probePointCounter + 0 * abl2] = xProbe; + eqnAMatrix[probePointCounter + 1 * abl2] = yProbe; + eqnAMatrix[probePointCounter + 2 * abl2] = 1; + #else + bed_level[xCount][yCount] = measured_z + z_offset; + #endif probePointCounter++; + + manage_heater(); + manage_inactivity(); + lcd_update(); + } //xProbe } //yProbe clean_up_after_endstop_move(); - #ifndef DELTA - // solve lsq problem - double *plane_equation_coefficients = qr_solve(abl2, 3, eqnAMatrix, eqnBVector); - - mean /= abl2; - - 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_EOL; - if (verbose_level > 2) { - SERIAL_PROTOCOLPGM("Mean of sampled points: "); - SERIAL_PROTOCOL_F(mean, 8); + #ifdef DELTA + + if (!dryrun) extrapolate_unprobed_bed_level(); + print_bed_level(); + + #else // !DELTA + + // solve lsq problem + double *plane_equation_coefficients = qr_solve(abl2, 3, eqnAMatrix, eqnBVector); + + mean /= abl2; + + 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_EOL; + if (verbose_level > 2) { + SERIAL_PROTOCOLPGM("Mean of sampled points: "); + SERIAL_PROTOCOL_F(mean, 8); + SERIAL_EOL; + } } - } - // Show the Topography map if enabled - if (do_topography_map) { - - SERIAL_PROTOCOLPGM(" \nBed Height Topography: \n"); - SERIAL_PROTOCOLPGM("+-----------+\n"); - SERIAL_PROTOCOLPGM("|...Back....|\n"); - SERIAL_PROTOCOLPGM("|Left..Right|\n"); - SERIAL_PROTOCOLPGM("|...Front...|\n"); - SERIAL_PROTOCOLPGM("+-----------+\n"); - - for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) { - for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) { - int ind = yy * auto_bed_leveling_grid_points + xx; - float diff = eqnBVector[ind] - mean; - if (diff >= 0.0) - SERIAL_PROTOCOLPGM(" +"); // Include + for column alignment - else - SERIAL_PROTOCOLPGM(" "); - SERIAL_PROTOCOL_F(diff, 5); - } // xx + // Show the Topography map if enabled + if (do_topography_map) { + + SERIAL_PROTOCOLPGM(" \nBed Height Topography: \n"); + SERIAL_PROTOCOLPGM("+-----------+\n"); + SERIAL_PROTOCOLPGM("|...Back....|\n"); + SERIAL_PROTOCOLPGM("|Left..Right|\n"); + SERIAL_PROTOCOLPGM("|...Front...|\n"); + SERIAL_PROTOCOLPGM("+-----------+\n"); + + for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) { + for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) { + int ind = yy * auto_bed_leveling_grid_points + xx; + float diff = eqnBVector[ind] - mean; + if (diff >= 0.0) + SERIAL_PROTOCOLPGM(" +"); // Include + for column alignment + else + SERIAL_PROTOCOLCHAR(' '); + SERIAL_PROTOCOL_F(diff, 5); + } // xx + SERIAL_EOL; + } // yy SERIAL_EOL; - } // yy - SERIAL_EOL; - } //do_topography_map + } //do_topography_map - set_bed_level_equation_lsq(plane_equation_coefficients); - free(plane_equation_coefficients); - #else - extrapolate_unprobed_bed_level(); - print_bed_level(); - #endif + if (!dryrun) set_bed_level_equation_lsq(plane_equation_coefficients); + free(plane_equation_coefficients); + + #endif //!DELTA #else // !AUTO_BED_LEVELING_GRID - // Probe at 3 arbitrary points - float z_at_pt_1, z_at_pt_2, z_at_pt_3; + // Actions for each probe + ProbeAction p1, p2, p3; + if (deploy_probe_for_each_reading) + p1 = p2 = p3 = ProbeDeployAndStow; + else + p1 = ProbeDeploy, p2 = ProbeStay, p3 = ProbeStow; - if (enhanced_g29) { - // Basic Enhanced G29 - z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, ProbeEngage, verbose_level); - z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeStay, verbose_level); - z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeRetract, verbose_level); - } - else { - z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, ProbeEngageAndRetract, verbose_level); - z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeEngageAndRetract, verbose_level); - z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeEngageAndRetract, verbose_level); - } + // Probe at 3 arbitrary points + float z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, p1, verbose_level), + z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, p2, verbose_level), + z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, p3, verbose_level); clean_up_after_endstop_move(); - set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3); + if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3); #endif // !AUTO_BED_LEVELING_GRID - #ifndef DELTA - if (verbose_level > 0) - plan_bed_level_matrix.debug(" \n\nBed Level Correction Matrix:"); - - // Correct the Z height difference from z-probe position and hotend tip position. - // The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend. - // When the bed is uneven, this height must be corrected. - real_z = float(st_get_position(Z_AXIS)) / axis_steps_per_unit[Z_AXIS]; //get the real Z (since the auto bed leveling is already correcting the plane) - x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER; - y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER; - z_tmp = current_position[Z_AXIS]; - - apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); //Apply the correction sending the probe offset - current_position[Z_AXIS] = z_tmp - real_z + current_position[Z_AXIS]; //The difference is added to current position and sent to planner. - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); - #endif + #ifndef DELTA + if (verbose_level > 0) + plan_bed_level_matrix.debug(" \n\nBed Level Correction Matrix:"); + + if (!dryrun) { + // Correct the Z height difference from z-probe position and hotend tip position. + // The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend. + // When the bed is uneven, this height must be corrected. + float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER, + y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER, + z_tmp = current_position[Z_AXIS], + real_z = (float)st_get_position(Z_AXIS) / axis_steps_per_unit[Z_AXIS]; //get the real Z (since the auto bed leveling is already correcting the plane) + + apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); //Apply the correction sending the probe offset + current_position[Z_AXIS] = z_tmp - real_z + current_position[Z_AXIS]; //The difference is added to current position and sent to planner. + sync_plan_position(); + } + #endif // !DELTA - #ifdef Z_PROBE_SLED - dock_sled(true, -SLED_DOCKING_OFFSET); // dock the probe, correcting for over-travel - #elif defined(Z_PROBE_ALLEN_KEY) - retract_z_probe(); - #endif - - #ifdef Z_PROBE_END_SCRIPT - enquecommands_P(PSTR(Z_PROBE_END_SCRIPT)); - st_synchronize(); - #endif + #ifdef Z_PROBE_SLED + dock_sled(true, -SLED_DOCKING_OFFSET); // dock the probe, correcting for over-travel + #elif defined(Z_PROBE_ALLEN_KEY) //|| defined(SERVO_LEVELING) + stow_z_probe(); + #endif + + #ifdef Z_PROBE_END_SCRIPT + enqueuecommands_P(PSTR(Z_PROBE_END_SCRIPT)); + st_synchronize(); + #endif } #ifndef Z_PROBE_SLED inline void gcode_G30() { - engage_z_probe(); // Engage Z Servo endstop if available + deploy_z_probe(); // Engage Z Servo endstop if available st_synchronize(); // TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly setup_for_endstop_move(); @@ -2449,7 +2575,7 @@ inline void gcode_G28() { feedrate = homing_feedrate[Z_AXIS]; run_z_probe(); - SERIAL_PROTOCOLPGM(MSG_BED); + SERIAL_PROTOCOLPGM("Bed"); SERIAL_PROTOCOLPGM(" X: "); SERIAL_PROTOCOL(current_position[X_AXIS] + 0.0001); SERIAL_PROTOCOLPGM(" Y: "); @@ -2459,7 +2585,7 @@ inline void gcode_G28() { SERIAL_EOL; clean_up_after_endstop_move(); - retract_z_probe(); // Retract Z Servo endstop if available + stow_z_probe(); // Retract Z Servo endstop if available } #endif //!Z_PROBE_SLED @@ -2473,15 +2599,17 @@ inline void gcode_G92() { if (!code_seen(axis_codes[E_AXIS])) st_synchronize(); + bool didXYZ = false; for (int i = 0; i < NUM_AXIS; i++) { if (code_seen(axis_codes[i])) { - current_position[i] = code_value(); + float v = current_position[i] = code_value(); if (i == E_AXIS) - plan_set_e_position(current_position[E_AXIS]); + plan_set_e_position(v); else - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); + didXYZ = true; } } + if (didXYZ) sync_plan_position(); } #ifdef ULTIPANEL @@ -2493,29 +2621,33 @@ inline void gcode_G92() { inline void gcode_M0_M1() { char *src = strchr_pointer + 2; - unsigned long codenum = 0; + millis_t codenum = 0; bool hasP = false, hasS = false; if (code_seen('P')) { - codenum = code_value(); // milliseconds to wait + codenum = code_value_short(); // milliseconds to wait hasP = codenum > 0; } if (code_seen('S')) { - codenum = code_value() * 1000; // seconds to wait + codenum = code_value_short() * 1000UL; // seconds to wait hasS = codenum > 0; } char* starpos = strchr(src, '*'); if (starpos != NULL) *(starpos) = '\0'; while (*src == ' ') ++src; if (!hasP && !hasS && *src != '\0') - lcd_setstatus(src); - else + lcd_setstatus(src, true); + else { LCD_MESSAGEPGM(MSG_USERWAIT); + #if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 + dontExpireStatus(); + #endif + } lcd_ignore_click(); st_synchronize(); - previous_millis_cmd = millis(); + refresh_cmd_timeout(); if (codenum > 0) { - codenum += previous_millis_cmd; // keep track of when we started waiting + codenum += previous_cmd_ms; // keep track of when we started waiting while(millis() < codenum && !lcd_clicked()) { manage_heater(); manage_inactivity(); @@ -2544,13 +2676,7 @@ inline void gcode_G92() { */ inline void gcode_M17() { LCD_MESSAGEPGM(MSG_NO_MOVE); - enable_x(); - enable_y(); - enable_z(); - enable_e0(); - enable_e1(); - enable_e2(); - enable_e3(); + enable_all_steppers(); } #ifdef SDSUPPORT @@ -2593,7 +2719,7 @@ inline void gcode_M17() { */ inline void gcode_M24() { card.startFileprint(); - starttime = millis(); + print_job_start_ms = millis(); } /** @@ -2608,7 +2734,7 @@ inline void gcode_M17() { */ inline void gcode_M26() { if (card.cardOK && code_seen('S')) - card.setIndex(code_value_long()); + card.setIndex(code_value_short()); } /** @@ -2625,7 +2751,7 @@ inline void gcode_M17() { char* codepos = strchr_pointer + 4; char* starpos = strchr(codepos, '*'); if (starpos) { - char* npos = strchr(cmdbuffer[bufindr], 'N'); + char* npos = strchr(command_queue[cmd_queue_index_r], 'N'); strchr_pointer = strchr(npos, ' ') + 1; *(starpos) = '\0'; } @@ -2648,7 +2774,7 @@ inline void gcode_M17() { card.closefile(); char* starpos = strchr(strchr_pointer + 4, '*'); if (starpos) { - char* npos = strchr(cmdbuffer[bufindr], 'N'); + char* npos = strchr(command_queue[cmd_queue_index_r], 'N'); strchr_pointer = strchr(npos, ' ') + 1; *(starpos) = '\0'; } @@ -2662,8 +2788,8 @@ inline void gcode_M17() { * M31: Get the time since the start of SD Print (or last M109) */ inline void gcode_M31() { - stoptime = millis(); - unsigned long t = (stoptime - starttime) / 1000; + print_job_stop_ms = millis(); + millis_t t = (print_job_stop_ms - print_job_start_ms) / 1000; int min = t / 60, sec = t % 60; char time[30]; sprintf_P(time, PSTR("%i min, %i sec"), min, sec); @@ -2699,11 +2825,11 @@ inline void gcode_M31() { card.openFile(namestartpos, true, !call_procedure); if (code_seen('S') && strchr_pointer < namestartpos) // "S" (must occur _before_ the filename!) - card.setIndex(code_value_long()); + card.setIndex(code_value_short()); card.startFileprint(); if (!call_procedure) - starttime = millis(); //procedure calls count as normal print time. + print_job_start_ms = millis(); //procedure calls count as normal print time. } } @@ -2713,7 +2839,7 @@ inline void gcode_M31() { inline void gcode_M928() { char* starpos = strchr(strchr_pointer + 5, '*'); if (starpos) { - char* npos = strchr(cmdbuffer[bufindr], 'N'); + char* npos = strchr(command_queue[cmd_queue_index_r], 'N'); strchr_pointer = strchr(npos, ' ') + 1; *(starpos) = '\0'; } @@ -2727,11 +2853,11 @@ inline void gcode_M31() { */ inline void gcode_M42() { if (code_seen('S')) { - int pin_status = code_value(), + int pin_status = code_value_short(), pin_number = LED_PIN; if (code_seen('P') && pin_status >= 0 && pin_status <= 255) - pin_number = code_value(); + pin_number = code_value_short(); for (int8_t i = 0; i < (int8_t)(sizeof(sensitive_pins) / sizeof(*sensitive_pins)); i++) { if (sensitive_pins[i] == pin_number) { @@ -2740,7 +2866,7 @@ inline void gcode_M42() { } } - #if defined(FAN_PIN) && FAN_PIN > -1 + #if HAS_FAN if (pin_number == FAN_PIN) fanSpeed = pin_status; #endif @@ -2752,11 +2878,15 @@ inline void gcode_M42() { } // code_seen('S') } - #if defined(ENABLE_AUTO_BED_LEVELING) && defined(Z_PROBE_REPEATABILITY_TEST) - #if Z_MIN_PIN == -1 - #error "You must have a Z_MIN endstop in order to enable calculation of Z-Probe repeatability." + // This is redundant since the SanityCheck.h already checks for a valid Z_PROBE_PIN, but here for clarity. + #ifdef Z_PROBE_ENDSTOP + #if !HAS_Z_PROBE + #error You must define Z_PROBE_PIN to enable Z-Probe repeatability calculation. + #endif + #elif !HAS_Z_MIN + #error You must define Z_MIN_PIN to enable Z-Probe repeatability calculation. #endif /** @@ -2764,14 +2894,14 @@ inline void gcode_M42() { * * Usage: * M48 - * n = Number of samples (4-50, default 10) + * P = Number of sampled points (4-50, default 10) * X = Sample X position * Y = Sample Y position * V = Verbose level (0-4, default=1) * E = Engage probe for each reading * L = Number of legs of movement before probe * - * This function assumes the bed has been homed. Specificaly, that a G28 command + * This function assumes the bed has been homed. Specifically, that a G28 command * as been issued prior to invoking the M48 Z-Probe repeatability measurement function. * Any information generated by a prior G29 Bed leveling command will be lost and need to be * regenerated. @@ -2783,12 +2913,10 @@ inline void gcode_M42() { inline void gcode_M48() { double sum = 0.0, mean = 0.0, sigma = 0.0, sample_set[50]; - int verbose_level = 1, n = 0, j, n_samples = 10, n_legs = 0, engage_probe_for_each_reading = 0; - double X_current, Y_current, Z_current; - double X_probe_location, Y_probe_location, Z_start_location, ext_position; - + uint8_t verbose_level = 1, n_samples = 10, n_legs = 0; + if (code_seen('V') || code_seen('v')) { - verbose_level = code_value(); + verbose_level = code_value_short(); if (verbose_level < 0 || verbose_level > 4 ) { SERIAL_PROTOCOLPGM("?Verbose Level not plausible (0-4).\n"); return; @@ -2798,27 +2926,27 @@ inline void gcode_M42() { if (verbose_level > 0) SERIAL_PROTOCOLPGM("M48 Z-Probe Repeatability test\n"); - if (code_seen('n')) { - n_samples = code_value(); + if (code_seen('P') || code_seen('p') || code_seen('n')) { // `n` for legacy support only - please use `P`! + n_samples = code_value_short(); if (n_samples < 4 || n_samples > 50) { - SERIAL_PROTOCOLPGM("?Specified sample size not plausible (4-50).\n"); + SERIAL_PROTOCOLPGM("?Sample size not plausible (4-50).\n"); return; } } - X_current = X_probe_location = st_get_position_mm(X_AXIS); - Y_current = Y_probe_location = st_get_position_mm(Y_AXIS); - Z_current = st_get_position_mm(Z_AXIS); - Z_start_location = st_get_position_mm(Z_AXIS) + Z_RAISE_BEFORE_PROBING; - ext_position = st_get_position_mm(E_AXIS); + double X_probe_location, Y_probe_location, + X_current = X_probe_location = st_get_position_mm(X_AXIS), + Y_current = Y_probe_location = st_get_position_mm(Y_AXIS), + Z_current = st_get_position_mm(Z_AXIS), + Z_start_location = Z_current + Z_RAISE_BEFORE_PROBING, + ext_position = st_get_position_mm(E_AXIS); - if (code_seen('E') || code_seen('e')) - engage_probe_for_each_reading++; + bool deploy_probe_for_each_reading = code_seen('E') || code_seen('e'); if (code_seen('X') || code_seen('x')) { X_probe_location = code_value() - X_PROBE_OFFSET_FROM_EXTRUDER; if (X_probe_location < X_MIN_POS || X_probe_location > X_MAX_POS) { - SERIAL_PROTOCOLPGM("?Specified X position out of range.\n"); + SERIAL_PROTOCOLPGM("?X position out of range.\n"); return; } } @@ -2826,16 +2954,16 @@ inline void gcode_M42() { if (code_seen('Y') || code_seen('y')) { Y_probe_location = code_value() - Y_PROBE_OFFSET_FROM_EXTRUDER; if (Y_probe_location < Y_MIN_POS || Y_probe_location > Y_MAX_POS) { - SERIAL_PROTOCOLPGM("?Specified Y position out of range.\n"); + SERIAL_PROTOCOLPGM("?Y position out of range.\n"); return; } } if (code_seen('L') || code_seen('l')) { - n_legs = code_value(); + n_legs = code_value_short(); if (n_legs == 1) n_legs = 2; if (n_legs < 0 || n_legs > 15) { - SERIAL_PROTOCOLPGM("?Specified number of legs in movement not plausible (0-15).\n"); + SERIAL_PROTOCOLPGM("?Number of legs in movement not plausible (0-15).\n"); return; } } @@ -2858,7 +2986,7 @@ inline void gcode_M42() { // use that as a starting point for each probe. // if (verbose_level > 2) - SERIAL_PROTOCOL("Positioning probe for the test.\n"); + SERIAL_PROTOCOLPGM("Positioning the probe...\n"); plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location, ext_position, @@ -2876,7 +3004,7 @@ inline void gcode_M42() { // Then retrace the right amount and use that in subsequent probes // - engage_z_probe(); + deploy_z_probe(); setup_for_endstop_move(); run_z_probe(); @@ -2891,51 +3019,51 @@ inline void gcode_M42() { st_synchronize(); current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS); - if (engage_probe_for_each_reading) retract_z_probe(); - - for (n=0; n < n_samples; n++) { + if (deploy_probe_for_each_reading) stow_z_probe(); - do_blocking_move_to( X_probe_location, Y_probe_location, Z_start_location); // Make sure we are at the probe location + for (uint8_t n=0; n < n_samples; n++) { + // Make sure we are at the probe location + do_blocking_move_to(X_probe_location, Y_probe_location, Z_start_location); // this also updates current_position if (n_legs) { - double radius=0.0, theta=0.0, x_sweep, y_sweep; - int l; - int rotational_direction = (unsigned long) millis() & 0x0001; // clockwise or counter clockwise - radius = (unsigned long)millis() % (long)(X_MAX_LENGTH / 4); // limit how far out to go - theta = (float)((unsigned long)millis() % 360L) / (360. / (2 * 3.1415926)); // turn into radians + millis_t ms = millis(); + double radius = ms % (X_MAX_LENGTH / 4), // limit how far out to go + theta = RADIANS(ms % 360L); + float dir = (ms & 0x0001) ? 1 : -1; // clockwise or counter clockwise //SERIAL_ECHOPAIR("starting radius: ",radius); //SERIAL_ECHOPAIR(" theta: ",theta); - //SERIAL_ECHOPAIR(" direction: ",rotational_direction); - //SERIAL_PROTOCOLLNPGM(""); + //SERIAL_ECHOPAIR(" direction: ",dir); + //SERIAL_EOL; - float dir = rotational_direction ? 1 : -1; - for (l = 0; l < n_legs - 1; l++) { - theta += dir * (float)((unsigned long)millis() % 20L) / (360.0/(2*3.1415926)); // turn into radians - - radius += (float)(((long)((unsigned long) millis() % 10L)) - 5L); + for (uint8_t l = 0; l < n_legs - 1; l++) { + ms = millis(); + theta += RADIANS(dir * (ms % 20L)); + radius += (ms % 10L) - 5L; if (radius < 0.0) radius = -radius; X_current = X_probe_location + cos(theta) * radius; Y_current = Y_probe_location + sin(theta) * radius; - - // Make sure our X & Y are sane X_current = constrain(X_current, X_MIN_POS, X_MAX_POS); Y_current = constrain(Y_current, Y_MIN_POS, Y_MAX_POS); if (verbose_level > 3) { SERIAL_ECHOPAIR("x: ", X_current); SERIAL_ECHOPAIR("y: ", Y_current); - SERIAL_PROTOCOLLNPGM(""); + SERIAL_EOL; } - do_blocking_move_to( X_current, Y_current, Z_current ); - } - do_blocking_move_to( X_probe_location, Y_probe_location, Z_start_location); // Go back to the probe location - } + do_blocking_move_to(X_current, Y_current, Z_current); // this also updates current_position - if (engage_probe_for_each_reading) { - engage_z_probe(); + } // n_legs loop + + // Go back to the probe location + do_blocking_move_to(X_probe_location, Y_probe_location, Z_start_location); // this also updates current_position + + } // n_legs + + if (deploy_probe_for_each_reading) { + deploy_z_probe(); delay(1000); } @@ -2948,46 +3076,49 @@ inline void gcode_M42() { // Get the current mean for the data points we have so far // sum = 0.0; - for (j=0; j<=n; j++) sum += sample_set[j]; - mean = sum / (double (n+1)); + for (uint8_t j = 0; j <= n; j++) sum += sample_set[j]; + mean = sum / (n + 1); // // Now, use that mean to calculate the standard deviation for the // data points we have so far // sum = 0.0; - for (j=0; j<=n; j++) sum += (sample_set[j]-mean) * (sample_set[j]-mean); - sigma = sqrt( sum / (double (n+1)) ); + for (uint8_t j = 0; j <= n; j++) { + float ss = sample_set[j] - mean; + sum += ss * ss; + } + sigma = sqrt(sum / (n + 1)); if (verbose_level > 1) { SERIAL_PROTOCOL(n+1); - SERIAL_PROTOCOL(" of "); + SERIAL_PROTOCOLPGM(" of "); SERIAL_PROTOCOL(n_samples); SERIAL_PROTOCOLPGM(" z: "); SERIAL_PROTOCOL_F(current_position[Z_AXIS], 6); - } - - if (verbose_level > 2) { - SERIAL_PROTOCOL(" mean: "); - SERIAL_PROTOCOL_F(mean,6); - SERIAL_PROTOCOL(" sigma: "); - SERIAL_PROTOCOL_F(sigma,6); + if (verbose_level > 2) { + SERIAL_PROTOCOLPGM(" mean: "); + SERIAL_PROTOCOL_F(mean,6); + SERIAL_PROTOCOLPGM(" sigma: "); + SERIAL_PROTOCOL_F(sigma,6); + } } if (verbose_level > 0) SERIAL_EOL; - plan_buffer_line(X_probe_location, Y_probe_location, Z_start_location, - current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder); + plan_buffer_line(X_probe_location, Y_probe_location, Z_start_location, current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder); st_synchronize(); - if (engage_probe_for_each_reading) { - retract_z_probe(); + if (deploy_probe_for_each_reading) { + stow_z_probe(); delay(1000); } } - retract_z_probe(); - delay(1000); + if (!deploy_probe_for_each_reading) { + stow_z_probe(); + delay(1000); + } clean_up_after_endstop_move(); @@ -3012,12 +3143,15 @@ inline void gcode_M42() { inline void gcode_M104() { if (setTargetedHotend(104)) return; - if (code_seen('S')) setTargetHotend(code_value(), tmp_extruder); - #ifdef DUAL_X_CARRIAGE - if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0) - setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset); - #endif - setWatch(); + if (code_seen('S')) { + float temp = code_value(); + setTargetHotend(temp, target_extruder); + #ifdef DUAL_X_CARRIAGE + if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0) + setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset); + #endif + setWatch(); + } } /** @@ -3026,48 +3160,51 @@ inline void gcode_M104() { inline void gcode_M105() { if (setTargetedHotend(105)) return; - #if defined(TEMP_0_PIN) && TEMP_0_PIN > -1 - SERIAL_PROTOCOLPGM("ok T:"); - SERIAL_PROTOCOL_F(degHotend(tmp_extruder),1); - SERIAL_PROTOCOLPGM(" /"); - SERIAL_PROTOCOL_F(degTargetHotend(tmp_extruder),1); - #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 + #if HAS_TEMP_0 || HAS_TEMP_BED + SERIAL_PROTOCOLPGM("ok"); + #if HAS_TEMP_0 + SERIAL_PROTOCOLPGM(" T:"); + SERIAL_PROTOCOL_F(degHotend(target_extruder), 1); + SERIAL_PROTOCOLPGM(" /"); + SERIAL_PROTOCOL_F(degTargetHotend(target_extruder), 1); + #endif + #if HAS_TEMP_BED SERIAL_PROTOCOLPGM(" B:"); - SERIAL_PROTOCOL_F(degBed(),1); + SERIAL_PROTOCOL_F(degBed(), 1); SERIAL_PROTOCOLPGM(" /"); - SERIAL_PROTOCOL_F(degTargetBed(),1); - #endif //TEMP_BED_PIN - for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) { + SERIAL_PROTOCOL_F(degTargetBed(), 1); + #endif + for (int8_t e = 0; e < EXTRUDERS; ++e) { SERIAL_PROTOCOLPGM(" T"); - SERIAL_PROTOCOL(cur_extruder); - SERIAL_PROTOCOLPGM(":"); - SERIAL_PROTOCOL_F(degHotend(cur_extruder),1); + SERIAL_PROTOCOL(e); + SERIAL_PROTOCOLCHAR(':'); + SERIAL_PROTOCOL_F(degHotend(e), 1); SERIAL_PROTOCOLPGM(" /"); - SERIAL_PROTOCOL_F(degTargetHotend(cur_extruder),1); + SERIAL_PROTOCOL_F(degTargetHotend(e), 1); } - #else + #else // !HAS_TEMP_0 && !HAS_TEMP_BED SERIAL_ERROR_START; SERIAL_ERRORLNPGM(MSG_ERR_NO_THERMISTORS); #endif SERIAL_PROTOCOLPGM(" @:"); #ifdef EXTRUDER_WATTS - SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(tmp_extruder))/127); - SERIAL_PROTOCOLPGM("W"); + SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(target_extruder))/127); + SERIAL_PROTOCOLCHAR('W'); #else - SERIAL_PROTOCOL(getHeaterPower(tmp_extruder)); + SERIAL_PROTOCOL(getHeaterPower(target_extruder)); #endif SERIAL_PROTOCOLPGM(" B@:"); #ifdef BED_WATTS SERIAL_PROTOCOL((BED_WATTS * getHeaterPower(-1))/127); - SERIAL_PROTOCOLPGM("W"); + SERIAL_PROTOCOLCHAR('W'); #else SERIAL_PROTOCOL(getHeaterPower(-1)); #endif #ifdef SHOW_TEMP_ADC_VALUES - #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 + #if HAS_TEMP_BED SERIAL_PROTOCOLPGM(" ADC B:"); SERIAL_PROTOCOL_F(degBed(),1); SERIAL_PROTOCOLPGM("C->"); @@ -3076,29 +3213,29 @@ inline void gcode_M105() { for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) { SERIAL_PROTOCOLPGM(" T"); SERIAL_PROTOCOL(cur_extruder); - SERIAL_PROTOCOLPGM(":"); + SERIAL_PROTOCOLCHAR(':'); SERIAL_PROTOCOL_F(degHotend(cur_extruder),1); SERIAL_PROTOCOLPGM("C->"); SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder)/OVERSAMPLENR,0); } #endif - SERIAL_PROTOCOLLN(""); + SERIAL_EOL; } -#if defined(FAN_PIN) && FAN_PIN > -1 +#if HAS_FAN /** * M106: Set Fan Speed */ - inline void gcode_M106() { fanSpeed = code_seen('S') ? constrain(code_value(), 0, 255) : 255; } + inline void gcode_M106() { fanSpeed = code_seen('S') ? constrain(code_value_short(), 0, 255) : 255; } /** * M107: Fan Off */ inline void gcode_M107() { fanSpeed = 0; } -#endif //FAN_PIN +#endif // HAS_FAN /** * M109: Wait for extruder(s) to reach temperature @@ -3108,12 +3245,13 @@ inline void gcode_M109() { LCD_MESSAGEPGM(MSG_HEATING); - CooldownNoWait = code_seen('S'); - if (CooldownNoWait || code_seen('R')) { - setTargetHotend(code_value(), tmp_extruder); + no_wait_for_cooling = code_seen('S'); + if (no_wait_for_cooling || code_seen('R')) { + float temp = code_value(); + setTargetHotend(temp, target_extruder); #ifdef DUAL_X_CARRIAGE - if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0) - setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset); + if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0) + setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset); #endif } @@ -3126,42 +3264,42 @@ inline void gcode_M109() { setWatch(); - unsigned long timetemp = millis(); + millis_t temp_ms = millis(); /* See if we are heating up or cooling down */ - target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling + target_direction = isHeatingHotend(target_extruder); // true if heating, false if cooling cancel_heatup = false; #ifdef TEMP_RESIDENCY_TIME - long residencyStart = -1; + long residency_start_ms = -1; /* continue to loop until we have reached the target temp _and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */ - while((!cancel_heatup)&&((residencyStart == -1) || - (residencyStart >= 0 && (((unsigned int) (millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL)))) ) + while((!cancel_heatup)&&((residency_start_ms == -1) || + (residency_start_ms >= 0 && (((unsigned int) (millis() - residency_start_ms)) < (TEMP_RESIDENCY_TIME * 1000UL)))) ) #else - while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)) ) + while ( target_direction ? (isHeatingHotend(target_extruder)) : (isCoolingHotend(target_extruder)&&(no_wait_for_cooling==false)) ) #endif //TEMP_RESIDENCY_TIME { // while loop - if (millis() > timetemp + 1000UL) { //Print temp & remaining time every 1s while waiting + if (millis() > temp_ms + 1000UL) { //Print temp & remaining time every 1s while waiting SERIAL_PROTOCOLPGM("T:"); - SERIAL_PROTOCOL_F(degHotend(tmp_extruder),1); + SERIAL_PROTOCOL_F(degHotend(target_extruder),1); SERIAL_PROTOCOLPGM(" E:"); - SERIAL_PROTOCOL((int)tmp_extruder); + SERIAL_PROTOCOL((int)target_extruder); #ifdef TEMP_RESIDENCY_TIME SERIAL_PROTOCOLPGM(" W:"); - if (residencyStart > -1) { - timetemp = ((TEMP_RESIDENCY_TIME * 1000UL) - (millis() - residencyStart)) / 1000UL; - SERIAL_PROTOCOLLN( timetemp ); + if (residency_start_ms > -1) { + temp_ms = ((TEMP_RESIDENCY_TIME * 1000UL) - (millis() - residency_start_ms)) / 1000UL; + SERIAL_PROTOCOLLN(temp_ms); } else { - SERIAL_PROTOCOLLN( "?" ); + SERIAL_PROTOCOLLNPGM("?"); } #else - SERIAL_PROTOCOLLN(""); + SERIAL_EOL; #endif - timetemp = millis(); + temp_ms = millis(); } manage_heater(); manage_inactivity(); @@ -3169,20 +3307,21 @@ inline void gcode_M109() { #ifdef TEMP_RESIDENCY_TIME // start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time // or when current temp falls outside the hysteresis after target temp was reached - if ((residencyStart == -1 && target_direction && (degHotend(tmp_extruder) >= (degTargetHotend(tmp_extruder)-TEMP_WINDOW))) || - (residencyStart == -1 && !target_direction && (degHotend(tmp_extruder) <= (degTargetHotend(tmp_extruder)+TEMP_WINDOW))) || - (residencyStart > -1 && labs(degHotend(tmp_extruder) - degTargetHotend(tmp_extruder)) > TEMP_HYSTERESIS) ) + if ((residency_start_ms == -1 && target_direction && (degHotend(target_extruder) >= (degTargetHotend(target_extruder)-TEMP_WINDOW))) || + (residency_start_ms == -1 && !target_direction && (degHotend(target_extruder) <= (degTargetHotend(target_extruder)+TEMP_WINDOW))) || + (residency_start_ms > -1 && labs(degHotend(target_extruder) - degTargetHotend(target_extruder)) > TEMP_HYSTERESIS) ) { - residencyStart = millis(); + residency_start_ms = millis(); } #endif //TEMP_RESIDENCY_TIME } LCD_MESSAGEPGM(MSG_HEATING_COMPLETE); - starttime = previous_millis_cmd = millis(); + refresh_cmd_timeout(); + print_job_start_ms = previous_cmd_ms; } -#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 +#if HAS_TEMP_BED /** * M190: Sxxx Wait for bed current temp to reach target temp. Waits only when heating @@ -3190,19 +3329,19 @@ inline void gcode_M109() { */ inline void gcode_M190() { LCD_MESSAGEPGM(MSG_BED_HEATING); - CooldownNoWait = code_seen('S'); - if (CooldownNoWait || code_seen('R')) + no_wait_for_cooling = code_seen('S'); + if (no_wait_for_cooling || code_seen('R')) setTargetBed(code_value()); - unsigned long timetemp = millis(); + millis_t temp_ms = millis(); cancel_heatup = false; target_direction = isHeatingBed(); // true if heating, false if cooling - while ( (target_direction)&&(!cancel_heatup) ? (isHeatingBed()) : (isCoolingBed()&&(CooldownNoWait==false)) ) { - unsigned long ms = millis(); - if (ms > timetemp + 1000UL) { //Print Temp Reading every 1 second while heating up. - timetemp = ms; + while ((target_direction && !cancel_heatup) ? isHeatingBed() : isCoolingBed() && !no_wait_for_cooling) { + millis_t ms = millis(); + if (ms > temp_ms + 1000UL) { //Print Temp Reading every 1 second while heating up. + temp_ms = ms; float tt = degHotend(active_extruder); SERIAL_PROTOCOLPGM("T:"); SERIAL_PROTOCOL(tt); @@ -3210,17 +3349,17 @@ inline void gcode_M109() { SERIAL_PROTOCOL((int)active_extruder); SERIAL_PROTOCOLPGM(" B:"); SERIAL_PROTOCOL_F(degBed(), 1); - SERIAL_PROTOCOLLN(""); + SERIAL_EOL; } manage_heater(); manage_inactivity(); lcd_update(); } LCD_MESSAGEPGM(MSG_BED_DONE); - previous_millis_cmd = millis(); + refresh_cmd_timeout(); } -#endif // TEMP_BED_PIN > -1 +#endif // HAS_TEMP_BED /** * M112: Emergency Stop @@ -3231,7 +3370,7 @@ inline void gcode_M112() { #ifdef BARICUDA - #if defined(HEATER_1_PIN) && HEATER_1_PIN > -1 + #if HAS_HEATER_1 /** * M126: Heater 1 valve open */ @@ -3242,7 +3381,7 @@ inline void gcode_M112() { inline void gcode_M127() { ValvePressure = 0; } #endif - #if defined(HEATER_2_PIN) && HEATER_2_PIN > -1 + #if HAS_HEATER_2 /** * M128: Heater 2 valve open */ @@ -3262,7 +3401,7 @@ inline void gcode_M140() { if (code_seen('S')) setTargetBed(code_value()); } -#if defined(PS_ON_PIN) && PS_ON_PIN > -1 +#if HAS_POWER_SWITCH /** * M80: Turn on Power Supply @@ -3273,7 +3412,7 @@ inline void gcode_M140() { // If you have a switch on suicide pin, this is useful // if you want to start another print with suicide feature after // a print without suicide... - #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1 + #if HAS_SUICIDE OUT_WRITE(SUICIDE_PIN, HIGH); #endif @@ -3284,13 +3423,15 @@ inline void gcode_M140() { #endif } -#endif // PS_ON_PIN +#endif // HAS_POWER_SWITCH /** - * M81: Turn off Power Supply + * M81: Turn off Power, including Power Supply, if there is one. + * + * This code should ALWAYS be available for EMERGENCY SHUTDOWN! */ inline void gcode_M81() { - disable_heater(); + disable_all_heaters(); st_synchronize(); disable_e0(); disable_e1(); @@ -3299,19 +3440,22 @@ inline void gcode_M81() { finishAndDisableSteppers(); fanSpeed = 0; delay(1000); // Wait 1 second before switching off - #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1 + #if HAS_SUICIDE st_synchronize(); suicide(); - #elif defined(PS_ON_PIN) && PS_ON_PIN > -1 + #elif HAS_POWER_SWITCH OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP); #endif #ifdef ULTIPANEL - powersupply = false; + #if HAS_POWER_SWITCH + powersupply = false; + #endif LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF "."); lcd_update(); #endif } + /** * M82: Set E codes absolute (default) */ @@ -3406,27 +3550,26 @@ inline void gcode_M114() { SERIAL_PROTOCOLPGM(" Z:"); SERIAL_PROTOCOL(float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS]); - SERIAL_PROTOCOLLN(""); + SERIAL_EOL; #ifdef SCARA SERIAL_PROTOCOLPGM("SCARA Theta:"); SERIAL_PROTOCOL(delta[X_AXIS]); SERIAL_PROTOCOLPGM(" Psi+Theta:"); SERIAL_PROTOCOL(delta[Y_AXIS]); - SERIAL_PROTOCOLLN(""); + SERIAL_EOL; SERIAL_PROTOCOLPGM("SCARA Cal - Theta:"); SERIAL_PROTOCOL(delta[X_AXIS]+home_offset[X_AXIS]); SERIAL_PROTOCOLPGM(" Psi+Theta (90):"); SERIAL_PROTOCOL(delta[Y_AXIS]-delta[X_AXIS]-90+home_offset[Y_AXIS]); - SERIAL_PROTOCOLLN(""); + SERIAL_EOL; SERIAL_PROTOCOLPGM("SCARA step Cal - Theta:"); SERIAL_PROTOCOL(delta[X_AXIS]/90*axis_steps_per_unit[X_AXIS]); SERIAL_PROTOCOLPGM(" Psi+Theta:"); SERIAL_PROTOCOL((delta[Y_AXIS]-delta[X_AXIS])/90*axis_steps_per_unit[Y_AXIS]); - SERIAL_PROTOCOLLN(""); - SERIAL_PROTOCOLLN(""); + SERIAL_EOL; SERIAL_EOL; #endif } @@ -3452,35 +3595,38 @@ inline void gcode_M117() { */ inline void gcode_M119() { SERIAL_PROTOCOLLN(MSG_M119_REPORT); - #if defined(X_MIN_PIN) && X_MIN_PIN > -1 + #if HAS_X_MIN SERIAL_PROTOCOLPGM(MSG_X_MIN); SERIAL_PROTOCOLLN(((READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); #endif - #if defined(X_MAX_PIN) && X_MAX_PIN > -1 + #if HAS_X_MAX SERIAL_PROTOCOLPGM(MSG_X_MAX); SERIAL_PROTOCOLLN(((READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); #endif - #if defined(Y_MIN_PIN) && Y_MIN_PIN > -1 + #if HAS_Y_MIN SERIAL_PROTOCOLPGM(MSG_Y_MIN); SERIAL_PROTOCOLLN(((READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); #endif - #if defined(Y_MAX_PIN) && Y_MAX_PIN > -1 + #if HAS_Y_MAX SERIAL_PROTOCOLPGM(MSG_Y_MAX); SERIAL_PROTOCOLLN(((READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); #endif - #if defined(Z_MIN_PIN) && Z_MIN_PIN > -1 + #if HAS_Z_MIN SERIAL_PROTOCOLPGM(MSG_Z_MIN); SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); #endif - #if defined(Z_MAX_PIN) && Z_MAX_PIN > -1 + #if HAS_Z_MAX SERIAL_PROTOCOLPGM(MSG_Z_MAX); SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); #endif - #if defined(Z2_MAX_PIN) && Z2_MAX_PIN > -1 + #if HAS_Z2_MAX SERIAL_PROTOCOLPGM(MSG_Z2_MAX); SERIAL_PROTOCOLLN(((READ(Z2_MAX_PIN)^Z2_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); #endif - + #if HAS_Z_PROBE + SERIAL_PROTOCOLPGM(MSG_Z_PROBE); + SERIAL_PROTOCOLLN(((READ(Z_PROBE_PIN)^Z_PROBE_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); + #endif } /** @@ -3500,9 +3646,9 @@ inline void gcode_M121() { enable_endstops(true); } */ inline void gcode_M150() { SendColors( - code_seen('R') ? (byte)code_value() : 0, - code_seen('U') ? (byte)code_value() : 0, - code_seen('B') ? (byte)code_value() : 0 + code_seen('R') ? (byte)code_value_short() : 0, + code_seen('U') ? (byte)code_value_short() : 0, + code_seen('B') ? (byte)code_value_short() : 0 ); } @@ -3514,9 +3660,9 @@ inline void gcode_M121() { enable_endstops(true); } * D */ inline void gcode_M200() { - tmp_extruder = active_extruder; + int tmp_extruder = active_extruder; if (code_seen('T')) { - tmp_extruder = code_value(); + tmp_extruder = code_value_short(); if (tmp_extruder >= EXTRUDERS) { SERIAL_ECHO_START; SERIAL_ECHO(MSG_M200_INVALID_EXTRUDER); @@ -3524,7 +3670,6 @@ inline void gcode_M200() { } } - float area = .0; if (code_seen('D')) { float diameter = code_value(); // setting any extruder filament size disables volumetric on the assumption that @@ -3588,27 +3733,23 @@ inline void gcode_M203() { * Also sets minimum segment time in ms (B20000) to prevent buffer under-runs and M20 minimum feedrate */ inline void gcode_M204() { - if (code_seen('S')) // Kept for legacy compatibility. Should NOT BE USED for new developments. - { + if (code_seen('S')) { // Kept for legacy compatibility. Should NOT BE USED for new developments. acceleration = code_value(); travel_acceleration = acceleration; - SERIAL_ECHOPAIR("Setting Printing and Travelling Acceleration: ", acceleration ); + SERIAL_ECHOPAIR("Setting Print and Travel Acceleration: ", acceleration ); SERIAL_EOL; } - if (code_seen('P')) - { + if (code_seen('P')) { acceleration = code_value(); - SERIAL_ECHOPAIR("Setting Printing Acceleration: ", acceleration ); + SERIAL_ECHOPAIR("Setting Print Acceleration: ", acceleration ); SERIAL_EOL; } - if (code_seen('R')) - { + if (code_seen('R')) { retract_acceleration = code_value(); SERIAL_ECHOPAIR("Setting Retract Acceleration: ", retract_acceleration ); SERIAL_EOL; } - if (code_seen('T')) - { + if (code_seen('T')) { travel_acceleration = code_value(); SERIAL_ECHOPAIR("Setting Travel Acceleration: ", travel_acceleration ); SERIAL_EOL; @@ -3711,7 +3852,7 @@ inline void gcode_M206() { */ inline void gcode_M209() { if (code_seen('S')) { - int t = code_value(); + int t = code_value_short(); switch(t) { case 0: autoretract_enabled = false; @@ -3722,7 +3863,7 @@ inline void gcode_M206() { default: SERIAL_ECHO_START; SERIAL_ECHOPGM(MSG_UNKNOWN_COMMAND); - SERIAL_ECHO(cmdbuffer[bufindr]); + SERIAL_ECHO(command_queue[cmd_queue_index_r]); SERIAL_ECHOLNPGM("\""); return; } @@ -3740,23 +3881,23 @@ inline void gcode_M206() { inline void gcode_M218() { if (setTargetedHotend(218)) return; - if (code_seen('X')) extruder_offset[X_AXIS][tmp_extruder] = code_value(); - if (code_seen('Y')) extruder_offset[Y_AXIS][tmp_extruder] = code_value(); + if (code_seen('X')) extruder_offset[X_AXIS][target_extruder] = code_value(); + if (code_seen('Y')) extruder_offset[Y_AXIS][target_extruder] = code_value(); #ifdef DUAL_X_CARRIAGE - if (code_seen('Z')) extruder_offset[Z_AXIS][tmp_extruder] = code_value(); + if (code_seen('Z')) extruder_offset[Z_AXIS][target_extruder] = code_value(); #endif SERIAL_ECHO_START; SERIAL_ECHOPGM(MSG_HOTEND_OFFSET); - for (tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++) { - SERIAL_ECHO(" "); - SERIAL_ECHO(extruder_offset[X_AXIS][tmp_extruder]); - SERIAL_ECHO(","); - SERIAL_ECHO(extruder_offset[Y_AXIS][tmp_extruder]); + for (int e = 0; e < EXTRUDERS; e++) { + SERIAL_CHAR(' '); + SERIAL_ECHO(extruder_offset[X_AXIS][e]); + SERIAL_CHAR(','); + SERIAL_ECHO(extruder_offset[Y_AXIS][e]); #ifdef DUAL_X_CARRIAGE - SERIAL_ECHO(","); - SERIAL_ECHO(extruder_offset[Z_AXIS][tmp_extruder]); + SERIAL_CHAR(','); + SERIAL_ECHO(extruder_offset[Z_AXIS][e]); #endif } SERIAL_EOL; @@ -3768,7 +3909,7 @@ inline void gcode_M206() { * M220: Set speed percentage factor, aka "Feed Rate" (M220 S95) */ inline void gcode_M220() { - if (code_seen('S')) feedmultiply = code_value(); + if (code_seen('S')) feedrate_multiplier = code_value(); } /** @@ -3779,10 +3920,10 @@ inline void gcode_M221() { int sval = code_value(); if (code_seen('T')) { if (setTargetedHotend(221)) return; - extruder_multiply[tmp_extruder] = sval; + extruder_multiply[target_extruder] = sval; } else { - extrudemultiply = sval; + extruder_multiply[active_extruder] = sval; } } } @@ -3849,12 +3990,12 @@ inline void gcode_M226() { servo_position = code_value(); if ((servo_index >= 0) && (servo_index < NUM_SERVOS)) { #if SERVO_LEVELING - servos[servo_index].attach(0); + servo[servo_index].attach(0); #endif - servos[servo_index].write(servo_position); + servo[servo_index].write(servo_position); #if SERVO_LEVELING delay(PROBE_SERVO_DEACTIVATION_DELAY); - servos[servo_index].detach(); + servo[servo_index].detach(); #endif } else { @@ -3869,21 +4010,21 @@ inline void gcode_M226() { SERIAL_PROTOCOL(" Servo "); SERIAL_PROTOCOL(servo_index); SERIAL_PROTOCOL(": "); - SERIAL_PROTOCOL(servos[servo_index].read()); - SERIAL_PROTOCOLLN(""); + SERIAL_PROTOCOL(servo[servo_index].read()); + SERIAL_EOL; } } #endif // NUM_SERVOS > 0 -#if defined(LARGE_FLASH) && (BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER)) +#if BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER) /** * M300: Play beep sound S P */ inline void gcode_M300() { - int beepS = code_seen('S') ? code_value() : 110; - int beepP = code_seen('P') ? code_value() : 1000; + uint16_t beepS = code_seen('S') ? code_value_short() : 110; + uint32_t beepP = code_seen('P') ? code_value_long() : 1000; if (beepS > 0) { #if BEEPER > 0 tone(BEEPER, beepS); @@ -3900,7 +4041,7 @@ inline void gcode_M226() { } } -#endif // LARGE_FLASH && (BEEPER>0 || ULTRALCD || LCD_USE_I2C_BUZZER) +#endif // BEEPER>0 || ULTRALCD || LCD_USE_I2C_BUZZER #ifdef PIDTEMP @@ -3938,7 +4079,7 @@ inline void gcode_M226() { //Kc does not have scaling applied above, or in resetting defaults SERIAL_PROTOCOL(PID_PARAM(Kc, e)); #endif - SERIAL_PROTOCOLLN(""); + SERIAL_EOL; } else { SERIAL_ECHO_START; @@ -3963,12 +4104,12 @@ inline void gcode_M226() { SERIAL_PROTOCOL(unscalePID_i(bedKi)); SERIAL_PROTOCOL(" d:"); SERIAL_PROTOCOL(unscalePID_d(bedKd)); - SERIAL_PROTOCOLLN(""); + SERIAL_EOL; } #endif // PIDTEMPBED -#if defined(CHDK) || (defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1) +#if defined(CHDK) || HAS_PHOTOGRAPH /** * M240: Trigger a camera by emulating a Canon RC-1 @@ -3981,7 +4122,7 @@ inline void gcode_M226() { chdkHigh = millis(); chdkActive = true; - #elif defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1 + #elif HAS_PHOTOGRAPH const uint8_t NUM_PULSES = 16; const float PULSE_LENGTH = 0.01524; @@ -3999,27 +4140,29 @@ inline void gcode_M226() { _delay_ms(PULSE_LENGTH); } - #endif // !CHDK && PHOTOGRAPH_PIN > -1 + #endif // !CHDK && HAS_PHOTOGRAPH } #endif // CHDK || PHOTOGRAPH_PIN -#ifdef DOGLCD +#ifdef HAS_LCD_CONTRAST /** * M250: Read and optionally set the LCD contrast */ inline void gcode_M250() { - if (code_seen('C')) lcd_setcontrast(code_value_long() & 0x3F); + if (code_seen('C')) lcd_setcontrast(code_value_short() & 0x3F); SERIAL_PROTOCOLPGM("lcd contrast value: "); SERIAL_PROTOCOL(lcd_contrast); - SERIAL_PROTOCOLLN(""); + SERIAL_EOL; } -#endif // DOGLCD +#endif // HAS_LCD_CONTRAST #ifdef PREVENT_DANGEROUS_EXTRUDE + void set_extrude_min_temp(float temp) { extrude_min_temp = temp; } + /** * M302: Allow cold extrudes, or set the minimum extrude S. */ @@ -4036,8 +4179,8 @@ inline void gcode_M226() { * C */ inline void gcode_M303() { - int e = code_seen('E') ? code_value_long() : 0; - int c = code_seen('C') ? code_value_long() : 5; + int e = code_seen('E') ? code_value_short() : 0; + int c = code_seen('C') ? code_value_short() : 5; float temp = code_seen('S') ? code_value() : (e < 0 ? 70.0 : 150.0); PID_autotune(temp, e, c); } @@ -4046,7 +4189,7 @@ inline void gcode_M303() { bool SCARA_move_to_cal(uint8_t delta_x, uint8_t delta_y) { //SoftEndsEnabled = false; // Ignore soft endstops during calibration //SERIAL_ECHOLN(" Soft endstops disabled "); - if (! Stopped) { + if (IsRunning()) { //get_coordinates(); // For X Y Z E F delta[X_AXIS] = delta_x; delta[Y_AXIS] = delta_y; @@ -4120,17 +4263,17 @@ inline void gcode_M303() { case 0: OUT_WRITE(SOL0_PIN, HIGH); break; - #if defined(SOL1_PIN) && SOL1_PIN > -1 + #if HAS_SOLENOID_1 case 1: OUT_WRITE(SOL1_PIN, HIGH); break; #endif - #if defined(SOL2_PIN) && SOL2_PIN > -1 + #if HAS_SOLENOID_2 case 2: OUT_WRITE(SOL2_PIN, HIGH); break; #endif - #if defined(SOL3_PIN) && SOL3_PIN > -1 + #if HAS_SOLENOID_3 case 3: OUT_WRITE(SOL3_PIN, HIGH); break; @@ -4173,11 +4316,11 @@ inline void gcode_M400() { st_synchronize(); } /** * M401: Engage Z Servo endstop if available */ - inline void gcode_M401() { engage_z_probe(); } + inline void gcode_M401() { deploy_z_probe(); } /** * M402: Retract Z Servo endstop if enabled */ - inline void gcode_M402() { retract_z_probe(); } + inline void gcode_M402() { stow_z_probe(); } #endif @@ -4187,7 +4330,7 @@ inline void gcode_M400() { st_synchronize(); } * M404: Display or set the nominal filament width (3mm, 1.75mm ) W<3.0> */ inline void gcode_M404() { - #if FILWIDTH_PIN > -1 + #if HAS_FILWIDTH if (code_seen('W')) { filament_width_nominal = code_value(); } @@ -4219,7 +4362,7 @@ inline void gcode_M400() { st_synchronize(); } //SERIAL_PROTOCOLPGM("Filament dia (measured mm):"); //SERIAL_PROTOCOL(filament_width_meas); //SERIAL_PROTOCOLPGM("Extrusion ratio(%):"); - //SERIAL_PROTOCOL(extrudemultiply); + //SERIAL_PROTOCOL(extruder_multiply[active_extruder]); } /** @@ -4262,7 +4405,7 @@ inline void gcode_M502() { * M503: print settings currently in memory */ inline void gcode_M503() { - Config_PrintSettings(code_seen('S') && code_value == 0); + Config_PrintSettings(code_seen('S') && code_value() == 0); } #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED @@ -4286,7 +4429,7 @@ inline void gcode_M503() { zprobe_zoffset = -value; // compare w/ line 278 of ConfigurationStore.cpp SERIAL_ECHO_START; SERIAL_ECHOLNPGM(MSG_ZPROBE_ZOFFSET " " MSG_OK); - SERIAL_PROTOCOLLN(""); + SERIAL_EOL; } else { SERIAL_ECHO_START; @@ -4295,14 +4438,14 @@ inline void gcode_M503() { SERIAL_ECHO(Z_PROBE_OFFSET_RANGE_MIN); SERIAL_ECHOPGM(MSG_Z_MAX); SERIAL_ECHO(Z_PROBE_OFFSET_RANGE_MAX); - SERIAL_PROTOCOLLN(""); + SERIAL_EOL; } } else { SERIAL_ECHO_START; SERIAL_ECHOLNPGM(MSG_ZPROBE_ZOFFSET " : "); SERIAL_ECHO(-zprobe_zoffset); - SERIAL_PROTOCOLLN(""); + SERIAL_EOL; } } @@ -4372,24 +4515,10 @@ inline void gcode_M503() { LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE); uint8_t cnt = 0; while (!lcd_clicked()) { - cnt++; + if (++cnt == 0) lcd_quick_feedback(); // every 256th frame till the lcd is clicked manage_heater(); manage_inactivity(true); lcd_update(); - if (cnt == 0) { - #if BEEPER > 0 - OUT_WRITE(BEEPER,HIGH); - delay(3); - WRITE(BEEPER,LOW); - delay(3); - #else - #if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS) - lcd_buzz(1000/6, 100); - #else - lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); - #endif - #endif - } } // while(!lcd_clicked) //return to normal @@ -4416,7 +4545,7 @@ inline void gcode_M503() { #endif #ifdef FILAMENT_RUNOUT_SENSOR - filrunoutEnqued = false; + filrunoutEnqueued = false; #endif } @@ -4446,13 +4575,13 @@ inline void gcode_M503() { if (code_seen('R')) duplicate_extruder_temp_offset = code_value(); SERIAL_ECHO_START; SERIAL_ECHOPGM(MSG_HOTEND_OFFSET); - SERIAL_ECHO(" "); + SERIAL_CHAR(' '); SERIAL_ECHO(extruder_offset[X_AXIS][0]); - SERIAL_ECHO(","); + SERIAL_CHAR(','); SERIAL_ECHO(extruder_offset[Y_AXIS][0]); - SERIAL_ECHO(" "); + SERIAL_CHAR(' '); SERIAL_ECHO(duplicate_extruder_x_offset); - SERIAL_ECHO(","); + SERIAL_CHAR(','); SERIAL_ECHOLN(extruder_offset[Y_AXIS][1]); break; case DXC_FULL_CONTROL_MODE: @@ -4510,23 +4639,22 @@ inline void gcode_M907() { #endif // HAS_DIGIPOTSS -// M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers. -inline void gcode_M350() { - #if defined(X_MS1_PIN) && X_MS1_PIN > -1 +#if HAS_MICROSTEPS + + // M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers. + inline void gcode_M350() { if(code_seen('S')) for(int i=0;i<=4;i++) microstep_mode(i,code_value()); for(int i=0;i -1 - if (code_seen('S')) switch(code_value_long()) { + /** + * M351: Toggle MS1 MS2 pins directly with axis codes X Y Z E B + * S# determines MS1 or MS2, X# sets the pin high/low. + */ + inline void gcode_M351() { + if (code_seen('S')) switch(code_value_short()) { case 1: for(int i=0;i= EXTRUDERS) { SERIAL_ECHO_START; - SERIAL_ECHO("T"); + SERIAL_CHAR('T'); SERIAL_ECHO(tmp_extruder); SERIAL_ECHOLN(MSG_INVALID_EXTRUDER); } else { - boolean make_move = false; + target_extruder = tmp_extruder; + + #if EXTRUDERS > 1 + bool make_move = false; + #endif + if (code_seen('F')) { - make_move = true; + + #if EXTRUDERS > 1 + make_move = true; + #endif + next_feedrate = code_value(); if (next_feedrate > 0.0) feedrate = next_feedrate; } #if EXTRUDERS > 1 if (tmp_extruder != active_extruder) { // Save current position to return to after applying extruder offset - memcpy(destination, current_position, sizeof(destination)); + set_destination_to_current(); #ifdef DUAL_X_CARRIAGE - if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE && Stopped == false && + if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE && IsRunning() && (delayed_move_time != 0 || current_position[X_AXIS] != x_home_pos(active_extruder))) { // Park old head: 1) raise 2) move to park position 3) lower plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT, @@ -4623,14 +4764,12 @@ inline void gcode_T() { active_extruder = tmp_extruder; #endif // !DUAL_X_CARRIAGE #ifdef DELTA - calculate_delta(current_position); // change cartesian kinematic to delta kinematic; - //sent position to plan_set_position(); - plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],current_position[E_AXIS]); + sync_plan_position_delta(); #else - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); + sync_plan_position(); #endif // Move to the old position if 'F' was in the parameters - if (make_move && !Stopped) prepare_move(); + if (make_move && IsRunning()) prepare_move(); } #ifdef EXT_SOLENOID @@ -4648,11 +4787,12 @@ inline void gcode_T() { /** * Process Commands and dispatch them to handlers + * This is called from the main loop() */ void process_commands() { if (code_seen('G')) { - int gCode = code_value_long(); + int gCode = code_value_short(); switch(gCode) { @@ -4688,18 +4828,14 @@ void process_commands() { gcode_G28(); break; - #if defined(MESH_BED_LEVELING) - case 29: // G29 Handle mesh based leveling + #if defined(ENABLE_AUTO_BED_LEVELING) || defined(MESH_BED_LEVELING) + case 29: // G29 Detailed Z-Probe, probes the bed at 3 or more points. gcode_G29(); break; #endif #ifdef ENABLE_AUTO_BED_LEVELING - case 29: // G29 Detailed Z-Probe, probes the bed at 3 or more points. - gcode_G29(); - break; - #ifndef Z_PROBE_SLED case 30: // G30 Single Z Probe @@ -4731,7 +4867,7 @@ void process_commands() { } else if (code_seen('M')) { - switch( code_value_long() ) { + switch(code_value_short()) { #ifdef ULTIPANEL case 0: // M0 - Unconditional stop - Wait for user button press on LCD case 1: // M1 - Conditional stop - Wait for user button press on LCD @@ -4809,52 +4945,52 @@ void process_commands() { gcode_M109(); break; - #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 + #if HAS_TEMP_BED case 190: // M190 - Wait for bed heater to reach target. gcode_M190(); break; - #endif //TEMP_BED_PIN + #endif // HAS_TEMP_BED - #if defined(FAN_PIN) && FAN_PIN > -1 + #if HAS_FAN case 106: //M106 Fan On gcode_M106(); break; case 107: //M107 Fan Off gcode_M107(); break; - #endif //FAN_PIN + #endif // HAS_FAN #ifdef BARICUDA // PWM for HEATER_1_PIN - #if defined(HEATER_1_PIN) && HEATER_1_PIN > -1 + #if HAS_HEATER_1 case 126: // M126 valve open gcode_M126(); break; case 127: // M127 valve closed gcode_M127(); break; - #endif //HEATER_1_PIN + #endif // HAS_HEATER_1 // PWM for HEATER_2_PIN - #if defined(HEATER_2_PIN) && HEATER_2_PIN > -1 + #if HAS_HEATER_2 case 128: // M128 valve open gcode_M128(); break; case 129: // M129 valve closed gcode_M129(); break; - #endif //HEATER_2_PIN - #endif //BARICUDA + #endif // HAS_HEATER_2 + #endif // BARICUDA - #if defined(PS_ON_PIN) && PS_ON_PIN > -1 + #if HAS_POWER_SWITCH case 80: // M80 - Turn on Power Supply gcode_M80(); break; - #endif // PS_ON_PIN + #endif // HAS_POWER_SWITCH - case 81: // M81 - Turn off Power Supply + case 81: // M81 - Turn off Power, including Power Supply, if possible gcode_M81(); break; @@ -4930,14 +5066,13 @@ void process_commands() { case 665: // M665 set delta configurations L R S gcode_M665(); break; - case 666: // M666 set delta endstop adjustment - gcode_M666(); - break; - #elif defined(Z_DUAL_ENDSTOPS) - case 666: // M666 set delta endstop adjustment + #endif + + #if defined(DELTA) || defined(Z_DUAL_ENDSTOPS) + case 666: // M666 set delta / dual endstop adjustment gcode_M666(); break; - #endif // DELTA + #endif #ifdef FWRETRACT case 207: //M207 - set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop] @@ -4975,11 +5110,11 @@ void process_commands() { break; #endif // NUM_SERVOS > 0 - #if defined(LARGE_FLASH) && (BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER)) + #if BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER) case 300: // M300 - Play beep tone gcode_M300(); break; - #endif // LARGE_FLASH && (BEEPER>0 || ULTRALCD || LCD_USE_I2C_BUZZER) + #endif // BEEPER > 0 || ULTRALCD || LCD_USE_I2C_BUZZER #ifdef PIDTEMP case 301: // M301 @@ -4993,17 +5128,17 @@ void process_commands() { break; #endif // PIDTEMPBED - #if defined(CHDK) || (defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1) + #if defined(CHDK) || HAS_PHOTOGRAPH case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/ gcode_M240(); break; #endif // CHDK || PHOTOGRAPH_PIN - #ifdef DOGLCD + #ifdef HAS_LCD_CONTRAST case 250: // M250 Set LCD contrast value: C (value 0..63) gcode_M250(); break; - #endif // DOGLCD + #endif // HAS_LCD_CONTRAST #ifdef PREVENT_DANGEROUS_EXTRUDE case 302: // allow cold extrudes, or set the minimum extrude temperature @@ -5111,13 +5246,17 @@ void process_commands() { break; #endif // HAS_DIGIPOTSS - case 350: // M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers. - gcode_M350(); - break; + #if HAS_MICROSTEPS - case 351: // M351 Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low. - gcode_M351(); - break; + case 350: // M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers. + gcode_M350(); + break; + + case 351: // M351 Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low. + gcode_M351(); + break; + + #endif // HAS_MICROSTEPS case 999: // M999: Restart after being Stopped gcode_M999(); @@ -5132,203 +5271,168 @@ void process_commands() { else { SERIAL_ECHO_START; SERIAL_ECHOPGM(MSG_UNKNOWN_COMMAND); - SERIAL_ECHO(cmdbuffer[bufindr]); + SERIAL_ECHO(command_queue[cmd_queue_index_r]); SERIAL_ECHOLNPGM("\""); } ClearToSend(); } -void FlushSerialRequestResend() -{ - //char cmdbuffer[bufindr][100]="Resend:"; +void FlushSerialRequestResend() { + //char command_queue[cmd_queue_index_r][100]="Resend:"; MYSERIAL.flush(); SERIAL_PROTOCOLPGM(MSG_RESEND); SERIAL_PROTOCOLLN(gcode_LastN + 1); ClearToSend(); } -void ClearToSend() -{ - previous_millis_cmd = millis(); +void ClearToSend() { + refresh_cmd_timeout(); #ifdef SDSUPPORT - if(fromsd[bufindr]) - return; - #endif //SDSUPPORT + if (fromsd[cmd_queue_index_r]) return; + #endif SERIAL_PROTOCOLLNPGM(MSG_OK); } -void get_coordinates() -{ - bool seen[4]={false,false,false,false}; - for(int8_t i=0; i < NUM_AXIS; i++) { - if(code_seen(axis_codes[i])) - { - destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i]; - seen[i]=true; - } - else destination[i] = current_position[i]; //Are these else lines really needed? +void get_coordinates() { + for (int i = 0; i < NUM_AXIS; i++) { + if (code_seen(axis_codes[i])) + destination[i] = code_value() + (axis_relative_modes[i] || relative_mode ? current_position[i] : 0); + else + destination[i] = current_position[i]; } - if(code_seen('F')) { + if (code_seen('F')) { next_feedrate = code_value(); - if(next_feedrate > 0.0) feedrate = next_feedrate; + if (next_feedrate > 0.0) feedrate = next_feedrate; } } -void get_arc_coordinates() -{ -#ifdef SF_ARC_FIX - bool relative_mode_backup = relative_mode; - relative_mode = true; -#endif - get_coordinates(); -#ifdef SF_ARC_FIX - relative_mode=relative_mode_backup; -#endif +void get_arc_coordinates() { + #ifdef SF_ARC_FIX + bool relative_mode_backup = relative_mode; + relative_mode = true; + #endif + get_coordinates(); + #ifdef SF_ARC_FIX + relative_mode = relative_mode_backup; + #endif - if(code_seen('I')) { - offset[0] = code_value(); - } - else { - offset[0] = 0.0; - } - if(code_seen('J')) { - offset[1] = code_value(); - } - else { - offset[1] = 0.0; - } + offset[0] = code_seen('I') ? code_value() : 0; + offset[1] = code_seen('J') ? code_value() : 0; } -void clamp_to_software_endstops(float target[3]) -{ +void clamp_to_software_endstops(float target[3]) { if (min_software_endstops) { - if (target[X_AXIS] < min_pos[X_AXIS]) target[X_AXIS] = min_pos[X_AXIS]; - if (target[Y_AXIS] < min_pos[Y_AXIS]) target[Y_AXIS] = min_pos[Y_AXIS]; + NOLESS(target[X_AXIS], min_pos[X_AXIS]); + NOLESS(target[Y_AXIS], min_pos[Y_AXIS]); float negative_z_offset = 0; #ifdef ENABLE_AUTO_BED_LEVELING - if (Z_PROBE_OFFSET_FROM_EXTRUDER < 0) negative_z_offset = negative_z_offset + Z_PROBE_OFFSET_FROM_EXTRUDER; - if (home_offset[Z_AXIS] < 0) negative_z_offset = negative_z_offset + home_offset[Z_AXIS]; + if (Z_PROBE_OFFSET_FROM_EXTRUDER < 0) negative_z_offset += Z_PROBE_OFFSET_FROM_EXTRUDER; + if (home_offset[Z_AXIS] < 0) negative_z_offset += home_offset[Z_AXIS]; #endif - - if (target[Z_AXIS] < min_pos[Z_AXIS]+negative_z_offset) target[Z_AXIS] = min_pos[Z_AXIS]+negative_z_offset; + NOLESS(target[Z_AXIS], min_pos[Z_AXIS] + negative_z_offset); } if (max_software_endstops) { - if (target[X_AXIS] > max_pos[X_AXIS]) target[X_AXIS] = max_pos[X_AXIS]; - if (target[Y_AXIS] > max_pos[Y_AXIS]) target[Y_AXIS] = max_pos[Y_AXIS]; - if (target[Z_AXIS] > max_pos[Z_AXIS]) target[Z_AXIS] = max_pos[Z_AXIS]; + NOMORE(target[X_AXIS], max_pos[X_AXIS]); + NOMORE(target[Y_AXIS], max_pos[Y_AXIS]); + NOMORE(target[Z_AXIS], max_pos[Z_AXIS]); } } #ifdef DELTA -void recalc_delta_settings(float radius, float diagonal_rod) -{ - delta_tower1_x= -SIN_60*radius; // front left tower - delta_tower1_y= -COS_60*radius; - delta_tower2_x= SIN_60*radius; // front right tower - delta_tower2_y= -COS_60*radius; - delta_tower3_x= 0.0; // back middle tower - delta_tower3_y= radius; - delta_diagonal_rod_2= sq(diagonal_rod); -} -void calculate_delta(float cartesian[3]) -{ - delta[X_AXIS] = sqrt(delta_diagonal_rod_2 - - sq(delta_tower1_x-cartesian[X_AXIS]) - - sq(delta_tower1_y-cartesian[Y_AXIS]) - ) + cartesian[Z_AXIS]; - delta[Y_AXIS] = sqrt(delta_diagonal_rod_2 - - sq(delta_tower2_x-cartesian[X_AXIS]) - - sq(delta_tower2_y-cartesian[Y_AXIS]) - ) + cartesian[Z_AXIS]; - delta[Z_AXIS] = sqrt(delta_diagonal_rod_2 - - sq(delta_tower3_x-cartesian[X_AXIS]) - - sq(delta_tower3_y-cartesian[Y_AXIS]) - ) + cartesian[Z_AXIS]; - /* - SERIAL_ECHOPGM("cartesian x="); SERIAL_ECHO(cartesian[X_AXIS]); - SERIAL_ECHOPGM(" y="); SERIAL_ECHO(cartesian[Y_AXIS]); - SERIAL_ECHOPGM(" z="); SERIAL_ECHOLN(cartesian[Z_AXIS]); + void recalc_delta_settings(float radius, float diagonal_rod) { + delta_tower1_x = -SIN_60 * radius; // front left tower + delta_tower1_y = -COS_60 * radius; + delta_tower2_x = SIN_60 * radius; // front right tower + delta_tower2_y = -COS_60 * radius; + delta_tower3_x = 0.0; // back middle tower + delta_tower3_y = radius; + delta_diagonal_rod_2 = sq(diagonal_rod); + } - SERIAL_ECHOPGM("delta x="); SERIAL_ECHO(delta[X_AXIS]); - SERIAL_ECHOPGM(" y="); SERIAL_ECHO(delta[Y_AXIS]); - SERIAL_ECHOPGM(" z="); SERIAL_ECHOLN(delta[Z_AXIS]); - */ -} + void calculate_delta(float cartesian[3]) { + delta[X_AXIS] = sqrt(delta_diagonal_rod_2 + - sq(delta_tower1_x-cartesian[X_AXIS]) + - sq(delta_tower1_y-cartesian[Y_AXIS]) + ) + cartesian[Z_AXIS]; + delta[Y_AXIS] = sqrt(delta_diagonal_rod_2 + - sq(delta_tower2_x-cartesian[X_AXIS]) + - sq(delta_tower2_y-cartesian[Y_AXIS]) + ) + cartesian[Z_AXIS]; + delta[Z_AXIS] = sqrt(delta_diagonal_rod_2 + - sq(delta_tower3_x-cartesian[X_AXIS]) + - sq(delta_tower3_y-cartesian[Y_AXIS]) + ) + cartesian[Z_AXIS]; + /* + SERIAL_ECHOPGM("cartesian x="); SERIAL_ECHO(cartesian[X_AXIS]); + SERIAL_ECHOPGM(" y="); SERIAL_ECHO(cartesian[Y_AXIS]); + SERIAL_ECHOPGM(" z="); SERIAL_ECHOLN(cartesian[Z_AXIS]); + + SERIAL_ECHOPGM("delta x="); SERIAL_ECHO(delta[X_AXIS]); + SERIAL_ECHOPGM(" y="); SERIAL_ECHO(delta[Y_AXIS]); + SERIAL_ECHOPGM(" z="); SERIAL_ECHOLN(delta[Z_AXIS]); + */ + } -#ifdef ENABLE_AUTO_BED_LEVELING -// Adjust print surface height by linear interpolation over the bed_level array. -int delta_grid_spacing[2] = { 0, 0 }; -void adjust_delta(float cartesian[3]) -{ - if (delta_grid_spacing[0] == 0 || delta_grid_spacing[1] == 0) - return; // G29 not done - - int half = (AUTO_BED_LEVELING_GRID_POINTS - 1) / 2; - float grid_x = max(0.001-half, min(half-0.001, cartesian[X_AXIS] / delta_grid_spacing[0])); - float grid_y = max(0.001-half, min(half-0.001, cartesian[Y_AXIS] / delta_grid_spacing[1])); - int floor_x = floor(grid_x); - int floor_y = floor(grid_y); - float ratio_x = grid_x - floor_x; - float ratio_y = grid_y - floor_y; - float z1 = bed_level[floor_x+half][floor_y+half]; - float z2 = bed_level[floor_x+half][floor_y+half+1]; - float z3 = bed_level[floor_x+half+1][floor_y+half]; - float z4 = bed_level[floor_x+half+1][floor_y+half+1]; - float left = (1-ratio_y)*z1 + ratio_y*z2; - float right = (1-ratio_y)*z3 + ratio_y*z4; - float offset = (1-ratio_x)*left + ratio_x*right; - - delta[X_AXIS] += offset; - delta[Y_AXIS] += offset; - delta[Z_AXIS] += offset; + #ifdef ENABLE_AUTO_BED_LEVELING - /* - SERIAL_ECHOPGM("grid_x="); SERIAL_ECHO(grid_x); - SERIAL_ECHOPGM(" grid_y="); SERIAL_ECHO(grid_y); - SERIAL_ECHOPGM(" floor_x="); SERIAL_ECHO(floor_x); - SERIAL_ECHOPGM(" floor_y="); SERIAL_ECHO(floor_y); - SERIAL_ECHOPGM(" ratio_x="); SERIAL_ECHO(ratio_x); - SERIAL_ECHOPGM(" ratio_y="); SERIAL_ECHO(ratio_y); - SERIAL_ECHOPGM(" z1="); SERIAL_ECHO(z1); - SERIAL_ECHOPGM(" z2="); SERIAL_ECHO(z2); - SERIAL_ECHOPGM(" z3="); SERIAL_ECHO(z3); - SERIAL_ECHOPGM(" z4="); SERIAL_ECHO(z4); - SERIAL_ECHOPGM(" left="); SERIAL_ECHO(left); - SERIAL_ECHOPGM(" right="); SERIAL_ECHO(right); - SERIAL_ECHOPGM(" offset="); SERIAL_ECHOLN(offset); - */ -} -#endif //ENABLE_AUTO_BED_LEVELING + // Adjust print surface height by linear interpolation over the bed_level array. + void adjust_delta(float cartesian[3]) { + if (delta_grid_spacing[0] == 0 || delta_grid_spacing[1] == 0) return; // G29 not done! + + int half = (AUTO_BED_LEVELING_GRID_POINTS - 1) / 2; + float h1 = 0.001 - half, h2 = half - 0.001, + grid_x = max(h1, min(h2, cartesian[X_AXIS] / delta_grid_spacing[0])), + grid_y = max(h1, min(h2, cartesian[Y_AXIS] / delta_grid_spacing[1])); + int floor_x = floor(grid_x), floor_y = floor(grid_y); + float ratio_x = grid_x - floor_x, ratio_y = grid_y - floor_y, + z1 = bed_level[floor_x + half][floor_y + half], + z2 = bed_level[floor_x + half][floor_y + half + 1], + z3 = bed_level[floor_x + half + 1][floor_y + half], + z4 = bed_level[floor_x + half + 1][floor_y + half + 1], + left = (1 - ratio_y) * z1 + ratio_y * z2, + right = (1 - ratio_y) * z3 + ratio_y * z4, + offset = (1 - ratio_x) * left + ratio_x * right; + + delta[X_AXIS] += offset; + delta[Y_AXIS] += offset; + delta[Z_AXIS] += offset; + + /* + SERIAL_ECHOPGM("grid_x="); SERIAL_ECHO(grid_x); + SERIAL_ECHOPGM(" grid_y="); SERIAL_ECHO(grid_y); + SERIAL_ECHOPGM(" floor_x="); SERIAL_ECHO(floor_x); + SERIAL_ECHOPGM(" floor_y="); SERIAL_ECHO(floor_y); + SERIAL_ECHOPGM(" ratio_x="); SERIAL_ECHO(ratio_x); + SERIAL_ECHOPGM(" ratio_y="); SERIAL_ECHO(ratio_y); + SERIAL_ECHOPGM(" z1="); SERIAL_ECHO(z1); + SERIAL_ECHOPGM(" z2="); SERIAL_ECHO(z2); + SERIAL_ECHOPGM(" z3="); SERIAL_ECHO(z3); + SERIAL_ECHOPGM(" z4="); SERIAL_ECHO(z4); + SERIAL_ECHOPGM(" left="); SERIAL_ECHO(left); + SERIAL_ECHOPGM(" right="); SERIAL_ECHO(right); + SERIAL_ECHOPGM(" offset="); SERIAL_ECHOLN(offset); + */ + } + #endif // ENABLE_AUTO_BED_LEVELING -void prepare_move_raw() -{ - previous_millis_cmd = millis(); - calculate_delta(destination); - plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], - destination[E_AXIS], feedrate*feedmultiply/60/100.0, - active_extruder); - for(int8_t i=0; i < NUM_AXIS; i++) { - current_position[i] = destination[i]; - } -} -#endif //DELTA +#endif // DELTA + +#ifdef MESH_BED_LEVELING + + #if !defined(MIN) + #define MIN(_v1, _v2) (((_v1) < (_v2)) ? (_v1) : (_v2)) + #endif // ! MIN -#if defined(MESH_BED_LEVELING) -#if !defined(MIN) -#define MIN(_v1, _v2) (((_v1) < (_v2)) ? (_v1) : (_v2)) -#endif // ! MIN // This function is used to split lines on mesh borders so each segment is only part of one mesh area void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_rate, const uint8_t &extruder, uint8_t x_splits=0xff, uint8_t y_splits=0xff) { if (!mbl.active) { plan_buffer_line(x, y, z, e, feed_rate, extruder); - for(int8_t i=0; i < NUM_AXIS; i++) { - current_position[i] = destination[i]; - } + set_current_to_destination(); return; } int pix = mbl.select_x_index(current_position[X_AXIS]); @@ -5342,9 +5446,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_ if (pix == ix && piy == iy) { // Start and end on same mesh square plan_buffer_line(x, y, z, e, feed_rate, extruder); - for(int8_t i=0; i < NUM_AXIS; i++) { - current_position[i] = destination[i]; - } + set_current_to_destination(); return; } float nx, ny, ne, normalized_dist; @@ -5375,9 +5477,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_ } else { // Already split on a border plan_buffer_line(x, y, z, e, feed_rate, extruder); - for(int8_t i=0; i < NUM_AXIS; i++) { - current_position[i] = destination[i]; - } + set_current_to_destination(); return; } // Do the split and look for more borders @@ -5392,172 +5492,177 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_ } #endif // MESH_BED_LEVELING -void prepare_move() -{ +#ifdef PREVENT_DANGEROUS_EXTRUDE + + inline float prevent_dangerous_extrude(float &curr_e, float &dest_e) { + float de = dest_e - curr_e; + if (de) { + if (degHotend(active_extruder) < extrude_min_temp) { + curr_e = dest_e; // Behave as if the move really took place, but ignore E part + SERIAL_ECHO_START; + SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); + return 0; + } + #ifdef PREVENT_LENGTHY_EXTRUDE + if (labs(de) > EXTRUDE_MAXLENGTH) { + curr_e = dest_e; // Behave as if the move really took place, but ignore E part + SERIAL_ECHO_START; + SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); + return 0; + } + #endif + } + return de; + } + +#endif // PREVENT_DANGEROUS_EXTRUDE + +void prepare_move() { clamp_to_software_endstops(destination); - previous_millis_cmd = millis(); - + refresh_cmd_timeout(); + + #ifdef PREVENT_DANGEROUS_EXTRUDE + (void)prevent_dangerous_extrude(current_position[E_AXIS], destination[E_AXIS]); + #endif + #ifdef SCARA //for now same as delta-code -float difference[NUM_AXIS]; -for (int8_t i=0; i < NUM_AXIS; i++) { - difference[i] = destination[i] - current_position[i]; -} + float difference[NUM_AXIS]; + for (int8_t i = 0; i < NUM_AXIS; i++) difference[i] = destination[i] - current_position[i]; -float cartesian_mm = sqrt( sq(difference[X_AXIS]) + - sq(difference[Y_AXIS]) + - sq(difference[Z_AXIS])); -if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); } -if (cartesian_mm < 0.000001) { return; } -float seconds = 6000 * cartesian_mm / feedrate / feedmultiply; -int steps = max(1, int(scara_segments_per_second * seconds)); - //SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm); - //SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds); - //SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps); -for (int s = 1; s <= steps; s++) { - float fraction = float(s) / float(steps); - for(int8_t i=0; i < NUM_AXIS; i++) { - destination[i] = current_position[i] + difference[i] * fraction; - } + float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS])); + if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); } + if (cartesian_mm < 0.000001) { return; } + float seconds = 6000 * cartesian_mm / feedrate / feedrate_multiplier; + int steps = max(1, int(scara_segments_per_second * seconds)); + //SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm); + //SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds); + //SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps); + + for (int s = 1; s <= steps; s++) { + float fraction = float(s) / float(steps); + for (int8_t i = 0; i < NUM_AXIS; i++) destination[i] = current_position[i] + difference[i] * fraction; - calculate_delta(destination); - //SERIAL_ECHOPGM("destination[X_AXIS]="); SERIAL_ECHOLN(destination[X_AXIS]); - //SERIAL_ECHOPGM("destination[Y_AXIS]="); SERIAL_ECHOLN(destination[Y_AXIS]); - //SERIAL_ECHOPGM("destination[Z_AXIS]="); SERIAL_ECHOLN(destination[Z_AXIS]); - //SERIAL_ECHOPGM("delta[X_AXIS]="); SERIAL_ECHOLN(delta[X_AXIS]); - //SERIAL_ECHOPGM("delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]); - //SERIAL_ECHOPGM("delta[Z_AXIS]="); SERIAL_ECHOLN(delta[Z_AXIS]); - - plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], - destination[E_AXIS], feedrate*feedmultiply/60/100.0, - active_extruder); -} -#endif // SCARA - -#ifdef DELTA - float difference[NUM_AXIS]; - for (int8_t i=0; i < NUM_AXIS; i++) { - difference[i] = destination[i] - current_position[i]; - } - float cartesian_mm = sqrt(sq(difference[X_AXIS]) + - sq(difference[Y_AXIS]) + - sq(difference[Z_AXIS])); - if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); } - if (cartesian_mm < 0.000001) { return; } - float seconds = 6000 * cartesian_mm / feedrate / feedmultiply; - int steps = max(1, int(delta_segments_per_second * seconds)); - // SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm); - // SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds); - // SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps); - for (int s = 1; s <= steps; s++) { - float fraction = float(s) / float(steps); - for(int8_t i=0; i < NUM_AXIS; i++) { - destination[i] = current_position[i] + difference[i] * fraction; + calculate_delta(destination); + //SERIAL_ECHOPGM("destination[X_AXIS]="); SERIAL_ECHOLN(destination[X_AXIS]); + //SERIAL_ECHOPGM("destination[Y_AXIS]="); SERIAL_ECHOLN(destination[Y_AXIS]); + //SERIAL_ECHOPGM("destination[Z_AXIS]="); SERIAL_ECHOLN(destination[Z_AXIS]); + //SERIAL_ECHOPGM("delta[X_AXIS]="); SERIAL_ECHOLN(delta[X_AXIS]); + //SERIAL_ECHOPGM("delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]); + //SERIAL_ECHOPGM("delta[Z_AXIS]="); SERIAL_ECHOLN(delta[Z_AXIS]); + + plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], feedrate/60*feedrate_multiplier/100.0, active_extruder); } - calculate_delta(destination); - plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], - destination[E_AXIS], feedrate*feedmultiply/60/100.0, - active_extruder); - } + + #endif // SCARA -#endif // DELTA + #ifdef DELTA -#ifdef DUAL_X_CARRIAGE - if (active_extruder_parked) - { - if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) - { - // move duplicate extruder into correct duplication position. - plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); - plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS], - current_position[E_AXIS], max_feedrate[X_AXIS], 1); - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); - st_synchronize(); - extruder_duplication_enabled = true; - active_extruder_parked = false; + float difference[NUM_AXIS]; + for (int8_t i=0; i < NUM_AXIS; i++) difference[i] = destination[i] - current_position[i]; + + float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS])); + if (cartesian_mm < 0.000001) cartesian_mm = abs(difference[E_AXIS]); + if (cartesian_mm < 0.000001) return; + float seconds = 6000 * cartesian_mm / feedrate / feedrate_multiplier; + int steps = max(1, int(delta_segments_per_second * seconds)); + + // SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm); + // SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds); + // SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps); + + for (int s = 1; s <= steps; s++) { + float fraction = float(s) / float(steps); + for (int8_t i = 0; i < NUM_AXIS; i++) destination[i] = current_position[i] + difference[i] * fraction; + calculate_delta(destination); + #ifdef ENABLE_AUTO_BED_LEVELING + adjust_delta(destination); + #endif + plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], feedrate/60*feedrate_multiplier/100.0, active_extruder); } - else if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE) // handle unparking of head - { - if (current_position[E_AXIS] == destination[E_AXIS]) - { - // this is a travel move - skit it but keep track of current position (so that it can later - // be used as start of first non-travel move) - if (delayed_move_time != 0xFFFFFFFFUL) - { - memcpy(current_position, destination, sizeof(current_position)); - if (destination[Z_AXIS] > raised_parked_position[Z_AXIS]) - raised_parked_position[Z_AXIS] = destination[Z_AXIS]; - delayed_move_time = millis(); - return; + + #endif // DELTA + + #ifdef DUAL_X_CARRIAGE + if (active_extruder_parked) { + if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) { + // move duplicate extruder into correct duplication position. + plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); + plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, + current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[X_AXIS], 1); + sync_plan_position(); + st_synchronize(); + extruder_duplication_enabled = true; + active_extruder_parked = false; + } + else if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE) { // handle unparking of head + if (current_position[E_AXIS] == destination[E_AXIS]) { + // This is a travel move (with no extrusion) + // Skip it, but keep track of the current position + // (so it can be used as the start of the next non-travel move) + if (delayed_move_time != 0xFFFFFFFFUL) { + set_current_to_destination(); + NOLESS(raised_parked_position[Z_AXIS], destination[Z_AXIS]); + delayed_move_time = millis(); + return; + } } + delayed_move_time = 0; + // unpark extruder: 1) raise, 2) move into starting XY position, 3) lower + plan_buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder); + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], min(max_feedrate[X_AXIS], max_feedrate[Y_AXIS]), active_extruder); + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder); + active_extruder_parked = false; } - delayed_move_time = 0; - // unpark extruder: 1) raise, 2) move into starting XY position, 3) lower - plan_buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder); - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], - current_position[E_AXIS], min(max_feedrate[X_AXIS],max_feedrate[Y_AXIS]), active_extruder); - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], - current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder); - active_extruder_parked = false; } - } -#endif //DUAL_X_CARRIAGE + #endif // DUAL_X_CARRIAGE -#if ! (defined DELTA || defined SCARA) - // Do not use feedmultiply for E or Z only moves - if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) { - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); - } else { -#if defined(MESH_BED_LEVELING) - mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder); - return; -#else - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder); -#endif // MESH_BED_LEVELING - } -#endif // !(DELTA || SCARA) + #if !defined(DELTA) && !defined(SCARA) + // Do not use feedrate_multiplier for E or Z only moves + if (current_position[X_AXIS] == destination[X_AXIS] && current_position[Y_AXIS] == destination[Y_AXIS]) { + line_to_destination(); + } + else { + #ifdef MESH_BED_LEVELING + mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate/60)*(feedrate_multiplier/100.0), active_extruder); + return; + #else + line_to_destination(feedrate * feedrate_multiplier / 100.0); + #endif // MESH_BED_LEVELING + } + #endif // !(DELTA || SCARA) - for(int8_t i=0; i < NUM_AXIS; i++) { - current_position[i] = destination[i]; - } + set_current_to_destination(); } void prepare_arc_move(char isclockwise) { float r = hypot(offset[X_AXIS], offset[Y_AXIS]); // Compute arc radius for mc_arc // Trace the arc - mc_arc(current_position, destination, offset, X_AXIS, Y_AXIS, Z_AXIS, feedrate*feedmultiply/60/100.0, r, isclockwise, active_extruder); + mc_arc(current_position, destination, offset, X_AXIS, Y_AXIS, Z_AXIS, feedrate*feedrate_multiplier/60/100.0, r, isclockwise, active_extruder); // As far as the parser is concerned, the position is now == target. In reality the // motion control system might still be processing the action and the real tool position // in any intermediate location. - for(int8_t i=0; i < NUM_AXIS; i++) { - current_position[i] = destination[i]; - } - previous_millis_cmd = millis(); + set_current_to_destination(); + refresh_cmd_timeout(); } -#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1 - -#if defined(FAN_PIN) - #if CONTROLLERFAN_PIN == FAN_PIN - #error "You cannot set CONTROLLERFAN_PIN equal to FAN_PIN" - #endif -#endif +#if HAS_CONTROLLERFAN -unsigned long lastMotor = 0; // Last time a motor was turned on -unsigned long lastMotorCheck = 0; // Last time the state was checked +millis_t lastMotor = 0; // Last time a motor was turned on +millis_t lastMotorCheck = 0; // Last time the state was checked void controllerFan() { - uint32_t ms = millis(); + millis_t ms = millis(); if (ms >= lastMotorCheck + 2500) { // Not a time critical function, so we only check every 2500ms lastMotorCheck = ms; if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON || soft_pwm_bed > 0 || E0_ENABLE_READ == E_ENABLE_ON // If any of the drivers are enabled... #if EXTRUDERS > 1 || E1_ENABLE_READ == E_ENABLE_ON - #if defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1 + #if HAS_X2_ENABLE || X2_ENABLE_READ == X_ENABLE_ON #endif #if EXTRUDERS > 2 @@ -5657,215 +5762,240 @@ void calculate_delta(float cartesian[3]){ #endif #ifdef TEMP_STAT_LEDS -static bool blue_led = false; -static bool red_led = false; -static uint32_t stat_update = 0; - -void handle_status_leds(void) { - float max_temp = 0.0; - if(millis() > stat_update) { - stat_update += 500; // Update every 0.5s - for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) { - max_temp = max(max_temp, degHotend(cur_extruder)); - max_temp = max(max_temp, degTargetHotend(cur_extruder)); - } - #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 - max_temp = max(max_temp, degTargetBed()); - max_temp = max(max_temp, degBed()); - #endif - if((max_temp > 55.0) && (red_led == false)) { - digitalWrite(STAT_LED_RED, 1); - digitalWrite(STAT_LED_BLUE, 0); - red_led = true; - blue_led = false; - } - if((max_temp < 54.0) && (blue_led == false)) { - digitalWrite(STAT_LED_RED, 0); - digitalWrite(STAT_LED_BLUE, 1); - red_led = false; - blue_led = true; + + static bool red_led = false; + static millis_t next_status_led_update_ms = 0; + + void handle_status_leds(void) { + float max_temp = 0.0; + if (millis() > next_status_led_update_ms) { + next_status_led_update_ms += 500; // Update every 0.5s + for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) + max_temp = max(max(max_temp, degHotend(cur_extruder)), degTargetHotend(cur_extruder)); + #if HAS_TEMP_BED + max_temp = max(max(max_temp, degTargetBed()), degBed()); + #endif + bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led; + if (new_led != red_led) { + red_led = new_led; + digitalWrite(STAT_LED_RED, new_led ? HIGH : LOW); + digitalWrite(STAT_LED_BLUE, new_led ? LOW : HIGH); + } } } -} -#endif -void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h -{ - -#if defined(KILL_PIN) && KILL_PIN > -1 - static int killCount = 0; // make the inactivity button a bit less responsive - const int KILL_DELAY = 750; #endif -#if defined(FILRUNOUT_PIN) && FILRUNOUT_PIN > -1 - if(card.sdprinting) { - if(!(READ(FILRUNOUT_PIN))^FIL_RUNOUT_INVERTING) - filrunout(); } -#endif +void enable_all_steppers() { + enable_x(); + enable_y(); + enable_z(); + enable_e0(); + enable_e1(); + enable_e2(); + enable_e3(); +} -#if defined(HOME_PIN) && HOME_PIN > -1 - static int homeDebounceCount = 0; // poor man's debouncing count - const int HOME_DEBOUNCE_DELAY = 750; -#endif - - - if(buflen < (BUFSIZE-1)) - get_command(); - - if( (millis() - previous_millis_cmd) > max_inactive_time ) - if(max_inactive_time) - kill(); - if(stepper_inactive_time) { - if( (millis() - previous_millis_cmd) > stepper_inactive_time ) - { - if(blocks_queued() == false && ignore_stepper_queue == false) { - disable_x(); - disable_y(); - disable_z(); - disable_e0(); - disable_e1(); - disable_e2(); - disable_e3(); - } - } - } +void disable_all_steppers() { + disable_x(); + disable_y(); + disable_z(); + disable_e0(); + disable_e1(); + disable_e2(); + disable_e3(); +} + +/** + * Manage several activities: + * - Check for Filament Runout + * - Keep the command buffer full + * - Check for maximum inactive time between commands + * - Check for maximum inactive time between stepper commands + * - Check if pin CHDK needs to go LOW + * - Check for KILL button held down + * - 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) + */ +void manage_inactivity(bool ignore_stepper_queue/*=false*/) { - #ifdef CHDK //Check if pin should be set to LOW after M240 set it to HIGH - if (chdkActive && (millis() - chdkHigh > CHDK_DELAY)) - { + #if HAS_FILRUNOUT + if (card.sdprinting && !(READ(FILRUNOUT_PIN) ^ FIL_RUNOUT_INVERTING)) + filrunout(); + #endif + + if (commands_in_queue < BUFSIZE - 1) get_command(); + + millis_t ms = millis(); + + if (max_inactive_time && ms > previous_cmd_ms + max_inactive_time) kill(); + + if (stepper_inactive_time && ms > previous_cmd_ms + stepper_inactive_time + && !ignore_stepper_queue && !blocks_queued()) + disable_all_steppers(); + + #ifdef CHDK // Check if pin should be set to LOW after M240 set it to HIGH + if (chdkActive && ms > chdkHigh + CHDK_DELAY) { chdkActive = false; WRITE(CHDK, LOW); } #endif - - #if defined(KILL_PIN) && KILL_PIN > -1 + + #if HAS_KILL // Check if the kill button was pressed and wait just in case it was an accidental // key kill key press // ------------------------------------------------------------------------------- - if( 0 == READ(KILL_PIN) ) - { + static int killCount = 0; // make the inactivity button a bit less responsive + const int KILL_DELAY = 750; + if (!READ(KILL_PIN)) killCount++; - } else if (killCount > 0) - { killCount--; - } + // Exceeded threshold and we can confirm that it was not accidental // KILL the machine // ---------------------------------------------------------------- - if ( killCount >= KILL_DELAY) - { - kill(); - } + if (killCount >= KILL_DELAY) kill(); #endif -#if defined(HOME_PIN) && HOME_PIN > -1 + #if HAS_HOME // Check to see if we have to home, use poor man's debouncer // --------------------------------------------------------- - if ( 0 == READ(HOME_PIN) ) - { - if (homeDebounceCount == 0) - { - enquecommands_P((PSTR("G28"))); - homeDebounceCount++; - LCD_ALERTMESSAGEPGM(MSG_AUTO_HOME); - } - else if (homeDebounceCount < HOME_DEBOUNCE_DELAY) - { - homeDebounceCount++; - } - else - { - homeDebounceCount = 0; - } + static int homeDebounceCount = 0; // poor man's debouncing count + const int HOME_DEBOUNCE_DELAY = 750; + if (!READ(HOME_PIN)) { + if (!homeDebounceCount) { + enqueuecommands_P(PSTR("G28")); + LCD_ALERTMESSAGEPGM(MSG_AUTO_HOME); + } + if (homeDebounceCount < HOME_DEBOUNCE_DELAY) + homeDebounceCount++; + else + homeDebounceCount = 0; } -#endif + #endif - #if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1 - controllerFan(); //Check if fan should be turned on to cool stepper drivers down + #if HAS_CONTROLLERFAN + controllerFan(); // Check if fan should be turned on to cool stepper drivers down #endif + #ifdef EXTRUDER_RUNOUT_PREVENT - if( (millis() - previous_millis_cmd) > EXTRUDER_RUNOUT_SECONDS*1000 ) - if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP) - { - bool oldstatus=E0_ENABLE_READ; - enable_e0(); - float oldepos=current_position[E_AXIS]; - float oldedes=destination[E_AXIS]; - plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], - destination[E_AXIS]+EXTRUDER_RUNOUT_EXTRUDE*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], - EXTRUDER_RUNOUT_SPEED/60.*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], active_extruder); - current_position[E_AXIS]=oldepos; - destination[E_AXIS]=oldedes; - plan_set_e_position(oldepos); - previous_millis_cmd=millis(); - st_synchronize(); - E0_ENABLE_WRITE(oldstatus); + if (ms > previous_cmd_ms + EXTRUDER_RUNOUT_SECONDS * 1000) + if (degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP) { + bool oldstatus; + switch(active_extruder) { + case 0: + oldstatus = E0_ENABLE_READ; + enable_e0(); + break; + #if EXTRUDERS > 1 + case 1: + oldstatus = E1_ENABLE_READ; + enable_e1(); + break; + #if EXTRUDERS > 2 + case 2: + oldstatus = E2_ENABLE_READ; + enable_e2(); + break; + #if EXTRUDERS > 3 + case 3: + oldstatus = E3_ENABLE_READ; + enable_e3(); + break; + #endif + #endif + #endif + } + float oldepos = current_position[E_AXIS], oldedes = destination[E_AXIS]; + plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], + destination[E_AXIS] + EXTRUDER_RUNOUT_EXTRUDE * EXTRUDER_RUNOUT_ESTEPS / axis_steps_per_unit[E_AXIS], + EXTRUDER_RUNOUT_SPEED / 60. * EXTRUDER_RUNOUT_ESTEPS / axis_steps_per_unit[E_AXIS], active_extruder); + current_position[E_AXIS] = oldepos; + destination[E_AXIS] = oldedes; + plan_set_e_position(oldepos); + previous_cmd_ms = ms; // refresh_cmd_timeout() + st_synchronize(); + switch(active_extruder) { + case 0: + E0_ENABLE_WRITE(oldstatus); + break; + #if EXTRUDERS > 1 + case 1: + E1_ENABLE_WRITE(oldstatus); + break; + #if EXTRUDERS > 2 + case 2: + E2_ENABLE_WRITE(oldstatus); + break; + #if EXTRUDERS > 3 + case 3: + E3_ENABLE_WRITE(oldstatus); + break; + #endif + #endif + #endif + } } #endif - #if defined(DUAL_X_CARRIAGE) + + #ifdef DUAL_X_CARRIAGE // handle delayed move timeout - if (delayed_move_time != 0 && (millis() - delayed_move_time) > 1000 && Stopped == false) - { + if (delayed_move_time && ms > delayed_move_time + 1000 && IsRunning()) { // travel moves have been received so enact them delayed_move_time = 0xFFFFFFFFUL; // force moves to be done - memcpy(destination,current_position,sizeof(destination)); + set_destination_to_current(); prepare_move(); } #endif + #ifdef TEMP_STAT_LEDS - handle_status_leds(); + handle_status_leds(); #endif + check_axes_activity(); } void kill() { cli(); // Stop interrupts - disable_heater(); + disable_all_heaters(); - disable_x(); - disable_y(); - disable_z(); - disable_e0(); - disable_e1(); - disable_e2(); - disable_e3(); + disable_all_steppers(); + + #if HAS_POWER_SWITCH + pinMode(PS_ON_PIN, INPUT); + #endif -#if defined(PS_ON_PIN) && PS_ON_PIN > -1 - pinMode(PS_ON_PIN,INPUT); -#endif SERIAL_ERROR_START; SERIAL_ERRORLNPGM(MSG_ERR_KILLED); LCD_ALERTMESSAGEPGM(MSG_KILLED); // FMC small patch to update the LCD before ending sei(); // enable interrupts - for ( int i=5; i--; lcd_update()) - { - delay(200); - } + for (int i = 5; i--; lcd_update()) delay(200); // Wait a short time cli(); // disable interrupts suicide(); while(1) { /* Intentionally left empty */ } // Wait for reset } #ifdef FILAMENT_RUNOUT_SENSOR - void filrunout() - { - if filrunoutEnqued == false { - filrunoutEnqued = true; - enquecommand("M600"); - } - } + + void filrunout() { + if (!filrunoutEnqueued) { + filrunoutEnqueued = true; + enqueuecommand("M600"); + } + } + #endif -void Stop() -{ - disable_heater(); - if(Stopped == false) { - Stopped = true; +void Stop() { + disable_all_heaters(); + if (IsRunning()) { + Running = false; Stopped_gcode_LastN = gcode_LastN; // Save last g_code for restart SERIAL_ERROR_START; SERIAL_ERRORLNPGM(MSG_ERR_STOPPED); @@ -5873,8 +6003,6 @@ void Stop() } } -bool IsStopped() { return Stopped; }; - #ifdef FAST_PWM_FAN void setPwmFrequency(uint8_t pin, int val) { @@ -5946,10 +6074,10 @@ void setPwmFrequency(uint8_t pin, int val) #endif //FAST_PWM_FAN bool setTargetedHotend(int code){ - tmp_extruder = active_extruder; - if(code_seen('T')) { - tmp_extruder = code_value(); - if(tmp_extruder >= EXTRUDERS) { + target_extruder = active_extruder; + if (code_seen('T')) { + target_extruder = code_value_short(); + if (target_extruder >= EXTRUDERS) { SERIAL_ECHO_START; switch(code){ case 104: @@ -5968,7 +6096,7 @@ bool setTargetedHotend(int code){ SERIAL_ECHO(MSG_M221_INVALID_EXTRUDER); break; } - SERIAL_ECHOLN(tmp_extruder); + SERIAL_ECHOLN(target_extruder); return true; } } diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index a8937b44b..857976bc3 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -17,8 +17,11 @@ * Progress Bar */ #ifdef LCD_PROGRESS_BAR + #ifndef SDSUPPORT + #error LCD_PROGRESS_BAR requires SDSUPPORT. + #endif #ifdef DOGLCD - #warning LCD_PROGRESS_BAR does not apply to graphical displays. + #error LCD_PROGRESS_BAR does not apply to graphical displays. #endif #ifdef FILAMENT_LCD_DISPLAY #error LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both. @@ -53,7 +56,7 @@ #if EXTRUDERS > 1 #if EXTRUDERS > 4 - #error The maximum number of EXTRUDERS is 4. + #error The maximum number of EXTRUDERS in Marlin is 4. #endif #ifdef TEMP_SENSOR_1_AS_REDUNDANT @@ -74,6 +77,13 @@ #endif // EXTRUDERS > 1 + /** + * Limited number of servos + */ + #if NUM_SERVOS > 4 + #error The maximum number of SERVOS in Marlin is 4. + #endif + /** * Required LCD language */ @@ -81,6 +91,21 @@ #error You must enable either DISPLAY_CHARSET_HD44780_JAPAN or DISPLAY_CHARSET_HD44780_WESTERN for your LCD controller. #endif + /** + * Mesh Bed Leveling + */ + #ifdef MESH_BED_LEVELING + #ifdef DELTA + #error MESH_BED_LEVELING does not yet support DELTA printers + #endif + #ifdef ENABLE_AUTO_BED_LEVELING + #error Select ENABLE_AUTO_BED_LEVELING or MESH_BED_LEVELING, not both + #endif + #if MESH_NUM_X_POINTS > 7 || MESH_NUM_Y_POINTS > 7 + #error MESH_NUM_X_POINTS and MESH_NUM_Y_POINTS need to be less than 8 + #endif + #endif + /** * Auto Bed Leveling */ @@ -90,13 +115,39 @@ * Require a Z Min pin */ #if Z_MIN_PIN == -1 - #ifdef Z_PROBE_REPEATABILITY_TEST - #error You must have a Z_MIN endstop to enable Z_PROBE_REPEATABILITY_TEST. - #else - #error ENABLE_AUTO_BED_LEVELING requires a Z_MIN endstop. Z_MIN_PIN must point to a valid hardware pin. + #if Z_PROBE_PIN == -1 || (!defined(Z_PROBE_ENDSTOP) || defined(DISABLE_Z_PROBE_ENDSTOP)) // It's possible for someone to set a pin for the Z Probe, but not enable it. + #ifdef Z_PROBE_REPEATABILITY_TEST + #error You must have a Z_MIN or Z_PROBE endstop to enable Z_PROBE_REPEATABILITY_TEST. + #else + #error ENABLE_AUTO_BED_LEVELING requires a Z_MIN or Z_PROBE endstop. Z_MIN_PIN or Z_PROBE_PIN must point to a valid hardware pin. + #endif #endif #endif + /** + * Require a Z Probe Pin if Z_PROBE_ENDSTOP is enabled. + */ + #if defined(Z_PROBE_ENDSTOP) + #ifndef Z_PROBE_PIN + #error You must have a Z_PROBE_PIN defined in your pins_XXXX.h file if you enable Z_PROBE_ENDSTOP + #endif + #if Z_PROBE_PIN == -1 + #error You must set Z_PROBE_PIN to a valid pin if you enable Z_PROBE_ENDSTOP + #endif +// Forcing Servo definitions can break some hall effect sensor setups. Leaving these here for further comment. +// #ifndef NUM_SERVOS +// #error You must have NUM_SERVOS defined and there must be at least 1 configured to use Z_PROBE_ENDSTOP +// #endif +// #if defined(NUM_SERVOS) && NUM_SERVOS < 1 +// #error You must have at least 1 servo defined for NUM_SERVOS to use Z_PROBE_ENDSTOP +// #endif +// #ifndef SERVO_ENDSTOPS +// #error You must have SERVO_ENDSTOPS defined and have the Z index set to at least 0 or above to use Z_PROBE_ENDSTOP +// #endif +// #ifndef SERVO_ENDSTOP_ANGLES +// #error You must have SERVO_ENDSTOP_ANGLES defined for Z Extend and Retract to use Z_PROBE_AND_ENSTOP +// #endif + #endif /** * Check if Probe_Offset * Grid Points is greater than Probing Range */ @@ -104,13 +155,13 @@ // Make sure probing points are reachable #if LEFT_PROBE_BED_POSITION < MIN_PROBE_X - #error The given LEFT_PROBE_BED_POSITION can't be reached by the probe. + #error "The given LEFT_PROBE_BED_POSITION can't be reached by the probe." #elif RIGHT_PROBE_BED_POSITION > MAX_PROBE_X - #error The given RIGHT_PROBE_BED_POSITION can't be reached by the probe. + #error "The given RIGHT_PROBE_BED_POSITION can't be reached by the probe." #elif FRONT_PROBE_BED_POSITION < MIN_PROBE_Y - #error The given FRONT_PROBE_BED_POSITION can't be reached by the probe. + #error "The given FRONT_PROBE_BED_POSITION can't be reached by the probe." #elif BACK_PROBE_BED_POSITION > MAX_PROBE_Y - #error The given BACK_PROBE_BED_POSITION can't be reached by the probe. + #error "The given BACK_PROBE_BED_POSITION can't be reached by the probe." #endif #define PROBE_SIZE_X (X_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1)) @@ -135,7 +186,7 @@ #define Y_PROBE_ERROR #endif #ifdef Y_PROBE_ERROR - #error The Y axis probing range is to small to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS + #error The Y axis probing range is too small to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS #endif #undef PROBE_SIZE_X @@ -206,9 +257,9 @@ */ #ifdef DUAL_X_CARRIAGE #if EXTRUDERS == 1 || defined(COREXY) \ - || !defined(X2_ENABLE_PIN) || !defined(X2_STEP_PIN) || !defined(X2_DIR_PIN) \ + || !HAS_X2_ENABLE || !HAS_X2_STEP || !HAS_X2_DIR \ || !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS) \ - || !defined(X_MAX_PIN) || X_MAX_PIN < 0 + || !HAS_X_MAX #error Missing or invalid definitions for DUAL_X_CARRIAGE mode. #endif #if X_HOME_DIR != -1 || X2_HOME_DIR != 1 @@ -231,6 +282,10 @@ #endif #endif + #if HAS_FAN && CONTROLLERFAN_PIN == FAN_PIN + #error You cannot set CONTROLLERFAN_PIN equal to FAN_PIN + #endif + /** * Test required HEATER defines */ @@ -251,4 +306,11 @@ #error HEATER_0_PIN not defined for this board #endif + /** + * Warnings for old configurations + */ + #ifdef X_HOME_RETRACT_MM + #error [XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM + #endif + #endif //SANITYCHECK_H diff --git a/Marlin/Sd2PinMap.h b/Marlin/Sd2PinMap.h index a94b9b3dc..97fea8bb0 100644 --- a/Marlin/Sd2PinMap.h +++ b/Marlin/Sd2PinMap.h @@ -312,6 +312,75 @@ static const pin_map_t digitalPinMap[] = { {&DDRC, &PINC, &PORTC, 4}, // C4 18 {&DDRC, &PINC, &PORTC, 5} // C5 19 }; +#elif defined(__AVR_ATmega1281__) +// Waspmote + +// Two Wire (aka I2C) ports +uint8_t const SDA_PIN = 41; +uint8_t const SCL_PIN = 40; + + +#undef MOSI_PIN +#undef MISO_PIN +// SPI port +uint8_t const SS_PIN = 16; // B0 +uint8_t const MOSI_PIN = 11; // B2 +uint8_t const MISO_PIN = 12; // B3 +uint8_t const SCK_PIN = 10; // B1 + +static const pin_map_t digitalPinMap[] = { + {&DDRE, &PINE, &PORTE, 0}, // E0 0 + {&DDRE, &PINE, &PORTE, 1}, // E1 1 + {&DDRE, &PINE, &PORTE, 3}, // E3 2 + {&DDRE, &PINE, &PORTE, 4}, // E4 3 + {&DDRC, &PINC, &PORTC, 4}, // C4 4 + {&DDRC, &PINC, &PORTC, 5}, // C5 5 + {&DDRC, &PINC, &PORTC, 6}, // C6 6 + {&DDRC, &PINC, &PORTC, 7}, // C7 7 + {&DDRA, &PINA, &PORTA, 2}, // A2 8 + {&DDRA, &PINA, &PORTA, 3}, // A3 9 + {&DDRA, &PINA, &PORTA, 4}, // A4 10 + {&DDRD, &PIND, &PORTD, 5}, // D5 11 + {&DDRD, &PIND, &PORTD, 6}, // D6 12 + {&DDRC, &PINC, &PORTC, 1}, // C1 13 + {&DDRF, &PINF, &PORTF, 1}, // F1 14 + {&DDRF, &PINF, &PORTF, 2}, // F2 15 + {&DDRF, &PINF, &PORTF, 3}, // F3 16 + {&DDRF, &PINF, &PORTF, 4}, // F4 17 + {&DDRF, &PINF, &PORTF, 5}, // F5 18 + {&DDRF, &PINF, &PORTF, 6}, // F6 19 + {&DDRF, &PINF, &PORTF, 7}, // F7 20 + {&DDRF, &PINF, &PORTF, 0}, // F0 21 + {&DDRA, &PINA, &PORTA, 1}, // A1 22 + {&DDRD, &PIND, &PORTD, 7}, // D7 23 + {&DDRE, &PINE, &PORTE, 5}, // E5 24 + {&DDRA, &PINA, &PORTA, 6}, // A6 25 + {&DDRE, &PINE, &PORTE, 2}, // E2 26 + {&DDRA, &PINA, &PORTA, 5}, // A5 27 + {&DDRC, &PINC, &PORTC, 0}, // C0 28 + {&DDRB, &PINB, &PORTB, 0}, // B0 29 + {&DDRB, &PINB, &PORTB, 1}, // B1 30 + {&DDRB, &PINB, &PORTB, 2}, // B2 31 + {&DDRB, &PINB, &PORTB, 3}, // B3 32 + {&DDRB, &PINB, &PORTB, 4}, // B4 33 + {&DDRB, &PINB, &PORTB, 5}, // B5 34 + {&DDRA, &PINA, &PORTA, 0}, // A0 35 + {&DDRB, &PINB, &PORTB, 6}, // B6 36 + {&DDRB, &PINB, &PORTB, 7}, // B7 37 + {&DDRE, &PINE, &PORTE, 6}, // E6 38 + {&DDRE, &PINE, &PORTE, 7}, // E7 39 + {&DDRD, &PIND, &PORTD, 0}, // D0 40 + {&DDRD, &PIND, &PORTD, 1}, // D1 41 + {&DDRC, &PINC, &PORTC, 3}, // C3 42 + {&DDRD, &PIND, &PORTD, 2}, // D2 43 + {&DDRD, &PIND, &PORTD, 3}, // D3 44 + {&DDRA, &PINA, &PORTA, 7}, // A7 45 + {&DDRC, &PINC, &PORTC, 2}, // C2 46 + {&DDRD, &PIND, &PORTD, 4}, // D4 47 + {&DDRG, &PING, &PORTG, 2}, // G2 48 + {&DDRG, &PING, &PORTG, 1}, // G1 49 + {&DDRG, &PING, &PORTG, 0}, // G0 50 +}; #else // defined(__AVR_ATmega1280__) #error unknown chip #endif // defined(__AVR_ATmega1280__) @@ -364,4 +433,4 @@ static inline __attribute__((always_inline)) #endif // Sd2PinMap_h -#endif \ No newline at end of file +#endif diff --git a/Marlin/Servo.h b/Marlin/Servo.h index bbdf6bf0a..682a3b379 100644 --- a/Marlin/Servo.h +++ b/Marlin/Servo.h @@ -123,7 +123,7 @@ class Servo { int read(); // returns current pulse width as an angle between 0 and 180 degrees int readMicroseconds(); // returns current pulse width in microseconds for this servo (was read_us() in first release) bool attached(); // return true if this servo is attached, otherwise false - #if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0) + #if defined(ENABLE_AUTO_BED_LEVELING) && PROBE_SERVO_DEACTIVATION_DELAY > 0 int pin; // store the hardware pin of the servo #endif private: diff --git a/Marlin/boards.h b/Marlin/boards.h index a8c980097..8a60f011d 100644 --- a/Marlin/boards.h +++ b/Marlin/boards.h @@ -37,6 +37,7 @@ #define BOARD_BRAINWAVE 82 // Brainwave (AT90USB646) #define BOARD_SAV_MKI 83 // SAV Mk-I (AT90USB1286) #define BOARD_TEENSY2 84 // Teensy++2.0 (AT90USB1286) - CLI compile: DEFINES=AT90USBxx_TEENSYPP_ASSIGNMENTS HARDWARE_MOTHERBOARD=84 make +#define BOARD_BRAINWAVE_PRO 85 // Brainwave Pro (AT90USB1286) #define BOARD_GEN3_PLUS 9 // Gen3+ #define BOARD_GEN3_MONOLITHIC 22 // Gen3 Monolithic Electronics #define BOARD_MEGATRONICS 70 // Megatronics diff --git a/Marlin/cardreader.cpp b/Marlin/cardreader.cpp index 125caab01..639b4f244 100644 --- a/Marlin/cardreader.cpp +++ b/Marlin/cardreader.cpp @@ -25,7 +25,7 @@ CardReader::CardReader() { OUT_WRITE(SDPOWER, HIGH); #endif //SDPOWER - autostart_atmillis = millis() + 5000; + next_autostart_ms = millis() + 5000; } char *createFilename(char *buffer, const dir_t &p) { //buffer > 12characters @@ -249,7 +249,7 @@ void CardReader::openFile(char* name, bool read, bool replace_current/*=true*/) if (!myDir.open(curDir, subdirname, O_READ)) { SERIAL_PROTOCOLPGM(MSG_SD_OPEN_FILE_FAIL); SERIAL_PROTOCOL(subdirname); - SERIAL_PROTOCOLLNPGM("."); + SERIAL_PROTOCOLCHAR('.'); return; } else { @@ -287,14 +287,14 @@ void CardReader::openFile(char* name, bool read, bool replace_current/*=true*/) else { SERIAL_PROTOCOLPGM(MSG_SD_OPEN_FILE_FAIL); SERIAL_PROTOCOL(fname); - SERIAL_PROTOCOLLNPGM("."); + SERIAL_PROTOCOLCHAR('.'); } } else { //write if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) { SERIAL_PROTOCOLPGM(MSG_SD_OPEN_FILE_FAIL); SERIAL_PROTOCOL(fname); - SERIAL_PROTOCOLLNPGM("."); + SERIAL_PROTOCOLCHAR('.'); } else { saving = true; @@ -330,7 +330,7 @@ void CardReader::removeFile(char* name) { if (!myDir.open(curDir, subdirname, O_READ)) { SERIAL_PROTOCOLPGM("open failed, File: "); SERIAL_PROTOCOL(subdirname); - SERIAL_PROTOCOLLNPGM("."); + SERIAL_PROTOCOLCHAR('.'); return; } else { @@ -360,7 +360,7 @@ void CardReader::removeFile(char* name) { else { SERIAL_PROTOCOLPGM("Deletion failed, File: "); SERIAL_PROTOCOL(fname); - SERIAL_PROTOCOLLNPGM("."); + SERIAL_PROTOCOLCHAR('.'); } } @@ -368,7 +368,7 @@ void CardReader::getStatus() { if (cardOK) { SERIAL_PROTOCOLPGM(MSG_SD_PRINTING_BYTE); SERIAL_PROTOCOL(sdpos); - SERIAL_PROTOCOLPGM("/"); + SERIAL_PROTOCOLCHAR('/'); SERIAL_PROTOCOLLN(filesize); } else { @@ -397,7 +397,7 @@ void CardReader::write_command(char *buf) { } void CardReader::checkautostart(bool force) { - if (!force && (!autostart_stilltocheck || autostart_atmillis < millis())) + if (!force && (!autostart_stilltocheck || next_autostart_ms < millis())) return; autostart_stilltocheck = false; @@ -421,8 +421,8 @@ void CardReader::checkautostart(bool force) { if (p.name[9] != '~' && strncmp((char*)p.name, autoname, 5) == 0) { char cmd[30]; sprintf_P(cmd, PSTR("M23 %s"), autoname); - enquecommand(cmd); - enquecommands_P(PSTR("M24")); + enqueuecommand(cmd); + enqueuecommands_P(PSTR("M24")); found = true; } } @@ -489,7 +489,7 @@ void CardReader::updir() { if (workDirDepth > 0) { --workDirDepth; workDir = workDirParents[0]; - for (int d = 0; d < workDirDepth; d++) + for (uint16_t d = 0; d < workDirDepth; d++) workDirParents[d] = workDirParents[d+1]; } } @@ -508,7 +508,7 @@ void CardReader::printingHasFinished() { sdprinting = false; if (SD_FINISHED_STEPPERRELEASE) { //finishAndDisableSteppers(); - enquecommands_P(PSTR(SD_FINISHED_RELEASECOMMAND)); + enqueuecommands_P(PSTR(SD_FINISHED_RELEASECOMMAND)); } autotempShutdown(); } diff --git a/Marlin/cardreader.h b/Marlin/cardreader.h index b55d09a65..03d4303e3 100644 --- a/Marlin/cardreader.h +++ b/Marlin/cardreader.h @@ -62,7 +62,7 @@ private: uint32_t filespos[SD_PROCEDURE_DEPTH]; char filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH]; uint32_t filesize; - unsigned long autostart_atmillis; + millis_t next_autostart_ms; uint32_t sdpos; bool autostart_stilltocheck; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware. diff --git a/Marlin/configurator/config/Configuration.h b/Marlin/configurator/config/Configuration.h index 71cbdebae..2b2175cc4 100644 --- a/Marlin/configurator/config/Configuration.h +++ b/Marlin/configurator/config/Configuration.h @@ -31,7 +31,7 @@ Here are some standard links for getting your machine calibrated: //=========================================================================== //============================= SCARA Printer =============================== //=========================================================================== -// For a Delta printer replace the configuration files with the files in the +// For a Scara printer replace the configuration files with the files in the // example_configurations/SCARA directory. // @@ -40,7 +40,7 @@ Here are some standard links for getting your machine calibrated: // 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_VERSION "1.0.2" +#define STRING_VERSION "1.0.3 dev" #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. @@ -65,11 +65,12 @@ Here are some standard links for getting your machine calibrated: // 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 + #define MOTHERBOARD BOARD_RAMPS_13_EFB #endif -// Define this to set a custom name for your generic Mendel, -// #define CUSTOM_MENDEL_NAME "This Mendel" +// 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) @@ -79,10 +80,17 @@ Here are some standard links for getting your machine calibrated: // :[1,2,3,4] #define EXTRUDERS 1 +// 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 EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis +//#define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis + //// The following define selects which power supply you have. Please choose the one that matches your setup // 1 = ATX // 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC) // :{1:'ATX',2:'X-Box 360'} + #define POWER_SUPPLY 1 // Define this to have the electronics keep the power supply off on startup. If you don't know what this is leave it. @@ -113,7 +121,7 @@ Here are some standard links for getting your machine calibrated: // 10 is 100k RS thermistor 198-961 (4.7k pullup) // 11 is 100k beta 3950 1% thermistor (4.7k pullup) // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) -// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" // 20 is the PT100 circuit found in the Ultimainboard V2.x // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // @@ -127,13 +135,13 @@ Here are some standard links for getting your machine calibrated: // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup // 110 is Pt100 with 1k pullup (non standard) -// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. +// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. // Use it for Testing or Development purposes. NEVER for production machine. // #define DUMMY_THERMISTOR_998_VALUE 25 // #define DUMMY_THERMISTOR_999_VALUE 100 -// :{ 0: "Not used", 4: "10k !! do not use for a hotend. Bad resolution at high temp. !!", 1: "100k / 4.7k - EPCOS", 51: "100k / 1k - EPCOS", 6: "100k / 4.7k EPCOS - Not as accurate as Table 1", 5: "100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", 7: "100k / 4.7k Honeywell 135-104LAG-J01", 71: "100k / 4.7k Honeywell 135-104LAF-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'", 60: "100k Maker's Tool Works Kapton Bed Thermistor beta=3950", 55: "100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", 2: "200k / 4.7k - ATC Semitec 204GT-2", 52: "200k / 1k - ATC Semitec 204GT-2", '-2': "Thermocouple + MAX6675 (only for sensor 0)", '-1': "Thermocouple + AD595", 3: "Mendel-parts / 4.7k", 1047: "Pt1000 / 4.7k", 1010: "Pt1000 / 1k (non standard)", 20: "PT100 (Ultimainboard V2.x)", 147: "Pt100 / 4.7k", 110: "Pt100 / 1k (non-standard)", 998: "Dummy 1", 999: "Dummy 2" } -#define TEMP_SENSOR_0 -1 -#define TEMP_SENSOR_1 -1 +// :{ '0': "Not used", '4': "10k !! do not use for a hotend. Bad resolution at high temp. !!", '1': "100k / 4.7k - EPCOS", '51': "100k / 1k - EPCOS", '6': "100k / 4.7k EPCOS - Not as accurate as Table 1", '5': "100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '7': "100k / 4.7k Honeywell 135-104LAG-J01", '71': "100k / 4.7k Honeywell 135-104LAF-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'", '60': "100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '55': "100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '2': "200k / 4.7k - ATC Semitec 204GT-2", '52': "200k / 1k - ATC Semitec 204GT-2", '-2': "Thermocouple + MAX6675 (only for sensor 0)", '-1': "Thermocouple + AD595", '3': "Mendel-parts / 4.7k", '1047': "Pt1000 / 4.7k", '1010': "Pt1000 / 1k (non standard)", '20': "PT100 (Ultimainboard V2.x)", '147': "Pt100 / 4.7k", '110': "Pt100 / 1k (non-standard)", '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_BED 0 @@ -193,7 +201,6 @@ Here are some standard links for getting your machine calibrated: // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term #define K1 0.95 //smoothing factor within the PID - #define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // Ultimaker @@ -218,7 +225,7 @@ Here are some standard links for getting your machine calibrated: // Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis // // Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. -// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// If your PID_dT is the default, and correct for your hardware/configuration, that means 7.689Hz, // which is fine for driving a square wave into a resistive load and does not significantly impact you 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, you probably @@ -275,15 +282,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua The system will turn the heater on forever, burning up the filament and anything else around. -After the temperature reaches the target for the first time, this feature will -start measuring for how long the current temperature stays below the target +After the temperature reaches the target for the first time, this feature will +start measuring for how long the current temperature stays below the target minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS). If it stays longer than _PERIOD, it means the thermistor temperature cannot catch up with the target, so something *may be* wrong. Then, to be on the safe side, the system will he halt. -Bear in mind the count down will just start AFTER the first time the +Bear in mind the count down will just start AFTER the first time the thermistor temperature is over the target, so you will have no problem if your extruder heater takes 2 minutes to hit the target on heating. @@ -328,19 +335,26 @@ your extruder heater takes 2 minutes to hit the target on heating. // #define ENDSTOPPULLUP_XMIN // #define ENDSTOPPULLUP_YMIN // #define ENDSTOPPULLUP_ZMIN + // #define ENDSTOPPULLUP_ZPROBE #endif -// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. -const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. -const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. -const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. -const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. -const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. -const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). +const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. //#define DISABLE_MAX_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS // @section machine +// If you want to enable the Z Probe pin, but disable its use, uncomment the line below. +// This only affects a Z Probe Endstop if you have separate Z min endstop as well and have +// activated Z_PROBE_ENDSTOP below. If you are using the Z Min endstop on your Z Probe, +// this has no effect. +//#define DISABLE_Z_PROBE_ENDSTOP // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 // :{0:'Low',1:'High'} @@ -362,17 +376,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // @section machine // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. -#define INVERT_X_DIR true // for Mendel set to false, for Orca set to true -#define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false -#define INVERT_Z_DIR true // for Mendel set to false, for Orca set to true +#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 // Direct drive extruder v9: true. Geared extruder: false -#define INVERT_E1_DIR false // Direct drive extruder v9: true. Geared extruder: false -#define INVERT_E2_DIR false // Direct drive extruder v9: true. Geared extruder: false -#define INVERT_E3_DIR false // Direct drive extruder v9: true. Geared extruder: false +#define INVERT_E0_DIR false +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false // @section homing @@ -392,8 +406,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define X_MIN_POS 0 #define Y_MIN_POS 0 #define Z_MIN_POS 0 -#define X_MAX_POS 205 -#define Y_MAX_POS 205 +#define X_MAX_POS 200 +#define Y_MAX_POS 200 #define Z_MAX_POS 200 //=========================================================================== @@ -413,7 +427,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // #define MANUAL_BED_LEVELING // Add display menu option for bed leveling // #define MESH_BED_LEVELING // Enable mesh bed leveling -#if defined(MESH_BED_LEVELING) +#ifdef MANUAL_BED_LEVELING + #define MBL_Z_STEP 0.025 +#endif // MANUAL_BED_LEVELING + +#ifdef MESH_BED_LEVELING #define MESH_MIN_X 10 #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MIN_Y 10 @@ -456,11 +474,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define FRONT_PROBE_BED_POSITION 20 #define BACK_PROBE_BED_POSITION 170 + #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this + // Set the number of grid points per dimension // You probably don't need more than 3 (squared=9) #define AUTO_BED_LEVELING_GRID_POINTS 2 - #else // !AUTO_BED_LEVELING_GRID // Arbitrary points to probe. A simple cross-product @@ -474,11 +493,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif // AUTO_BED_LEVELING_GRID - // Offsets to the probe relative to the extruder tip (Hotend - Probe) // X and Y offsets must be integers - #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // -left +right - #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // -front +behind + #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // Probe on: -left +right + #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // Probe on: -front +behind #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35 // -below (always!) #define Z_RAISE_BEFORE_HOMING 4 // (in mm) Raise Z before homing (G28) for Probe Clearance. @@ -486,9 +504,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min - #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. + #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points + #define Z_RAISE_AFTER_PROBING 15 //How much the extruder will be raised after the last probing point. +// #define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" //These commands will be executed in the end of G29 routine. + //Useful to retract a deployable probe. + //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#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. @@ -516,6 +538,20 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif + // Support for a dedicated Z PROBE endstop separate from the Z MIN endstop. + // If you would like to use both a Z PROBE and a Z MIN endstop together or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP and read the instructions below. + // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. + // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. + // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 + // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. + // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. + // D32 is currently selected in the RAMPS 1.3/1.4 pin file. All other boards will need changes to the respective pins_XXXXX.h file. + // WARNING: Setting the wrong pin may have unexpected and potentially disastrous outcomes. Use with caution and do your homework. + + //#define Z_PROBE_ENDSTOP + #endif // ENABLE_AUTO_BED_LEVELING @@ -536,24 +572,21 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // @section movement -//// MOVEMENT SETTINGS -#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E +/** + * MOVEMENT SETTINGS + */ + #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0} // set the homing speeds (mm/min) // default settings -#define DEFAULT_AXIS_STEPS_PER_UNIT {78.7402,78.7402,200.0*8/3,760*1.1} // default steps per unit for Ultimaker -#define DEFAULT_MAX_FEEDRATE {500, 500, 5, 25} // (mm/sec) -#define DEFAULT_MAX_ACCELERATION {9000,9000,100,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. +#define DEFAULT_AXIS_STEPS_PER_UNIT {80,80,4000,500} // default steps per unit for Ultimaker +#define DEFAULT_MAX_FEEDRATE {300, 300, 5, 25} // (mm/sec) +#define DEFAULT_MAX_ACCELERATION {3000,3000,100,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. -#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves -#define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for retracts - -// 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 EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis -// #define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis +#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration in mm/s^2 for retracts +#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves // The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously) #define DEFAULT_XYJERK 20.0 // (mm/sec) @@ -570,9 +603,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Custom M code points #define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES - #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 - #define Z_PROBE_OFFSET_RANGE_MIN -15 - #define Z_PROBE_OFFSET_RANGE_MAX -5 + #ifdef ENABLE_AUTO_BED_LEVELING + #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 + #define Z_PROBE_OFFSET_RANGE_MIN -20 + #define Z_PROBE_OFFSET_RANGE_MAX 20 + #endif #endif // @section extras @@ -584,32 +619,37 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. //define this to enable EEPROM support //#define EEPROM_SETTINGS -//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: -// please keep turned on if you can. -//#define EEPROM_CHITCHAT + +#ifdef EEPROM_SETTINGS + // To disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: + #define EEPROM_CHITCHAT // please keep turned on if you can. +#endif // @section temperature // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 180 #define PLA_PREHEAT_HPB_TEMP 70 -#define PLA_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255 +#define PLA_PREHEAT_FAN_SPEED 0 // Insert Value between 0 and 255 #define ABS_PREHEAT_HOTEND_TEMP 240 -#define ABS_PREHEAT_HPB_TEMP 100 -#define ABS_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255 +#define ABS_PREHEAT_HPB_TEMP 110 +#define ABS_PREHEAT_FAN_SPEED 0 // Insert Value between 0 and 255 //==============================LCD and SD support============================= // @section lcd // Define your display language below. Replace (en) with your language code and uncomment. -// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu +// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu, kana, kana_utf8, test // See also language.h -//#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) +#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) -// Character based displays can have different extended charsets. -#define DISPLAY_CHARSET_HD44780_JAPAN // "ääööüüß23°" -//#define DISPLAY_CHARSET_HD44780_WESTERN // "ÄäÖöÜüß²³°" if you see a '~' instead of a 'arrow_right' at the right of submenuitems - this is the right one. +// Choose ONE of these 3 charsets. This has to match your hardware. Ignored for full graphic display. +// To find out what type you have - compile with (test) - upload - click to get the menu. You'll see two typical lines from the upper half of the charset. +// See also documentation/LCDLanguageFont.md + #define DISPLAY_CHARSET_HD44780_JAPAN // this is the most common hardware + //#define DISPLAY_CHARSET_HD44780_WESTERN + //#define DISPLAY_CHARSET_HD44780_CYRILLIC //#define ULTRA_LCD //general LCD support, also 16x2 //#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) @@ -622,6 +662,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define ULTIPANEL //the UltiPanel as on Thingiverse //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click + // 0 to disable buzzer feedback // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne @@ -676,7 +717,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Shift register panels // --------------------- // 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection //#define SAV_3DLCD @@ -686,7 +727,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define FAST_PWM_FAN // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency -// which is not ass annoying as with the hardware PWM. On the other hand, if this 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 @@ -705,7 +746,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Data from: http://www.doc-diy.net/photo/rc-1_hacked/ // #define PHOTOGRAPH_PIN 23 -// SF send wrong arc g-codes when using Arc Point as fillet procedure +// SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX // Support for the BariCUDA Paste Extruder. @@ -731,7 +772,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Servo Endstops // // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. -// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. +// Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500. // //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles @@ -740,9 +781,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of * Support for a filament diameter sensor * Also allows adjustment of diameter at print time (vs at slicing) * Single extruder only at this point (extruder 0) - * + * * Motherboards - * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector + * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E) * 301 - Rambo - uses Analog input 3 * Note may require analog pins to be defined for different motherboards @@ -759,7 +800,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define MAX_MEASUREMENT_DELAY 20 //delay buffer size in bytes (1 byte = 1cm)- limits maximum measurement delay allowable (must be larger than MEASUREMENT_DELAY_CM and lower number saves RAM) //defines used in the code -#define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA //set measured to nominal initially +#define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA //set measured to nominal initially //When using an LCD, uncomment the line below to display the Filament sensor data on the last line instead of status. Status will appear for 5 sec. //#define FILAMENT_LCD_DISPLAY diff --git a/Marlin/configurator/config/Configuration_adv.h b/Marlin/configurator/config/Configuration_adv.h index b03402e79..6478eb923 100644 --- a/Marlin/configurator/config/Configuration_adv.h +++ b/Marlin/configurator/config/Configuration_adv.h @@ -112,6 +112,30 @@ // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. //#define Z_DUAL_STEPPER_DRIVERS +#ifdef Z_DUAL_STEPPER_DRIVERS + + // Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper. + // That way the machine is capable to align the bed during home, since both Z steppers are homed. + // There is also an implementation of M666 (software endstops adjustment) to this feature. + // After Z homing, this adjustment is applied to just one of the steppers in order to align the bed. + // One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2. + // If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive. + // Play a little bit with small adjustments (0.5mm) and check the behaviour. + // The M119 (endstops report) will start reporting the Z2 Endstop as well. + + #define Z_DUAL_ENDSTOPS + + #ifdef Z_DUAL_ENDSTOPS + #define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis. + #define Z2_DIR_PIN E2_DIR_PIN + #define Z2_ENABLE_PIN E2_ENABLE_PIN + #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) + const bool Z2_MAX_ENDSTOP_INVERTING = false; + #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #endif + +#endif // Z_DUAL_STEPPER_DRIVERS + // Same again but for Y Axis. //#define Y_DUAL_STEPPER_DRIVERS @@ -124,50 +148,51 @@ // allowing faster printing speeds. //#define DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE -// Configuration for second X-carriage -// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; -// the second x-carriage always homes to the maximum endstop. -#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 EXTRUDER_OFFSET_X value for the second extruder provides a software - // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops - // without modifying the firmware (through the "M218 T1 X???" command). - // Remember: you should set the second extruder x-offset to 0 in your slicer. - -// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) -#define X2_ENABLE_PIN 29 -#define X2_STEP_PIN 25 -#define X2_DIR_PIN 23 - -// There are a few selectable movement modes for dual x-carriages using M605 S -// Mode 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) -// Mode 1: 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: 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 0 - -// Default settings in "Auto-park Mode" -#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder -#define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - -// Default x offset in duplication mode (typically set to half print bed width) -#define DEFAULT_DUPLICATION_X_OFFSET 100 + // Configuration for second X-carriage + // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; + // the second x-carriage always homes to the maximum endstop. + #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 EXTRUDER_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) + #define X2_ENABLE_PIN 29 + #define X2_STEP_PIN 25 + #define X2_DIR_PIN 23 + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 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) + // Mode 1: 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: 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 0 + + // Default settings in "Auto-park Mode" + #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder + #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 #endif //DUAL_X_CARRIAGE // @section homing //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: -#define X_HOME_RETRACT_MM 5 -#define Y_HOME_RETRACT_MM 5 -#define Z_HOME_RETRACT_MM 2 +#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 this is defined, if both x and y are to be homed, a diagonal move will be performed initially. // @section machine @@ -231,8 +256,8 @@ //=========================================================================== #define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ @@ -240,27 +265,37 @@ // @section lcd -#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? -#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. - -#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. -// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. -// using: -//#define MENU_ADDAUTOSTART - -// Show a progress bar on HD44780 LCDs for SD printing -//#define LCD_PROGRESS_BAR - -#ifdef LCD_PROGRESS_BAR - // Amount of time (ms) to show the bar - #define PROGRESS_BAR_BAR_TIME 2000 - // Amount of time (ms) to show the status message - #define PROGRESS_BAR_MSG_TIME 3000 - // Amount of time (ms) to retain the status message (0=forever) - #define PROGRESS_MSG_EXPIRE 0 - // Enable this to show messages for MSG_TIME then hide them - //#define PROGRESS_MSG_ONCE -#endif +#ifdef SDSUPPORT + + // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted + // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT + // in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should + // be commented out otherwise + #define SDCARDDETECTINVERTED + + #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + + #define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. + // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. + // using: + //#define MENU_ADDAUTOSTART + + // Show a progress bar on HD44780 LCDs for SD printing + //#define LCD_PROGRESS_BAR + + #ifdef LCD_PROGRESS_BAR + // Amount of time (ms) to show the bar + #define PROGRESS_BAR_BAR_TIME 2000 + // Amount of time (ms) to show the status message + #define PROGRESS_BAR_MSG_TIME 3000 + // Amount of time (ms) to retain the status message (0=forever) + #define PROGRESS_MSG_EXPIRE 0 + // Enable this to show messages for MSG_TIME then hide them + //#define PROGRESS_MSG_ONCE + #endif + +#endif // SDSUPPORT // @section more @@ -277,6 +312,8 @@ // Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled. //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED +// @section lcd + // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process // it can e.g. be used to change z-positions in the print startup phase in real-time // does not respect endstops! @@ -287,24 +324,24 @@ #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements #endif +// @section extruder + // extruder advance constant (s2/mm3) // // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2 // -// Hooke's law says: force = k * distance -// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant +// Hooke's law says: force = k * distance +// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant // so: v ^ 2 is proportional to number of steps we advance the extruder //#define ADVANCE #ifdef ADVANCE #define EXTRUDER_ADVANCE_K .0 - #define D_FILAMENT 2.85 #define STEPS_MM_E 836 - #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) - #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA) +#endif -#endif // ADVANCE +// @section extras // Arc interpretation settings: #define MM_PER_ARC_SEGMENT 1 @@ -312,14 +349,6 @@ const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement -// @section lcd - -// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted -// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT -// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should -// be commented out otherwise -#define SDCARDDETECTINVERTED - // @section temperature // Control heater 0 and heater 1 in parallel. @@ -333,7 +362,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st // 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, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. -#if defined SDSUPPORT +#ifdef 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 @@ -345,7 +374,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define MAX_CMD_SIZE 96 #define BUFSIZE 4 -// @section extras +// @section fwretract // Firmware based and LCD controlled retract // M207 and M208 can be used to define parameters for the retraction. @@ -377,6 +406,143 @@ const unsigned int dropsegments=5; //everything with less than this number of st #endif #endif +/******************************************************************************\ + * enable this section if you have TMC26X motor drivers. + * you need to import the TMC26XStepper library into the arduino IDE for this + ******************************************************************************/ + +// @section tmc + +//#define HAVE_TMCDRIVER +#ifdef HAVE_TMCDRIVER + +// #define X_IS_TMC + #define X_MAX_CURRENT 1000 //in mA + #define X_SENSE_RESISTOR 91 //in mOhms + #define X_MICROSTEPS 16 //number of microsteps + +// #define X2_IS_TMC + #define X2_MAX_CURRENT 1000 //in mA + #define X2_SENSE_RESISTOR 91 //in mOhms + #define X2_MICROSTEPS 16 //number of microsteps + +// #define Y_IS_TMC + #define Y_MAX_CURRENT 1000 //in mA + #define Y_SENSE_RESISTOR 91 //in mOhms + #define Y_MICROSTEPS 16 //number of microsteps + +// #define Y2_IS_TMC + #define Y2_MAX_CURRENT 1000 //in mA + #define Y2_SENSE_RESISTOR 91 //in mOhms + #define Y2_MICROSTEPS 16 //number of microsteps + +// #define Z_IS_TMC + #define Z_MAX_CURRENT 1000 //in mA + #define Z_SENSE_RESISTOR 91 //in mOhms + #define Z_MICROSTEPS 16 //number of microsteps + +// #define Z2_IS_TMC + #define Z2_MAX_CURRENT 1000 //in mA + #define Z2_SENSE_RESISTOR 91 //in mOhms + #define Z2_MICROSTEPS 16 //number of microsteps + +// #define E0_IS_TMC + #define E0_MAX_CURRENT 1000 //in mA + #define E0_SENSE_RESISTOR 91 //in mOhms + #define E0_MICROSTEPS 16 //number of microsteps + +// #define E1_IS_TMC + #define E1_MAX_CURRENT 1000 //in mA + #define E1_SENSE_RESISTOR 91 //in mOhms + #define E1_MICROSTEPS 16 //number of microsteps + +// #define E2_IS_TMC + #define E2_MAX_CURRENT 1000 //in mA + #define E2_SENSE_RESISTOR 91 //in mOhms + #define E2_MICROSTEPS 16 //number of microsteps + +// #define E3_IS_TMC + #define E3_MAX_CURRENT 1000 //in mA + #define E3_SENSE_RESISTOR 91 //in mOhms + #define E3_MICROSTEPS 16 //number of microsteps + +#endif + +/******************************************************************************\ + * enable this section if you have L6470 motor drivers. + * you need to import the L6470 library into the arduino IDE for this + ******************************************************************************/ + +// @section l6470 + +//#define HAVE_L6470DRIVER +#ifdef HAVE_L6470DRIVER + +// #define X_IS_L6470 + #define X_MICROSTEPS 16 //number of microsteps + #define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #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_IS_L6470 + #define X2_MICROSTEPS 16 //number of microsteps + #define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y_IS_L6470 + #define Y_MICROSTEPS 16 //number of microsteps + #define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y2_IS_L6470 + #define Y2_MICROSTEPS 16 //number of microsteps + #define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z_IS_L6470 + #define Z_MICROSTEPS 16 //number of microsteps + #define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z2_IS_L6470 + #define Z2_MICROSTEPS 16 //number of microsteps + #define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E0_IS_L6470 + #define E0_MICROSTEPS 16 //number of microsteps + #define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E1_IS_L6470 + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E2_IS_L6470 + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E3_IS_L6470 + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +#endif + #include "Conditionals.h" #include "SanityCheck.h" diff --git a/Marlin/configurator/config/boards.h b/Marlin/configurator/config/boards.h index 079813978..8a60f011d 100644 --- a/Marlin/configurator/config/boards.h +++ b/Marlin/configurator/config/boards.h @@ -10,10 +10,11 @@ #define BOARD_CHEAPTRONIC 2 // Cheaptronic v1.0 #define BOARD_SETHI 20 // Sethi 3D_1 #define BOARD_RAMPS_OLD 3 // MEGA/RAMPS up to 1.2 -#define BOARD_RAMPS_13_EFB 33 // RAMPS 1.3 / 1.4 (Extruder, Fan, Bed) -#define BOARD_RAMPS_13_EEB 34 // RAMPS 1.3 / 1.4 (Extruder0, Extruder1, Bed) -#define BOARD_RAMPS_13_EFF 35 // RAMPS 1.3 / 1.4 (Extruder, Fan, Fan) -#define BOARD_RAMPS_13_EEF 36 // RAMPS 1.3 / 1.4 (Extruder0, Extruder1, Fan) +#define BOARD_RAMPS_13_EFB 33 // RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed) +#define BOARD_RAMPS_13_EEB 34 // RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed) +#define BOARD_RAMPS_13_EFF 35 // RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Fan) +#define BOARD_RAMPS_13_EEF 36 // RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Fan) +#define BOARD_FELIX2 37 // Felix 2.0+ Electronics Board (RAMPS like) #define BOARD_DUEMILANOVE_328P 4 // Duemilanove w/ ATMega328P pin assignments #define BOARD_GEN6 5 // Gen6 #define BOARD_GEN6_DELUXE 51 // Gen6 deluxe @@ -28,14 +29,15 @@ #define BOARD_ULTIMAKER 7 // Ultimaker #define BOARD_ULTIMAKER_OLD 71 // Ultimaker (Older electronics. Pre 1.5.4. This is rare) #define BOARD_ULTIMAIN_2 72 // Ultimainboard 2.x (Uses TEMP_SENSOR 20) -#define BOARD_3DRAG 77 // 3Drag -#define BOARD_K8200 78 // Vellemann K8200 (derived from 3Drag) +#define BOARD_3DRAG 77 // 3Drag Controller +#define BOARD_K8200 78 // Vellemann K8200 Controller (derived from 3Drag Controller) #define BOARD_TEENSYLU 8 // Teensylu #define BOARD_RUMBA 80 // Rumba #define BOARD_PRINTRBOARD 81 // Printrboard (AT90USB1286) #define BOARD_BRAINWAVE 82 // Brainwave (AT90USB646) #define BOARD_SAV_MKI 83 // SAV Mk-I (AT90USB1286) #define BOARD_TEENSY2 84 // Teensy++2.0 (AT90USB1286) - CLI compile: DEFINES=AT90USBxx_TEENSYPP_ASSIGNMENTS HARDWARE_MOTHERBOARD=84 make +#define BOARD_BRAINWAVE_PRO 85 // Brainwave Pro (AT90USB1286) #define BOARD_GEN3_PLUS 9 // Gen3+ #define BOARD_GEN3_MONOLITHIC 22 // Gen3 Monolithic Electronics #define BOARD_MEGATRONICS 70 // Megatronics @@ -50,10 +52,11 @@ #define BOARD_LEAPFROG 999 // Leapfrog #define BOARD_WITBOX 41 // bq WITBOX #define BOARD_HEPHESTOS 42 // bq Prusa i3 Hephestos +#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_99 99 // This is in pins.h but...? #define MB(board) (MOTHERBOARD==BOARD_##board) -#define IS_RAMPS (MB(RAMPS_OLD) || MB(RAMPS_13_EFB) || MB(RAMPS_13_EEB) || MB(RAMPS_13_EFF) || MB(RAMPS_13_EEF)) #endif //__BOARDS_H diff --git a/Marlin/configurator/config/language.h b/Marlin/configurator/config/language.h index e13fc3176..eb0ef8c0a 100644 --- a/Marlin/configurator/config/language.h +++ b/Marlin/configurator/config/language.h @@ -11,30 +11,36 @@ // // ==> ALWAYS TRY TO COMPILE MARLIN WITH/WITHOUT "ULTIPANEL" / "ULTRALCD" / "SDSUPPORT" #define IN "Configuration.h" // ==> ALSO TRY ALL AVAILABLE LANGUAGE OPTIONS +// See also documentation/LCDLanguageFont.md // Languages -// en English -// pl Polish -// fr French -// de German -// es Spanish -// ru Russian -// it Italian -// pt Portuguese -// pt-br Portuguese (Brazil) -// fi Finnish -// an Aragonese -// nl Dutch -// ca Catalan -// eu Basque-Euskera +// en English +// pl Polish +// fr French +// de German +// es Spanish +// ru Russian +// it Italian +// pt Portuguese +// pt-br Portuguese (Brazil) +// fi Finnish +// an Aragonese +// nl Dutch +// ca Catalan +// eu Basque-Euskera +// kana Japanese +// kana_utf Japanese #ifndef LANGUAGE_INCLUDE // pick your language from the list above #define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) #endif +#ifdef HAS_AUTOMATIC_VERSIONING + #include "_Version.h" +#endif + #define PROTOCOL_VERSION "1.0" -#define FIRMWARE_URL "https://github.com/MarlinFirmware/Marlin" #if MB(ULTIMAKER)|| MB(ULTIMAKER_OLD)|| MB(ULTIMAIN_2) #define MACHINE_NAME "Ultimaker" @@ -57,12 +63,33 @@ #elif MB(HEPHESTOS) #define MACHINE_NAME "HEPHESTOS" #define FIRMWARE_URL "http://www.bq.com/gb/downloads-prusa-i3-hephestos.html" -#else // Default firmware set to Mendel - #define MACHINE_NAME "Mendel" +#elif MB(BRAINWAVE_PRO) + #define MACHINE_NAME "Kossel Pro" + #ifndef FIRMWARE_URL + #define FIRMWARE_URL "https://github.com/OpenBeamUSA/Marlin/" + #endif +#else + #ifndef MACHINE_NAME + #define MACHINE_NAME "Mendel" + #endif #endif #ifdef CUSTOM_MENDEL_NAME - #define MACHINE_NAME CUSTOM_MENDEL_NAME + #error CUSTOM_MENDEL_NAME deprecated - use CUSTOM_MACHINE_NAME + #define CUSTOM_MACHINE_NAME CUSTOM_MENDEL_NAME +#endif + +#ifdef CUSTOM_MACHINE_NAME + #undef MACHINE_NAME + #define MACHINE_NAME CUSTOM_MACHINE_NAME +#endif + +#ifndef FIRMWARE_URL + #define FIRMWARE_URL "https://github.com/MarlinFirmware/Marlin" +#endif + +#ifndef BUILD_VERSION + #define BUILD_VERSION "V1; Sprinter/grbl mashup for gen6" #endif #ifndef MACHINE_UUID @@ -83,7 +110,7 @@ // Serial Console Messages (do not translate those!) -#define MSG_Enqueing "enqueing \"" +#define MSG_Enqueueing "enqueueing \"" #define MSG_POWERUP "PowerUp" #define MSG_EXTERNAL_RESET " External Reset" #define MSG_BROWNOUT_RESET " Brown out Reset" @@ -113,7 +140,7 @@ #define MSG_HEATING_COMPLETE "Heating done." #define MSG_BED_HEATING "Bed Heating." #define MSG_BED_DONE "Bed done." -#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n" +#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin " BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n" #define MSG_COUNT_X " Count X: " #define MSG_ERR_KILLED "Printer halted. kill() called!" #define MSG_ERR_STOPPED "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)" @@ -121,12 +148,15 @@ #define MSG_UNKNOWN_COMMAND "Unknown command: \"" #define MSG_ACTIVE_EXTRUDER "Active Extruder: " #define MSG_INVALID_EXTRUDER "Invalid extruder" +#define MSG_INVALID_SOLENOID "Invalid solenoid" #define MSG_X_MIN "x_min: " #define MSG_X_MAX "x_max: " #define MSG_Y_MIN "y_min: " #define MSG_Y_MAX "y_max: " #define MSG_Z_MIN "z_min: " #define MSG_Z_MAX "z_max: " +#define MSG_Z2_MAX "z2_max: " +#define MSG_Z_PROBE "z_probe: " #define MSG_M119_REPORT "Reporting endstop status" #define MSG_ENDSTOP_HIT "TRIGGERED" #define MSG_ENDSTOP_OPEN "open" @@ -159,68 +189,48 @@ #define MSG_ERR_EEPROM_WRITE "Error writing to EEPROM!" +// temperature.cpp strings +#define MSG_PID_AUTOTUNE "PID Autotune" +#define MSG_PID_AUTOTUNE_START MSG_PID_AUTOTUNE " start" +#define MSG_PID_AUTOTUNE_FAILED MSG_PID_AUTOTUNE " failed!" +#define MSG_PID_BAD_EXTRUDER_NUM MSG_PID_AUTOTUNE_FAILED " Bad extruder number" +#define MSG_PID_TEMP_TOO_HIGH MSG_PID_AUTOTUNE_FAILED " Temperature too high" +#define MSG_PID_TIMEOUT MSG_PID_AUTOTUNE_FAILED " timeout" +#define MSG_BIAS " bias: " +#define MSG_D " d: " +#define MSG_T_MIN " min: " +#define MSG_T_MAX " max: " +#define MSG_KU " Ku: " +#define MSG_TU " Tu: " +#define MSG_CLASSIC_PID " Classic PID " +#define MSG_KP " Kp: " +#define MSG_KI " Ki: " +#define MSG_KD " Kd: " +#define MSG_OK_B "ok B:" +#define MSG_OK_T "ok T:" +#define MSG_AT " @:" +#define MSG_PID_AUTOTUNE_FINISHED MSG_PID_AUTOTUNE " finished! Put the last Kp, Ki and Kd constants from above into Configuration.h" +#define MSG_PID_DEBUG " PID_DEBUG " +#define MSG_PID_DEBUG_INPUT ": Input " +#define MSG_PID_DEBUG_OUTPUT " Output " +#define MSG_PID_DEBUG_PTERM " pTerm " +#define MSG_PID_DEBUG_ITERM " iTerm " +#define MSG_PID_DEBUG_DTERM " dTerm " +#define MSG_HEATING_FAILED "Heating failed" +#define MSG_EXTRUDER_SWITCHED_OFF "Extruder switched off. Temperature difference between temp sensors is too high !" + +#define MSG_INVALID_EXTRUDER_NUM " - Invalid extruder number !" +#define MSG_THERMAL_RUNAWAY_STOP "Thermal Runaway, system stopped! Heater_ID: " +#define MSG_SWITCHED_OFF_MAX " switched off. MAXTEMP triggered !!" +#define MSG_MINTEMP_EXTRUDER_OFF ": Extruder switched off. MINTEMP triggered !" +#define MSG_MAXTEMP_EXTRUDER_OFF ": Extruder" MSG_SWITCHED_OFF_MAX +#define MSG_MAXTEMP_BED_OFF "Heated bed" MSG_SWITCHED_OFF_MAX + // LCD Menu Messages -// Add your own character. Reference: https://github.com/MarlinFirmware/Marlin/pull/1434 photos -// and https://www.sparkfun.com/datasheets/LCD/HD44780.pdf page 17-18 -#ifdef DOGLCD - #define STR_Ae "\304" // 'Ä' U8glib - #define STR_ae "\344" // 'ä' - #define STR_Oe "\326" // 'Ö' - #define STR_oe STR_Oe // 'ö' - #define STR_Ue "\334" // 'Ü' - #define STR_ue STR_Ue // 'ü' - #define STR_sz "\337" // 'ß' - #define STR_h2 "\262" // '²' - #define STR_h3 "\263" // '³' - #define STR_Deg "\260" // '°' - #define STR_THERMOMETER "\377" -#else - #ifdef DISPLAY_CHARSET_HD44780_JAPAN // HD44780 ROM Code: A00 (Japan) - #define STR_ae "\xe1" - #define STR_Ae STR_ae - #define STR_oe "\357" - #define STR_Oe STR_oe - #define STR_ue "\365" - #define STR_Ue STR_ue - #define STR_sz "\342" - #define STR_h2 "2" - #define STR_h3 "3" - #define STR_Deg "\271" - #define STR_THERMOMETER "\002" - #endif - #ifdef DISPLAY_CHARSET_HD44780_WESTERN // HD44780 ROM Code: A02 (Western) - #define STR_Ae "\216" - #define STR_ae "\204" - #define STR_Oe "\211" - #define STR_oe "\204" - #define STR_Ue "\212" - #define STR_ue "\201" - #define STR_sz "\160" - #define STR_h2 "\262" - #define STR_h3 "\263" - #define STR_Deg "\337" - #define STR_THERMOMETER "\002" - #endif +#if !(defined( DISPLAY_CHARSET_HD44780_JAPAN ) || defined( DISPLAY_CHARSET_HD44780_WESTERN ) || defined( DISPLAY_CHARSET_HD44780_CYRILLIC )) + #define DISPLAY_CHARSET_HD44780_JAPAN #endif -/* -#define TESTSTRING000 "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017" -#define TESTSTRING020 "\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -#define TESTSTRING040 "\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057" -#define TESTSTRING060 "\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077" -#define TESTSTRING100 "\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117" -#define TESTSTRING120 "\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137" -#define TESTSTRING140 "\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157" -#define TESTSTRING160 "\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177" -#define TESTSTRING200 "\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217" -#define TESTSTRING220 "\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237" -#define TESTSTRING240 "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257" -#define TESTSTRING260 "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277" -#define TESTSTRING300 "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317" -#define TESTSTRING320 "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337" -#define TESTSTRING340 "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357" -#define TESTSTRING360 "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377" -*/ #include LANGUAGE_INCLUDE #include "language_en.h" diff --git a/Marlin/configurator/index.html b/Marlin/configurator/index.html index 93d2ae553..54353913d 100644 --- a/Marlin/configurator/index.html +++ b/Marlin/configurator/index.html @@ -30,6 +30,10 @@ Download Zip +
+ Info +
+
Machine @@ -42,7 +46,7 @@ - + @@ -84,12 +88,20 @@ Bed Leveling
-
- Extras +
+ FW Retract
-
- Info +
+ TMC +
+ +
+ L6470 +
+ +
+ Extras
diff --git a/Marlin/configurator/js/configurator.js b/Marlin/configurator/js/configurator.js index b9c6636d2..1a0da92ab 100644 --- a/Marlin/configurator/js/configurator.js +++ b/Marlin/configurator/js/configurator.js @@ -29,9 +29,9 @@ $(function(){ var config = { type: 'github', host: 'https://api.github.com', - owner: 'thinkyhead', + owner: 'MarlinFirmware', repo: 'Marlin', - ref: 'marlin_configurator', + ref: 'Development', path: 'Marlin/configurator/config' }; /**/ @@ -397,7 +397,7 @@ window.configuratorApp = (function(){ * .count number of items in the group */ refreshDefineGroups: function(cindex) { - var findDef = /^(|.*_)(([XYZE](MAX|MIN))|(E[0-3]|[XYZE01234])|MAX|MIN|(bed)?K[pid]|HOTEND|HPB|JAPAN|WESTERN|LEFT|RIGHT|BACK|FRONT|[XYZ]_POINT)(_.*|)$/i; + var findDef = /^(|.*_)(([XYZE](MAX|MIN))|(E[0-3]|[XYZE01234])|MAX|MIN|(bed)?K[pid]|HOTEND|HPB|JAPAN|WESTERN|CYRILLIC|LEFT|RIGHT|BACK|FRONT|[XYZ]_POINT)(_.*|)$/i; var match_prev, patt, title, nameList, groups = {}, match_section; $.each(define_list[cindex], function(i, name) { if (match_prev) { @@ -458,7 +458,8 @@ window.configuratorApp = (function(){ break; case 'JAPAN': case 'WESTERN': - patt = '(JAPAN|WESTERN)'; + case 'CYRILLIC': + patt = '(JAPAN|WESTERN|CYRILLIC)'; break; case 'XMIN': case 'XMAX': @@ -1267,56 +1268,73 @@ window.configuratorApp = (function(){ if (info.line.search(find) >= 0) eoltip = tooltip = info.line.replace(find, '$1'); - // Get all the comments immediately before the item + // Get all the comments immediately before the item, also include #define lines preceding it var s; - find = new RegExp('(([ \\t]*(//|#)[^\n]+\n){1,4})' + info.line.regEsc(), 'g'); + // find = new RegExp('(([ \\t]*(//|#)[^\n]+\n){1,4})' + info.line.regEsc(), 'g'); + find = new RegExp('(([ \\t]*//+[^\n]+\n)+([ \\t]*(//)?#define[^\n]+\n)*)' + info.line.regEsc(), 'g'); if (r = find.exec(txt)) { - // Get the text of the found comments + var temp = [], tips = []; + + // Find each line in forward order, store in reverse find = new RegExp('^[ \\t]*//+[ \\t]*(.*)[ \\t]*$', 'gm'); - while((s = find.exec(r[1])) !== null) { - var tip = s[1].replace(/[ \\t]*(={5,}|(#define[ \\t]+.*|@section[ \\t]+\w+))[ \\t]*/g, ''); - if (tip.length) { - if (tip.match(/^#define[ \\t]/) != null) tooltip = eoltip; - // JSON data? Save as select options - if (!info.options && tip.match(/:[\[{]/) != null) { - // TODO - // :[1-6] = value limits - var o; eval('o=' + tip.substr(1)); - info.options = o; - if (Object.prototype.toString.call(o) == "[object Array]" && o.length == 2 && !eval(''+o[0])) - info.type = 'toggle'; - } - else { - // Other lines added to the tooltip - tooltip += ' ' + tip + '\n'; - } - } - } - } + while((s = find.exec(r[1])) !== null) temp.unshift(s[1]); + + this.log(name+":\n"+temp.join('\n'), 2); + + // Go through the reversed lines and add comment lines on + $.each(temp, function(i,v) { + // @ annotation breaks the comment chain + if (v.match(/^[ \\t]*\/\/+[ \\t]*@/)) return false; + // A #define breaks the chain, after a good tip + if (v.match(/^[ \\t]*(\/\/+)?[ \\t]*#define/)) return (tips.length < 1); + // Skip unwanted lines + if (v.match(/^[ \\t]*(={5,}|#define[ \\t]+.*)/g)) return true; + tips.unshift(v); + }); - // Add .tooltip and .lineNum properties to the info - find = new RegExp('^'+name); // Strip the name from the tooltip - var lineNum = this.getLineNumberOfText(info.line, txt); - - // See if this define is enabled conditionally - var enable_cond = ''; - $.each(dependent_groups, function(cond,dat){ - $.each(dat, function(i,o){ - if (o.cindex == cindex && lineNum > o.start && lineNum < o.end) { - if (enable_cond != '') enable_cond += ' && '; - enable_cond += '(' + cond + ')'; + // Build the final tooltip, extract embedded options + $.each(tips, function(i,tip) { + // if (tip.match(/^#define[ \\t]/) != null) tooltip = eoltip; + // JSON data? Save as select options + if (!info.options && tip.match(/:[\[{]/) != null) { + // TODO + // :[1-6] = value limits + var o; eval('o=' + tip.substr(1)); + info.options = o; + if (Object.prototype.toString.call(o) == "[object Array]" && o.length == 2 && !eval(''+o[0])) + info.type = 'toggle'; + } + else { + // Other lines added to the tooltip + tooltip += ' ' + tip + '\n'; } }); - }); - $.extend(info, { - tooltip: ''+name+' '+tooltip.trim().replace(find,'').toHTML(), - lineNum: lineNum, - switchable: (info.type != 'switch' && info.line.match(/^[ \t]*\/\//)) || false, // Disabled? Mark as "switchable" - enabled: enable_cond ? enable_cond : 'true' - }); + // Add .tooltip and .lineNum properties to the info + find = new RegExp('^'+name); // Strip the name from the tooltip + var lineNum = this.getLineNumberOfText(info.line, txt); + + // See if this define is enabled conditionally + var enable_cond = ''; + $.each(dependent_groups, function(cond,dat){ + $.each(dat, function(i,o){ + if (o.cindex == cindex && lineNum > o.start && lineNum < o.end) { + if (enable_cond != '') enable_cond += ' && '; + enable_cond += '(' + cond + ')'; + } + }); + }); - } + $.extend(info, { + tooltip: ''+name+' '+tooltip.trim().replace(find,'').toHTML(), + lineNum: lineNum, + switchable: (info.type != 'switch' && info.line.match(/^[ \t]*\/\//)) || false, // Disabled? Mark as "switchable" + enabled: enable_cond ? enable_cond : 'true' + }); + + } // found comments + + } // if info.type else info = null; diff --git a/Marlin/dogm_font_data_6x9_marlin.h b/Marlin/dogm_font_data_6x9_marlin.h new file mode 100644 index 000000000..a3b16ecb4 --- /dev/null +++ b/Marlin/dogm_font_data_6x9_marlin.h @@ -0,0 +1,157 @@ +/* + Fontname: -Misc-Fixed-Medium-R-Normal--9-90-75-75-C-60-ISO10646-1 + Copyright: Public domain font. Share and enjoy. + Capital A Height: 6, '1' Height: 6 + Calculated Max Values w= 6 h= 9 x= 2 y= 7 dx= 6 dy= 0 ascent= 7 len= 9 + Font Bounding box w= 6 h= 9 x= 0 y=-2 + Calculated Min Values x= 0 y=-2 dx= 0 dy= 0 + Pure Font ascent = 6 descent=-2 + X Font ascent = 6 descent=-2 + Max Font ascent = 7 descent=-2 +*/ +#include +const u8g_fntpgm_uint8_t u8g_font_6x9[2300] U8G_SECTION(".progmem.u8g_font_6x9") = { + 0,6,9,0,254,6,1,137,2,254,32,255,254,7,254,6, + 254,0,0,0,6,0,7,1,6,6,6,2,0,128,128,128, + 128,0,128,3,3,3,6,1,3,160,160,160,5,7,7,6, + 0,255,80,80,248,80,248,80,80,5,9,9,6,0,254,32, + 112,168,160,112,40,168,112,32,6,8,8,6,0,255,64,168, + 72,16,32,72,84,8,5,7,7,6,0,255,96,144,144,96, + 152,144,104,1,3,3,6,2,3,128,128,128,2,7,7,6, + 2,255,64,128,128,128,128,128,64,2,7,7,6,2,255,128, + 64,64,64,64,64,128,5,5,5,6,0,0,136,80,248,80, + 136,5,5,5,6,0,0,32,32,248,32,32,2,4,4,6, + 2,254,192,64,64,128,5,1,1,6,0,2,248,2,2,2, + 6,2,0,192,192,4,6,6,6,1,0,16,16,32,64,128, + 128,4,6,6,6,1,0,96,144,144,144,144,96,3,6,6, + 6,1,0,64,192,64,64,64,224,4,6,6,6,1,0,96, + 144,16,32,64,240,4,6,6,6,1,0,240,32,96,16,16, + 224,5,6,6,6,0,0,16,48,80,144,248,16,4,6,6, + 6,1,0,240,128,224,16,16,224,4,6,6,6,1,0,96, + 128,224,144,144,96,4,6,6,6,1,0,240,16,16,32,64, + 64,4,6,6,6,1,0,96,144,96,144,144,96,4,6,6, + 6,1,0,96,144,144,112,16,96,2,5,5,6,2,0,192, + 192,0,192,192,2,7,7,6,2,254,192,192,0,192,64,64, + 128,5,5,5,6,0,0,24,96,128,96,24,5,3,3,6, + 0,1,248,0,248,5,5,5,6,0,0,192,48,8,48,192, + 4,7,7,6,1,0,96,144,16,96,64,0,64,5,6,6, + 6,0,0,112,144,168,176,128,112,5,6,6,6,0,0,32, + 80,136,248,136,136,5,6,6,6,0,0,240,136,240,136,136, + 240,4,6,6,6,1,0,96,144,128,128,144,96,4,6,6, + 6,1,0,224,144,144,144,144,224,4,6,6,6,1,0,240, + 128,224,128,128,240,4,6,6,6,1,0,240,128,224,128,128, + 128,4,6,6,6,1,0,96,144,128,176,144,96,4,6,6, + 6,1,0,144,144,240,144,144,144,3,6,6,6,1,0,224, + 64,64,64,64,224,5,6,6,6,0,0,56,16,16,16,144, + 96,4,6,6,6,1,0,144,160,192,160,144,144,4,6,6, + 6,1,0,128,128,128,128,128,240,5,6,6,6,0,0,136, + 216,168,168,136,136,4,6,6,6,1,0,144,208,176,144,144, + 144,5,6,6,6,0,0,112,136,136,136,136,112,4,6,6, + 6,1,0,224,144,144,224,128,128,4,7,7,6,1,255,96, + 144,144,208,176,96,16,4,6,6,6,1,0,224,144,144,224, + 144,144,4,6,6,6,1,0,96,144,64,32,144,96,5,6, + 6,6,0,0,248,32,32,32,32,32,4,6,6,6,1,0, + 144,144,144,144,144,96,4,6,6,6,1,0,144,144,144,240, + 96,96,5,6,6,6,0,0,136,136,168,168,216,136,5,6, + 6,6,0,0,136,80,32,32,80,136,5,6,6,6,0,0, + 136,136,80,32,32,32,4,6,6,6,1,0,240,16,32,64, + 128,240,3,6,6,6,1,0,224,128,128,128,128,224,4,6, + 6,6,1,0,128,128,64,32,16,16,3,6,6,6,1,0, + 224,32,32,32,32,224,5,3,3,6,0,3,32,80,136,5, + 1,1,6,0,254,248,2,2,2,6,2,4,128,64,4,4, + 4,6,1,0,112,144,144,112,4,6,6,6,1,0,128,128, + 224,144,144,224,4,4,4,6,1,0,112,128,128,112,4,6, + 6,6,1,0,16,16,112,144,144,112,4,4,4,6,1,0, + 96,176,192,112,4,6,6,6,1,0,32,80,64,224,64,64, + 4,6,6,6,1,254,96,144,144,112,16,96,4,6,6,6, + 1,0,128,128,224,144,144,144,3,6,6,6,1,0,64,0, + 192,64,64,224,3,8,8,6,1,254,32,0,96,32,32,32, + 160,64,4,6,6,6,1,0,128,128,160,192,160,144,3,6, + 6,6,1,0,192,64,64,64,64,224,5,4,4,6,0,0, + 208,168,168,136,4,4,4,6,1,0,224,144,144,144,4,4, + 4,6,1,0,96,144,144,96,4,6,6,6,1,254,224,144, + 144,224,128,128,4,6,6,6,1,254,112,144,144,112,16,16, + 4,4,4,6,1,0,160,208,128,128,4,4,4,6,1,0, + 112,192,48,224,4,6,6,6,1,0,64,64,224,64,80,32, + 4,4,4,6,1,0,144,144,144,112,4,4,4,6,1,0, + 144,144,96,96,5,4,4,6,0,0,136,168,168,80,4,4, + 4,6,1,0,144,96,96,144,4,6,6,6,1,254,144,144, + 144,112,144,96,4,4,4,6,1,0,240,32,64,240,3,7, + 7,6,1,0,32,64,64,128,64,64,32,1,7,7,6,2, + 255,128,128,128,128,128,128,128,3,7,7,6,1,0,128,64, + 64,32,64,64,128,4,2,2,6,1,3,80,160,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0, + 0,6,0,7,1,6,6,6,2,0,128,0,128,128,128,128, + 4,6,6,6,1,255,32,112,160,160,112,32,5,7,7,6, + 0,255,48,72,64,240,64,64,248,5,5,5,6,0,0,168, + 80,136,80,168,5,6,6,6,0,0,136,80,248,32,248,32, + 1,7,7,6,2,255,128,128,128,0,128,128,128,4,7,7, + 6,1,255,112,128,96,144,96,16,224,3,1,1,6,1,5, + 160,6,7,7,6,0,0,120,132,148,164,148,132,120,3,5, + 5,6,1,1,96,160,96,0,224,5,5,5,6,0,0,40, + 80,160,80,40,4,3,3,6,1,0,240,16,16,4,1,1, + 6,1,2,240,6,7,7,6,0,0,120,132,180,164,164,132, + 120,4,1,1,6,1,5,240,4,3,3,6,1,2,96,144, + 96,5,7,7,6,0,255,32,32,248,32,32,0,248,3,5, + 5,6,1,1,64,160,32,64,224,3,5,5,6,1,1,192, + 32,64,32,192,2,2,2,6,2,4,64,128,4,5,5,6, + 1,255,144,144,176,208,128,5,6,6,6,0,0,120,232,232, + 104,40,40,1,1,1,6,2,2,128,2,2,2,6,2,254, + 64,128,3,5,5,6,1,1,64,192,64,64,224,3,5,5, + 6,1,1,64,160,64,0,224,5,5,5,6,0,0,160,80, + 40,80,160,5,8,8,6,0,255,64,192,64,80,112,48,120, + 16,5,8,8,6,0,255,64,192,64,80,104,8,16,56,5, + 8,8,6,0,255,192,32,64,48,240,48,120,16,4,7,7, + 6,1,0,32,0,32,96,128,144,96,5,7,7,6,0,0, + 64,32,32,80,112,136,136,5,7,7,6,0,0,16,32,32, + 80,112,136,136,5,7,7,6,0,0,32,80,32,80,112,136, + 136,5,7,7,6,0,0,40,80,32,80,112,136,136,5,7, + 7,6,0,0,80,0,32,80,112,136,136,5,7,7,6,0, + 0,32,80,32,80,112,136,136,5,6,6,6,0,0,120,160, + 240,160,160,184,4,8,8,6,1,254,96,144,128,128,144,96, + 32,64,4,7,7,6,1,0,64,32,240,128,224,128,240,4, + 7,7,6,1,0,32,64,240,128,224,128,240,4,7,7,6, + 1,0,32,80,240,128,224,128,240,4,7,7,6,1,0,80, + 0,240,128,224,128,240,3,7,7,6,1,0,128,64,224,64, + 64,64,224,3,7,7,6,1,0,32,64,224,64,64,64,224, + 3,7,7,6,1,0,64,160,224,64,64,64,224,3,7,7, + 6,1,0,160,0,224,64,64,64,224,5,6,6,6,0,0, + 112,72,232,72,72,112,4,7,7,6,1,0,80,160,144,208, + 176,144,144,4,7,7,6,1,0,64,32,96,144,144,144,96, + 4,7,7,6,1,0,32,64,96,144,144,144,96,4,7,7, + 6,1,0,32,80,96,144,144,144,96,4,7,7,6,1,0, + 80,160,96,144,144,144,96,4,7,7,6,1,0,80,0,96, + 144,144,144,96,5,5,5,6,0,0,136,80,32,80,136,4, + 8,8,6,1,255,16,112,176,176,208,208,224,128,4,7,7, + 6,1,0,64,32,144,144,144,144,96,4,7,7,6,1,0, + 32,64,144,144,144,144,96,4,7,7,6,1,0,32,80,144, + 144,144,144,96,4,7,7,6,1,0,80,0,144,144,144,144, + 96,5,7,7,6,0,0,16,32,136,80,32,32,32,4,6, + 6,6,1,0,128,224,144,144,224,128,4,6,6,6,1,0, + 96,144,160,160,144,160,4,7,7,6,1,0,64,32,0,112, + 144,144,112,4,7,7,6,1,0,32,64,0,112,144,144,112, + 4,7,7,6,1,0,32,80,0,112,144,144,112,4,7,7, + 6,1,0,80,160,0,112,144,144,112,4,6,6,6,1,0, + 80,0,112,144,144,112,4,7,7,6,1,0,32,80,32,112, + 144,144,112,5,4,4,6,0,0,112,168,176,120,4,6,6, + 6,1,254,112,128,128,112,32,64,4,7,7,6,1,0,64, + 32,0,96,176,192,112,4,7,7,6,1,0,32,64,0,96, + 176,192,112,4,7,7,6,1,0,32,80,0,96,176,192,112, + 4,6,6,6,1,0,80,0,96,176,192,112,3,7,7,6, + 1,0,128,64,0,192,64,64,224,3,7,7,6,1,0,32, + 64,0,192,64,64,224,3,7,7,6,1,0,64,160,0,192, + 64,64,224,3,6,6,6,1,0,160,0,192,64,64,224,4, + 7,7,6,1,0,48,96,16,112,144,144,96,4,7,7,6, + 1,0,80,160,0,224,144,144,144,4,7,7,6,1,0,64, + 32,0,96,144,144,96,4,7,7,6,1,0,32,64,0,96, + 144,144,96,4,7,7,6,1,0,32,80,0,96,144,144,96, + 4,7,7,6,1,0,80,160,0,96,144,144,96,4,6,6, + 6,1,0,80,0,96,144,144,96,5,5,5,6,0,0,32, + 0,248,0,32,4,4,4,6,1,0,112,176,208,224,4,7, + 7,6,1,0,64,32,0,144,144,144,112,4,7,7,6,1, + 0,32,64,0,144,144,144,112,4,7,7,6,1,0,32,80, + 0,144,144,144,112,4,6,6,6,1,0,80,0,144,144,144, + 112,4,9,9,6,1,254,32,64,0,144,144,144,112,144,96, + 4,8,8,6,1,254,128,128,224,144,144,224,128,128,4,8, + 8,6,1,254,80,0,144,144,144,112,144,96}; diff --git a/Marlin/dogm_font_data_HD44780_C.h b/Marlin/dogm_font_data_HD44780_C.h new file mode 100644 index 000000000..bc6af9150 --- /dev/null +++ b/Marlin/dogm_font_data_HD44780_C.h @@ -0,0 +1,171 @@ +/* + Fontname: HD44780_C v1.2 + Copyright: A. Hardtung, public domain + Capital A Height: 7, '1' Height: 7 + Calculated Max Values w= 5 h= 8 x= 2 y= 7 dx= 6 dy= 0 ascent= 8 len= 8 + Font Bounding box w= 6 h= 9 x= 0 y=-2 + Calculated Min Values x= 0 y=-1 dx= 0 dy= 0 + Pure Font ascent = 7 descent=-1 + X Font ascent = 7 descent=-1 + Max Font ascent = 8 descent=-1 +*/ +#include +const u8g_fntpgm_uint8_t HD44780_C_5x7[2522] U8G_SECTION(".progmem.HD44780_C_5x7") = { + 0,6,9,0,254,7,1,145,3,34,32,255,255,8,255,7, + 255,0,0,0,6,0,0,1,7,7,6,2,0,128,128,128, + 128,128,0,128,3,2,2,6,1,5,160,160,5,7,7,6, + 0,0,80,80,248,80,248,80,80,5,7,7,6,0,0,32, + 120,160,112,40,240,32,5,7,7,6,0,0,192,200,16,32, + 64,152,24,5,7,7,6,0,0,96,144,160,64,168,144,104, + 2,3,3,6,1,4,192,64,128,3,7,7,6,1,0,32, + 64,128,128,128,64,32,3,7,7,6,1,0,128,64,32,32, + 32,64,128,5,5,5,6,0,1,32,168,112,168,32,5,5, + 5,6,0,1,32,32,248,32,32,2,3,3,6,2,255,192, + 64,128,5,1,1,6,0,3,248,2,2,2,6,2,0,192, + 192,5,5,5,6,0,1,8,16,32,64,128,5,7,7,6, + 0,0,112,136,152,168,200,136,112,3,7,7,6,1,0,64, + 192,64,64,64,64,224,5,7,7,6,0,0,112,136,8,112, + 128,128,248,5,7,7,6,0,0,248,16,32,16,8,8,240, + 5,7,7,6,0,0,16,48,80,144,248,16,16,5,7,7, + 6,0,0,248,128,240,8,8,136,112,5,7,7,6,0,0, + 48,64,128,240,136,136,112,5,7,7,6,0,0,248,8,16, + 32,32,32,32,5,7,7,6,0,0,112,136,136,112,136,136, + 112,5,7,7,6,0,0,112,136,136,120,8,16,96,2,5, + 5,6,2,0,192,192,0,192,192,2,6,6,6,2,255,192, + 192,0,192,64,128,4,7,7,6,0,0,16,32,64,128,64, + 32,16,5,3,3,6,0,2,248,0,248,4,7,7,6,1, + 0,128,64,32,16,32,64,128,5,7,7,6,0,0,112,136, + 8,16,32,0,32,5,6,6,6,0,0,112,136,8,104,168, + 112,5,7,7,6,0,0,112,136,136,248,136,136,136,5,7, + 7,6,0,0,240,136,136,240,136,136,240,5,7,7,6,0, + 0,112,136,128,128,128,136,112,5,7,7,6,0,0,224,144, + 136,136,136,144,224,5,7,7,6,0,0,248,128,128,240,128, + 128,248,5,7,7,6,0,0,248,128,128,240,128,128,128,5, + 7,7,6,0,0,112,136,128,184,136,136,112,5,7,7,6, + 0,0,136,136,136,248,136,136,136,1,7,7,6,2,0,128, + 128,128,128,128,128,128,5,7,7,6,0,0,56,16,16,16, + 16,144,96,5,7,7,6,0,0,136,144,160,192,160,144,136, + 5,7,7,6,0,0,128,128,128,128,128,128,248,5,7,7, + 6,0,0,136,216,168,136,136,136,136,5,7,7,6,0,0, + 136,136,200,168,152,136,136,5,7,7,6,0,0,112,136,136, + 136,136,136,112,5,7,7,6,0,0,240,136,136,240,128,128, + 128,5,7,7,6,0,0,112,136,136,136,168,144,104,5,7, + 7,6,0,0,240,136,136,240,160,144,136,5,7,7,6,0, + 0,120,128,128,112,8,8,240,5,7,7,6,0,0,248,32, + 32,32,32,32,32,5,7,7,6,0,0,136,136,136,136,136, + 136,112,5,7,7,6,0,0,136,136,136,136,136,80,32,5, + 7,7,6,0,0,136,136,136,136,136,168,80,5,7,7,6, + 0,0,136,136,80,32,80,136,136,5,7,7,6,0,0,136, + 136,136,80,32,32,32,5,7,7,6,0,0,248,8,16,32, + 64,128,248,3,7,7,6,1,0,224,128,128,128,128,128,224, + 5,7,7,6,0,0,32,112,160,160,168,112,32,3,7,7, + 6,1,0,224,32,32,32,32,32,224,5,3,3,6,0,4, + 32,80,136,5,1,1,6,0,0,248,2,2,2,6,2,5, + 128,64,5,5,5,6,0,0,112,8,120,136,120,5,7,7, + 6,0,0,128,128,176,200,136,136,240,5,5,5,6,0,0, + 112,128,128,136,112,5,7,7,6,0,0,8,8,104,152,136, + 136,120,5,5,5,6,0,0,112,136,248,128,112,5,7,7, + 6,0,0,48,72,224,64,64,64,64,5,6,6,6,0,255, + 112,136,136,120,8,112,5,7,7,6,0,0,128,128,176,200, + 136,136,136,1,7,7,6,2,0,128,0,128,128,128,128,128, + 3,8,8,6,1,255,32,0,32,32,32,32,160,64,4,7, + 7,6,0,0,128,128,144,160,192,160,144,3,7,7,6,1, + 0,192,64,64,64,64,64,224,5,5,5,6,0,0,208,168, + 168,168,168,5,5,5,6,0,0,176,200,136,136,136,5,5, + 5,6,0,0,112,136,136,136,112,5,6,6,6,0,255,240, + 136,136,240,128,128,5,6,6,6,0,255,120,136,136,120,8, + 8,5,5,5,6,0,0,176,200,128,128,128,5,5,5,6, + 0,0,112,128,112,8,240,5,7,7,6,0,0,64,64,224, + 64,64,72,48,5,5,5,6,0,0,136,136,136,152,104,5, + 5,5,6,0,0,136,136,136,80,32,5,5,5,6,0,0, + 136,136,168,168,80,5,5,5,6,0,0,136,80,32,80,136, + 5,6,6,6,0,255,136,136,136,120,8,112,5,5,5,6, + 0,0,248,16,32,64,248,5,5,5,6,0,2,184,168,168, + 168,184,5,5,5,6,0,2,184,136,184,160,184,5,5,5, + 6,0,2,184,160,184,136,184,5,6,6,6,0,1,8,40, + 72,248,64,32,5,5,5,6,0,0,56,112,224,136,240,0, + 0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0, + 0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0, + 6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0, + 0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0, + 0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0, + 6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0, + 0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0, + 0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0, + 6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0, + 0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0, + 0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0, + 6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,5, + 7,7,6,0,0,248,136,128,240,136,136,240,5,7,7,6, + 0,0,248,136,128,128,128,128,128,5,7,7,6,0,0,80, + 0,248,128,240,128,248,5,7,7,6,0,0,168,168,168,112, + 168,168,168,5,7,7,6,0,0,240,8,8,112,8,8,240, + 5,7,7,6,0,0,136,136,152,168,200,136,136,5,8,8, + 6,0,0,80,32,136,152,168,168,200,136,5,7,7,6,0, + 0,120,40,40,40,40,168,72,5,7,7,6,0,0,248,136, + 136,136,136,136,136,5,7,7,6,0,0,136,136,136,80,32, + 64,128,5,7,7,6,0,0,32,112,168,168,168,112,32,5, + 7,7,6,0,0,136,136,136,120,8,8,8,5,7,7,6, + 0,0,168,168,168,168,168,168,248,5,7,7,6,0,0,192, + 64,64,112,72,72,112,5,7,7,6,0,0,136,136,136,200, + 168,168,200,5,7,7,6,0,0,112,136,8,56,8,136,112, + 5,7,7,6,0,0,144,168,168,232,168,168,144,5,7,7, + 6,0,0,120,136,136,120,40,72,136,5,7,7,6,0,0, + 24,96,128,240,136,136,112,4,5,5,6,0,0,224,144,224, + 144,224,5,5,5,6,0,0,248,136,128,128,128,5,7,7, + 6,0,0,80,0,112,136,248,128,112,5,5,5,6,0,0, + 168,168,112,168,168,5,5,5,6,0,0,240,8,48,8,240, + 5,5,5,6,0,0,136,152,168,200,136,5,7,7,6,0, + 0,80,32,136,152,168,200,136,4,5,5,6,0,0,144,160, + 192,160,144,5,5,5,6,0,0,248,40,40,168,72,5,5, + 5,6,0,0,136,216,168,136,136,5,5,5,6,0,0,136, + 136,248,136,136,5,5,5,6,0,0,248,136,136,136,136,5, + 5,5,6,0,0,248,32,32,32,32,5,5,5,6,0,0, + 136,136,120,8,8,5,5,5,6,0,0,168,168,168,168,248, + 5,5,5,6,0,0,192,64,112,72,112,5,5,5,6,0, + 0,136,136,200,168,200,4,5,5,6,0,0,128,128,224,144, + 224,5,5,5,6,0,0,112,136,56,136,112,5,5,5,6, + 0,0,144,168,232,168,144,5,5,5,6,0,0,120,136,120, + 40,72,5,5,5,6,0,1,32,72,144,72,32,5,5,5, + 6,0,1,32,144,72,144,32,5,3,3,6,0,0,72,144, + 216,5,3,3,6,0,4,216,72,144,5,7,7,6,0,0, + 144,208,176,144,56,40,56,5,7,7,6,0,0,32,0,32, + 64,128,136,112,5,7,7,6,0,0,24,32,32,112,32,32, + 192,5,7,7,6,0,0,32,80,64,240,64,64,120,1,2, + 2,6,2,0,128,128,1,4,4,6,2,0,128,128,128,128, + 3,5,5,6,1,0,160,160,160,0,224,3,5,5,6,1, + 0,160,160,160,0,160,5,7,7,6,0,0,160,0,232,16, + 32,64,128,5,5,5,6,0,1,216,112,32,112,216,5,7, + 7,6,0,0,160,64,168,16,32,64,128,3,6,6,6,1, + 1,224,64,64,64,64,224,5,6,6,6,0,1,248,80,80, + 80,80,248,5,7,7,6,0,0,32,112,168,32,32,32,32, + 5,7,7,6,0,0,32,32,32,32,168,112,32,5,7,7, + 6,0,0,128,144,176,248,176,144,128,5,7,7,6,0,0, + 8,72,104,248,104,72,8,5,7,7,6,0,0,128,136,168, + 248,168,136,128,5,7,7,6,0,0,128,224,136,16,32,64, + 128,2,2,2,6,2,2,192,192,5,8,8,6,0,255,120, + 40,40,40,72,136,248,136,5,8,8,6,0,255,136,136,136, + 136,136,136,248,8,5,8,8,6,0,255,168,168,168,168,168, + 168,248,8,5,6,6,6,0,255,120,40,72,136,248,136,5, + 7,7,6,0,255,32,32,112,168,168,112,32,5,6,6,6, + 0,255,136,136,136,136,248,8,5,6,6,6,0,255,168,168, + 168,168,248,8,2,2,2,6,2,6,64,128,3,1,1,6, + 1,7,160,5,2,2,6,0,6,72,176,5,8,8,6,0, + 0,16,32,0,112,136,248,128,112,5,6,6,6,0,255,112, + 128,136,112,32,96,3,7,7,6,1,0,160,0,160,160,160, + 32,192,5,6,6,6,0,1,32,112,112,112,248,32,5,5, + 5,6,0,1,80,0,136,0,80,5,5,5,6,0,1,112, + 136,136,136,112,5,7,7,6,0,0,136,144,168,88,184,8, + 8,5,7,7,6,0,0,136,144,184,72,184,8,56,5,7, + 7,6,0,0,136,144,184,72,152,32,56,5,8,8,6,0, + 0,192,64,192,72,216,56,8,8,5,7,7,6,0,0,136, + 248,136,248,136,248,136,4,5,5,6,0,2,192,0,48,0, + 96,5,8,8,6,0,0,64,160,224,168,8,40,120,32,5, + 8,8,6,0,0,64,112,64,120,64,112,64,224,5,8,8, + 6,0,0,32,112,32,248,32,112,32,112,5,7,7,6,0, + 0,104,0,232,0,104,16,56,5,8,8,6,0,0,16,112, + 16,240,16,112,16,56,5,7,7,6,0,1,32,112,32,248, + 32,112,32,5,8,8,6,0,0,16,144,80,48,80,144,16, + 56,5,8,8,6,0,0,48,72,32,80,80,32,144,96,5, + 7,7,6,0,0,120,168,168,120,40,40,40,5,8,8,6, + 0,0,248,248,248,248,248,248,248,248}; diff --git a/Marlin/dogm_font_data_HD44780_J.h b/Marlin/dogm_font_data_HD44780_J.h new file mode 100644 index 000000000..84f568161 --- /dev/null +++ b/Marlin/dogm_font_data_HD44780_J.h @@ -0,0 +1,169 @@ +/* + Fontname: HD44780_J + Copyright: A. Hardtung, public domain + Capital A Height: 7, '1' Height: 7 + Calculated Max Values w= 6 h=10 x= 2 y= 8 dx= 6 dy= 0 ascent= 8 len= 8 + Font Bounding box w= 6 h= 9 x= 0 y=-2 + Calculated Min Values x= 0 y=-2 dx= 0 dy= 0 + Pure Font ascent = 7 descent=-1 + X Font ascent = 7 descent=-1 + Max Font ascent = 8 descent=-2 +*/ +#include +const u8g_fntpgm_uint8_t HD44780_J_5x7[2491] U8G_SECTION(".progmem.HD44780_J_5x7") = { + 0,6,9,0,254,7,1,145,3,34,32,255,255,8,254,7, + 255,0,0,0,6,0,8,1,7,7,6,2,0,128,128,128, + 128,128,0,128,3,2,2,6,1,5,160,160,5,7,7,6, + 0,0,80,80,248,80,248,80,80,5,7,7,6,0,0,32, + 120,160,112,40,240,32,5,7,7,6,0,0,192,200,16,32, + 64,152,24,5,7,7,6,0,0,96,144,160,64,168,144,104, + 2,3,3,6,1,4,192,64,128,3,7,7,6,1,0,32, + 64,128,128,128,64,32,3,7,7,6,1,0,128,64,32,32, + 32,64,128,5,5,5,6,0,1,32,168,112,168,32,5,5, + 5,6,0,1,32,32,248,32,32,2,3,3,6,2,255,192, + 64,128,5,1,1,6,0,3,248,2,2,2,6,2,0,192, + 192,5,5,5,6,0,1,8,16,32,64,128,5,7,7,6, + 0,0,112,136,152,168,200,136,112,3,7,7,6,1,0,64, + 192,64,64,64,64,224,5,7,7,6,0,0,112,136,8,112, + 128,128,248,5,7,7,6,0,0,248,16,32,16,8,8,240, + 5,7,7,6,0,0,16,48,80,144,248,16,16,5,7,7, + 6,0,0,248,128,240,8,8,136,112,5,7,7,6,0,0, + 48,64,128,240,136,136,112,5,7,7,6,0,0,248,8,16, + 32,32,32,32,5,7,7,6,0,0,112,136,136,112,136,136, + 112,5,7,7,6,0,0,112,136,136,120,8,16,96,2,5, + 5,6,2,0,192,192,0,192,192,2,6,6,6,2,255,192, + 192,0,192,64,128,4,7,7,6,0,0,16,32,64,128,64, + 32,16,5,3,3,6,0,2,248,0,248,4,7,7,6,1, + 0,128,64,32,16,32,64,128,5,7,7,6,0,0,112,136, + 8,16,32,0,32,5,6,6,6,0,0,112,136,8,104,168, + 112,5,7,7,6,0,0,112,136,136,248,136,136,136,5,7, + 7,6,0,0,240,136,136,240,136,136,240,5,7,7,6,0, + 0,112,136,128,128,128,136,112,5,7,7,6,0,0,224,144, + 136,136,136,144,224,5,7,7,6,0,0,248,128,128,240,128, + 128,248,5,7,7,6,0,0,248,128,128,240,128,128,128,5, + 7,7,6,0,0,112,136,128,184,136,136,112,5,7,7,6, + 0,0,136,136,136,248,136,136,136,1,7,7,6,2,0,128, + 128,128,128,128,128,128,5,7,7,6,0,0,56,16,16,16, + 16,144,96,5,7,7,6,0,0,136,144,160,192,160,144,136, + 5,7,7,6,0,0,128,128,128,128,128,128,248,5,7,7, + 6,0,0,136,216,168,136,136,136,136,5,7,7,6,0,0, + 136,136,200,168,152,136,136,5,7,7,6,0,0,112,136,136, + 136,136,136,112,5,7,7,6,0,0,240,136,136,240,128,128, + 128,5,7,7,6,0,0,112,136,136,136,168,144,104,5,7, + 7,6,0,0,240,136,136,240,160,144,136,5,7,7,6,0, + 0,120,128,128,112,8,8,240,5,7,7,6,0,0,248,32, + 32,32,32,32,32,5,7,7,6,0,0,136,136,136,136,136, + 136,112,5,7,7,6,0,0,136,136,136,136,136,80,32,5, + 7,7,6,0,0,136,136,136,136,136,168,80,5,7,7,6, + 0,0,136,136,80,32,80,136,136,5,7,7,6,0,0,136, + 136,136,80,32,32,32,5,7,7,6,0,0,248,8,16,32, + 64,128,248,3,7,7,6,1,0,224,128,128,128,128,128,224, + 5,7,7,6,0,0,136,80,248,32,248,32,32,3,7,7, + 6,1,0,224,32,32,32,32,32,224,5,3,3,6,0,4, + 32,80,136,5,1,1,6,0,0,248,2,2,2,6,2,5, + 128,64,5,5,5,6,0,0,112,8,120,136,120,5,7,7, + 6,0,0,128,128,176,200,136,136,240,5,5,5,6,0,0, + 112,128,128,136,112,5,7,7,6,0,0,8,8,104,152,136, + 136,120,5,5,5,6,0,0,112,136,248,128,112,5,7,7, + 6,0,0,48,72,224,64,64,64,64,5,6,6,6,0,255, + 112,136,136,120,8,112,5,7,7,6,0,0,128,128,176,200, + 136,136,136,1,7,7,6,2,0,128,0,128,128,128,128,128, + 3,8,8,6,1,255,32,0,32,32,32,32,160,64,4,7, + 7,6,0,0,128,128,144,160,192,160,144,3,7,7,6,1, + 0,192,64,64,64,64,64,224,5,5,5,6,0,0,208,168, + 168,168,168,5,5,5,6,0,0,176,200,136,136,136,5,5, + 5,6,0,0,112,136,136,136,112,5,6,6,6,0,255,240, + 136,136,240,128,128,5,6,6,6,0,255,120,136,136,120,8, + 8,5,5,5,6,0,0,176,200,128,128,128,5,5,5,6, + 0,0,112,128,112,8,240,5,7,7,6,0,0,64,64,224, + 64,64,72,48,5,5,5,6,0,0,136,136,136,152,104,5, + 5,5,6,0,0,136,136,136,80,32,5,5,5,6,0,0, + 136,136,168,168,80,5,5,5,6,0,0,136,80,32,80,136, + 5,6,6,6,0,255,136,136,136,120,8,112,5,5,5,6, + 0,0,248,16,32,64,248,3,7,7,6,1,0,32,64,64, + 128,64,64,32,1,7,7,6,2,0,128,128,128,128,128,128, + 128,3,7,7,6,1,0,128,64,64,32,64,64,128,5,5, + 5,6,0,1,32,16,248,16,32,5,5,5,6,0,1,32, + 64,248,64,32,0,0,0,6,0,8,0,0,0,6,0,8, + 0,0,0,6,0,8,0,0,0,6,0,8,0,0,0,6, + 0,8,0,0,0,6,0,8,0,0,0,6,0,8,0,0, + 0,6,0,8,0,0,0,6,0,8,0,0,0,6,0,8, + 0,0,0,6,0,8,0,0,0,6,0,8,0,0,0,6, + 0,8,0,0,0,6,0,8,0,0,0,6,0,8,0,0, + 0,6,0,8,0,0,0,6,0,8,0,0,0,6,0,8, + 0,0,0,6,0,8,0,0,0,6,0,8,0,0,0,6, + 0,8,0,0,0,6,0,8,0,0,0,6,0,8,0,0, + 0,6,0,8,0,0,0,6,0,8,0,0,0,6,0,8, + 0,0,0,6,0,8,0,0,0,6,0,8,0,0,0,6, + 0,8,0,0,0,6,0,8,0,0,0,6,0,8,0,0, + 0,6,0,8,0,0,0,6,0,8,3,3,3,6,0,0, + 224,160,224,3,4,4,6,2,3,224,128,128,128,3,4,4, + 6,0,0,32,32,32,224,3,3,3,6,0,0,128,64,32, + 2,2,2,6,1,2,192,192,5,6,6,6,0,0,248,8, + 248,8,16,32,5,5,5,6,0,0,248,8,48,32,64,4, + 5,5,6,0,0,16,32,96,160,32,5,5,5,6,0,0, + 32,248,136,8,48,5,4,4,6,0,0,248,32,32,248,5, + 5,5,6,0,0,16,248,48,80,144,5,5,5,6,0,0, + 64,248,72,80,64,5,4,4,6,0,0,112,16,16,248,4, + 5,5,6,0,0,240,16,240,16,240,5,4,4,6,0,0, + 168,168,8,48,5,1,1,6,0,4,248,5,7,7,6,0, + 0,248,8,40,48,32,32,64,5,7,7,6,0,0,8,16, + 32,96,160,32,32,5,7,7,6,0,0,32,248,136,136,8, + 16,32,5,6,6,6,0,0,248,32,32,32,32,248,5,7, + 7,6,0,0,16,248,16,48,80,144,16,5,7,7,6,0, + 0,64,248,72,72,72,72,144,5,7,7,6,0,0,32,248, + 32,248,32,32,32,5,6,6,6,0,0,120,72,136,8,16, + 96,5,7,7,6,0,0,64,120,144,16,16,16,32,5,6, + 6,6,0,0,248,8,8,8,8,248,5,7,7,6,0,0, + 80,248,80,80,16,32,64,5,6,6,6,0,0,192,8,200, + 8,16,224,5,6,6,6,0,0,248,8,16,32,80,136,5, + 7,7,6,0,0,64,248,72,80,64,64,56,5,6,6,6, + 0,0,136,136,72,8,16,96,5,6,6,6,0,0,120,72, + 168,24,16,96,5,7,7,6,0,0,16,224,32,248,32,32, + 64,5,6,6,6,0,0,168,168,168,8,16,32,5,7,7, + 6,0,0,112,0,248,32,32,32,64,3,7,7,6,1,0, + 128,128,128,192,160,128,128,5,7,7,6,0,0,32,32,248, + 32,32,64,128,5,6,6,6,0,0,112,0,0,0,0,248, + 5,6,6,6,0,0,248,8,80,32,80,128,5,6,6,6, + 0,1,32,248,16,32,112,168,3,7,7,6,1,0,32,32, + 32,32,32,64,128,5,6,6,6,0,0,32,16,136,136,136, + 136,5,7,7,6,0,0,128,128,248,128,128,128,120,5,6, + 6,6,0,0,248,8,8,8,16,96,5,5,5,6,0,1, + 64,160,16,8,8,5,7,7,6,0,0,32,248,32,32,168, + 168,32,5,6,6,6,0,0,248,8,8,80,32,16,4,6, + 6,6,1,0,224,0,224,0,224,16,5,6,6,6,0,0, + 32,64,128,136,248,8,5,6,6,6,0,0,8,8,80,32, + 80,128,5,6,6,6,0,0,248,64,248,64,64,56,5,7, + 7,6,0,0,64,64,248,72,80,64,64,5,7,7,6,0, + 0,112,16,16,16,16,16,248,5,6,6,6,0,0,248,8, + 248,8,8,248,5,7,7,6,0,0,112,0,248,8,8,16, + 32,4,7,7,6,0,0,144,144,144,144,16,32,64,5,6, + 6,6,0,0,32,160,160,168,168,176,5,7,7,6,0,0, + 128,128,128,136,144,160,192,5,6,6,6,0,0,248,136,136, + 136,136,248,5,6,6,6,0,0,248,136,136,8,16,32,5, + 6,6,6,0,0,192,0,8,8,16,224,4,3,3,6,0, + 4,32,144,64,3,3,3,6,0,4,224,160,224,5,5,5, + 6,0,1,72,168,144,144,104,5,7,7,6,0,0,80,0, + 112,8,120,136,120,4,8,8,6,1,255,96,144,144,224,144, + 144,224,128,5,5,5,6,0,0,112,128,96,136,112,5,6, + 6,6,0,255,136,136,152,232,136,128,5,5,5,6,0,0, + 120,160,144,136,112,5,7,7,6,0,254,48,72,136,136,240, + 128,128,5,8,8,6,0,254,120,136,136,136,120,8,8,112, + 5,5,5,6,0,1,56,32,32,160,64,4,3,3,6,0, + 3,16,208,16,4,8,8,6,0,255,16,0,48,16,16,16, + 144,96,3,3,3,6,0,4,160,64,160,5,7,7,6,0, + 0,32,112,160,160,168,112,32,5,7,7,6,0,0,64,64, + 224,64,224,64,120,5,7,7,6,0,0,112,0,176,200,136, + 136,136,5,7,7,6,0,0,80,0,112,136,136,136,112,5, + 7,7,6,0,255,176,200,136,136,240,128,128,5,7,7,6, + 0,255,104,152,136,136,120,8,8,5,6,6,6,0,0,112, + 136,248,136,136,112,5,3,3,6,0,2,88,168,208,5,5, + 5,6,0,0,112,136,136,80,216,5,7,7,6,0,0,80, + 0,136,136,136,152,104,5,7,7,6,0,0,248,128,64,32, + 64,128,248,5,5,5,6,0,0,248,80,80,80,152,5,7, + 7,6,0,0,248,0,136,80,32,80,136,5,7,7,6,0, + 255,136,136,136,136,120,8,112,5,6,6,6,0,1,8,240, + 32,248,32,32,5,5,5,6,0,0,248,64,120,72,136,5, + 5,5,6,0,0,248,168,248,136,136,5,5,5,6,0,1, + 32,0,248,0,32,0,0,0,6,0,8,6,10,10,6,0, + 254,252,252,252,252,252,252,252,252,252,252}; diff --git a/Marlin/dogm_font_data_HD44780_W.h b/Marlin/dogm_font_data_HD44780_W.h new file mode 100644 index 000000000..2a52429a6 --- /dev/null +++ b/Marlin/dogm_font_data_HD44780_W.h @@ -0,0 +1,203 @@ +/* + Fontname: HD44780_W + Copyright: A.Hardtung, public domain + Capital A Height: 7, '1' Height: 7 + Calculated Max Values w= 5 h= 9 x= 2 y= 5 dx= 6 dy= 0 ascent= 8 len= 9 + Font Bounding box w= 6 h= 9 x= 0 y=-2 + Calculated Min Values x= 0 y=-1 dx= 0 dy= 0 + Pure Font ascent = 7 descent=-1 + X Font ascent = 7 descent=-1 + Max Font ascent = 8 descent=-1 +*/ +#include +const u8g_fntpgm_uint8_t HD44780_W_5x7[3034] U8G_SECTION(".progmem.HD44780_W_5x7") = { + 0,6,9,0,254,7,2,79,3,222,16,255,255,8,255,7, + 255,4,7,7,6,0,0,16,48,112,240,112,48,16,4,7, + 7,6,1,0,128,192,224,240,224,192,128,5,3,3,6,0, + 4,216,72,144,5,3,3,6,0,4,216,144,72,5,7,7, + 6,0,0,32,112,248,0,32,112,248,5,7,7,6,0,0, + 248,112,32,0,248,112,32,5,5,5,6,0,1,112,248,248, + 248,112,5,7,7,6,0,0,8,8,40,72,248,64,32,5, + 7,7,6,0,0,32,112,168,32,32,32,32,5,7,7,6, + 0,0,32,32,32,32,168,112,32,5,5,5,6,0,1,32, + 64,248,64,32,5,5,5,6,0,1,32,16,248,16,32,5, + 7,7,6,0,0,16,32,64,32,16,0,248,5,7,7,6, + 0,0,64,32,16,32,64,0,248,5,5,5,6,0,1,32, + 32,112,112,248,5,5,5,6,0,0,248,112,112,32,32,0, + 0,0,6,0,0,1,7,7,6,2,0,128,128,128,128,128, + 0,128,3,2,2,6,1,5,160,160,5,7,7,6,0,0, + 80,80,248,80,248,80,80,5,7,7,6,0,0,32,120,160, + 112,40,240,32,5,7,7,6,0,0,192,200,16,32,64,152, + 24,5,7,7,6,0,0,96,144,160,64,168,144,104,2,3, + 3,6,1,4,192,64,128,3,7,7,6,1,0,32,64,128, + 128,128,64,32,3,7,7,6,1,0,128,64,32,32,32,64, + 128,5,5,5,6,0,1,32,168,112,168,32,5,5,5,6, + 0,1,32,32,248,32,32,2,3,3,6,2,255,192,64,128, + 5,1,1,6,0,3,248,2,2,2,6,2,0,192,192,5, + 5,5,6,0,1,8,16,32,64,128,5,7,7,6,0,0, + 112,136,152,168,200,136,112,3,7,7,6,1,0,64,192,64, + 64,64,64,224,5,7,7,6,0,0,112,136,8,112,128,128, + 248,5,7,7,6,0,0,248,16,32,16,8,8,240,5,7, + 7,6,0,0,16,48,80,144,248,16,16,5,7,7,6,0, + 0,248,128,240,8,8,136,112,5,7,7,6,0,0,48,64, + 128,240,136,136,112,5,7,7,6,0,0,248,8,16,32,32, + 32,32,5,7,7,6,0,0,112,136,136,112,136,136,112,5, + 7,7,6,0,0,112,136,136,120,8,16,96,2,5,5,6, + 2,0,192,192,0,192,192,2,6,6,6,2,255,192,192,0, + 192,64,128,4,7,7,6,0,0,16,32,64,128,64,32,16, + 5,3,3,6,0,2,248,0,248,4,7,7,6,1,0,128, + 64,32,16,32,64,128,5,7,7,6,0,0,112,136,8,16, + 32,0,32,5,6,6,6,0,0,112,136,8,104,168,112,5, + 7,7,6,0,0,112,136,136,248,136,136,136,5,7,7,6, + 0,0,240,136,136,240,136,136,240,5,7,7,6,0,0,112, + 136,128,128,128,136,112,5,7,7,6,0,0,224,144,136,136, + 136,144,224,5,7,7,6,0,0,248,128,128,240,128,128,248, + 5,7,7,6,0,0,248,128,128,240,128,128,128,5,7,7, + 6,0,0,112,136,128,184,136,136,112,5,7,7,6,0,0, + 136,136,136,248,136,136,136,1,7,7,6,2,0,128,128,128, + 128,128,128,128,5,7,7,6,0,0,56,16,16,16,16,144, + 96,5,7,7,6,0,0,136,144,160,192,160,144,136,5,7, + 7,6,0,0,128,128,128,128,128,128,248,5,7,7,6,0, + 0,136,216,168,136,136,136,136,5,7,7,6,0,0,136,136, + 200,168,152,136,136,5,7,7,6,0,0,112,136,136,136,136, + 136,112,5,7,7,6,0,0,240,136,136,240,128,128,128,5, + 7,7,6,0,0,112,136,136,136,168,144,104,5,7,7,6, + 0,0,240,136,136,240,160,144,136,5,7,7,6,0,0,120, + 128,128,112,8,8,240,5,7,7,6,0,0,248,32,32,32, + 32,32,32,5,7,7,6,0,0,136,136,136,136,136,136,112, + 5,7,7,6,0,0,136,136,136,136,136,80,32,5,7,7, + 6,0,0,136,136,136,136,136,168,80,5,7,7,6,0,0, + 136,136,80,32,80,136,136,5,7,7,6,0,0,136,136,136, + 80,32,32,32,5,7,7,6,0,0,248,8,16,32,64,128, + 248,3,7,7,6,1,0,224,128,128,128,128,128,224,5,5, + 5,6,0,1,128,64,32,16,8,3,7,7,6,1,0,224, + 32,32,32,32,32,224,5,3,3,6,0,4,32,80,136,5, + 1,1,6,0,0,248,2,2,2,6,2,5,128,64,5,5, + 5,6,0,0,112,8,120,136,120,5,7,7,6,0,0,128, + 128,176,200,136,136,240,5,5,5,6,0,0,112,128,128,136, + 112,5,7,7,6,0,0,8,8,104,152,136,136,120,5,5, + 5,6,0,0,112,136,248,128,112,5,7,7,6,0,0,48, + 72,224,64,64,64,64,5,6,6,6,0,255,112,136,136,120, + 8,112,5,7,7,6,0,0,128,128,176,200,136,136,136,1, + 7,7,6,2,0,128,0,128,128,128,128,128,3,8,8,6, + 1,255,32,0,32,32,32,32,160,64,4,7,7,6,0,0, + 128,128,144,160,192,160,144,3,7,7,6,1,0,192,64,64, + 64,64,64,224,5,5,5,6,0,0,208,168,168,168,168,5, + 5,5,6,0,0,176,200,136,136,136,5,5,5,6,0,0, + 112,136,136,136,112,5,6,6,6,0,255,240,136,136,240,128, + 128,5,6,6,6,0,255,120,136,136,120,8,8,5,5,5, + 6,0,0,176,200,128,128,128,5,5,5,6,0,0,112,128, + 112,8,240,5,7,7,6,0,0,64,64,224,64,64,72,48, + 5,5,5,6,0,0,136,136,136,152,104,5,5,5,6,0, + 0,136,136,136,80,32,5,5,5,6,0,0,136,136,168,168, + 80,5,5,5,6,0,0,136,80,32,80,136,5,6,6,6, + 0,255,136,136,136,120,8,112,5,5,5,6,0,0,248,16, + 32,64,248,3,7,7,6,1,0,32,64,64,128,64,64,32, + 1,7,7,6,2,0,128,128,128,128,128,128,128,3,7,7, + 6,1,0,128,64,64,32,64,64,128,5,6,6,6,0,1, + 8,40,72,248,64,32,5,7,7,6,0,0,32,80,136,136, + 136,136,248,5,7,7,6,0,0,248,136,128,240,136,136,240, + 5,8,8,6,0,255,120,40,40,40,72,136,248,136,5,7, + 7,6,0,0,168,168,168,112,168,168,168,5,7,7,6,0, + 0,240,8,8,112,8,8,240,5,7,7,6,0,0,136,136, + 152,168,200,136,136,5,8,8,6,0,0,80,32,136,152,168, + 168,200,136,5,7,7,6,0,0,120,40,40,40,40,168,72, + 5,7,7,6,0,0,248,136,136,136,136,136,136,5,7,7, + 6,0,0,136,136,136,80,32,64,128,5,8,8,6,0,255, + 136,136,136,136,136,136,248,8,5,7,7,6,0,0,136,136, + 136,120,8,8,8,5,7,7,6,0,0,168,168,168,168,168, + 168,248,5,8,8,6,0,255,168,168,168,168,168,168,248,8, + 5,7,7,6,0,0,192,64,64,112,72,72,112,5,7,7, + 6,0,0,136,136,136,200,168,168,200,5,7,7,6,0,0, + 112,136,40,80,8,136,112,5,5,5,6,0,0,64,160,144, + 144,104,5,7,7,6,0,0,32,48,40,40,32,224,224,5, + 7,7,6,0,0,248,136,128,128,128,128,128,5,5,5,6, + 0,0,248,80,80,80,152,5,7,7,6,0,0,248,128,64, + 32,64,128,248,5,5,5,6,0,0,120,144,144,144,96,5, + 7,7,6,0,0,48,40,56,40,200,216,24,5,6,6,6, + 0,0,8,112,160,32,32,16,5,6,6,6,0,1,32,112, + 112,112,248,32,5,7,7,6,0,0,112,136,136,248,136,136, + 112,5,5,5,6,0,0,112,136,136,80,216,5,7,7,6, + 0,0,48,72,32,80,136,136,112,5,3,3,6,0,2,88, + 168,208,5,6,6,6,0,0,80,248,248,248,112,32,5,5, + 5,6,0,0,112,128,96,136,112,5,7,7,6,0,0,112, + 136,136,136,136,136,136,5,7,7,6,0,0,216,216,216,216, + 216,216,216,1,7,7,6,2,0,128,0,128,128,128,128,128, + 5,7,7,6,0,0,32,112,160,160,168,112,32,5,7,7, + 6,0,0,48,64,64,224,64,80,168,5,5,5,6,0,0, + 136,112,80,112,136,5,7,7,6,0,0,136,80,248,32,248, + 32,32,1,7,7,6,2,0,128,128,128,0,128,128,128,5, + 8,8,6,0,0,48,72,32,80,80,32,144,96,5,7,7, + 6,0,0,24,32,32,112,32,32,192,5,7,7,6,0,0, + 248,136,184,184,184,136,248,5,7,7,6,0,0,112,8,120, + 136,120,0,248,5,5,5,6,0,1,40,80,160,80,40,5, + 7,7,6,0,0,144,168,168,232,168,168,144,5,7,7,6, + 0,0,120,136,136,120,40,72,136,5,7,7,6,0,0,248, + 136,168,136,152,168,248,2,3,3,6,2,4,64,128,192,4, + 5,5,6,0,3,96,144,144,144,96,5,7,7,6,0,0, + 32,32,248,32,32,0,248,4,5,5,6,0,3,96,144,32, + 64,240,3,5,5,6,0,3,224,32,224,32,224,5,8,8, + 6,0,0,224,144,224,128,144,184,144,24,5,8,8,6,0, + 255,136,136,136,136,152,232,128,128,5,7,7,6,0,0,120, + 152,152,120,24,24,24,2,2,2,6,2,2,192,192,5,5, + 5,6,0,0,80,136,168,168,80,3,5,5,6,0,3,64, + 192,64,64,224,5,7,7,6,0,0,112,136,136,136,112,0, + 248,5,5,5,6,0,1,160,80,40,80,160,5,7,7,6, + 0,0,136,144,168,88,184,8,8,5,7,7,6,0,0,136, + 144,184,72,152,32,56,5,8,8,6,0,0,192,64,192,72, + 216,56,8,8,5,7,7,6,0,0,32,0,32,64,128,136, + 112,5,8,8,6,0,0,64,32,32,80,136,248,136,136,5, + 8,8,6,0,0,16,32,32,80,136,248,136,136,5,8,8, + 6,0,0,32,80,0,112,136,248,136,136,5,8,8,6,0, + 0,104,144,0,112,136,248,136,136,5,8,8,6,0,0,80, + 0,32,80,136,248,136,136,5,8,8,6,0,0,32,80,32, + 112,136,248,136,136,5,7,7,6,0,0,56,96,160,184,224, + 160,184,5,8,8,6,0,255,112,136,128,128,136,112,32,96, + 5,8,8,6,0,0,64,32,0,248,128,240,128,248,5,8, + 8,6,0,0,8,16,0,248,128,240,128,248,5,8,8,6, + 0,0,32,80,0,248,128,240,128,248,5,7,7,6,0,0, + 80,0,248,128,240,128,248,3,8,8,6,1,0,128,64,0, + 224,64,64,64,224,3,8,8,6,1,0,32,64,0,224,64, + 64,64,224,3,8,8,6,1,0,64,160,0,224,64,64,64, + 224,3,7,7,6,1,0,160,0,224,64,64,64,224,5,7, + 7,6,0,0,112,72,72,232,72,72,112,5,8,8,6,0, + 0,104,144,0,136,200,168,152,136,5,8,8,6,0,0,64, + 32,112,136,136,136,136,112,5,8,8,6,0,0,16,32,112, + 136,136,136,136,112,5,8,8,6,0,0,32,80,0,112,136, + 136,136,112,5,8,8,6,0,0,104,144,0,112,136,136,136, + 112,5,8,8,6,0,0,80,0,112,136,136,136,136,112,5, + 5,5,6,0,1,136,80,32,80,136,5,7,7,6,0,0, + 112,32,112,168,112,32,112,5,8,8,6,0,0,64,32,136, + 136,136,136,136,112,5,8,8,6,0,0,16,32,136,136,136, + 136,136,112,5,8,8,6,0,0,32,80,0,136,136,136,136, + 112,5,8,8,6,0,0,80,0,136,136,136,136,136,112,5, + 8,8,6,0,0,16,32,136,80,32,32,32,32,5,8,8, + 6,0,0,192,64,112,72,72,112,64,224,5,7,7,6,0, + 0,48,72,72,112,72,72,176,5,8,8,6,0,0,64,32, + 0,112,8,120,136,120,5,8,8,6,0,0,16,32,0,112, + 8,120,136,120,5,8,8,6,0,0,32,80,0,112,8,120, + 136,120,5,8,8,6,0,0,104,144,0,112,8,120,136,120, + 5,7,7,6,0,0,80,0,112,8,120,136,120,5,8,8, + 6,0,0,32,80,32,112,8,120,136,120,5,6,6,6,0, + 0,208,40,120,160,168,80,5,6,6,6,0,255,112,128,136, + 112,32,96,5,8,8,6,0,0,64,32,0,112,136,248,128, + 112,5,8,8,6,0,0,16,32,0,112,136,248,128,112,5, + 8,8,6,0,0,32,80,0,112,136,248,128,112,5,7,7, + 6,0,0,80,0,112,136,248,128,112,3,8,8,6,1,0, + 128,64,0,64,192,64,64,224,3,8,8,6,1,0,32,64, + 0,64,192,64,64,224,3,8,8,6,1,0,64,160,0,64, + 192,64,64,224,3,7,7,6,1,0,160,0,64,192,64,64, + 224,5,7,7,6,0,0,160,64,160,16,120,136,112,5,8, + 8,6,0,0,104,144,0,176,200,136,136,136,5,8,8,6, + 0,0,64,32,0,112,136,136,136,112,5,8,8,6,0,0, + 16,32,0,112,136,136,136,112,5,8,8,6,0,0,32,80, + 0,112,136,136,136,112,5,8,8,6,0,0,104,144,0,112, + 136,136,136,112,5,7,7,6,0,0,80,0,112,136,136,136, + 112,5,5,5,6,0,1,32,0,248,0,32,5,7,7,6, + 0,0,16,32,112,168,112,32,64,5,8,8,6,0,0,64, + 32,0,136,136,136,152,104,5,8,8,6,0,0,16,32,0, + 136,136,136,152,104,5,8,8,6,0,0,32,80,0,136,136, + 136,152,104,5,7,7,6,0,0,80,0,136,136,136,152,104, + 5,9,9,6,0,255,16,32,0,136,136,136,248,8,112,4, + 7,7,6,1,0,192,64,96,80,96,64,224,5,8,8,6, + 0,255,80,0,136,136,136,248,8,112}; diff --git a/Marlin/dogm_font_data_ISO10646_1_Marlin.h b/Marlin/dogm_font_data_ISO10646_1.h similarity index 91% rename from Marlin/dogm_font_data_ISO10646_1_Marlin.h rename to Marlin/dogm_font_data_ISO10646_1.h index eeec3b2de..2e973cc51 100644 --- a/Marlin/dogm_font_data_ISO10646_1_Marlin.h +++ b/Marlin/dogm_font_data_ISO10646_1.h @@ -1,17 +1,17 @@ /* - Fontname: ISO10646-1-Marlin + Fontname: ISO10646-1 Copyright: A.Hardtung, public domain Capital A Height: 7, '1' Height: 7 - Calculated Max Values w= 5 h=10 x= 2 y= 7 dx= 6 dy= 0 ascent= 8 len= 9 + Calculated Max Values w= 5 h= 9 x= 2 y= 7 dx= 6 dy= 0 ascent= 8 len= 9 Font Bounding box w= 6 h= 9 x= 0 y=-2 - Calculated Min Values x= 0 y=-2 dx= 0 dy= 0 + Calculated Min Values x= 0 y=-1 dx= 0 dy= 0 Pure Font ascent = 7 descent=-1 X Font ascent = 7 descent=-1 - Max Font ascent = 8 descent=-2 + Max Font ascent = 8 descent=-1 */ #include -const u8g_fntpgm_uint8_t ISO10646_1_Marlin_5x7[2596] U8G_SECTION(".progmem.ISO10646_1_Marlin_5x7") = { - 0,6,9,0,254,7,1,146,3,33,32,255,255,8,254,7, +const u8g_fntpgm_uint8_t ISO10646_1_5x7[2592] U8G_SECTION(".progmem.ISO10646_1_5x7") = { + 0,6,9,0,254,7,1,146,3,33,32,255,255,8,255,7, 255,0,0,0,6,0,0,1,7,7,6,2,0,128,128,128, 128,128,0,128,3,2,2,6,1,5,160,160,5,7,7,6, 0,0,80,80,248,80,248,80,80,5,7,7,6,0,0,32, @@ -166,11 +166,11 @@ const u8g_fntpgm_uint8_t ISO10646_1_Marlin_5x7[2596] U8G_SECTION(".progmem.ISO10 8,6,0,0,32,80,0,112,136,136,136,112,5,8,8,6, 0,0,104,144,0,112,136,136,136,112,5,7,7,6,0,0, 80,0,112,136,136,136,112,5,5,5,6,0,1,32,0,248, - 0,32,5,8,8,6,0,0,64,240,200,136,136,152,120,16, - 5,8,8,6,0,0,192,248,136,136,136,136,136,248,5,5, - 5,6,0,1,32,48,248,48,32,5,8,8,6,0,0,32, - 112,248,32,32,32,32,224,5,9,9,6,0,255,32,112,168, - 168,184,136,136,112,32,5,9,9,6,0,255,224,128,192,176, - 168,40,48,40,40,5,9,9,6,0,255,248,168,136,136,136, - 136,136,168,248,5,10,10,6,0,254,32,80,80,80,80,136, - 168,168,136,112}; + 0,32,5,7,7,6,0,255,16,112,168,168,168,112,64,5, + 8,8,6,0,0,64,32,0,136,136,136,152,104,5,8,8, + 6,0,0,16,32,0,136,136,136,152,104,5,8,8,6,0, + 0,32,80,0,136,136,136,152,104,5,7,7,6,0,0,80, + 0,136,136,136,152,104,5,9,9,6,0,255,16,32,0,136, + 136,136,248,8,112,4,7,7,6,1,255,192,64,96,80,96, + 64,224,5,8,8,6,0,255,80,0,136,136,136,120,8,112 + }; diff --git a/Marlin/dogm_font_data_ISO10646_5_Cyrillic.h b/Marlin/dogm_font_data_ISO10646_5_Cyrillic.h new file mode 100644 index 000000000..b44936cef --- /dev/null +++ b/Marlin/dogm_font_data_ISO10646_5_Cyrillic.h @@ -0,0 +1,174 @@ +/* + Fontname: ISO10646_5_Cyrillic + Copyright: A. Hardtung, public domain + Capital A Height: 7, '1' Height: 7 + Calculated Max Values w= 5 h= 9 x= 2 y= 5 dx= 6 dy= 0 ascent= 8 len= 9 + Font Bounding box w= 6 h= 9 x= 0 y=-2 + Calculated Min Values x= 0 y=-1 dx= 0 dy= 0 + Pure Font ascent = 7 descent=-1 + X Font ascent = 7 descent=-1 + Max Font ascent = 8 descent=-1 +*/ +#include +const u8g_fntpgm_uint8_t ISO10646_5_Cyrillic_5x7[2560] U8G_SECTION(".progmem.ISO10646_5_Cyrillic_5x7") = { + 0,6,9,0,254,7,1,145,3,32,32,255,255,8,255,7, + 255,0,0,0,6,0,0,1,7,7,6,2,0,128,128,128, + 128,128,0,128,3,2,2,6,1,5,160,160,5,7,7,6, + 0,0,80,80,248,80,248,80,80,5,7,7,6,0,0,32, + 120,160,112,40,240,32,5,7,7,6,0,0,192,200,16,32, + 64,152,24,5,7,7,6,0,0,96,144,160,64,168,144,104, + 2,3,3,6,1,4,192,64,128,3,7,7,6,1,0,32, + 64,128,128,128,64,32,3,7,7,6,1,0,128,64,32,32, + 32,64,128,5,5,5,6,0,1,32,168,112,168,32,5,5, + 5,6,0,1,32,32,248,32,32,2,3,3,6,2,255,192, + 64,128,5,1,1,6,0,3,248,2,2,2,6,2,0,192, + 192,5,5,5,6,0,1,8,16,32,64,128,5,7,7,6, + 0,0,112,136,152,168,200,136,112,3,7,7,6,1,0,64, + 192,64,64,64,64,224,5,7,7,6,0,0,112,136,8,112, + 128,128,248,5,7,7,6,0,0,248,16,32,16,8,8,240, + 5,7,7,6,0,0,16,48,80,144,248,16,16,5,7,7, + 6,0,0,248,128,240,8,8,136,112,5,7,7,6,0,0, + 48,64,128,240,136,136,112,5,7,7,6,0,0,248,8,16, + 32,32,32,32,5,7,7,6,0,0,112,136,136,112,136,136, + 112,5,7,7,6,0,0,112,136,136,120,8,16,96,2,5, + 5,6,2,0,192,192,0,192,192,2,6,6,6,2,255,192, + 192,0,192,64,128,4,7,7,6,0,0,16,32,64,128,64, + 32,16,5,3,3,6,0,2,248,0,248,4,7,7,6,1, + 0,128,64,32,16,32,64,128,5,7,7,6,0,0,112,136, + 8,16,32,0,32,5,6,6,6,0,0,112,136,8,104,168, + 112,5,7,7,6,0,0,112,136,136,248,136,136,136,5,7, + 7,6,0,0,240,136,136,240,136,136,240,5,7,7,6,0, + 0,112,136,128,128,128,136,112,5,7,7,6,0,0,224,144, + 136,136,136,144,224,5,7,7,6,0,0,248,128,128,240,128, + 128,248,5,7,7,6,0,0,248,128,128,240,128,128,128,5, + 7,7,6,0,0,112,136,128,184,136,136,112,5,7,7,6, + 0,0,136,136,136,248,136,136,136,1,7,7,6,2,0,128, + 128,128,128,128,128,128,5,7,7,6,0,0,56,16,16,16, + 16,144,96,5,7,7,6,0,0,136,144,160,192,160,144,136, + 5,7,7,6,0,0,128,128,128,128,128,128,248,5,7,7, + 6,0,0,136,216,168,136,136,136,136,5,7,7,6,0,0, + 136,136,200,168,152,136,136,5,7,7,6,0,0,112,136,136, + 136,136,136,112,5,7,7,6,0,0,240,136,136,240,128,128, + 128,5,7,7,6,0,0,112,136,136,136,168,144,104,5,7, + 7,6,0,0,240,136,136,240,160,144,136,5,7,7,6,0, + 0,120,128,128,112,8,8,240,5,7,7,6,0,0,248,32, + 32,32,32,32,32,5,7,7,6,0,0,136,136,136,136,136, + 136,112,5,7,7,6,0,0,136,136,136,136,136,80,32,5, + 7,7,6,0,0,136,136,136,136,136,168,80,5,7,7,6, + 0,0,136,136,80,32,80,136,136,5,7,7,6,0,0,136, + 136,136,80,32,32,32,5,7,7,6,0,0,248,8,16,32, + 64,128,248,3,7,7,6,1,0,224,128,128,128,128,128,224, + 5,5,5,6,0,1,128,64,32,16,8,3,7,7,6,1, + 0,224,32,32,32,32,32,224,5,3,3,6,0,4,32,80, + 136,5,1,1,6,0,0,248,2,2,2,6,2,5,128,64, + 5,5,5,6,0,0,112,8,120,136,120,5,7,7,6,0, + 0,128,128,176,200,136,136,240,5,5,5,6,0,0,112,128, + 128,136,112,5,7,7,6,0,0,8,8,104,152,136,136,120, + 5,5,5,6,0,0,112,136,248,128,112,5,7,7,6,0, + 0,48,72,224,64,64,64,64,5,6,6,6,0,255,112,136, + 136,120,8,112,5,7,7,6,0,0,128,128,176,200,136,136, + 136,1,7,7,6,2,0,128,0,128,128,128,128,128,3,8, + 8,6,1,255,32,0,32,32,32,32,160,64,4,7,7,6, + 0,0,128,128,144,160,192,160,144,3,7,7,6,1,0,192, + 64,64,64,64,64,224,5,5,5,6,0,0,208,168,168,168, + 168,5,5,5,6,0,0,176,200,136,136,136,5,5,5,6, + 0,0,112,136,136,136,112,5,6,6,6,0,255,240,136,136, + 240,128,128,5,6,6,6,0,255,120,136,136,120,8,8,5, + 5,5,6,0,0,176,200,128,128,128,5,5,5,6,0,0, + 112,128,112,8,240,5,7,7,6,0,0,64,64,224,64,64, + 72,48,5,5,5,6,0,0,136,136,136,152,104,5,5,5, + 6,0,0,136,136,136,80,32,5,5,5,6,0,0,136,136, + 168,168,80,5,5,5,6,0,0,136,80,32,80,136,5,6, + 6,6,0,255,136,136,136,120,8,112,5,5,5,6,0,0, + 248,16,32,64,248,3,7,7,6,1,0,32,64,64,128,64, + 64,32,1,7,7,6,2,0,128,128,128,128,128,128,128,3, + 7,7,6,1,0,128,64,64,32,64,64,128,5,2,2,6, + 0,3,104,144,0,0,0,6,0,0,0,0,0,6,0,0, + 0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6, + 0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0, + 0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,0, + 0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6, + 0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0, + 0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,0, + 0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6, + 0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0, + 0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,0, + 0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6, + 0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0, + 0,6,0,0,0,0,0,6,0,0,5,8,8,6,0,0, + 64,248,128,128,240,128,128,248,5,8,8,6,0,0,80,248, + 128,128,240,128,128,248,5,7,7,6,0,0,224,64,64,112, + 72,72,112,5,8,8,6,0,0,16,32,248,136,128,128,128, + 128,5,7,7,6,0,0,48,72,128,224,128,72,48,5,7, + 7,6,0,0,112,136,128,112,8,136,112,3,7,7,6,1, + 0,224,64,64,64,64,64,224,3,8,8,6,1,0,160,0, + 224,64,64,64,64,224,5,7,7,6,0,0,56,16,16,16, + 16,144,96,5,7,7,6,0,0,160,160,160,184,168,168,184, + 5,7,7,6,0,0,160,160,160,248,168,168,184,4,7,7, + 6,0,0,224,64,112,80,80,80,80,5,8,8,6,0,0, + 16,32,136,144,160,224,144,136,5,8,8,6,0,0,64,32, + 136,152,168,200,136,136,5,9,9,6,0,255,80,32,136,136, + 136,80,32,32,32,5,8,8,6,0,255,136,136,136,136,136, + 136,248,32,5,7,7,6,0,0,112,136,136,248,136,136,136, + 5,7,7,6,0,0,248,128,128,240,136,136,240,5,7,7, + 6,0,0,240,136,136,240,136,136,240,5,7,7,6,0,0, + 248,136,128,128,128,128,128,5,8,8,6,0,255,120,40,40, + 40,72,136,248,136,5,7,7,6,0,0,248,128,128,240,128, + 128,248,5,7,7,6,0,0,168,168,168,112,168,168,168,5, + 7,7,6,0,0,240,8,8,112,8,8,240,5,7,7,6, + 0,0,136,136,152,168,200,136,136,5,8,8,6,0,0,80, + 32,136,152,168,168,200,136,5,7,7,6,0,0,136,144,160, + 192,160,144,136,5,7,7,6,0,0,120,40,40,40,40,168, + 72,5,7,7,6,0,0,136,216,168,136,136,136,136,5,7, + 7,6,0,0,136,136,136,248,136,136,136,5,7,7,6,0, + 0,112,136,136,136,136,136,112,5,7,7,6,0,0,248,136, + 136,136,136,136,136,5,7,7,6,0,0,240,136,136,240,128, + 128,128,5,7,7,6,0,0,112,136,128,128,128,136,112,5, + 7,7,6,0,0,248,32,32,32,32,32,32,5,7,7,6, + 0,0,136,136,136,80,32,64,128,5,7,7,6,0,0,32, + 112,168,168,168,112,32,5,7,7,6,0,0,136,136,80,32, + 80,136,136,5,8,8,6,0,255,136,136,136,136,136,136,248, + 8,5,7,7,6,0,0,136,136,136,152,104,8,8,5,7, + 7,6,0,0,168,168,168,168,168,168,248,5,8,8,6,0, + 255,168,168,168,168,168,168,248,8,5,7,7,6,0,0,192, + 64,64,112,72,72,112,5,7,7,6,0,0,136,136,136,200, + 168,168,200,5,7,7,6,0,0,128,128,128,240,136,136,240, + 5,7,7,6,0,0,112,136,8,56,8,136,112,5,7,7, + 6,0,0,144,168,168,232,168,168,144,5,7,7,6,0,0, + 120,136,136,120,40,72,136,5,5,5,6,0,0,112,8,120, + 136,120,5,7,7,6,0,0,24,96,128,240,136,136,112,4, + 5,5,6,0,0,224,144,224,144,224,5,5,5,6,0,0, + 248,136,128,128,128,5,6,6,6,0,255,120,40,72,136,248, + 136,5,5,5,6,0,0,112,136,248,128,112,5,5,5,6, + 0,0,168,168,112,168,168,5,5,5,6,0,0,240,8,48, + 8,240,5,5,5,6,0,0,136,152,168,200,136,5,7,7, + 6,0,0,80,32,136,152,168,200,136,4,5,5,6,0,0, + 144,160,192,160,144,5,5,5,6,0,0,248,40,40,168,72, + 5,5,5,6,0,0,136,216,168,136,136,5,5,5,6,0, + 0,136,136,248,136,136,5,5,5,6,0,0,112,136,136,136, + 112,5,5,5,6,0,0,248,136,136,136,136,5,6,6,6, + 0,255,240,136,136,240,128,128,5,5,5,6,0,0,112,128, + 128,136,112,5,5,5,6,0,0,248,32,32,32,32,5,6, + 6,6,0,255,136,136,136,120,8,112,5,6,6,6,0,0, + 32,112,168,168,112,32,5,5,5,6,0,0,136,80,32,80, + 136,5,6,6,6,0,255,136,136,136,136,248,8,5,5,5, + 6,0,0,136,136,248,8,8,5,5,5,6,0,0,168,168, + 168,168,248,5,6,6,6,0,255,168,168,168,168,248,8,5, + 5,5,6,0,0,192,64,112,72,112,5,5,5,6,0,0, + 136,136,200,168,200,3,5,5,6,1,0,128,128,192,160,192, + 5,5,5,6,0,0,112,136,56,136,112,5,5,5,6,0, + 0,144,168,232,168,144,5,5,5,6,0,0,120,136,120,40, + 72,5,8,8,6,0,0,64,32,0,112,136,248,128,112,5, + 7,7,6,0,0,80,0,112,136,248,128,112,5,9,9,6, + 0,255,64,224,64,64,120,72,72,72,16,5,8,8,6,0, + 0,16,32,0,248,136,128,128,128,5,5,5,6,0,0,112, + 136,96,136,112,5,5,5,6,0,0,112,128,112,8,240,1, + 7,7,6,2,0,128,0,128,128,128,128,128,3,7,7,6, + 1,0,160,0,64,64,64,64,64,3,8,8,6,1,255,32, + 0,32,32,32,32,160,64,5,5,5,6,0,0,160,160,184, + 168,184,5,5,5,6,0,0,160,160,248,168,184,5,6,6, + 6,0,0,64,224,64,120,72,72,4,8,8,6,0,0,16, + 32,0,144,160,192,160,144,5,8,8,6,0,0,64,32,0, + 136,152,168,200,136,5,9,9,6,0,255,80,32,0,136,136, + 136,120,8,112,5,6,6,6,0,255,136,136,136,136,248,32 + }; diff --git a/Marlin/dogm_font_data_ISO10646_Kana.h b/Marlin/dogm_font_data_ISO10646_Kana.h new file mode 100644 index 000000000..9970a3823 --- /dev/null +++ b/Marlin/dogm_font_data_ISO10646_Kana.h @@ -0,0 +1,173 @@ +/* + Fontname: ISO10646_Kana + Copyright: A. Hardtung, public domain + Capital A Height: 7, '1' Height: 7 + Calculated Max Values w= 5 h= 9 x= 2 y= 5 dx= 6 dy= 0 ascent= 8 len= 9 + Font Bounding box w= 6 h= 9 x= 0 y=-2 + Calculated Min Values x= 0 y=-1 dx= 0 dy= 0 + Pure Font ascent = 7 descent=-1 + X Font ascent = 7 descent=-1 + Max Font ascent = 8 descent=-1 +*/ +#include +const u8g_fntpgm_uint8_t ISO10646_Kana_5x7[2549] U8G_SECTION(".progmem.ISO10646_Kana_5x7") = { + 0,6,9,0,254,7,1,145,3,32,32,255,255,8,255,7, + 255,0,0,0,6,0,0,1,7,7,6,2,0,128,128,128, + 128,128,0,128,3,2,2,6,1,5,160,160,5,7,7,6, + 0,0,80,80,248,80,248,80,80,5,7,7,6,0,0,32, + 120,160,112,40,240,32,5,7,7,6,0,0,192,200,16,32, + 64,152,24,5,7,7,6,0,0,96,144,160,64,168,144,104, + 2,3,3,6,1,4,192,64,128,3,7,7,6,1,0,32, + 64,128,128,128,64,32,3,7,7,6,1,0,128,64,32,32, + 32,64,128,5,5,5,6,0,1,32,168,112,168,32,5,5, + 5,6,0,1,32,32,248,32,32,2,3,3,6,2,255,192, + 64,128,5,1,1,6,0,3,248,2,2,2,6,2,0,192, + 192,5,5,5,6,0,1,8,16,32,64,128,5,7,7,6, + 0,0,112,136,152,168,200,136,112,3,7,7,6,1,0,64, + 192,64,64,64,64,224,5,7,7,6,0,0,112,136,8,112, + 128,128,248,5,7,7,6,0,0,248,16,32,16,8,8,240, + 5,7,7,6,0,0,16,48,80,144,248,16,16,5,7,7, + 6,0,0,248,128,240,8,8,136,112,5,7,7,6,0,0, + 48,64,128,240,136,136,112,5,7,7,6,0,0,248,8,16, + 32,32,32,32,5,7,7,6,0,0,112,136,136,112,136,136, + 112,5,7,7,6,0,0,112,136,136,120,8,16,96,2,5, + 5,6,2,0,192,192,0,192,192,2,6,6,6,2,255,192, + 192,0,192,64,128,4,7,7,6,0,0,16,32,64,128,64, + 32,16,5,3,3,6,0,2,248,0,248,4,7,7,6,1, + 0,128,64,32,16,32,64,128,5,7,7,6,0,0,112,136, + 8,16,32,0,32,5,6,6,6,0,0,112,136,8,104,168, + 112,5,7,7,6,0,0,112,136,136,248,136,136,136,5,7, + 7,6,0,0,240,136,136,240,136,136,240,5,7,7,6,0, + 0,112,136,128,128,128,136,112,5,7,7,6,0,0,224,144, + 136,136,136,144,224,5,7,7,6,0,0,248,128,128,240,128, + 128,248,5,7,7,6,0,0,248,128,128,240,128,128,128,5, + 7,7,6,0,0,112,136,128,184,136,136,112,5,7,7,6, + 0,0,136,136,136,248,136,136,136,1,7,7,6,2,0,128, + 128,128,128,128,128,128,5,7,7,6,0,0,56,16,16,16, + 16,144,96,5,7,7,6,0,0,136,144,160,192,160,144,136, + 5,7,7,6,0,0,128,128,128,128,128,128,248,5,7,7, + 6,0,0,136,216,168,136,136,136,136,5,7,7,6,0,0, + 136,136,200,168,152,136,136,5,7,7,6,0,0,112,136,136, + 136,136,136,112,5,7,7,6,0,0,240,136,136,240,128,128, + 128,5,7,7,6,0,0,112,136,136,136,168,144,104,5,7, + 7,6,0,0,240,136,136,240,160,144,136,5,7,7,6,0, + 0,120,128,128,112,8,8,240,5,7,7,6,0,0,248,32, + 32,32,32,32,32,5,7,7,6,0,0,136,136,136,136,136, + 136,112,5,7,7,6,0,0,136,136,136,136,136,80,32,5, + 7,7,6,0,0,136,136,136,136,136,168,80,5,7,7,6, + 0,0,136,136,80,32,80,136,136,5,7,7,6,0,0,136, + 136,136,80,32,32,32,5,7,7,6,0,0,248,8,16,32, + 64,128,248,3,7,7,6,1,0,224,128,128,128,128,128,224, + 5,5,5,6,0,1,128,64,32,16,8,3,7,7,6,1, + 0,224,32,32,32,32,32,224,5,3,3,6,0,4,32,80, + 136,5,1,1,6,0,0,248,2,2,2,6,2,5,128,64, + 5,5,5,6,0,0,112,8,120,136,120,5,7,7,6,0, + 0,128,128,176,200,136,136,240,5,5,5,6,0,0,112,128, + 128,136,112,5,7,7,6,0,0,8,8,104,152,136,136,120, + 5,5,5,6,0,0,112,136,248,128,112,5,7,7,6,0, + 0,48,72,224,64,64,64,64,5,6,6,6,0,255,112,136, + 136,120,8,112,5,7,7,6,0,0,128,128,176,200,136,136, + 136,1,7,7,6,2,0,128,0,128,128,128,128,128,3,8, + 8,6,1,255,32,0,32,32,32,32,160,64,4,7,7,6, + 0,0,128,128,144,160,192,160,144,3,7,7,6,1,0,192, + 64,64,64,64,64,224,5,5,5,6,0,0,208,168,168,168, + 168,5,5,5,6,0,0,176,200,136,136,136,5,5,5,6, + 0,0,112,136,136,136,112,5,6,6,6,0,255,240,136,136, + 240,128,128,5,6,6,6,0,255,120,136,136,120,8,8,5, + 5,5,6,0,0,176,200,128,128,128,5,5,5,6,0,0, + 112,128,112,8,240,5,7,7,6,0,0,64,64,224,64,64, + 72,48,5,5,5,6,0,0,136,136,136,152,104,5,5,5, + 6,0,0,136,136,136,80,32,5,5,5,6,0,0,136,136, + 168,168,80,5,5,5,6,0,0,136,80,32,80,136,5,6, + 6,6,0,255,136,136,136,120,8,112,5,5,5,6,0,0, + 248,16,32,64,248,3,7,7,6,1,0,32,64,64,128,64, + 64,32,1,7,7,6,2,0,128,128,128,128,128,128,128,3, + 7,7,6,1,0,128,64,64,32,64,64,128,5,2,2,6, + 0,3,104,144,0,0,0,6,0,0,0,0,0,6,0,0, + 0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6, + 0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0, + 0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,0, + 0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6, + 0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0, + 0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,0, + 0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6, + 0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0, + 0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,0, + 0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6, + 0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0, + 0,6,0,0,0,0,0,6,0,0,5,3,3,6,0,2, + 248,0,248,5,6,6,6,0,0,248,8,40,48,32,64,5, + 7,7,6,0,0,248,8,40,48,32,32,64,4,5,5,6, + 0,0,16,32,96,160,32,5,7,7,6,0,0,8,16,32, + 96,160,32,32,5,5,5,6,0,0,32,248,136,8,48,5, + 7,7,6,0,0,32,248,136,136,8,16,32,5,4,4,6, + 0,0,248,32,32,248,5,6,6,6,0,0,248,32,32,32, + 32,248,5,5,5,6,0,0,16,248,48,80,144,5,7,7, + 6,0,0,16,248,16,48,80,144,16,5,5,5,6,0,0, + 64,248,72,80,64,5,7,7,6,0,0,40,0,64,248,72, + 80,64,5,7,7,6,0,0,32,248,32,248,32,32,32,5, + 8,8,6,0,0,40,0,32,248,32,248,32,32,4,6,6, + 6,0,0,64,112,144,16,16,32,5,8,8,6,0,0,40, + 0,64,112,144,16,16,32,5,6,6,6,0,0,64,120,144, + 16,16,32,5,8,8,6,0,0,40,0,64,120,144,16,16, + 32,5,5,5,6,0,0,248,8,8,8,248,5,7,7,6, + 0,0,40,0,248,8,8,8,248,5,7,7,6,0,255,80, + 248,80,80,16,32,64,5,9,9,6,0,255,40,0,80,248, + 80,80,16,32,64,5,6,6,6,0,0,192,8,200,8,16, + 224,5,8,8,6,0,0,40,0,192,8,200,8,16,224,5, + 6,6,6,0,0,248,8,16,32,80,136,5,8,8,6,0, + 0,40,0,248,8,16,32,80,136,5,6,6,6,0,0,64, + 248,72,80,64,120,5,8,8,6,0,0,40,0,64,248,72, + 80,64,120,4,4,4,6,0,1,16,208,16,224,5,7,7, + 6,0,0,40,0,8,200,8,16,224,5,7,7,6,0,255, + 32,120,136,40,16,40,64,5,9,9,6,0,255,40,0,32, + 120,136,40,16,40,64,5,6,6,6,0,0,240,32,248,32, + 64,128,5,8,8,6,0,0,40,0,240,32,248,32,64,128, + 4,5,5,6,0,1,192,16,208,16,224,5,6,6,6,0, + 0,192,8,200,8,16,224,5,8,8,6,0,0,40,0,192, + 8,200,8,16,224,5,6,6,6,0,0,112,0,248,32,32, + 64,5,8,8,6,0,0,40,0,112,0,248,32,32,64,3, + 7,7,6,1,0,128,128,128,192,160,128,128,4,8,8,6, + 1,0,80,0,128,128,192,160,128,128,5,7,7,6,0,0, + 32,32,248,32,32,64,128,5,6,6,6,0,0,112,0,0, + 0,0,248,5,6,6,6,0,0,248,8,80,32,80,128,5, + 7,7,6,0,255,32,248,8,16,32,112,168,3,7,7,6, + 1,0,32,32,32,32,32,64,128,5,5,5,6,0,0,16, + 136,136,136,136,5,7,7,6,0,0,40,0,16,136,136,136, + 136,5,8,8,6,0,0,24,24,0,16,136,136,136,136,5, + 7,7,6,0,0,128,128,248,128,128,128,120,5,8,8,6, + 0,0,40,128,128,248,128,128,128,120,5,8,8,6,0,0, + 24,152,128,248,128,128,128,120,5,6,6,6,0,0,248,8, + 8,8,16,96,5,8,8,6,0,0,40,0,248,8,8,8, + 16,96,5,8,8,6,0,0,24,24,248,8,8,8,16,96, + 5,5,5,6,0,1,64,160,16,8,8,5,7,7,6,0, + 1,40,0,64,160,16,8,8,5,7,7,6,0,1,24,24, + 64,160,16,8,8,5,6,6,6,0,0,32,248,32,32,168, + 168,5,8,8,6,0,0,40,0,32,248,32,32,168,168,5, + 8,8,6,0,0,24,24,32,248,32,32,168,168,5,6,6, + 6,0,0,248,8,8,80,32,16,4,6,6,6,1,0,224, + 0,224,0,224,16,5,6,6,6,0,0,32,64,128,144,248, + 8,5,6,6,6,0,0,8,8,80,32,80,128,5,6,6, + 6,0,0,120,32,248,32,32,56,5,7,7,6,0,0,64, + 64,248,72,80,64,64,5,7,7,6,0,0,64,248,72,80, + 64,64,64,5,5,5,6,0,0,112,16,16,16,248,5,7, + 7,6,0,0,112,16,16,16,16,16,248,4,5,5,6,1, + 0,240,16,240,16,240,5,7,7,6,0,0,248,8,8,248, + 8,8,248,5,6,6,6,0,0,112,0,248,8,16,32,3, + 6,6,6,1,0,160,160,160,160,32,64,5,6,6,6,0, + 0,80,80,80,80,88,144,4,6,6,6,1,0,128,128,128, + 144,160,192,5,6,6,6,0,0,248,136,136,136,248,136,5, + 5,5,6,0,0,248,136,8,16,96,5,6,6,6,0,0, + 248,136,8,8,16,96,5,6,6,6,0,0,16,248,80,80, + 248,16,5,6,6,6,0,0,248,8,80,96,64,248,5,6, + 6,6,0,0,248,8,248,8,16,32,5,6,6,6,0,0, + 128,64,8,8,16,224,5,8,8,6,0,0,40,0,32,248, + 136,8,24,32,5,6,6,6,0,0,64,248,72,72,136,144, + 4,5,5,6,1,0,128,240,160,32,32,5,8,8,6,0, + 0,40,0,248,136,8,8,16,96,5,8,8,6,0,0,40, + 0,16,248,80,80,248,16,5,7,7,6,0,0,40,0,248, + 16,32,32,248,5,8,8,6,0,0,40,0,248,8,248,8, + 16,32,2,2,2,6,2,2,192,192,5,1,1,6,0,3, + 248,5,5,5,6,0,1,128,64,32,16,8,5,6,6,6, + 0,1,40,128,64,32,16,8,5,7,7,6,0,0,248,8, + 8,8,8,8,8}; diff --git a/Marlin/dogm_font_data_Marlin_symbols.h b/Marlin/dogm_font_data_Marlin_symbols.h new file mode 100644 index 000000000..9fdb0370c --- /dev/null +++ b/Marlin/dogm_font_data_Marlin_symbols.h @@ -0,0 +1,22 @@ +/* + Fontname: Marlin_symbols + Copyright: Created with Fony 1.4.7 + Capital A Height: 0, '1' Height: 0 + Calculated Max Values w= 5 h=10 x= 0 y= 3 dx= 6 dy= 0 ascent= 8 len=10 + Font Bounding box w= 6 h= 9 x= 0 y=-2 + Calculated Min Values x= 0 y=-2 dx= 0 dy= 0 + Pure Font ascent = 0 descent= 0 + X Font ascent = 0 descent= 0 + Max Font ascent = 8 descent=-2 +*/ +#include +const u8g_fntpgm_uint8_t Marlin_symbols[140] U8G_SECTION(".progmem.Marlin_symbols") = { + 0,6,9,0,254,0,0,0,0,0,1,9,0,8,254,0, + 0,5,8,8,6,0,0,64,240,200,136,136,152,120,16,5, + 8,8,6,0,0,192,248,136,136,136,136,136,248,5,5,5, + 6,0,1,32,48,248,48,32,5,8,8,6,0,0,32,112, + 248,32,32,32,32,224,5,9,9,6,0,255,32,112,168,168, + 184,136,136,112,32,5,9,9,6,0,255,224,128,192,176,168, + 40,48,40,40,5,9,9,6,0,255,248,168,136,136,136,136, + 136,168,248,5,10,10,6,0,254,32,80,80,80,80,136,168, + 168,136,112,3,3,3,6,0,3,64,160,64}; diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index 7025e87bb..3ab18af75 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -14,11 +14,9 @@ #ifndef DOGM_LCD_IMPLEMENTATION_H #define DOGM_LCD_IMPLEMENTATION_H -#define MARLIN_VERSION "1.0.2" - /** -* Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays. -**/ + * Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays. + */ #ifdef ULTIPANEL #define BLEN_A 0 @@ -32,73 +30,150 @@ #include #include "DOGMbitmaps.h" -#include "dogm_font_data_ISO10646_1_Marlin.h" + #include "ultralcd.h" #include "ultralcd_st7920_u8glib_rrd.h" +#include "Configuration.h" -/* Russian language not supported yet, needs custom font +// save 3120 bytes of PROGMEM by commenting out #define USE_BIG_EDIT_FONT +// we don't have a big font for Cyrillic, Kana +#if defined(MAPPER_C2C3) || defined(MAPPER_NON) + //#define USE_BIG_EDIT_FONT +#endif -#ifdef LANGUAGE_RU -#include "LiquidCrystalRus.h" -#define LCD_CLASS LiquidCrystalRus +// If you have spare 2300Byte of progmem and want to use a +// smaller font on the Info-screen uncomment the next line. +//#define USE_SMALL_INFOFONT +#ifdef USE_SMALL_INFOFONT + #include "dogm_font_data_6x9_marlin.h" + #define FONT_STATUSMENU_NAME u8g_font_6x9 #else -#include -#define LCD_CLASS LiquidCrystal + #define FONT_STATUSMENU_NAME FONT_MENU_NAME #endif -*/ -#define USE_BIG_EDIT_FONT // save 3120 bytes of PROGMEM by commenting out this line -#define FONT_MENU ISO10646_1_Marlin_5x7 +#include "dogm_font_data_Marlin_symbols.h" // The Marlin special symbols +#define FONT_SPECIAL_NAME Marlin_symbols + +#ifndef SIMULATE_ROMFONT + #if defined( DISPLAY_CHARSET_ISO10646_1 ) + #include "dogm_font_data_ISO10646_1.h" + #define FONT_MENU_NAME ISO10646_1_5x7 + #elif defined( DISPLAY_CHARSET_ISO10646_5 ) + #include "dogm_font_data_ISO10646_5_Cyrillic.h" + #define FONT_MENU_NAME ISO10646_5_Cyrillic_5x7 + #elif defined( DISPLAY_CHARSET_ISO10646_KANA ) + #include "dogm_font_data_ISO10646_Kana.h" + #define FONT_MENU_NAME ISO10646_Kana_5x7 + #else // fall-back + #include "dogm_font_data_ISO10646_1.h" + #define FONT_MENU_NAME ISO10646_1_5x7 + #endif +#else // SIMULATE_ROMFONT + #if defined( DISPLAY_CHARSET_HD44780_JAPAN ) + #include "dogm_font_data_HD44780_J.h" + #define FONT_MENU_NAME HD44780_J_5x7 + #elif defined( DISPLAY_CHARSET_HD44780_WESTERN ) + #include "dogm_font_data_HD44780_W.h" + #define FONT_MENU_NAME HD44780_W_5x7 + #elif defined( DISPLAY_CHARSET_HD44780_CYRILLIC ) + #include "dogm_font_data_HD44780_C.h" + #define FONT_MENU_NAME HD44780_C_5x7 + #else // fall-back + #include "dogm_font_data_ISO10646_1.h" + #define FONT_MENU_NAME ISO10646_1_5x7 + #endif +#endif // SIMULATE_ROMFONT + +//#define FONT_STATUSMENU_NAME FONT_MENU_NAME + +#define FONT_STATUSMENU 1 +#define FONT_SPECIAL 2 +#define FONT_MENU_EDIT 3 +#define FONT_MENU 4 // DOGM parameters (size in pixels) #define DOG_CHAR_WIDTH 6 #define DOG_CHAR_HEIGHT 12 #ifdef USE_BIG_EDIT_FONT - #define FONT_MENU_EDIT u8g_font_9x18 + #define FONT_MENU_EDIT_NAME u8g_font_9x18 #define DOG_CHAR_WIDTH_EDIT 9 #define DOG_CHAR_HEIGHT_EDIT 18 #define LCD_WIDTH_EDIT 14 #else - #define FONT_MENU_EDIT ISO10646_1_Marlin_5x7 + #define FONT_MENU_EDIT_NAME FONT_MENU_NAME #define DOG_CHAR_WIDTH_EDIT 6 #define DOG_CHAR_HEIGHT_EDIT 12 #define LCD_WIDTH_EDIT 22 #endif -#define FONT_STATUSMENU FONT_MENU - #define START_ROW 0 -/* Custom characters defined in font font_6x10_marlin.c */ -#define LCD_STR_DEGREE "\xB0" -#define LCD_STR_REFRESH "\xF8" -#define LCD_STR_FOLDER "\xF9" -#define LCD_STR_ARROW_RIGHT "\xFA" -#define LCD_STR_UPLEVEL "\xFB" -#define LCD_STR_CLOCK "\xFC" -#define LCD_STR_FEEDRATE "\xFD" -#define LCD_STR_BEDTEMP "\xFE" -#define LCD_STR_THERMOMETER "\xFF" - -int lcd_contrast; - // LCD selection #ifdef U8GLIB_ST7920 -//U8GLIB_ST7920_128X64_RRD u8g(0,0,0); -U8GLIB_ST7920_128X64_RRD u8g(0); + //U8GLIB_ST7920_128X64_RRD u8g(0,0,0); + U8GLIB_ST7920_128X64_RRD u8g(0); #elif defined(MAKRPANEL) -// The MaKrPanel display, ST7565 controller as well -U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0); + // The MaKrPanel display, ST7565 controller as well + U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0); #elif defined(VIKI2) || defined(miniVIKI) -// Mini Viki and Viki 2.0 LCD, ST7565 controller as well -U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0); + // Mini Viki and Viki 2.0 LCD, ST7565 controller as well + U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0); #else -// for regular DOGM128 display with HW-SPI -U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0 + // for regular DOGM128 display with HW-SPI + U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0 #endif -static void lcd_implementation_init() -{ +#include "utf_mapper.h" + +int lcd_contrast; +static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD +static char currentfont = 0; + +static void lcd_setFont(char font_nr) { + switch(font_nr) { + case FONT_STATUSMENU : {u8g.setFont(FONT_STATUSMENU_NAME); currentfont = FONT_STATUSMENU;}; break; + case FONT_MENU : {u8g.setFont(FONT_MENU_NAME); currentfont = FONT_MENU;}; break; + case FONT_SPECIAL : {u8g.setFont(FONT_SPECIAL_NAME); currentfont = FONT_SPECIAL;}; break; + case FONT_MENU_EDIT : {u8g.setFont(FONT_MENU_EDIT_NAME); currentfont = FONT_MENU_EDIT;}; break; + break; + } +} + +char lcd_print(char c) { + if ((c > 0) && (c <= LCD_STR_SPECIAL_MAX)) { + u8g.setFont(FONT_SPECIAL_NAME); + u8g.print(c); + lcd_setFont(currentfont); + return 1; + } else { + return charset_mapper(c); + } +} + +char lcd_print(char* str) { + char c; + int i = 0; + char n = 0; + while ((c = str[i++])) { + n += lcd_print(c); + } + return n; +} + +/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */ +char lcd_printPGM(const char* str) { + char c; + char n = 0; + while ((c = pgm_read_byte(str++))) { + n += lcd_print(c); + } + return n; +} + +static bool show_splashscreen = true; + +static void lcd_implementation_init() { + #ifdef LCD_PIN_BL // Enable LCD backlight pinMode(LCD_PIN_BL, OUTPUT); digitalWrite(LCD_PIN_BL, HIGH); @@ -107,16 +182,16 @@ static void lcd_implementation_init() u8g.setContrast(lcd_contrast); // FIXME: remove this workaround // Uncomment this if you have the first generation (V1.10) of STBs board - // pinMode(17, OUTPUT); // Enable LCD backlight - // digitalWrite(17, HIGH); - -#ifdef LCD_SCREEN_ROT_90 - u8g.setRot90(); // Rotate screen by 90° -#elif defined(LCD_SCREEN_ROT_180) - u8g.setRot180(); // Rotate screen by 180° -#elif defined(LCD_SCREEN_ROT_270) - u8g.setRot270(); // Rotate screen by 270° -#endif + // pinMode(17, OUTPUT); // Enable LCD backlight + // digitalWrite(17, HIGH); + + #ifdef LCD_SCREEN_ROT_90 + u8g.setRot90(); // Rotate screen by 90° + #elif defined(LCD_SCREEN_ROT_180) + u8g.setRot180(); // Rotate screen by 180° + #elif defined(LCD_SCREEN_ROT_270) + u8g.setRot270(); // Rotate screen by 270° + #endif // Show splashscreen int offx = (u8g.getWidth() - START_BMPWIDTH) / 2; @@ -129,36 +204,35 @@ static void lcd_implementation_init() int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1)*DOG_CHAR_WIDTH) / 2; u8g.firstPage(); - do { - u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); - u8g.setFont(FONT_MENU); - #ifndef STRING_SPLASH_LINE2 - u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1); - #else - int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1)*DOG_CHAR_WIDTH) / 2; - u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT*3/2, STRING_SPLASH_LINE1); - u8g.drawStr(txt2X, u8g.getHeight() - DOG_CHAR_HEIGHT*1/2, STRING_SPLASH_LINE2); - #endif - } while (u8g.nextPage()); + do { + if (show_splashscreen) { + u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); + lcd_setFont(FONT_MENU); + #ifndef STRING_SPLASH_LINE2 + u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1); + #else + int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1)*DOG_CHAR_WIDTH) / 2; + u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT*3/2, STRING_SPLASH_LINE1); + u8g.drawStr(txt2X, u8g.getHeight() - DOG_CHAR_HEIGHT*1/2, STRING_SPLASH_LINE2); + #endif + } + } while (u8g.nextPage()); + show_splashscreen = false; } static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop -/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */ -static void lcd_printPGM(const char* str) { - char c; - while ((c = pgm_read_byte(str++))) u8g.print(c); -} - static void _draw_heater_status(int x, int heater) { bool isBed = heater < 0; int y = 17 + (isBed ? 1 : 0); - u8g.setFont(FONT_STATUSMENU); + + lcd_setFont(FONT_STATUSMENU); u8g.setPrintPos(x,7); - u8g.print(itostr3(int((heater >= 0 ? degTargetHotend(heater) : degTargetBed()) + 0.5))); + lcd_print(itostr3(int((heater >= 0 ? degTargetHotend(heater) : degTargetBed()) + 0.5))); lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); u8g.setPrintPos(x,28); - u8g.print(itostr3(int(heater >= 0 ? degHotend(heater) : degBed()) + 0.5)); + lcd_print(itostr3(int(heater >= 0 ? degHotend(heater) : degBed()) + 0.5)); + lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); if (!isHeatingHotend(0)) { u8g.drawBox(x+7,y,2,2); @@ -171,9 +245,6 @@ static void _draw_heater_status(int x, int heater) { } static void lcd_implementation_status_screen() { - - static unsigned char fan_rot = 0; - u8g.setColorIndex(1); // black on white // Symbols menu graphics, animated fan @@ -190,7 +261,7 @@ static void lcd_implementation_status_screen() { u8g.drawFrame(54,49,73,4); // SD Card Progress bar and clock - u8g.setFont(FONT_STATUSMENU); + lcd_setFont(FONT_STATUSMENU); if (IS_SD_PRINTING) { // Progress bar solid part @@ -198,87 +269,96 @@ static void lcd_implementation_status_screen() { } u8g.setPrintPos(80,48); - if (starttime != 0) { - uint16_t time = (millis() - starttime) / 60000; - u8g.print(itostr2(time/60)); - u8g.print(':'); - u8g.print(itostr2(time%60)); + if (print_job_start_ms != 0) { + uint16_t time = (millis() - print_job_start_ms) / 60000; + lcd_print(itostr2(time/60)); + lcd_print(':'); + lcd_print(itostr2(time%60)); } else { lcd_printPGM(PSTR("--:--")); } #endif - + // Extruders for (int i=0; i -1 + #if HAS_FAN int per = ((fanSpeed + 1) * 100) / 256; if (per) { - u8g.print(itostr3(per)); - u8g.print('%'); + lcd_print(itostr3(per)); + lcd_print('%'); } else #endif { - u8g.print("---"); + lcd_printPGM(PSTR("---")); } // X, Y, Z-Coordinates #define XYZ_BASELINE 38 - u8g.setFont(FONT_STATUSMENU); - u8g.drawBox(0,30,128,9); + lcd_setFont(FONT_STATUSMENU); + + #ifdef USE_SMALL_INFOFONT + u8g.drawBox(0,30,128,10); + #else + u8g.drawBox(0,30,128,9); + #endif u8g.setColorIndex(0); // white on black u8g.setPrintPos(2,XYZ_BASELINE); - u8g.print('X'); + lcd_print('X'); u8g.drawPixel(8,XYZ_BASELINE - 5); u8g.drawPixel(8,XYZ_BASELINE - 3); u8g.setPrintPos(10,XYZ_BASELINE); - u8g.print(ftostr31ns(current_position[X_AXIS])); + lcd_print(ftostr31ns(current_position[X_AXIS])); u8g.setPrintPos(43,XYZ_BASELINE); - u8g.print('Y'); + lcd_print('Y'); u8g.drawPixel(49,XYZ_BASELINE - 5); u8g.drawPixel(49,XYZ_BASELINE - 3); u8g.setPrintPos(51,XYZ_BASELINE); - u8g.print(ftostr31ns(current_position[Y_AXIS])); + lcd_print(ftostr31ns(current_position[Y_AXIS])); u8g.setPrintPos(83,XYZ_BASELINE); - u8g.print('Z'); + lcd_print('Z'); u8g.drawPixel(89,XYZ_BASELINE - 5); u8g.drawPixel(89,XYZ_BASELINE - 3); u8g.setPrintPos(91,XYZ_BASELINE); - u8g.print(ftostr31(current_position[Z_AXIS])); + lcd_print(ftostr31(current_position[Z_AXIS])); u8g.setColorIndex(1); // black on white // Feedrate - u8g.setFont(FONT_MENU); + lcd_setFont(FONT_MENU); u8g.setPrintPos(3,49); - u8g.print(LCD_STR_FEEDRATE[0]); - u8g.setFont(FONT_STATUSMENU); + lcd_print(LCD_STR_FEEDRATE[0]); + lcd_setFont(FONT_STATUSMENU); u8g.setPrintPos(12,49); - u8g.print(itostr3(feedmultiply)); - u8g.print('%'); + lcd_print(itostr3(feedrate_multiplier)); + lcd_print('%'); // Status line - u8g.setFont(FONT_STATUSMENU); - u8g.setPrintPos(0,63); + lcd_setFont(FONT_STATUSMENU); + #ifdef USE_SMALL_INFOFONT + u8g.setPrintPos(0,62); + #else + u8g.setPrintPos(0,63); + #endif #ifndef FILAMENT_LCD_DISPLAY - u8g.print(lcd_status_message); + lcd_print(lcd_status_message); #else - if (millis() < message_millis + 5000) { //Display both Status message line and Filament display on the last line - u8g.print(lcd_status_message); + if (millis() < previous_lcd_status_ms + 5000) { //Display both Status message line and Filament display on the last line + lcd_print(lcd_status_message); } else { lcd_printPGM(PSTR("dia:")); - u8g.print(ftostr12ns(filament_width_meas)); + lcd_print(ftostr12ns(filament_width_meas)); lcd_printPGM(PSTR(" factor:")); - u8g.print(itostr3(extrudemultiply)); - u8g.print('%'); + lcd_print(itostr3(volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM])); + lcd_print('%'); } #endif } @@ -301,14 +381,13 @@ static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, co lcd_implementation_mark_as_selected(row, isSelected); - while ((c = pgm_read_byte(pstr))) { - u8g.print(c); + while (c = pgm_read_byte(pstr)) { + n -= lcd_print(c); pstr++; - n--; } - while (n--) u8g.print(' '); - u8g.print(post_char); - u8g.print(' '); + while (n--) lcd_print(' '); + lcd_print(post_char); + lcd_print(' '); } static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const char* pstr, const char* data, bool pgm) { @@ -317,14 +396,13 @@ static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const c lcd_implementation_mark_as_selected(row, isSelected); - while ((c = pgm_read_byte(pstr))) { - u8g.print(c); + while (c = pgm_read_byte(pstr)) { + n -= lcd_print(c); pstr++; - n--; } - u8g.print(':'); - while (n--) u8g.print(' '); - if (pgm) { lcd_printPGM(data); } else { u8g.print(data); } + lcd_print(':'); + while (n--) lcd_print(' '); + if (pgm) { lcd_printPGM(data); } else { lcd_print((char *)data); } } #define lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, false) @@ -358,13 +436,13 @@ void lcd_implementation_drawedit(const char* pstr, char* value) { #ifdef USE_BIG_EDIT_FONT if (lcd_strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) { - u8g.setFont(FONT_MENU_EDIT); + lcd_setFont(FONT_MENU_EDIT); lcd_width = LCD_WIDTH_EDIT + 1; char_width = DOG_CHAR_WIDTH_EDIT; if (lcd_strlen_P(pstr) >= LCD_WIDTH_EDIT - vallen) rows = 2; } else { - u8g.setFont(FONT_MENU); + lcd_setFont(FONT_MENU); } #endif @@ -375,9 +453,9 @@ void lcd_implementation_drawedit(const char* pstr, char* value) { u8g.setPrintPos(0, rowHeight + kHalfChar); lcd_printPGM(pstr); - u8g.print(':'); + lcd_print(':'); u8g.setPrintPos((lcd_width - 1 - vallen) * char_width, rows * rowHeight + kHalfChar); - u8g.print(value); + lcd_print(value); } static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir) { @@ -391,13 +469,12 @@ static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const c lcd_implementation_mark_as_selected(row, isSelected); - if (isDir) u8g.print(LCD_STR_FOLDER[0]); + if (isDir) lcd_print(LCD_STR_FOLDER[0]); while ((c = *filename)) { - u8g.print(c); + n -= lcd_print(c); filename++; - n--; } - while (n--) u8g.print(' '); + while (n--) lcd_print(' '); } #define lcd_implementation_drawmenu_sdfile(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, false) @@ -408,16 +485,4 @@ static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const c #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') -static void lcd_implementation_quick_feedback() { - #if BEEPER > -1 - SET_OUTPUT(BEEPER); - for(int8_t i=0; i<10; i++) { - WRITE(BEEPER,HIGH); - delay(3); - WRITE(BEEPER,LOW); - delay(3); - } - #endif -} - #endif //__DOGM_LCD_IMPLEMENTATION_H diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index e9801813f..269b8b794 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -1,4 +1,4 @@ -#ifndef CONFIGURATION_H +#ifndef CONFIGURATION_H #define CONFIGURATION_H #include "boards.h" @@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated: // 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_VERSION "1.0.2" +#define STRING_VERSION "1.0.3 dev" #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. @@ -62,8 +62,9 @@ Here are some standard links for getting your machine calibrated: #define MOTHERBOARD BOARD_FELIX2 #endif -// Define this to set a custom name for your generic Mendel, -// #define CUSTOM_MENDEL_NAME "This Mendel" +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "Felix" // 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) @@ -122,7 +123,7 @@ Here are some standard links for getting your machine calibrated: // Use it for Testing or Development purposes. NEVER for production machine. // #define DUMMY_THERMISTOR_998_VALUE 25 // #define DUMMY_THERMISTOR_999_VALUE 100 - +// :{ '0': "Not used", '4': "10k !! do not use for a hotend. Bad resolution at high temp. !!", '1': "100k / 4.7k - EPCOS", '51': "100k / 1k - EPCOS", '6': "100k / 4.7k EPCOS - Not as accurate as Table 1", '5': "100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '7': "100k / 4.7k Honeywell 135-104LAG-J01", '71': "100k / 4.7k Honeywell 135-104LAF-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'", '60': "100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '55': "100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '2': "200k / 4.7k - ATC Semitec 204GT-2", '52': "200k / 1k - ATC Semitec 204GT-2", '-2': "Thermocouple + MAX6675 (only for sensor 0)", '-1': "Thermocouple + AD595", '3': "Mendel-parts / 4.7k", '1047': "Pt1000 / 4.7k", '1010': "Pt1000 / 1k (non standard)", '20': "PT100 (Ultimainboard V2.x)", '147': "Pt100 / 4.7k", '110': "Pt100 / 1k (non-standard)", '998': "Dummy 1", '999': "Dummy 2" } #define TEMP_SENSOR_0 1 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 @@ -184,7 +185,6 @@ Here are some standard links for getting your machine calibrated: // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term #define K1 0.95 //smoothing factor within the PID - #define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // Felix 2.0+ electronics with v4 Hotend #define DEFAULT_Kp 12 @@ -199,7 +199,7 @@ Here are some standard links for getting your machine calibrated: // Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis // // Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. -// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// If your PID_dT is the default, and correct for your hardware/configuration, that means 7.689Hz, // which is fine for driving a square wave into a resistive load and does not significantly impact you 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, you probably @@ -265,24 +265,27 @@ your extruder heater takes 2 minutes to hit the target on heating. // uncomment the 2 defines below: // Parameters for all extruder heaters -//#define THERMAL_RUNAWAY_PROTECTION_PERIOD 60 //in seconds -//#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 5 // in degree Celsius +//#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 //in seconds +//#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius // If you want to enable this feature for your bed heater, // uncomment the 2 defines below: // Parameters for the bed heater -//#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 30 //in seconds -//#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 5// in degree Celsius +//#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 //in seconds +//#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius //=========================================================================== //============================= Mechanical Settings ========================= //=========================================================================== -// Uncomment the following line to enable CoreXY kinematics +// Uncomment this option to enable CoreXY kinematics // #define COREXY +// Enable this option for Toshiba steppers +// #define CONFIG_STEPPERS_TOSHIBA + // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors @@ -296,13 +299,14 @@ your extruder heater takes 2 minutes to hit the target on heating. // #define ENDSTOPPULLUP_ZMIN #endif -// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. +const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. #define DISABLE_MAX_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS @@ -319,13 +323,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DISABLE_E false // For all extruders #define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled -#define INVERT_X_DIR true // for Mendel set to false, for Orca set to true -#define INVERT_Y_DIR true // for Mendel set to true, for Orca set to false -#define INVERT_Z_DIR true // for Mendel set to false, for Orca set to true -#define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E3_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false +// 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 +#define INVERT_E0_DIR false +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false // ENDSTOP SETTINGS: // Sets direction of endstops when homing; 1=MAX, -1=MIN @@ -337,12 +342,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. // Travel limits after homing (units are in mm) -#define X_MAX_POS 255 #define X_MIN_POS 0 -#define Y_MAX_POS 205 #define Y_MIN_POS 0 -#define Z_MAX_POS 235 #define Z_MIN_POS 0 +#define X_MAX_POS 255 +#define Y_MAX_POS 205 +#define Z_MAX_POS 235 //=========================================================================== //============================= Filament Runout Sensor ====================== @@ -361,7 +366,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // #define MANUAL_BED_LEVELING // Add display menu option for bed leveling // #define MESH_BED_LEVELING // Enable mesh bed leveling -#if defined(MESH_BED_LEVELING) +#ifdef MANUAL_BED_LEVELING + #define MBL_Z_STEP 0.025 +#endif // MANUAL_BED_LEVELING + +#ifdef MESH_BED_LEVELING #define MESH_MIN_X 10 #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MIN_Y 10 @@ -380,39 +389,38 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef ENABLE_AUTO_BED_LEVELING -// There are 2 different ways to pick the X and Y locations to probe: - -// - "grid" mode -// Probe every point in a rectangular grid -// You must specify the rectangle, and the density of sample points -// This mode is preferred because there are more measurements. -// It used to be called ACCURATE_BED_LEVELING but "grid" is more descriptive - -// - "3-point" mode -// Probe 3 arbitrary points on the bed (that aren't colinear) -// You must specify the X & Y coordinates of all 3 points - + // There are 2 different ways to specify probing locations + // + // - "grid" mode + // Probe several points in a rectangular grid. + // You specify the rectangle and the density of sample points. + // This mode is preferred because there are more measurements. + // + // - "3-point" mode + // Probe 3 arbitrary points on the bed (that aren't colinear) + // You specify the XY coordinates of all 3 points. + + // Enable this to sample the bed in a grid (least squares solution) + // Note: this feature generates 10KB extra code size #define AUTO_BED_LEVELING_GRID - // with AUTO_BED_LEVELING_GRID, the bed is sampled in a - // AUTO_BED_LEVELING_GRID_POINTSxAUTO_BED_LEVELING_GRID_POINTS grid - // and least squares solution is calculated - // Note: this feature occupies 10'206 byte + #ifdef AUTO_BED_LEVELING_GRID #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 - #define BACK_PROBE_BED_POSITION 180 #define FRONT_PROBE_BED_POSITION 20 + #define BACK_PROBE_BED_POSITION 180 - // set the number of grid points per dimension - // I wouldn't see a reason to go above 3 (=9 probing points on the bed) - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this + // Set the number of grid points per dimension + // You probably don't need more than 3 (squared=9) + #define AUTO_BED_LEVELING_GRID_POINTS 2 - #else // not AUTO_BED_LEVELING_GRID - // with no grid, just probe 3 arbitrary points. A simple cross-product - // is used to esimate the plane of the print bed + #else // !AUTO_BED_LEVELING_GRID + // Arbitrary points to probe. A simple cross-product + // is used to estimate the plane of the bed. #define ABL_PROBE_PT_1_X 15 #define ABL_PROBE_PT_1_Y 180 #define ABL_PROBE_PT_2_X 15 @@ -422,21 +430,24 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif // AUTO_BED_LEVELING_GRID - - // these are the offsets to the probe relative to the extruder tip (Hotend - Probe) + // Offsets to the probe relative to the extruder tip (Hotend - Probe) // X and Y offsets must be integers - #define X_PROBE_OFFSET_FROM_EXTRUDER -25 - #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 - #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35 + #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // Probe on: -left +right + #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // Probe on: -front +behind + #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35 // -below (always!) #define Z_RAISE_BEFORE_HOMING 4 // (in mm) Raise Z before homing (G28) for Probe Clearance. // Be sure you have this distance over your Z_MAX_POS in case #define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min - #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. + #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points + #define Z_RAISE_AFTER_PROBING 15 //How much the extruder will be raised after the last probing point. +// #define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" //These commands will be executed in the end of G29 routine. + //Useful to retract a deployable probe. + //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#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. @@ -464,6 +475,20 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif + // Support for a dedicated Z PROBE endstop separate from the Z MIN endstop. + // If you would like to use both a Z PROBE and a Z MIN endstop together or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP and read the instructions below. + // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. + // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. + // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 + // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. + // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. + // D32 is currently selected in the RAMPS 1.3/1.4 pin file. All other boards will need changes to the respective pins_XXXXX.h file. + // WARNING: Setting the wrong pin may have unexpected and potentially disastrous outcomes. Use with caution and do your homework. + + //#define Z_PROBE_ENDSTOP + #endif // ENABLE_AUTO_BED_LEVELING @@ -471,15 +496,19 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) -//Manual homing switch locations: +// Manual homing switch locations: // For deltabots this means top and center of the Cartesian print volume. -#define MANUAL_X_HOME_POS 0 -#define MANUAL_Y_HOME_POS 0 -#define MANUAL_Z_HOME_POS 0 -//#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +#ifdef MANUAL_HOME_POSITIONS + #define MANUAL_X_HOME_POS 0 + #define MANUAL_Y_HOME_POS 0 + #define MANUAL_Z_HOME_POS 0 + //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +#endif + +/** + * MOVEMENT SETTINGS + */ -//// MOVEMENT SETTINGS -#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0} // set the homing speeds (mm/min) // default settings @@ -512,9 +541,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Custom M code points #define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES - #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 - #define Z_PROBE_OFFSET_RANGE_MIN -15 - #define Z_PROBE_OFFSET_RANGE_MAX -5 + #ifdef ENABLE_AUTO_BED_LEVELING + #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 + #define Z_PROBE_OFFSET_RANGE_MIN -20 + #define Z_PROBE_OFFSET_RANGE_MAX 20 + #endif #endif @@ -525,9 +556,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. //define this to enable EEPROM support //#define EEPROM_SETTINGS -//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: -// please keep turned on if you can. -//#define EEPROM_CHITCHAT + +#ifdef EEPROM_SETTINGS + // To disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: + #define EEPROM_CHITCHAT // please keep turned on if you can. +#endif // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 180 @@ -541,13 +574,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //==============================LCD and SD support============================= // Define your display language below. Replace (en) with your language code and uncomment. -// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu +// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu, kana, kana_utf8, test // See also language.h //#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) -// Character based displays can have different extended charsets. -//#define DISPLAY_CHARSET_HD44780_JAPAN // "ääööüüß23°" -//#define DISPLAY_CHARSET_HD44780_WESTERN // "ÄäÖöÜüß²³°" if you see a '~' instead of a 'arrow_right' at the right of submenuitems - this is the right one. +// Choose ONE of these 3 charsets. This has to match your hardware. Ignored for full graphic display. +// To find out what type you have - compile with (test) - upload - click to get the menu. You'll see two typical lines from the upper half of the charset. +// See also documentation/LCDLanguageFont.md + #define DISPLAY_CHARSET_HD44780_JAPAN // this is the most common hardware + //#define DISPLAY_CHARSET_HD44780_WESTERN + //#define DISPLAY_CHARSET_HD44780_CYRILLIC //#define ULTRA_LCD //general LCD support, also 16x2 //#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) @@ -560,6 +596,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define ULTIPANEL //the UltiPanel as on Thingiverse //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click + // 0 to disable buzzer feedback // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne @@ -621,11 +658,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino #define FAST_PWM_FAN -// Temperature status LEDs that display the hotend and bet temperature. -// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on. -// Otherwise the RED led is on. There is 1C hysteresis. -//#define TEMP_STAT_LEDS - // 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. @@ -637,6 +669,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // at zero value, there are 128 effective control positions. #define SOFT_PWM_SCALE 0 +// Temperature status LEDs that display the hotend and bet temperature. +// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on. +// Otherwise the RED led is on. There is 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 @@ -667,7 +704,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Servo Endstops // // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. -// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. +// Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500. // //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h index e9e4623ca..49b9f5b0b 100644 --- a/Marlin/example_configurations/Felix/Configuration_DUAL.h +++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h @@ -1,4 +1,4 @@ -#ifndef CONFIGURATION_H +#ifndef CONFIGURATION_H #define CONFIGURATION_H #include "boards.h" @@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated: // 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_VERSION "1.0.2" +#define STRING_VERSION "1.0.3 dev" #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. @@ -62,8 +62,9 @@ Here are some standard links for getting your machine calibrated: #define MOTHERBOARD BOARD_FELIX2 #endif -// Define this to set a custom name for your generic Mendel, -// #define CUSTOM_MENDEL_NAME "This Mendel" +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "Felix Dual" // 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) @@ -122,7 +123,7 @@ Here are some standard links for getting your machine calibrated: // Use it for Testing or Development purposes. NEVER for production machine. // #define DUMMY_THERMISTOR_998_VALUE 25 // #define DUMMY_THERMISTOR_999_VALUE 100 - +// :{ '0': "Not used", '4': "10k !! do not use for a hotend. Bad resolution at high temp. !!", '1': "100k / 4.7k - EPCOS", '51': "100k / 1k - EPCOS", '6': "100k / 4.7k EPCOS - Not as accurate as Table 1", '5': "100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '7': "100k / 4.7k Honeywell 135-104LAG-J01", '71': "100k / 4.7k Honeywell 135-104LAF-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'", '60': "100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '55': "100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '2': "200k / 4.7k - ATC Semitec 204GT-2", '52': "200k / 1k - ATC Semitec 204GT-2", '-2': "Thermocouple + MAX6675 (only for sensor 0)", '-1': "Thermocouple + AD595", '3': "Mendel-parts / 4.7k", '1047': "Pt1000 / 4.7k", '1010': "Pt1000 / 1k (non standard)", '20': "PT100 (Ultimainboard V2.x)", '147': "Pt100 / 4.7k", '110': "Pt100 / 1k (non-standard)", '998': "Dummy 1", '999': "Dummy 2" } #define TEMP_SENSOR_0 1 #define TEMP_SENSOR_1 1 #define TEMP_SENSOR_2 0 @@ -184,7 +185,6 @@ Here are some standard links for getting your machine calibrated: // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term #define K1 0.95 //smoothing factor within the PID - #define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // Felix 2.0+ electronics with v4 Hotend #define DEFAULT_Kp 12 @@ -199,7 +199,7 @@ Here are some standard links for getting your machine calibrated: // Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis // // Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. -// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// If your PID_dT is the default, and correct for your hardware/configuration, that means 7.689Hz, // which is fine for driving a square wave into a resistive load and does not significantly impact you 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, you probably @@ -265,24 +265,27 @@ your extruder heater takes 2 minutes to hit the target on heating. // uncomment the 2 defines below: // Parameters for all extruder heaters -//#define THERMAL_RUNAWAY_PROTECTION_PERIOD 60 //in seconds -//#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 5 // in degree Celsius +//#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 //in seconds +//#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius // If you want to enable this feature for your bed heater, // uncomment the 2 defines below: // Parameters for the bed heater -//#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 30 //in seconds -//#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 5// in degree Celsius +//#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 //in seconds +//#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius //=========================================================================== //============================= Mechanical Settings ========================= //=========================================================================== -// Uncomment the following line to enable CoreXY kinematics +// Uncomment this option to enable CoreXY kinematics // #define COREXY +// Enable this option for Toshiba steppers +// #define CONFIG_STEPPERS_TOSHIBA + // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors @@ -296,13 +299,14 @@ your extruder heater takes 2 minutes to hit the target on heating. // #define ENDSTOPPULLUP_ZMIN #endif -// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. +const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. #define DISABLE_MAX_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS @@ -319,13 +323,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DISABLE_E false // For all extruders #define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled -#define INVERT_X_DIR true // for Mendel set to false, for Orca set to true -#define INVERT_Y_DIR true // for Mendel set to true, for Orca set to false -#define INVERT_Z_DIR true // for Mendel set to false, for Orca set to true -#define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E1_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E3_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false +// 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 +#define INVERT_E0_DIR false +#define INVERT_E1_DIR true +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false // ENDSTOP SETTINGS: // Sets direction of endstops when homing; 1=MAX, -1=MIN @@ -337,12 +342,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. // Travel limits after homing (units are in mm) -#define X_MAX_POS 255 #define X_MIN_POS 0 -#define Y_MAX_POS 205 #define Y_MIN_POS 0 -#define Z_MAX_POS 235 #define Z_MIN_POS 0 +#define X_MAX_POS 255 +#define Y_MAX_POS 205 +#define Z_MAX_POS 235 //=========================================================================== //============================= Filament Runout Sensor ====================== @@ -361,7 +366,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // #define MANUAL_BED_LEVELING // Add display menu option for bed leveling // #define MESH_BED_LEVELING // Enable mesh bed leveling -#if defined(MESH_BED_LEVELING) +#ifdef MESH_BED_LEVELING #define MESH_MIN_X 10 #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MIN_Y 10 @@ -380,39 +385,38 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef ENABLE_AUTO_BED_LEVELING -// There are 2 different ways to pick the X and Y locations to probe: - -// - "grid" mode -// Probe every point in a rectangular grid -// You must specify the rectangle, and the density of sample points -// This mode is preferred because there are more measurements. -// It used to be called ACCURATE_BED_LEVELING but "grid" is more descriptive - -// - "3-point" mode -// Probe 3 arbitrary points on the bed (that aren't colinear) -// You must specify the X & Y coordinates of all 3 points - + // There are 2 different ways to specify probing locations + // + // - "grid" mode + // Probe several points in a rectangular grid. + // You specify the rectangle and the density of sample points. + // This mode is preferred because there are more measurements. + // + // - "3-point" mode + // Probe 3 arbitrary points on the bed (that aren't colinear) + // You specify the XY coordinates of all 3 points. + + // Enable this to sample the bed in a grid (least squares solution) + // Note: this feature generates 10KB extra code size #define AUTO_BED_LEVELING_GRID - // with AUTO_BED_LEVELING_GRID, the bed is sampled in a - // AUTO_BED_LEVELING_GRID_POINTSxAUTO_BED_LEVELING_GRID_POINTS grid - // and least squares solution is calculated - // Note: this feature occupies 10'206 byte + #ifdef AUTO_BED_LEVELING_GRID #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 - #define BACK_PROBE_BED_POSITION 180 #define FRONT_PROBE_BED_POSITION 20 + #define BACK_PROBE_BED_POSITION 180 - // set the number of grid points per dimension - // I wouldn't see a reason to go above 3 (=9 probing points on the bed) - #define AUTO_BED_LEVELING_GRID_POINTS 2 + #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this + // Set the number of grid points per dimension + // You probably don't need more than 3 (squared=9) + #define AUTO_BED_LEVELING_GRID_POINTS 2 - #else // not AUTO_BED_LEVELING_GRID - // with no grid, just probe 3 arbitrary points. A simple cross-product - // is used to esimate the plane of the print bed + #else // !AUTO_BED_LEVELING_GRID + // Arbitrary points to probe. A simple cross-product + // is used to estimate the plane of the bed. #define ABL_PROBE_PT_1_X 15 #define ABL_PROBE_PT_1_Y 180 #define ABL_PROBE_PT_2_X 15 @@ -422,21 +426,24 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif // AUTO_BED_LEVELING_GRID - - // these are the offsets to the probe relative to the extruder tip (Hotend - Probe) + // Offsets to the probe relative to the extruder tip (Hotend - Probe) // X and Y offsets must be integers - #define X_PROBE_OFFSET_FROM_EXTRUDER -25 - #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 - #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35 + #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // Probe on: -left +right + #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // Probe on: -front +behind + #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35 // -below (always!) #define Z_RAISE_BEFORE_HOMING 4 // (in mm) Raise Z before homing (G28) for Probe Clearance. // Be sure you have this distance over your Z_MAX_POS in case #define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min - #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. + #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points + #define Z_RAISE_AFTER_PROBING 15 //How much the extruder will be raised after the last probing point. +// #define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" //These commands will be executed in the end of G29 routine. + //Useful to retract a deployable probe. + //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#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. @@ -464,6 +471,20 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif + // Support for a dedicated Z PROBE endstop separate from the Z MIN endstop. + // If you would like to use both a Z PROBE and a Z MIN endstop together or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP and read the instructions below. + // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. + // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. + // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 + // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. + // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. + // D32 is currently selected in the RAMPS 1.3/1.4 pin file. All other boards will need changes to the respective pins_XXXXX.h file. + // WARNING: Setting the wrong pin may have unexpected and potentially disastrous outcomes. Use with caution and do your homework. + + //#define Z_PROBE_ENDSTOP + #endif // ENABLE_AUTO_BED_LEVELING @@ -471,15 +492,19 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) -//Manual homing switch locations: +// Manual homing switch locations: // For deltabots this means top and center of the Cartesian print volume. -#define MANUAL_X_HOME_POS 0 -#define MANUAL_Y_HOME_POS 0 -#define MANUAL_Z_HOME_POS 0 -//#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +#ifdef MANUAL_HOME_POSITIONS + #define MANUAL_X_HOME_POS 0 + #define MANUAL_Y_HOME_POS 0 + #define MANUAL_Z_HOME_POS 0 + //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +#endif + +/** + * MOVEMENT SETTINGS + */ -//// MOVEMENT SETTINGS -#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0} // set the homing speeds (mm/min) // default settings @@ -512,9 +537,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Custom M code points #define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES - #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 - #define Z_PROBE_OFFSET_RANGE_MIN -15 - #define Z_PROBE_OFFSET_RANGE_MAX -5 + #ifdef ENABLE_AUTO_BED_LEVELING + #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 + #define Z_PROBE_OFFSET_RANGE_MIN -20 + #define Z_PROBE_OFFSET_RANGE_MAX 20 + #endif #endif @@ -525,9 +552,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. //define this to enable EEPROM support //#define EEPROM_SETTINGS -//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: -// please keep turned on if you can. -//#define EEPROM_CHITCHAT + +#ifdef EEPROM_SETTINGS + // To disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: + #define EEPROM_CHITCHAT // please keep turned on if you can. +#endif // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 180 @@ -541,13 +570,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //==============================LCD and SD support============================= // Define your display language below. Replace (en) with your language code and uncomment. -// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu +// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu, kana, kana_utf8, test // See also language.h //#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) -// Character based displays can have different extended charsets. -//#define DISPLAY_CHARSET_HD44780_JAPAN // "ääööüüß23°" -//#define DISPLAY_CHARSET_HD44780_WESTERN // "ÄäÖöÜüß²³°" if you see a '~' instead of a 'arrow_right' at the right of submenuitems - this is the right one. +// Choose ONE of these 3 charsets. This has to match your hardware. Ignored for full graphic display. +// To find out what type you have - compile with (test) - upload - click to get the menu. You'll see two typical lines from the upper half of the charset. +// See also documentation/LCDLanguageFont.md + #define DISPLAY_CHARSET_HD44780_JAPAN // this is the most common hardware + //#define DISPLAY_CHARSET_HD44780_WESTERN + //#define DISPLAY_CHARSET_HD44780_CYRILLIC //#define ULTRA_LCD //general LCD support, also 16x2 //#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) @@ -560,6 +592,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define ULTIPANEL //the UltiPanel as on Thingiverse //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click + // 0 to disable buzzer feedback // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne @@ -618,15 +651,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define SAV_3DLCD - // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino #define FAST_PWM_FAN -// Temperature status LEDs that display the hotend and bet temperature. -// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on. -// Otherwise the RED led is on. There is 1C hysteresis. -//#define TEMP_STAT_LEDS - // 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. @@ -638,6 +665,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // at zero value, there are 128 effective control positions. #define SOFT_PWM_SCALE 0 +// Temperature status LEDs that display the hotend and bet temperature. +// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on. +// Otherwise the RED led is on. There is 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 @@ -668,7 +700,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Servo Endstops // // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. -// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. +// Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500. // //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index da2424d64..a80790b95 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -3,6 +3,8 @@ #include "Conditionals.h" +// @section temperature + //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== @@ -46,6 +48,8 @@ //The M105 command return, besides traditional information, the ADC value read from temperature sensors. //#define SHOW_TEMP_ADC_VALUES +// @section extruder + // extruder run-out prevention. //if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded //#define EXTRUDER_RUNOUT_PREVENT @@ -55,6 +59,8 @@ #define EXTRUDER_RUNOUT_SPEED 1500. //extrusion speed #define EXTRUDER_RUNOUT_EXTRUDE 100 +// @section temperature + //These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements. //The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET" #define TEMP_SENSOR_AD595_OFFSET 0.0 @@ -72,6 +78,8 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// @section extruder + // Extruder cooling fans // Configure fan pin outputs to automatically turn on/off when the associated // extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. @@ -89,8 +97,12 @@ //=============================Mechanical Settings=========================== //=========================================================================== +// @section homing + #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing +// @section extras + //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. // A single Z stepper driver is usually used to drive 2 stepper motors. @@ -100,6 +112,30 @@ // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. //#define Z_DUAL_STEPPER_DRIVERS +#ifdef Z_DUAL_STEPPER_DRIVERS + + // Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper. + // That way the machine is capable to align the bed during home, since both Z steppers are homed. + // There is also an implementation of M666 (software endstops adjustment) to this feature. + // After Z homing, this adjustment is applied to just one of the steppers in order to align the bed. + // One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2. + // If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive. + // Play a little bit with small adjustments (0.5mm) and check the behaviour. + // The M119 (endstops report) will start reporting the Z2 Endstop as well. + + #define Z_DUAL_ENDSTOPS + + #ifdef Z_DUAL_ENDSTOPS + #define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis. + #define Z2_DIR_PIN E2_DIR_PIN + #define Z2_ENABLE_PIN E2_ENABLE_PIN + #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) + const bool Z2_MAX_ENDSTOP_INVERTING = false; + #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #endif + +#endif // Z_DUAL_STEPPER_DRIVERS + // Same again but for Y Axis. //#define Y_DUAL_STEPPER_DRIVERS @@ -112,53 +148,59 @@ // allowing faster printing speeds. //#define DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE -// Configuration for second X-carriage -// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; -// the second x-carriage always homes to the maximum endstop. -#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 EXTRUDER_OFFSET_X value for the second extruder provides a software - // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops - // without modifying the firmware (through the "M218 T1 X???" command). - // Remember: you should set the second extruder x-offset to 0 in your slicer. - -// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) -#define X2_ENABLE_PIN 29 -#define X2_STEP_PIN 25 -#define X2_DIR_PIN 23 - -// There are a few selectable movement modes for dual x-carriages using M605 S -// Mode 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) -// Mode 1: 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: 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 0 - -// Default settings in "Auto-park Mode" -#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder -#define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - -// Default x offset in duplication mode (typically set to half print bed width) -#define DEFAULT_DUPLICATION_X_OFFSET 100 + // Configuration for second X-carriage + // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; + // the second x-carriage always homes to the maximum endstop. + #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 EXTRUDER_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) + #define X2_ENABLE_PIN 29 + #define X2_STEP_PIN 25 + #define X2_DIR_PIN 23 + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 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) + // Mode 1: 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: 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 0 + + // Default settings in "Auto-park Mode" + #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder + #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 #endif //DUAL_X_CARRIAGE +// @section homing + //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: -#define X_HOME_RETRACT_MM 5 -#define Y_HOME_RETRACT_MM 5 -#define Z_HOME_RETRACT_MM 3 -#define HOMING_BUMP_DIVISOR {10, 10, 20} // Re-Bump Speed Divisor (Divides the Homing Feedrate) +#define X_HOME_BUMP_MM 5 +#define Y_HOME_BUMP_MM 5 +#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 this is defined, if both x and y are to be homed, a diagonal move will be performed initially. +// @section machine + #define AXIS_RELATIVE_MODES {false, false, false, false} +// @section machine + //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 @@ -171,11 +213,15 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +// @section lcd + #ifdef ULTIPANEL #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel #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 @@ -210,34 +256,48 @@ //=========================================================================== #define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again -#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? -#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. - -#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. -// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. -// using: -//#define MENU_ADDAUTOSTART - -// Show a progress bar on HD44780 LCDs for SD printing -//#define LCD_PROGRESS_BAR - -#ifdef LCD_PROGRESS_BAR - // Amount of time (ms) to show the bar - #define PROGRESS_BAR_BAR_TIME 2000 - // Amount of time (ms) to show the status message - #define PROGRESS_BAR_MSG_TIME 3000 - // Amount of time (ms) to retain the status message (0=forever) - #define PROGRESS_MSG_EXPIRE 0 - // Enable this to show messages for MSG_TIME then hide them - //#define PROGRESS_MSG_ONCE -#endif +// @section lcd + +#ifdef SDSUPPORT + + // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted + // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT + // in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should + // be commented out otherwise + #define SDCARDDETECTINVERTED + + #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + + #define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. + // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. + // using: + //#define MENU_ADDAUTOSTART + + // Show a progress bar on HD44780 LCDs for SD printing + //#define LCD_PROGRESS_BAR + + #ifdef LCD_PROGRESS_BAR + // Amount of time (ms) to show the bar + #define PROGRESS_BAR_BAR_TIME 2000 + // Amount of time (ms) to show the status message + #define PROGRESS_BAR_MSG_TIME 3000 + // Amount of time (ms) to retain the status message (0=forever) + #define PROGRESS_MSG_EXPIRE 0 + // Enable this to show messages for MSG_TIME then hide them + //#define PROGRESS_MSG_ONCE + #endif + +#endif // SDSUPPORT + +// @section more // 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 @@ -252,6 +312,8 @@ // Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled. //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED +// @section lcd + // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process // it can e.g. be used to change z-positions in the print startup phase in real-time // does not respect endstops! @@ -262,12 +324,14 @@ #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements #endif +// @section extruder + // extruder advance constant (s2/mm3) // // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2 // -// Hooke's law says: force = k * distance -// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant +// Hooke's law says: force = k * distance +// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant // so: v ^ 2 is proportional to number of steps we advance the extruder //#define ADVANCE @@ -275,7 +339,9 @@ #define EXTRUDER_ADVANCE_K .0 #define D_FILAMENT 2.85 #define STEPS_MM_E 836 -#endif // ADVANCE +#endif + +// @section extras // Arc interpretation settings: #define MM_PER_ARC_SEGMENT 1 @@ -283,31 +349,7 @@ const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement -// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted -// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT -// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should -// be commented out otherwise -#define SDCARDDETECTINVERTED - -//#ifdef ULTIPANEL -// #undef SDCARDDETECTINVERTED -//#endif - -// Power Signal Control Definitions -// By default use ATX definition -#ifndef POWER_SUPPLY - #define POWER_SUPPLY 1 -#endif -// 1 = ATX -#if (POWER_SUPPLY == 1) - #define PS_ON_AWAKE LOW - #define PS_ON_ASLEEP HIGH -#endif -// 2 = X-Box 360 203W -#if (POWER_SUPPLY == 2) - #define PS_ON_AWAKE HIGH - #define PS_ON_ASLEEP LOW -#endif +// @section temperature // Control heater 0 and heater 1 in parallel. //#define HEATERS_PARALLEL @@ -316,19 +358,23 @@ const unsigned int dropsegments=5; //everything with less than this number of st //=============================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, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. -#if defined SDSUPPORT +#ifdef 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 more //The ASCII buffer for receiving from the serial: #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// @section fwretract // Firmware based and LCD controlled retract // M207 and M208 can be used to define parameters for the retraction. @@ -360,6 +406,143 @@ const unsigned int dropsegments=5; //everything with less than this number of st #endif #endif +/******************************************************************************\ + * enable this section if you have TMC26X motor drivers. + * you need to import the TMC26XStepper library into the arduino IDE for this + ******************************************************************************/ + +// @section tmc + +//#define HAVE_TMCDRIVER +#ifdef HAVE_TMCDRIVER + +// #define X_IS_TMC + #define X_MAX_CURRENT 1000 //in mA + #define X_SENSE_RESISTOR 91 //in mOhms + #define X_MICROSTEPS 16 //number of microsteps + +// #define X2_IS_TMC + #define X2_MAX_CURRENT 1000 //in mA + #define X2_SENSE_RESISTOR 91 //in mOhms + #define X2_MICROSTEPS 16 //number of microsteps + +// #define Y_IS_TMC + #define Y_MAX_CURRENT 1000 //in mA + #define Y_SENSE_RESISTOR 91 //in mOhms + #define Y_MICROSTEPS 16 //number of microsteps + +// #define Y2_IS_TMC + #define Y2_MAX_CURRENT 1000 //in mA + #define Y2_SENSE_RESISTOR 91 //in mOhms + #define Y2_MICROSTEPS 16 //number of microsteps + +// #define Z_IS_TMC + #define Z_MAX_CURRENT 1000 //in mA + #define Z_SENSE_RESISTOR 91 //in mOhms + #define Z_MICROSTEPS 16 //number of microsteps + +// #define Z2_IS_TMC + #define Z2_MAX_CURRENT 1000 //in mA + #define Z2_SENSE_RESISTOR 91 //in mOhms + #define Z2_MICROSTEPS 16 //number of microsteps + +// #define E0_IS_TMC + #define E0_MAX_CURRENT 1000 //in mA + #define E0_SENSE_RESISTOR 91 //in mOhms + #define E0_MICROSTEPS 16 //number of microsteps + +// #define E1_IS_TMC + #define E1_MAX_CURRENT 1000 //in mA + #define E1_SENSE_RESISTOR 91 //in mOhms + #define E1_MICROSTEPS 16 //number of microsteps + +// #define E2_IS_TMC + #define E2_MAX_CURRENT 1000 //in mA + #define E2_SENSE_RESISTOR 91 //in mOhms + #define E2_MICROSTEPS 16 //number of microsteps + +// #define E3_IS_TMC + #define E3_MAX_CURRENT 1000 //in mA + #define E3_SENSE_RESISTOR 91 //in mOhms + #define E3_MICROSTEPS 16 //number of microsteps + +#endif + +/******************************************************************************\ + * enable this section if you have L6470 motor drivers. + * you need to import the L6470 library into the arduino IDE for this + ******************************************************************************/ + +// @section l6470 + +//#define HAVE_L6470DRIVER +#ifdef HAVE_L6470DRIVER + +// #define X_IS_L6470 + #define X_MICROSTEPS 16 //number of microsteps + #define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #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_IS_L6470 + #define X2_MICROSTEPS 16 //number of microsteps + #define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y_IS_L6470 + #define Y_MICROSTEPS 16 //number of microsteps + #define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y2_IS_L6470 + #define Y2_MICROSTEPS 16 //number of microsteps + #define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z_IS_L6470 + #define Z_MICROSTEPS 16 //number of microsteps + #define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z2_IS_L6470 + #define Z2_MICROSTEPS 16 //number of microsteps + #define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E0_IS_L6470 + #define E0_MICROSTEPS 16 //number of microsteps + #define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E1_IS_L6470 + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E2_IS_L6470 + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E3_IS_L6470 + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +#endif + #include "Conditionals.h" #include "SanityCheck.h" diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index c5b0243d5..a83c6e911 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated: // 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_VERSION "1.0.2" +#define STRING_VERSION "1.0.3 dev" #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(bq Hephestos)" // Who made the changes. @@ -58,13 +58,12 @@ Here are some standard links for getting your machine calibrated: // 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_HEPHESTOS -#endif - -// Define this to set a custom name for your generic Mendel, -// #define CUSTOM_MENDEL_NAME "This Mendel" +#define MOTHERBOARD BOARD_HEPHESTOS +// 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" @@ -104,7 +103,7 @@ Here are some standard links for getting your machine calibrated: // 10 is 100k RS thermistor 198-961 (4.7k pullup) // 11 is 100k beta 3950 1% thermistor (4.7k pullup) // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) -// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" // 20 is the PT100 circuit found in the Ultimainboard V2.x // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // @@ -118,11 +117,11 @@ Here are some standard links for getting your machine calibrated: // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup // 110 is Pt100 with 1k pullup (non standard) -// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. +// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. // Use it for Testing or Development purposes. NEVER for production machine. // #define DUMMY_THERMISTOR_998_VALUE 25 // #define DUMMY_THERMISTOR_999_VALUE 100 - +// :{ '0': "Not used", '4': "10k !! do not use for a hotend. Bad resolution at high temp. !!", '1': "100k / 4.7k - EPCOS", '51': "100k / 1k - EPCOS", '6': "100k / 4.7k EPCOS - Not as accurate as Table 1", '5': "100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '7': "100k / 4.7k Honeywell 135-104LAG-J01", '71': "100k / 4.7k Honeywell 135-104LAF-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'", '60': "100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '55': "100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '2': "200k / 4.7k - ATC Semitec 204GT-2", '52': "200k / 1k - ATC Semitec 204GT-2", '-2': "Thermocouple + MAX6675 (only for sensor 0)", '-1': "Thermocouple + AD595", '3': "Mendel-parts / 4.7k", '1047': "Pt1000 / 4.7k", '1010': "Pt1000 / 1k (non standard)", '20': "PT100 (Ultimainboard V2.x)", '147': "Pt100 / 4.7k", '110': "Pt100 / 1k (non-standard)", '998': "Dummy 1", '999': "Dummy 2" } #define TEMP_SENSOR_0 1 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 @@ -184,7 +183,6 @@ Here are some standard links for getting your machine calibrated: // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term #define K1 0.95 //smoothing factor within the PID - #define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // Ultimaker @@ -215,7 +213,7 @@ Here are some standard links for getting your machine calibrated: // Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis // // Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. -// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// If your PID_dT is the default, and correct for your hardware/configuration, that means 7.689Hz, // which is fine for driving a square wave into a resistive load and does not significantly impact you 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, you probably @@ -271,15 +269,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua The system will turn the heater on forever, burning up the filament and anything else around. -After the temperature reaches the target for the first time, this feature will -start measuring for how long the current temperature stays below the target +After the temperature reaches the target for the first time, this feature will +start measuring for how long the current temperature stays below the target minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS). If it stays longer than _PERIOD, it means the thermistor temperature cannot catch up with the target, so something *may be* wrong. Then, to be on the safe side, the system will he halt. -Bear in mind the count down will just start AFTER the first time the +Bear in mind the count down will just start AFTER the first time the thermistor temperature is over the target, so you will have no problem if your extruder heater takes 2 minutes to hit the target on heating. @@ -322,13 +320,14 @@ your extruder heater takes 2 minutes to hit the target on heating. // #define ENDSTOPPULLUP_ZMIN #endif -// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. +const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. //#define DISABLE_MAX_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS @@ -345,13 +344,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DISABLE_E false // For all extruders #define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled -#define INVERT_X_DIR true // for Mendel set to false, for Orca set to true -#define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false -#define INVERT_Z_DIR true // for Mendel set to false, for Orca set to true -#define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E3_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false +// 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 +#define INVERT_E0_DIR false +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false // ENDSTOP SETTINGS: // Sets direction of endstops when homing; 1=MAX, -1=MIN @@ -362,13 +362,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. #define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. -// Travel limits after homing (units in mm) -#define X_MAX_POS 215 +// Travel limits after homing (units are in mm) #define X_MIN_POS 0 -#define Y_MAX_POS 210 #define Y_MIN_POS 0 -#define Z_MAX_POS 180 #define Z_MIN_POS 0 +#define X_MAX_POS 215 +#define Y_MAX_POS 210 +#define Z_MAX_POS 180 //=========================================================================== //============================= Filament Runout Sensor ====================== @@ -387,7 +387,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // #define MANUAL_BED_LEVELING // Add display menu option for bed leveling // #define MESH_BED_LEVELING // Enable mesh bed leveling -#if defined(MESH_BED_LEVELING) +#ifdef MANUAL_BED_LEVELING + #define MBL_Z_STEP 0.025 +#endif // MANUAL_BED_LEVELING + +#ifdef MESH_BED_LEVELING #define MESH_MIN_X 10 #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MIN_Y 10 @@ -427,14 +431,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 #define BACK_PROBE_BED_POSITION 170 - + #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this // Set the number of grid points per dimension // You probably don't need more than 3 (squared=9) #define AUTO_BED_LEVELING_GRID_POINTS 2 - #else // !AUTO_BED_LEVELING_GRID // Arbitrary points to probe. A simple cross-product @@ -448,11 +451,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif // AUTO_BED_LEVELING_GRID - // Offsets to the probe relative to the extruder tip (Hotend - Probe) // X and Y offsets must be integers - #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // -left +right - #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // -front +behind + #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // Probe on: -left +right + #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // Probe on: -front +behind #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35 // -below (always!) #define Z_RAISE_BEFORE_HOMING 4 // (in mm) Raise Z before homing (G28) for Probe Clearance. @@ -460,10 +462,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min - #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. + #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points #define Z_RAISE_AFTER_PROBING 15 //How much the extruder will be raised after the last probing point. +// #define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" //These commands will be executed in the end of G29 routine. + //Useful to retract a deployable probe. + //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#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. @@ -491,6 +496,20 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif + // Support for a dedicated Z PROBE endstop separate from the Z MIN endstop. + // If you would like to use both a Z PROBE and a Z MIN endstop together or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP and read the instructions below. + // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. + // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. + // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 + // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. + // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. + // D32 is currently selected in the RAMPS 1.3/1.4 pin file. All other boards will need changes to the respective pins_XXXXX.h file. + // WARNING: Setting the wrong pin may have unexpected and potentially disastrous outcomes. Use with caution and do your homework. + + //#define Z_PROBE_ENDSTOP + #endif // ENABLE_AUTO_BED_LEVELING @@ -498,15 +517,19 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) -//Manual homing switch locations: +// Manual homing switch locations: // For deltabots this means top and center of the Cartesian print volume. -#define MANUAL_X_HOME_POS 0 -#define MANUAL_Y_HOME_POS 0 -#define MANUAL_Z_HOME_POS 0 -//#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +#ifdef MANUAL_HOME_POSITIONS + #define MANUAL_X_HOME_POS 0 + #define MANUAL_Y_HOME_POS 0 + #define MANUAL_Z_HOME_POS 0 + //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +#endif + +/** + * MOVEMENT SETTINGS + */ -//// MOVEMENT SETTINGS -#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define HOMING_FEEDRATE {2000, 2000, 150, 0} // set the homing speeds (mm/min) // default settings @@ -519,8 +542,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DEFAULT_RETRACT_ACCELERATION 1000 // E acceleration in mm/s^2 for retracts #define DEFAULT_TRAVEL_ACCELERATION 1000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves - - // 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. @@ -540,9 +561,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Custom M code points #define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES - #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 - #define Z_PROBE_OFFSET_RANGE_MIN -15 - #define Z_PROBE_OFFSET_RANGE_MAX -5 + #ifdef ENABLE_AUTO_BED_LEVELING + #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 + #define Z_PROBE_OFFSET_RANGE_MIN -20 + #define Z_PROBE_OFFSET_RANGE_MAX 20 + #endif #endif @@ -553,9 +576,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. //define this to enable EEPROM support //#define EEPROM_SETTINGS -//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: -// please keep turned on if you can. -//#define EEPROM_CHITCHAT + +#ifdef EEPROM_SETTINGS + // To disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: + #define EEPROM_CHITCHAT // please keep turned on if you can. +#endif // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 200 @@ -569,13 +594,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //==============================LCD and SD support============================= // Define your display language below. Replace (en) with your language code and uncomment. -// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu +// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu, kana, kana_utf8, test // See also language.h //#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) -// Character based displays can have different extended charsets. -#define DISPLAY_CHARSET_HD44780_JAPAN // "ääööüüß23°" -//#define DISPLAY_CHARSET_HD44780_WESTERN // "ÄäÖöÜüß²³°" if you see a '~' instead of a 'arrow_right' at the right of submenuitems - this is the right one. +// Choose ONE of these 3 charsets. This has to match your hardware. Ignored for full graphic display. +// To find out what type you have - compile with (test) - upload - click to get the menu. You'll see two typical lines from the upper half of the charset. +// See also documentation/LCDLanguageFont.md + #define DISPLAY_CHARSET_HD44780_JAPAN // this is the most common hardware + //#define DISPLAY_CHARSET_HD44780_WESTERN + //#define DISPLAY_CHARSET_HD44780_CYRILLIC #define ULTRA_LCD //general LCD support, also 16x2 //#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) @@ -588,6 +616,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define ULTIPANEL //the UltiPanel as on Thingiverse //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click + // 0 to disable buzzer feedback // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne @@ -642,7 +671,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Shift register panels // --------------------- // 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection //#define SAV_3DLCD @@ -650,7 +679,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define FAST_PWM_FAN // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency -// which is not ass annoying as with the hardware PWM. On the other hand, if this 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 @@ -695,7 +724,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Servo Endstops // // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. -// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. +// Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500. // //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles @@ -704,9 +733,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of * Support for a filament diameter sensor * Also allows adjustment of diameter at print time (vs at slicing) * Single extruder only at this point (extruder 0) - * + * * Motherboards - * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector + * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E) * 301 - Rambo - uses Analog input 3 * Note may require analog pins to be defined for different motherboards @@ -723,7 +752,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define MAX_MEASUREMENT_DELAY 20 //delay buffer size in bytes (1 byte = 1cm)- limits maximum measurement delay allowable (must be larger than MEASUREMENT_DELAY_CM and lower number saves RAM) //defines used in the code -#define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA //set measured to nominal initially +#define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA //set measured to nominal initially //When using an LCD, uncomment the line below to display the Filament sensor data on the last line instead of status. Status will appear for 5 sec. //#define FILAMENT_LCD_DISPLAY diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index fcdf4d161..84536d044 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -3,6 +3,8 @@ #include "Conditionals.h" +// @section temperature + //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== @@ -46,6 +48,8 @@ //The M105 command return, besides traditional information, the ADC value read from temperature sensors. //#define SHOW_TEMP_ADC_VALUES +// @section extruder + // extruder run-out prevention. //if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded //#define EXTRUDER_RUNOUT_PREVENT @@ -55,6 +59,8 @@ #define EXTRUDER_RUNOUT_SPEED 1500. //extrusion speed #define EXTRUDER_RUNOUT_EXTRUDE 100 +// @section temperature + //These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements. //The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET" #define TEMP_SENSOR_AD595_OFFSET 0.0 @@ -72,6 +78,8 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// @section extruder + // Extruder cooling fans // Configure fan pin outputs to automatically turn on/off when the associated // extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. @@ -89,8 +97,12 @@ //=============================Mechanical Settings=========================== //=========================================================================== +// @section homing + //#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing +// @section extras + //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. // A single Z stepper driver is usually used to drive 2 stepper motors. @@ -100,6 +112,30 @@ // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. //#define Z_DUAL_STEPPER_DRIVERS +#ifdef Z_DUAL_STEPPER_DRIVERS + + // Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper. + // That way the machine is capable to align the bed during home, since both Z steppers are homed. + // There is also an implementation of M666 (software endstops adjustment) to this feature. + // After Z homing, this adjustment is applied to just one of the steppers in order to align the bed. + // One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2. + // If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive. + // Play a little bit with small adjustments (0.5mm) and check the behaviour. + // The M119 (endstops report) will start reporting the Z2 Endstop as well. + + #define Z_DUAL_ENDSTOPS + + #ifdef Z_DUAL_ENDSTOPS + #define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis. + #define Z2_DIR_PIN E2_DIR_PIN + #define Z2_ENABLE_PIN E2_ENABLE_PIN + #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) + const bool Z2_MAX_ENDSTOP_INVERTING = false; + #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #endif + +#endif // Z_DUAL_STEPPER_DRIVERS + // Same again but for Y Axis. //#define Y_DUAL_STEPPER_DRIVERS @@ -112,57 +148,59 @@ // allowing faster printing speeds. //#define DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE -// Configuration for second X-carriage -// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; -// the second x-carriage always homes to the maximum endstop. -#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 EXTRUDER_OFFSET_X value for the second extruder provides a software - // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops - // without modifying the firmware (through the "M218 T1 X???" command). - // Remember: you should set the second extruder x-offset to 0 in your slicer. - -// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) -#define X2_ENABLE_PIN 29 -#define X2_STEP_PIN 25 -#define X2_DIR_PIN 23 - -// There are a few selectable movement modes for dual x-carriages using M605 S -// Mode 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) -// Mode 1: 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: 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 0 - -// Default settings in "Auto-park Mode" -#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder -#define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - -// Default x offset in duplication mode (typically set to half print bed width) -#define DEFAULT_DUPLICATION_X_OFFSET 100 + // Configuration for second X-carriage + // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; + // the second x-carriage always homes to the maximum endstop. + #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 EXTRUDER_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) + #define X2_ENABLE_PIN 29 + #define X2_STEP_PIN 25 + #define X2_DIR_PIN 23 + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 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) + // Mode 1: 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: 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 0 + + // Default settings in "Auto-park Mode" + #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder + #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 #endif //DUAL_X_CARRIAGE +// @section homing + //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: -#define X_HOME_RETRACT_MM 5 -#define Y_HOME_RETRACT_MM 5 -#define Z_HOME_RETRACT_MM 2 -#define HOMING_BUMP_DIVISOR {10, 10, 20} // Re-Bump Speed Divisor (Divides the Homing Feedrate) +#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 this is defined, if both x and y are to be homed, a diagonal move will be performed initially. +// @section machine + #define AXIS_RELATIVE_MODES {false, false, false, false} -#ifdef CONFIG_STEPPERS_TOSHIBA -#define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers -#else -#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step) -#endif + +// @section machine + //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 @@ -175,11 +213,15 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +// @section lcd + #ifdef ULTIPANEL #define MANUAL_FEEDRATE {120*60, 120*60, 18*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel #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 @@ -214,34 +256,48 @@ //=========================================================================== #define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again -#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? -#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. - -#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. -// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. -// using: -#define MENU_ADDAUTOSTART - -// Show a progress bar on HD44780 LCDs for SD printing -//#define LCD_PROGRESS_BAR - -#ifdef LCD_PROGRESS_BAR - // Amount of time (ms) to show the bar - #define PROGRESS_BAR_BAR_TIME 2000 - // Amount of time (ms) to show the status message - #define PROGRESS_BAR_MSG_TIME 3000 - // Amount of time (ms) to retain the status message (0=forever) - #define PROGRESS_MSG_EXPIRE 0 - // Enable this to show messages for MSG_TIME then hide them - //#define PROGRESS_MSG_ONCE -#endif +// @section lcd + +#ifdef SDSUPPORT + + // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted + // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT + // in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should + // be commented out otherwise + #define SDCARDDETECTINVERTED + + #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + + #define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. + // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. + // using: + //#define MENU_ADDAUTOSTART + + // Show a progress bar on HD44780 LCDs for SD printing + //#define LCD_PROGRESS_BAR + + #ifdef LCD_PROGRESS_BAR + // Amount of time (ms) to show the bar + #define PROGRESS_BAR_BAR_TIME 2000 + // Amount of time (ms) to show the status message + #define PROGRESS_BAR_MSG_TIME 3000 + // Amount of time (ms) to retain the status message (0=forever) + #define PROGRESS_MSG_EXPIRE 0 + // Enable this to show messages for MSG_TIME then hide them + //#define PROGRESS_MSG_ONCE + #endif + +#endif // SDSUPPORT + +// @section more // 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 @@ -256,6 +312,8 @@ // Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled. //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED +// @section lcd + // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process // it can e.g. be used to change z-positions in the print startup phase in real-time // does not respect endstops! @@ -266,12 +324,14 @@ #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements #endif +// @section extruder + // extruder advance constant (s2/mm3) // // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2 // -// Hooke's law says: force = k * distance -// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant +// Hooke's law says: force = k * distance +// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant // so: v ^ 2 is proportional to number of steps we advance the extruder //#define ADVANCE @@ -279,7 +339,9 @@ #define EXTRUDER_ADVANCE_K .0 #define D_FILAMENT 1.75 #define STEPS_MM_E 100.47095761381482 -#endif // ADVANCE +#endif + +// @section extras // Arc interpretation settings: #define MM_PER_ARC_SEGMENT 1 @@ -287,11 +349,7 @@ const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement -// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted -// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT -// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should -// be commented out otherwise -#define SDCARDDETECTINVERTED +// @section temperature // Control heater 0 and heater 1 in parallel. //#define HEATERS_PARALLEL @@ -300,19 +358,23 @@ const unsigned int dropsegments=5; //everything with less than this number of st //=============================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, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. -#if defined SDSUPPORT +#ifdef 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 more //The ASCII buffer for receiving from the serial: #define MAX_CMD_SIZE 96 #define BUFSIZE 5 +// @section fwretract // Firmware based and LCD controlled retract // M207 and M208 can be used to define parameters for the retraction. @@ -325,11 +387,11 @@ const unsigned int dropsegments=5; //everything with less than this number of st #define MIN_RETRACT 0.1 //minimum extruded mm to accept a automatic gcode retraction attempt #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 80*60 //default feedrate for retracting (mm/s) + #define RETRACT_FEEDRATE 80*60 //default feedrate for retracting (mm/s) #define RETRACT_ZLIFT 0 //default retract Z-lift #define RETRACT_RECOVER_LENGTH 0 //default additional recover length (mm, added to retract length when recovering) //#define RETRACT_RECOVER_LENGTH_SWAP 0 //default additional swap recover length (mm, added to retract length when recovering from extruder change) - #define RETRACT_RECOVER_FEEDRATE 8*60 //default feedrate for recovering from retraction (mm/s) + #define RETRACT_RECOVER_FEEDRATE 8*60 //default feedrate for recovering from retraction (mm/s) #endif // Add support for experimental filament exchange support M600; requires display @@ -344,6 +406,143 @@ const unsigned int dropsegments=5; //everything with less than this number of st #endif #endif +/******************************************************************************\ + * enable this section if you have TMC26X motor drivers. + * you need to import the TMC26XStepper library into the arduino IDE for this + ******************************************************************************/ + +// @section tmc + +//#define HAVE_TMCDRIVER +#ifdef HAVE_TMCDRIVER + +// #define X_IS_TMC + #define X_MAX_CURRENT 1000 //in mA + #define X_SENSE_RESISTOR 91 //in mOhms + #define X_MICROSTEPS 16 //number of microsteps + +// #define X2_IS_TMC + #define X2_MAX_CURRENT 1000 //in mA + #define X2_SENSE_RESISTOR 91 //in mOhms + #define X2_MICROSTEPS 16 //number of microsteps + +// #define Y_IS_TMC + #define Y_MAX_CURRENT 1000 //in mA + #define Y_SENSE_RESISTOR 91 //in mOhms + #define Y_MICROSTEPS 16 //number of microsteps + +// #define Y2_IS_TMC + #define Y2_MAX_CURRENT 1000 //in mA + #define Y2_SENSE_RESISTOR 91 //in mOhms + #define Y2_MICROSTEPS 16 //number of microsteps + +// #define Z_IS_TMC + #define Z_MAX_CURRENT 1000 //in mA + #define Z_SENSE_RESISTOR 91 //in mOhms + #define Z_MICROSTEPS 16 //number of microsteps + +// #define Z2_IS_TMC + #define Z2_MAX_CURRENT 1000 //in mA + #define Z2_SENSE_RESISTOR 91 //in mOhms + #define Z2_MICROSTEPS 16 //number of microsteps + +// #define E0_IS_TMC + #define E0_MAX_CURRENT 1000 //in mA + #define E0_SENSE_RESISTOR 91 //in mOhms + #define E0_MICROSTEPS 16 //number of microsteps + +// #define E1_IS_TMC + #define E1_MAX_CURRENT 1000 //in mA + #define E1_SENSE_RESISTOR 91 //in mOhms + #define E1_MICROSTEPS 16 //number of microsteps + +// #define E2_IS_TMC + #define E2_MAX_CURRENT 1000 //in mA + #define E2_SENSE_RESISTOR 91 //in mOhms + #define E2_MICROSTEPS 16 //number of microsteps + +// #define E3_IS_TMC + #define E3_MAX_CURRENT 1000 //in mA + #define E3_SENSE_RESISTOR 91 //in mOhms + #define E3_MICROSTEPS 16 //number of microsteps + +#endif + +/******************************************************************************\ + * enable this section if you have L6470 motor drivers. + * you need to import the L6470 library into the arduino IDE for this + ******************************************************************************/ + +// @section l6470 + +//#define HAVE_L6470DRIVER +#ifdef HAVE_L6470DRIVER + +// #define X_IS_L6470 + #define X_MICROSTEPS 16 //number of microsteps + #define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #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_IS_L6470 + #define X2_MICROSTEPS 16 //number of microsteps + #define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y_IS_L6470 + #define Y_MICROSTEPS 16 //number of microsteps + #define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y2_IS_L6470 + #define Y2_MICROSTEPS 16 //number of microsteps + #define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z_IS_L6470 + #define Z_MICROSTEPS 16 //number of microsteps + #define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z2_IS_L6470 + #define Z2_MICROSTEPS 16 //number of microsteps + #define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E0_IS_L6470 + #define E0_MICROSTEPS 16 //number of microsteps + #define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E1_IS_L6470 + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E2_IS_L6470 + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E3_IS_L6470 + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +#endif + #include "Conditionals.h" #include "SanityCheck.h" diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index bc0f3e5df..df0614b50 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated: // 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_VERSION "1.0.2" +#define STRING_VERSION "1.0.3 dev" #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(K8200, CONSULitAS)" // Who made the changes. @@ -62,8 +62,9 @@ Here are some standard links for getting your machine calibrated: #define MOTHERBOARD BOARD_K8200 #endif -// Define this to set a custom name for your generic Mendel, -// #define CUSTOM_MENDEL_NAME "This Mendel" +// 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) @@ -104,7 +105,7 @@ Here are some standard links for getting your machine calibrated: // 10 is 100k RS thermistor 198-961 (4.7k pullup) // 11 is 100k beta 3950 1% thermistor (4.7k pullup) // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) -// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" // 20 is the PT100 circuit found in the Ultimainboard V2.x // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // @@ -118,11 +119,11 @@ Here are some standard links for getting your machine calibrated: // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup // 110 is Pt100 with 1k pullup (non standard) -// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. +// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. // Use it for Testing or Development purposes. NEVER for production machine. // #define DUMMY_THERMISTOR_998_VALUE 25 // #define DUMMY_THERMISTOR_999_VALUE 100 - +// :{ '0': "Not used", '4': "10k !! do not use for a hotend. Bad resolution at high temp. !!", '1': "100k / 4.7k - EPCOS", '51': "100k / 1k - EPCOS", '6': "100k / 4.7k EPCOS - Not as accurate as Table 1", '5': "100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '7': "100k / 4.7k Honeywell 135-104LAG-J01", '71': "100k / 4.7k Honeywell 135-104LAF-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'", '60': "100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '55': "100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '2': "200k / 4.7k - ATC Semitec 204GT-2", '52': "200k / 1k - ATC Semitec 204GT-2", '-2': "Thermocouple + MAX6675 (only for sensor 0)", '-1': "Thermocouple + AD595", '3': "Mendel-parts / 4.7k", '1047': "Pt1000 / 4.7k", '1010': "Pt1000 / 1k (non standard)", '20': "PT100 (Ultimainboard V2.x)", '147': "Pt100 / 4.7k", '110': "Pt100 / 1k (non-standard)", '998': "Dummy 1", '999': "Dummy 2" } #define TEMP_SENSOR_0 5 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 @@ -184,7 +185,6 @@ Here are some standard links for getting your machine calibrated: // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term #define K1 0.95 //smoothing factor within the PID - #define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // Ultimaker @@ -214,7 +214,7 @@ Here are some standard links for getting your machine calibrated: // Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis // // Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. -// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// If your PID_dT is the default, and correct for your hardware/configuration, that means 7.689Hz, // which is fine for driving a square wave into a resistive load and does not significantly impact you 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, you probably @@ -276,15 +276,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua The system will turn the heater on forever, burning up the filament and anything else around. -After the temperature reaches the target for the first time, this feature will -start measuring for how long the current temperature stays below the target +After the temperature reaches the target for the first time, this feature will +start measuring for how long the current temperature stays below the target minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS). If it stays longer than _PERIOD, it means the thermistor temperature cannot catch up with the target, so something *may be* wrong. Then, to be on the safe side, the system will he halt. -Bear in mind the count down will just start AFTER the first time the +Bear in mind the count down will just start AFTER the first time the thermistor temperature is over the target, so you will have no problem if your extruder heater takes 2 minutes to hit the target on heating. @@ -327,13 +327,14 @@ your extruder heater takes 2 minutes to hit the target on heating. #define ENDSTOPPULLUP_ZMIN #endif -// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. +const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. #define DISABLE_MAX_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS @@ -350,13 +351,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DISABLE_E false // For all extruders #define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled -#define INVERT_X_DIR false // for Mendel set to false, for Orca set to true -#define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false -#define INVERT_Z_DIR false // for Mendel set to false, for Orca set to true -#define INVERT_E0_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E1_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E2_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E3_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false +// 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 +#define INVERT_E0_DIR true +#define INVERT_E1_DIR true +#define INVERT_E2_DIR true +#define INVERT_E3_DIR true // ENDSTOP SETTINGS: // Sets direction of endstops when homing; 1=MAX, -1=MIN @@ -368,12 +370,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. // Travel limits after homing (units are in mm) -#define X_MAX_POS 200 #define X_MIN_POS 0 -#define Y_MAX_POS 200 #define Y_MIN_POS 0 -#define Z_MAX_POS 200 #define Z_MIN_POS 0 +#define X_MAX_POS 200 +#define Y_MAX_POS 200 +#define Z_MAX_POS 200 //=========================================================================== //============================= Filament Runout Sensor ====================== @@ -392,7 +394,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // #define MANUAL_BED_LEVELING // Add display menu option for bed leveling // #define MESH_BED_LEVELING // Enable mesh bed leveling -#if defined(MESH_BED_LEVELING) +#ifdef MANUAL_BED_LEVELING + #define MBL_Z_STEP 0.025 +#endif // MANUAL_BED_LEVELING + +#ifdef MESH_BED_LEVELING #define MESH_MIN_X 10 #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MIN_Y 10 @@ -433,13 +439,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define FRONT_PROBE_BED_POSITION 20 #define BACK_PROBE_BED_POSITION 170 - #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this - + #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this + // Set the number of grid points per dimension // You probably don't need more than 3 (squared=9) #define AUTO_BED_LEVELING_GRID_POINTS 2 - #else // !AUTO_BED_LEVELING_GRID // Arbitrary points to probe. A simple cross-product @@ -453,11 +458,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif // AUTO_BED_LEVELING_GRID - // Offsets to the probe relative to the extruder tip (Hotend - Probe) // X and Y offsets must be integers - #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // -left +right - #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // -front +behind + #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // Probe on: -left +right + #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // Probe on: -front +behind #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35 // -below (always!) #define Z_RAISE_BEFORE_HOMING 4 // (in mm) Raise Z before homing (G28) for Probe Clearance. @@ -465,10 +469,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min - #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. + #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points #define Z_RAISE_AFTER_PROBING 15 //How much the extruder will be raised after the last probing point. +// #define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" //These commands will be executed in the end of G29 routine. + //Useful to retract a deployable probe. + //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#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. @@ -496,6 +503,20 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif + // Support for a dedicated Z PROBE endstop separate from the Z MIN endstop. + // If you would like to use both a Z PROBE and a Z MIN endstop together or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP and read the instructions below. + // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. + // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. + // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 + // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. + // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. + // D32 is currently selected in the RAMPS 1.3/1.4 pin file. All other boards will need changes to the respective pins_XXXXX.h file. + // WARNING: Setting the wrong pin may have unexpected and potentially disastrous outcomes. Use with caution and do your homework. + + //#define Z_PROBE_ENDSTOP + #endif // ENABLE_AUTO_BED_LEVELING @@ -503,15 +524,19 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) -//Manual homing switch locations: +// Manual homing switch locations: // For deltabots this means top and center of the Cartesian print volume. -#define MANUAL_X_HOME_POS 0 -#define MANUAL_Y_HOME_POS 0 -#define MANUAL_Z_HOME_POS 0 -//#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +#ifdef MANUAL_HOME_POSITIONS + #define MANUAL_X_HOME_POS 0 + #define MANUAL_Y_HOME_POS 0 + #define MANUAL_Z_HOME_POS 0 + //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +#endif + +/** + * MOVEMENT SETTINGS + */ -//// MOVEMENT SETTINGS -#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0} // set the homing speeds (mm/min) // default settings @@ -544,9 +569,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Custom M code points #define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES - #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 - #define Z_PROBE_OFFSET_RANGE_MIN -15 - #define Z_PROBE_OFFSET_RANGE_MAX -5 + #ifdef ENABLE_AUTO_BED_LEVELING + #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 + #define Z_PROBE_OFFSET_RANGE_MIN -20 + #define Z_PROBE_OFFSET_RANGE_MAX 20 + #endif #endif @@ -557,9 +584,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. //define this to enable EEPROM support #define EEPROM_SETTINGS -//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: -// please keep turned on if you can. -//#define EEPROM_CHITCHAT + +#ifdef EEPROM_SETTINGS + // To disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: + #define EEPROM_CHITCHAT // please keep turned on if you can. +#endif // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 190 @@ -573,13 +602,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //==============================LCD and SD support============================= // Define your display language below. Replace (en) with your language code and uncomment. -// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu +// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu, kana, kana_utf8, test // See also language.h //#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) -// Character based displays can have different extended charsets. -#define DISPLAY_CHARSET_HD44780_JAPAN // "ääööüüß23°" -//#define DISPLAY_CHARSET_HD44780_WESTERN // "ÄäÖöÜüß²³°" if you see a '~' instead of a 'arrow_right' at the right of submenuitems - this is the right one. +// Choose ONE of these 3 charsets. This has to match your hardware. Ignored for full graphic display. +// To find out what type you have - compile with (test) - upload - click to get the menu. You'll see two typical lines from the upper half of the charset. +// See also documentation/LCDLanguageFont.md + #define DISPLAY_CHARSET_HD44780_JAPAN // this is the most common hardware + //#define DISPLAY_CHARSET_HD44780_WESTERN + //#define DISPLAY_CHARSET_HD44780_CYRILLIC //#define ULTRA_LCD //general LCD support, also 16x2 //#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) @@ -592,6 +624,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define ULTIPANEL //the UltiPanel as on Thingiverse //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click + // 0 to disable buzzer feedback // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne @@ -646,7 +679,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Shift register panels // --------------------- // 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection //#define SAV_3DLCD @@ -654,7 +687,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define FAST_PWM_FAN // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency -// which is not ass annoying as with the hardware PWM. On the other hand, if this 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 @@ -699,7 +732,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Servo Endstops // // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. -// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. +// Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500. // //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles @@ -708,9 +741,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of * Support for a filament diameter sensor * Also allows adjustment of diameter at print time (vs at slicing) * Single extruder only at this point (extruder 0) - * + * * Motherboards - * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector + * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E) * 301 - Rambo - uses Analog input 3 * Note may require analog pins to be defined for different motherboards diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index e802338b8..a80790b95 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -3,6 +3,8 @@ #include "Conditionals.h" +// @section temperature + //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== @@ -46,6 +48,8 @@ //The M105 command return, besides traditional information, the ADC value read from temperature sensors. //#define SHOW_TEMP_ADC_VALUES +// @section extruder + // extruder run-out prevention. //if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded //#define EXTRUDER_RUNOUT_PREVENT @@ -55,6 +59,8 @@ #define EXTRUDER_RUNOUT_SPEED 1500. //extrusion speed #define EXTRUDER_RUNOUT_EXTRUDE 100 +// @section temperature + //These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements. //The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET" #define TEMP_SENSOR_AD595_OFFSET 0.0 @@ -72,6 +78,8 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// @section extruder + // Extruder cooling fans // Configure fan pin outputs to automatically turn on/off when the associated // extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. @@ -89,8 +97,12 @@ //=============================Mechanical Settings=========================== //=========================================================================== +// @section homing + #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing +// @section extras + //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. // A single Z stepper driver is usually used to drive 2 stepper motors. @@ -100,6 +112,30 @@ // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. //#define Z_DUAL_STEPPER_DRIVERS +#ifdef Z_DUAL_STEPPER_DRIVERS + + // Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper. + // That way the machine is capable to align the bed during home, since both Z steppers are homed. + // There is also an implementation of M666 (software endstops adjustment) to this feature. + // After Z homing, this adjustment is applied to just one of the steppers in order to align the bed. + // One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2. + // If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive. + // Play a little bit with small adjustments (0.5mm) and check the behaviour. + // The M119 (endstops report) will start reporting the Z2 Endstop as well. + + #define Z_DUAL_ENDSTOPS + + #ifdef Z_DUAL_ENDSTOPS + #define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis. + #define Z2_DIR_PIN E2_DIR_PIN + #define Z2_ENABLE_PIN E2_ENABLE_PIN + #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) + const bool Z2_MAX_ENDSTOP_INVERTING = false; + #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #endif + +#endif // Z_DUAL_STEPPER_DRIVERS + // Same again but for Y Axis. //#define Y_DUAL_STEPPER_DRIVERS @@ -112,53 +148,59 @@ // allowing faster printing speeds. //#define DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE -// Configuration for second X-carriage -// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; -// the second x-carriage always homes to the maximum endstop. -#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 EXTRUDER_OFFSET_X value for the second extruder provides a software - // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops - // without modifying the firmware (through the "M218 T1 X???" command). - // Remember: you should set the second extruder x-offset to 0 in your slicer. - -// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) -#define X2_ENABLE_PIN 29 -#define X2_STEP_PIN 25 -#define X2_DIR_PIN 23 - -// There are a few selectable movement modes for dual x-carriages using M605 S -// Mode 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) -// Mode 1: 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: 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 0 - -// Default settings in "Auto-park Mode" -#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder -#define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - -// Default x offset in duplication mode (typically set to half print bed width) -#define DEFAULT_DUPLICATION_X_OFFSET 100 + // Configuration for second X-carriage + // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; + // the second x-carriage always homes to the maximum endstop. + #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 EXTRUDER_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) + #define X2_ENABLE_PIN 29 + #define X2_STEP_PIN 25 + #define X2_DIR_PIN 23 + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 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) + // Mode 1: 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: 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 0 + + // Default settings in "Auto-park Mode" + #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder + #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 #endif //DUAL_X_CARRIAGE +// @section homing + //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: -#define X_HOME_RETRACT_MM 5 -#define Y_HOME_RETRACT_MM 5 -#define Z_HOME_RETRACT_MM 3 -#define HOMING_BUMP_DIVISOR {10, 10, 20} // Re-Bump Speed Divisor (Divides the Homing Feedrate) +#define X_HOME_BUMP_MM 5 +#define Y_HOME_BUMP_MM 5 +#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 this is defined, if both x and y are to be homed, a diagonal move will be performed initially. +// @section machine + #define AXIS_RELATIVE_MODES {false, false, false, false} +// @section machine + //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 @@ -171,11 +213,15 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +// @section lcd + #ifdef ULTIPANEL #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel #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 @@ -210,34 +256,48 @@ //=========================================================================== #define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again -#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? -#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. - -#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. -// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. -// using: -//#define MENU_ADDAUTOSTART - -// Show a progress bar on HD44780 LCDs for SD printing -//#define LCD_PROGRESS_BAR - -#ifdef LCD_PROGRESS_BAR - // Amount of time (ms) to show the bar - #define PROGRESS_BAR_BAR_TIME 2000 - // Amount of time (ms) to show the status message - #define PROGRESS_BAR_MSG_TIME 3000 - // Amount of time (ms) to retain the status message (0=forever) - #define PROGRESS_MSG_EXPIRE 0 - // Enable this to show messages for MSG_TIME then hide them - //#define PROGRESS_MSG_ONCE -#endif +// @section lcd + +#ifdef SDSUPPORT + + // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted + // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT + // in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should + // be commented out otherwise + #define SDCARDDETECTINVERTED + + #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + + #define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. + // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. + // using: + //#define MENU_ADDAUTOSTART + + // Show a progress bar on HD44780 LCDs for SD printing + //#define LCD_PROGRESS_BAR + + #ifdef LCD_PROGRESS_BAR + // Amount of time (ms) to show the bar + #define PROGRESS_BAR_BAR_TIME 2000 + // Amount of time (ms) to show the status message + #define PROGRESS_BAR_MSG_TIME 3000 + // Amount of time (ms) to retain the status message (0=forever) + #define PROGRESS_MSG_EXPIRE 0 + // Enable this to show messages for MSG_TIME then hide them + //#define PROGRESS_MSG_ONCE + #endif + +#endif // SDSUPPORT + +// @section more // 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 @@ -252,6 +312,8 @@ // Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled. //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED +// @section lcd + // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process // it can e.g. be used to change z-positions in the print startup phase in real-time // does not respect endstops! @@ -262,12 +324,14 @@ #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements #endif +// @section extruder + // extruder advance constant (s2/mm3) // // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2 // -// Hooke's law says: force = k * distance -// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant +// Hooke's law says: force = k * distance +// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant // so: v ^ 2 is proportional to number of steps we advance the extruder //#define ADVANCE @@ -275,7 +339,9 @@ #define EXTRUDER_ADVANCE_K .0 #define D_FILAMENT 2.85 #define STEPS_MM_E 836 -#endif // ADVANCE +#endif + +// @section extras // Arc interpretation settings: #define MM_PER_ARC_SEGMENT 1 @@ -283,11 +349,7 @@ const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement -// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted -// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT -// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should -// be commented out otherwise -#define SDCARDDETECTINVERTED +// @section temperature // Control heater 0 and heater 1 in parallel. //#define HEATERS_PARALLEL @@ -296,19 +358,23 @@ const unsigned int dropsegments=5; //everything with less than this number of st //=============================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, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. -#if defined SDSUPPORT +#ifdef 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 more //The ASCII buffer for receiving from the serial: #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// @section fwretract // Firmware based and LCD controlled retract // M207 and M208 can be used to define parameters for the retraction. @@ -340,6 +406,143 @@ const unsigned int dropsegments=5; //everything with less than this number of st #endif #endif +/******************************************************************************\ + * enable this section if you have TMC26X motor drivers. + * you need to import the TMC26XStepper library into the arduino IDE for this + ******************************************************************************/ + +// @section tmc + +//#define HAVE_TMCDRIVER +#ifdef HAVE_TMCDRIVER + +// #define X_IS_TMC + #define X_MAX_CURRENT 1000 //in mA + #define X_SENSE_RESISTOR 91 //in mOhms + #define X_MICROSTEPS 16 //number of microsteps + +// #define X2_IS_TMC + #define X2_MAX_CURRENT 1000 //in mA + #define X2_SENSE_RESISTOR 91 //in mOhms + #define X2_MICROSTEPS 16 //number of microsteps + +// #define Y_IS_TMC + #define Y_MAX_CURRENT 1000 //in mA + #define Y_SENSE_RESISTOR 91 //in mOhms + #define Y_MICROSTEPS 16 //number of microsteps + +// #define Y2_IS_TMC + #define Y2_MAX_CURRENT 1000 //in mA + #define Y2_SENSE_RESISTOR 91 //in mOhms + #define Y2_MICROSTEPS 16 //number of microsteps + +// #define Z_IS_TMC + #define Z_MAX_CURRENT 1000 //in mA + #define Z_SENSE_RESISTOR 91 //in mOhms + #define Z_MICROSTEPS 16 //number of microsteps + +// #define Z2_IS_TMC + #define Z2_MAX_CURRENT 1000 //in mA + #define Z2_SENSE_RESISTOR 91 //in mOhms + #define Z2_MICROSTEPS 16 //number of microsteps + +// #define E0_IS_TMC + #define E0_MAX_CURRENT 1000 //in mA + #define E0_SENSE_RESISTOR 91 //in mOhms + #define E0_MICROSTEPS 16 //number of microsteps + +// #define E1_IS_TMC + #define E1_MAX_CURRENT 1000 //in mA + #define E1_SENSE_RESISTOR 91 //in mOhms + #define E1_MICROSTEPS 16 //number of microsteps + +// #define E2_IS_TMC + #define E2_MAX_CURRENT 1000 //in mA + #define E2_SENSE_RESISTOR 91 //in mOhms + #define E2_MICROSTEPS 16 //number of microsteps + +// #define E3_IS_TMC + #define E3_MAX_CURRENT 1000 //in mA + #define E3_SENSE_RESISTOR 91 //in mOhms + #define E3_MICROSTEPS 16 //number of microsteps + +#endif + +/******************************************************************************\ + * enable this section if you have L6470 motor drivers. + * you need to import the L6470 library into the arduino IDE for this + ******************************************************************************/ + +// @section l6470 + +//#define HAVE_L6470DRIVER +#ifdef HAVE_L6470DRIVER + +// #define X_IS_L6470 + #define X_MICROSTEPS 16 //number of microsteps + #define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #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_IS_L6470 + #define X2_MICROSTEPS 16 //number of microsteps + #define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y_IS_L6470 + #define Y_MICROSTEPS 16 //number of microsteps + #define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y2_IS_L6470 + #define Y2_MICROSTEPS 16 //number of microsteps + #define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z_IS_L6470 + #define Z_MICROSTEPS 16 //number of microsteps + #define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z2_IS_L6470 + #define Z2_MICROSTEPS 16 //number of microsteps + #define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E0_IS_L6470 + #define E0_MICROSTEPS 16 //number of microsteps + #define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E1_IS_L6470 + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E2_IS_L6470 + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E3_IS_L6470 + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +#endif + #include "Conditionals.h" #include "SanityCheck.h" diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index d42bebe3a..1f180a53d 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -56,7 +56,7 @@ Here are some standard links for getting your machine calibrated: // 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_VERSION "1.0.2" +#define STRING_VERSION "1.0.3 dev" #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. @@ -80,8 +80,9 @@ Here are some standard links for getting your machine calibrated: #define MOTHERBOARD BOARD_RAMPS_13_EFB #endif -// Define this to set a custom name for your generic Mendel, -// #define CUSTOM_MENDEL_NAME "This Mendel" +// 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) @@ -122,7 +123,7 @@ Here are some standard links for getting your machine calibrated: // 10 is 100k RS thermistor 198-961 (4.7k pullup) // 11 is 100k beta 3950 1% thermistor (4.7k pullup) // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) -// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" // 20 is the PT100 circuit found in the Ultimainboard V2.x // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // @@ -136,11 +137,11 @@ Here are some standard links for getting your machine calibrated: // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup // 110 is Pt100 with 1k pullup (non standard) -// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. +// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. // Use it for Testing or Development purposes. NEVER for production machine. // #define DUMMY_THERMISTOR_998_VALUE 25 // #define DUMMY_THERMISTOR_999_VALUE 100 - +// :{ '0': "Not used", '4': "10k !! do not use for a hotend. Bad resolution at high temp. !!", '1': "100k / 4.7k - EPCOS", '51': "100k / 1k - EPCOS", '6': "100k / 4.7k EPCOS - Not as accurate as Table 1", '5': "100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '7': "100k / 4.7k Honeywell 135-104LAG-J01", '71': "100k / 4.7k Honeywell 135-104LAF-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'", '60': "100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '55': "100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '2': "200k / 4.7k - ATC Semitec 204GT-2", '52': "200k / 1k - ATC Semitec 204GT-2", '-2': "Thermocouple + MAX6675 (only for sensor 0)", '-1': "Thermocouple + AD595", '3': "Mendel-parts / 4.7k", '1047': "Pt1000 / 4.7k", '1010': "Pt1000 / 1k (non standard)", '20': "PT100 (Ultimainboard V2.x)", '147': "Pt100 / 4.7k", '110': "Pt100 / 1k (non-standard)", '998': "Dummy 1", '999': "Dummy 2" } #define TEMP_SENSOR_0 1 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 @@ -202,7 +203,6 @@ Here are some standard links for getting your machine calibrated: // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term #define K1 0.95 //smoothing factor within the PID - #define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // Ultimaker @@ -238,7 +238,7 @@ Here are some standard links for getting your machine calibrated: // Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis // // Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. -// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// If your PID_dT is the default, and correct for your hardware/configuration, that means 7.689Hz, // which is fine for driving a square wave into a resistive load and does not significantly impact you 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, you probably @@ -300,15 +300,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua The system will turn the heater on forever, burning up the filament and anything else around. -After the temperature reaches the target for the first time, this feature will -start measuring for how long the current temperature stays below the target +After the temperature reaches the target for the first time, this feature will +start measuring for how long the current temperature stays below the target minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS). If it stays longer than _PERIOD, it means the thermistor temperature cannot catch up with the target, so something *may be* wrong. Then, to be on the safe side, the system will he halt. -Bear in mind the count down will just start AFTER the first time the +Bear in mind the count down will just start AFTER the first time the thermistor temperature is over the target, so you will have no problem if your extruder heater takes 2 minutes to hit the target on heating. @@ -351,13 +351,14 @@ your extruder heater takes 2 minutes to hit the target on heating. // #define ENDSTOPPULLUP_ZMIN #endif -// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. +const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. //#define DISABLE_MAX_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS @@ -374,13 +375,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DISABLE_E false // For all extruders #define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled -#define INVERT_X_DIR false // for Mendel set to false, for Orca set to true -#define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false -#define INVERT_Z_DIR true // for Mendel set to false, for Orca set to true -#define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E3_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false +// 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 +#define INVERT_E0_DIR false +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false // ENDSTOP SETTINGS: // Sets direction of endstops when homing; 1=MAX, -1=MIN @@ -392,12 +394,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. // Travel limits after homing (units are in mm) -#define X_MAX_POS 200 #define X_MIN_POS 0 -#define Y_MAX_POS 200 #define Y_MIN_POS 0 -#define Z_MAX_POS 225 #define Z_MIN_POS MANUAL_Z_HOME_POS +#define X_MAX_POS 200 +#define Y_MAX_POS 200 +#define Z_MAX_POS 225 //=========================================================================== //============================= Filament Runout Sensor ====================== @@ -416,7 +418,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // #define MANUAL_BED_LEVELING // Add display menu option for bed leveling // #define MESH_BED_LEVELING // Enable mesh bed leveling -#if defined(MESH_BED_LEVELING) +#ifdef MANUAL_BED_LEVELING + #define MBL_Z_STEP 0.025 +#endif // MANUAL_BED_LEVELING + +#ifdef MESH_BED_LEVELING #define MESH_MIN_X 10 #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MIN_Y 10 @@ -457,13 +463,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define FRONT_PROBE_BED_POSITION 20 #define BACK_PROBE_BED_POSITION 170 - #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this - + #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this + // Set the number of grid points per dimension // You probably don't need more than 3 (squared=9) #define AUTO_BED_LEVELING_GRID_POINTS 2 - #else // !AUTO_BED_LEVELING_GRID // Arbitrary points to probe. A simple cross-product @@ -477,11 +482,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif // AUTO_BED_LEVELING_GRID - // Offsets to the probe relative to the extruder tip (Hotend - Probe) // X and Y offsets must be integers - #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // -left +right - #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // -front +behind + #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // Probe on: -left +right + #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // Probe on: -front +behind #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35 // -below (always!) //#define Z_RAISE_BEFORE_HOMING 4 // (in mm) Raise Z before homing (G28) for Probe Clearance. @@ -489,10 +493,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min - #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. + #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points #define Z_RAISE_AFTER_PROBING 15 //How much the extruder will be raised after the last probing point. +// #define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" //These commands will be executed in the end of G29 routine. + //Useful to retract a deployable probe. + //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#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. @@ -520,6 +527,20 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif + // Support for a dedicated Z PROBE endstop separate from the Z MIN endstop. + // If you would like to use both a Z PROBE and a Z MIN endstop together or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP and read the instructions below. + // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. + // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. + // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 + // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. + // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. + // D32 is currently selected in the RAMPS 1.3/1.4 pin file. All other boards will need changes to the respective pins_XXXXX.h file. + // WARNING: Setting the wrong pin may have unexpected and potentially disastrous outcomes. Use with caution and do your homework. + + //#define Z_PROBE_ENDSTOP + #endif // ENABLE_AUTO_BED_LEVELING @@ -527,16 +548,19 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) -//Manual homing switch locations: +// Manual homing switch locations: // For deltabots this means top and center of the Cartesian print volume. -// For SCARA: Offset between HomingPosition and Bed X=0 / Y=0 -#define MANUAL_X_HOME_POS -22. -#define MANUAL_Y_HOME_POS -52. -#define MANUAL_Z_HOME_POS 0.1 // Distance between nozzle and print surface after homing. +#ifdef MANUAL_HOME_POSITIONS + // For SCARA: Offset between HomingPosition and Bed X=0 / Y=0 + #define MANUAL_X_HOME_POS -22. + #define MANUAL_Y_HOME_POS -52. + #define MANUAL_Z_HOME_POS 0.1 // Distance between nozzle and print surface after homing. +#endif +/** + * MOVEMENT SETTINGS + */ -//// MOVEMENT SETTINGS -#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define HOMING_FEEDRATE {40*60, 40*60, 10*60, 0} // set the homing speeds (mm/min) // default settings @@ -549,8 +573,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DEFAULT_RETRACT_ACCELERATION 2000 // E acceleration in mm/s^2 for retracts #define DEFAULT_TRAVEL_ACCELERATION 400 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves - - // 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. @@ -570,9 +592,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Custom M code points //#define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES - #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 - #define Z_PROBE_OFFSET_RANGE_MIN -15 - #define Z_PROBE_OFFSET_RANGE_MAX -5 + #ifdef ENABLE_AUTO_BED_LEVELING + #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 + #define Z_PROBE_OFFSET_RANGE_MIN -20 + #define Z_PROBE_OFFSET_RANGE_MAX 20 + #endif #endif @@ -583,9 +607,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. //define this to enable EEPROM support //#define EEPROM_SETTINGS -//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: -// please keep turned on if you can. -#define EEPROM_CHITCHAT + +#ifdef EEPROM_SETTINGS + // To disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: + #define EEPROM_CHITCHAT // please keep turned on if you can. +#endif // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 180 @@ -599,13 +625,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //==============================LCD and SD support============================= // Define your display language below. Replace (en) with your language code and uncomment. -// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu +// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu, kana, kana_utf8, test // See also language.h //#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) -// Character based displays can have different extended charsets. -#define DISPLAY_CHARSET_HD44780_JAPAN // "ääööüüß23°" -//#define DISPLAY_CHARSET_HD44780_WESTERN // "ÄäÖöÜüß²³°" if you see a '~' instead of a 'arrow_right' at the right of submenuitems - this is the right one. +// Choose ONE of these 3 charsets. This has to match your hardware. Ignored for full graphic display. +// To find out what type you have - compile with (test) - upload - click to get the menu. You'll see two typical lines from the upper half of the charset. +// See also documentation/LCDLanguageFont.md + #define DISPLAY_CHARSET_HD44780_JAPAN // this is the most common hardware + //#define DISPLAY_CHARSET_HD44780_WESTERN + //#define DISPLAY_CHARSET_HD44780_CYRILLIC //#define ULTRA_LCD //general LCD support, also 16x2 //#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) @@ -618,6 +647,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define ULTIPANEL //the UltiPanel as on Thingiverse //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click + // 0 to disable buzzer feedback // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne @@ -672,7 +702,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Shift register panels // --------------------- // 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection //#define SAV_3DLCD @@ -680,7 +710,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define FAST_PWM_FAN // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency -// which is not ass annoying as with the hardware PWM. On the other hand, if this 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 @@ -725,7 +755,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Servo Endstops // // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. -// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. +// Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500. // //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles @@ -734,9 +764,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of * Support for a filament diameter sensor * Also allows adjustment of diameter at print time (vs at slicing) * Single extruder only at this point (extruder 0) - * + * * Motherboards - * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector + * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E) * 301 - Rambo - uses Analog input 3 * Note may require analog pins to be defined for different motherboards @@ -753,7 +783,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define MAX_MEASUREMENT_DELAY 20 //delay buffer size in bytes (1 byte = 1cm)- limits maximum measurement delay allowable (must be larger than MEASUREMENT_DELAY_CM and lower number saves RAM) //defines used in the code -#define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA //set measured to nominal initially +#define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA //set measured to nominal initially //When using an LCD, uncomment the line below to display the Filament sensor data on the last line instead of status. Status will appear for 5 sec. //#define FILAMENT_LCD_DISPLAY diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 452f8edeb..edc2445af 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -3,6 +3,8 @@ #include "Conditionals.h" +// @section temperature + //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== @@ -46,6 +48,8 @@ //The M105 command return, besides traditional information, the ADC value read from temperature sensors. //#define SHOW_TEMP_ADC_VALUES +// @section extruder + // extruder run-out prevention. //if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded //#define EXTRUDER_RUNOUT_PREVENT @@ -55,6 +59,8 @@ #define EXTRUDER_RUNOUT_SPEED 180. //extrusion speed #define EXTRUDER_RUNOUT_EXTRUDE 100 +// @section temperature + //These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements. //The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET" #define TEMP_SENSOR_AD595_OFFSET 0.0 @@ -72,15 +78,17 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// @section extruder + // Extruder cooling fans // Configure fan pin outputs to automatically turn on/off when the associated // extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. // 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 EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +#define EXTRUDER_0_AUTO_FAN_PIN -1 +#define EXTRUDER_1_AUTO_FAN_PIN -1 +#define EXTRUDER_2_AUTO_FAN_PIN -1 +#define EXTRUDER_3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed @@ -89,8 +97,12 @@ //=============================Mechanical Settings=========================== //=========================================================================== +// @section homing + #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing +// @section extras + //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. // A single Z stepper driver is usually used to drive 2 stepper motors. @@ -100,6 +112,30 @@ // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. //#define Z_DUAL_STEPPER_DRIVERS +#ifdef Z_DUAL_STEPPER_DRIVERS + + // Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper. + // That way the machine is capable to align the bed during home, since both Z steppers are homed. + // There is also an implementation of M666 (software endstops adjustment) to this feature. + // After Z homing, this adjustment is applied to just one of the steppers in order to align the bed. + // One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2. + // If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive. + // Play a little bit with small adjustments (0.5mm) and check the behaviour. + // The M119 (endstops report) will start reporting the Z2 Endstop as well. + + #define Z_DUAL_ENDSTOPS + + #ifdef Z_DUAL_ENDSTOPS + #define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis. + #define Z2_DIR_PIN E2_DIR_PIN + #define Z2_ENABLE_PIN E2_ENABLE_PIN + #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) + const bool Z2_MAX_ENDSTOP_INVERTING = false; + #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #endif + +#endif // Z_DUAL_STEPPER_DRIVERS + // Same again but for Y Axis. //#define Y_DUAL_STEPPER_DRIVERS @@ -112,54 +148,58 @@ // allowing faster printing speeds. //#define DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE -// Configuration for second X-carriage -// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; -// the second x-carriage always homes to the maximum endstop. -#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 EXTRUDER_OFFSET_X value for the second extruder provides a software - // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops - // without modifying the firmware (through the "M218 T1 X???" command). - // Remember: you should set the second extruder x-offset to 0 in your slicer. - -// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) -#define X2_ENABLE_PIN 29 -#define X2_STEP_PIN 25 -#define X2_DIR_PIN 23 - -// There are a few selectable movement modes for dual x-carriages using M605 S -// Mode 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) -// Mode 1: 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: 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 0 - -// Default settings in "Auto-park Mode" -#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder -#define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - -// Default x offset in duplication mode (typically set to half print bed width) -#define DEFAULT_DUPLICATION_X_OFFSET 100 + // Configuration for second X-carriage + // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; + // the second x-carriage always homes to the maximum endstop. + #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 EXTRUDER_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) + #define X2_ENABLE_PIN 29 + #define X2_STEP_PIN 25 + #define X2_DIR_PIN 23 + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 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) + // Mode 1: 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: 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 0 + + // Default settings in "Auto-park Mode" + #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder + #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 #endif //DUAL_X_CARRIAGE +// @section homing + //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: -#define X_HOME_RETRACT_MM 3 -#define Y_HOME_RETRACT_MM 3 -#define Z_HOME_RETRACT_MM 3 -#define HOMING_BUMP_DIVISOR {10, 10, 20} // Re-Bump Speed Divisor (Divides the Homing Feedrate) +#define X_HOME_BUMP_MM 3 +#define Y_HOME_BUMP_MM 3 +#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 this is defined, if both x and y are to be homed, a diagonal move will be performed initially. +// @section machine + #define AXIS_RELATIVE_MODES {false, false, false, false} -#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step) +// @section machine //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 @@ -173,11 +213,15 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +// @section lcd + #ifdef ULTIPANEL #define MANUAL_FEEDRATE {50*60, 50*60, 10*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel #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 @@ -212,34 +256,48 @@ //=========================================================================== #define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again -#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? -#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. - -#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. -// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. -// using: -//#define MENU_ADDAUTOSTART - -// Show a progress bar on the LCD when printing from SD? -//#define LCD_PROGRESS_BAR - -#ifdef LCD_PROGRESS_BAR - // Amount of time (ms) to show the bar - #define PROGRESS_BAR_BAR_TIME 2000 - // Amount of time (ms) to show the status message - #define PROGRESS_BAR_MSG_TIME 3000 - // Amount of time (ms) to retain the status message (0=forever) - #define PROGRESS_MSG_EXPIRE 0 - // Enable this to show messages for MSG_TIME then hide them - //#define PROGRESS_MSG_ONCE -#endif +// @section lcd + +#ifdef SDSUPPORT + + // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted + // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT + // in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should + // be commented out otherwise + #define SDCARDDETECTINVERTED + + #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + + #define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. + // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. + // using: + //#define MENU_ADDAUTOSTART + + // Show a progress bar on HD44780 LCDs for SD printing + //#define LCD_PROGRESS_BAR + + #ifdef LCD_PROGRESS_BAR + // Amount of time (ms) to show the bar + #define PROGRESS_BAR_BAR_TIME 2000 + // Amount of time (ms) to show the status message + #define PROGRESS_BAR_MSG_TIME 3000 + // Amount of time (ms) to retain the status message (0=forever) + #define PROGRESS_MSG_EXPIRE 0 + // Enable this to show messages for MSG_TIME then hide them + //#define PROGRESS_MSG_ONCE + #endif + +#endif // SDSUPPORT + +// @section more // 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 @@ -254,6 +312,8 @@ // Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled. //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED +// @section lcd + // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process // it can e.g. be used to change z-positions in the print startup phase in real-time // does not respect endstops! @@ -264,24 +324,24 @@ #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements #endif +// @section extruder + // extruder advance constant (s2/mm3) // // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2 // -// Hooke's law says: force = k * distance -// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant +// Hooke's law says: force = k * distance +// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant // so: v ^ 2 is proportional to number of steps we advance the extruder #define ADVANCE #ifdef ADVANCE #define EXTRUDER_ADVANCE_K .0 - #define D_FILAMENT 1.75 #define STEPS_MM_E 1000 - #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) - #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA) +#endif -#endif // ADVANCE +// @section extras // Arc interpretation settings: #define MM_PER_ARC_SEGMENT 1 @@ -289,11 +349,7 @@ const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement -// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted -// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT -// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should -// be commented out otherwise -#define SDCARDDETECTINVERTED +// @section temperature // Control heater 0 and heater 1 in parallel. //#define HEATERS_PARALLEL @@ -302,19 +358,23 @@ const unsigned int dropsegments=5; //everything with less than this number of st //=============================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, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. -#if defined SDSUPPORT +#ifdef 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 more //The ASCII buffer for receiving from the serial: #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// @section fwretract // Firmware based and LCD controlled retract // M207 and M208 can be used to define parameters for the retraction. @@ -326,9 +386,11 @@ const unsigned int dropsegments=5; //everything with less than this number of st #ifdef FWRETRACT #define MIN_RETRACT 0.1 //minimum extruded mm to accept a automatic gcode retraction attempt #define RETRACT_LENGTH 3 //default retract length (positive mm) + #define RETRACT_LENGTH_SWAP 13 //default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 35 //default feedrate for retracting (mm/s) #define RETRACT_ZLIFT 0 //default retract Z-lift #define RETRACT_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) #endif @@ -344,6 +406,143 @@ const unsigned int dropsegments=5; //everything with less than this number of st #endif #endif +/******************************************************************************\ + * enable this section if you have TMC26X motor drivers. + * you need to import the TMC26XStepper library into the arduino IDE for this + ******************************************************************************/ + +// @section tmc + +//#define HAVE_TMCDRIVER +#ifdef HAVE_TMCDRIVER + +// #define X_IS_TMC + #define X_MAX_CURRENT 1000 //in mA + #define X_SENSE_RESISTOR 91 //in mOhms + #define X_MICROSTEPS 16 //number of microsteps + +// #define X2_IS_TMC + #define X2_MAX_CURRENT 1000 //in mA + #define X2_SENSE_RESISTOR 91 //in mOhms + #define X2_MICROSTEPS 16 //number of microsteps + +// #define Y_IS_TMC + #define Y_MAX_CURRENT 1000 //in mA + #define Y_SENSE_RESISTOR 91 //in mOhms + #define Y_MICROSTEPS 16 //number of microsteps + +// #define Y2_IS_TMC + #define Y2_MAX_CURRENT 1000 //in mA + #define Y2_SENSE_RESISTOR 91 //in mOhms + #define Y2_MICROSTEPS 16 //number of microsteps + +// #define Z_IS_TMC + #define Z_MAX_CURRENT 1000 //in mA + #define Z_SENSE_RESISTOR 91 //in mOhms + #define Z_MICROSTEPS 16 //number of microsteps + +// #define Z2_IS_TMC + #define Z2_MAX_CURRENT 1000 //in mA + #define Z2_SENSE_RESISTOR 91 //in mOhms + #define Z2_MICROSTEPS 16 //number of microsteps + +// #define E0_IS_TMC + #define E0_MAX_CURRENT 1000 //in mA + #define E0_SENSE_RESISTOR 91 //in mOhms + #define E0_MICROSTEPS 16 //number of microsteps + +// #define E1_IS_TMC + #define E1_MAX_CURRENT 1000 //in mA + #define E1_SENSE_RESISTOR 91 //in mOhms + #define E1_MICROSTEPS 16 //number of microsteps + +// #define E2_IS_TMC + #define E2_MAX_CURRENT 1000 //in mA + #define E2_SENSE_RESISTOR 91 //in mOhms + #define E2_MICROSTEPS 16 //number of microsteps + +// #define E3_IS_TMC + #define E3_MAX_CURRENT 1000 //in mA + #define E3_SENSE_RESISTOR 91 //in mOhms + #define E3_MICROSTEPS 16 //number of microsteps + +#endif + +/******************************************************************************\ + * enable this section if you have L6470 motor drivers. + * you need to import the L6470 library into the arduino IDE for this + ******************************************************************************/ + +// @section l6470 + +//#define HAVE_L6470DRIVER +#ifdef HAVE_L6470DRIVER + +// #define X_IS_L6470 + #define X_MICROSTEPS 16 //number of microsteps + #define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #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_IS_L6470 + #define X2_MICROSTEPS 16 //number of microsteps + #define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y_IS_L6470 + #define Y_MICROSTEPS 16 //number of microsteps + #define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y2_IS_L6470 + #define Y2_MICROSTEPS 16 //number of microsteps + #define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z_IS_L6470 + #define Z_MICROSTEPS 16 //number of microsteps + #define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z2_IS_L6470 + #define Z2_MICROSTEPS 16 //number of microsteps + #define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E0_IS_L6470 + #define E0_MICROSTEPS 16 //number of microsteps + #define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E1_IS_L6470 + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E2_IS_L6470 + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E3_IS_L6470 + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +#endif + #include "Conditionals.h" #include "SanityCheck.h" diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index 481b59125..dda21b775 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated: // 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_VERSION "1.0.2" +#define STRING_VERSION "1.0.3 dev" #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(bq Witbox)" // Who made the changes. @@ -58,12 +58,11 @@ Here are some standard links for getting your machine calibrated: // 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_WITBOX -#endif +#define MOTHERBOARD BOARD_WITBOX -// Define this to set a custom name for your generic Mendel, -// #define CUSTOM_MENDEL_NAME "This Mendel" +// 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) @@ -104,7 +103,7 @@ Here are some standard links for getting your machine calibrated: // 10 is 100k RS thermistor 198-961 (4.7k pullup) // 11 is 100k beta 3950 1% thermistor (4.7k pullup) // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) -// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" // 20 is the PT100 circuit found in the Ultimainboard V2.x // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // @@ -118,11 +117,11 @@ Here are some standard links for getting your machine calibrated: // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup // 110 is Pt100 with 1k pullup (non standard) -// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. +// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. // Use it for Testing or Development purposes. NEVER for production machine. // #define DUMMY_THERMISTOR_998_VALUE 25 // #define DUMMY_THERMISTOR_999_VALUE 100 - +// :{ '0': "Not used", '4': "10k !! do not use for a hotend. Bad resolution at high temp. !!", '1': "100k / 4.7k - EPCOS", '51': "100k / 1k - EPCOS", '6': "100k / 4.7k EPCOS - Not as accurate as Table 1", '5': "100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '7': "100k / 4.7k Honeywell 135-104LAG-J01", '71': "100k / 4.7k Honeywell 135-104LAF-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'", '60': "100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '55': "100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '2': "200k / 4.7k - ATC Semitec 204GT-2", '52': "200k / 1k - ATC Semitec 204GT-2", '-2': "Thermocouple + MAX6675 (only for sensor 0)", '-1': "Thermocouple + AD595", '3': "Mendel-parts / 4.7k", '1047': "Pt1000 / 4.7k", '1010': "Pt1000 / 1k (non standard)", '20': "PT100 (Ultimainboard V2.x)", '147': "Pt100 / 4.7k", '110': "Pt100 / 1k (non-standard)", '998': "Dummy 1", '999': "Dummy 2" } #define TEMP_SENSOR_0 1 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 @@ -184,7 +183,6 @@ Here are some standard links for getting your machine calibrated: // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term #define K1 0.95 //smoothing factor within the PID - #define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // Ultimaker @@ -214,7 +212,7 @@ Here are some standard links for getting your machine calibrated: // Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis // // Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. -// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// If your PID_dT is the default, and correct for your hardware/configuration, that means 7.689Hz, // which is fine for driving a square wave into a resistive load and does not significantly impact you 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, you probably @@ -270,15 +268,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua The system will turn the heater on forever, burning up the filament and anything else around. -After the temperature reaches the target for the first time, this feature will -start measuring for how long the current temperature stays below the target +After the temperature reaches the target for the first time, this feature will +start measuring for how long the current temperature stays below the target minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS). If it stays longer than _PERIOD, it means the thermistor temperature cannot catch up with the target, so something *may be* wrong. Then, to be on the safe side, the system will he halt. -Bear in mind the count down will just start AFTER the first time the +Bear in mind the count down will just start AFTER the first time the thermistor temperature is over the target, so you will have no problem if your extruder heater takes 2 minutes to hit the target on heating. @@ -321,13 +319,14 @@ your extruder heater takes 2 minutes to hit the target on heating. // #define ENDSTOPPULLUP_ZMIN #endif -// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. +const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. //#define DISABLE_MAX_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS @@ -344,13 +343,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DISABLE_E false // For all extruders #define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled -#define INVERT_X_DIR true // for Mendel set to false, for Orca set to true -#define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false -#define INVERT_Z_DIR true // for Mendel set to false, for Orca set to true -#define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E3_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false +// 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 +#define INVERT_E0_DIR false +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false // ENDSTOP SETTINGS: // Sets direction of endstops when homing; 1=MAX, -1=MIN @@ -362,12 +362,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. // Travel limits after homing (units are in mm) -#define X_MAX_POS 297 #define X_MIN_POS 0 -#define Y_MAX_POS 210 #define Y_MIN_POS 0 -#define Z_MAX_POS 200 #define Z_MIN_POS 0 +#define X_MAX_POS 297 +#define Y_MAX_POS 210 +#define Z_MAX_POS 200 //=========================================================================== //============================= Filament Runout Sensor ====================== @@ -386,7 +386,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // #define MANUAL_BED_LEVELING // Add display menu option for bed leveling // #define MESH_BED_LEVELING // Enable mesh bed leveling -#if defined(MESH_BED_LEVELING) +#ifdef MANUAL_BED_LEVELING + #define MBL_Z_STEP 0.025 +#endif // MANUAL_BED_LEVELING + +#ifdef MESH_BED_LEVELING #define MESH_MIN_X 10 #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MIN_Y 10 @@ -428,12 +432,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define BACK_PROBE_BED_POSITION 170 #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this - + // Set the number of grid points per dimension // You probably don't need more than 3 (squared=9) #define AUTO_BED_LEVELING_GRID_POINTS 2 - #else // !AUTO_BED_LEVELING_GRID // Arbitrary points to probe. A simple cross-product @@ -447,11 +450,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif // AUTO_BED_LEVELING_GRID - // Offsets to the probe relative to the extruder tip (Hotend - Probe) // X and Y offsets must be integers - #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // -left +right - #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // -front +behind + #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // Probe on: -left +right + #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // Probe on: -front +behind #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35 // -below (always!) #define Z_RAISE_BEFORE_HOMING 4 // (in mm) Raise Z before homing (G28) for Probe Clearance. @@ -459,10 +461,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min - #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. + #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points #define Z_RAISE_AFTER_PROBING 15 //How much the extruder will be raised after the last probing point. +// #define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" //These commands will be executed in the end of G29 routine. + //Useful to retract a deployable probe. + //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#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. @@ -490,6 +495,20 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif + // Support for a dedicated Z PROBE endstop separate from the Z MIN endstop. + // If you would like to use both a Z PROBE and a Z MIN endstop together or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP and read the instructions below. + // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. + // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. + // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 + // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. + // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. + // D32 is currently selected in the RAMPS 1.3/1.4 pin file. All other boards will need changes to the respective pins_XXXXX.h file. + // WARNING: Setting the wrong pin may have unexpected and potentially disastrous outcomes. Use with caution and do your homework. + + //#define Z_PROBE_ENDSTOP + #endif // ENABLE_AUTO_BED_LEVELING @@ -497,15 +516,19 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) -//Manual homing switch locations: +// Manual homing switch locations: // For deltabots this means top and center of the Cartesian print volume. -#define MANUAL_X_HOME_POS 0 -#define MANUAL_Y_HOME_POS 0 -#define MANUAL_Z_HOME_POS 0 -//#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +#ifdef MANUAL_HOME_POSITIONS + #define MANUAL_X_HOME_POS 0 + #define MANUAL_Y_HOME_POS 0 + #define MANUAL_Z_HOME_POS 0 + //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +#endif + +/** + * MOVEMENT SETTINGS + */ -//// MOVEMENT SETTINGS -#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define HOMING_FEEDRATE {120*60, 120*60, 7.2*60, 0} // set the homing speeds (mm/min) // default settings @@ -537,9 +560,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Custom M code points #define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES - #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 - #define Z_PROBE_OFFSET_RANGE_MIN -15 - #define Z_PROBE_OFFSET_RANGE_MAX -5 + #ifdef ENABLE_AUTO_BED_LEVELING + #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 + #define Z_PROBE_OFFSET_RANGE_MIN -20 + #define Z_PROBE_OFFSET_RANGE_MAX 20 + #endif #endif @@ -550,9 +575,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. //define this to enable EEPROM support //#define EEPROM_SETTINGS -//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: -// please keep turned on if you can. -//#define EEPROM_CHITCHAT + +#ifdef EEPROM_SETTINGS + // To disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: + #define EEPROM_CHITCHAT // please keep turned on if you can. +#endif // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 200 @@ -566,13 +593,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //==============================LCD and SD support============================= // Define your display language below. Replace (en) with your language code and uncomment. -// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu +// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu, kana, kana_utf8, test // See also language.h //#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) -// Character based displays can have different extended charsets. -#define DISPLAY_CHARSET_HD44780_JAPAN // "ääööüüß23°" -//#define DISPLAY_CHARSET_HD44780_WESTERN // "ÄäÖöÜüß²³°" if you see a '~' instead of a 'arrow_right' at the right of submenuitems - this is the right one. +// Choose ONE of these 3 charsets. This has to match your hardware. Ignored for full graphic display. +// To find out what type you have - compile with (test) - upload - click to get the menu. You'll see two typical lines from the upper half of the charset. +// See also documentation/LCDLanguageFont.md + #define DISPLAY_CHARSET_HD44780_JAPAN // this is the most common hardware + //#define DISPLAY_CHARSET_HD44780_WESTERN + //#define DISPLAY_CHARSET_HD44780_CYRILLIC #define ULTRA_LCD //general LCD support, also 16x2 //#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) @@ -585,6 +615,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define ULTIPANEL //the UltiPanel as on Thingiverse //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click + // 0 to disable buzzer feedback // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne @@ -639,7 +670,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Shift register panels // --------------------- // 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection //#define SAV_3DLCD @@ -647,7 +678,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define FAST_PWM_FAN // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency -// which is not ass annoying as with the hardware PWM. On the other hand, if this 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 @@ -692,7 +723,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Servo Endstops // // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. -// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. +// Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500. // //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles @@ -701,9 +732,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of * Support for a filament diameter sensor * Also allows adjustment of diameter at print time (vs at slicing) * Single extruder only at this point (extruder 0) - * + * * Motherboards - * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector + * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E) * 301 - Rambo - uses Analog input 3 * Note may require analog pins to be defined for different motherboards diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index fcdf4d161..15c523284 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -3,6 +3,8 @@ #include "Conditionals.h" +// @section temperature + //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== @@ -46,6 +48,8 @@ //The M105 command return, besides traditional information, the ADC value read from temperature sensors. //#define SHOW_TEMP_ADC_VALUES +// @section extruder + // extruder run-out prevention. //if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded //#define EXTRUDER_RUNOUT_PREVENT @@ -55,6 +59,8 @@ #define EXTRUDER_RUNOUT_SPEED 1500. //extrusion speed #define EXTRUDER_RUNOUT_EXTRUDE 100 +// @section temperature + //These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements. //The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET" #define TEMP_SENSOR_AD595_OFFSET 0.0 @@ -72,6 +78,8 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// @section extruder + // Extruder cooling fans // Configure fan pin outputs to automatically turn on/off when the associated // extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. @@ -89,8 +97,12 @@ //=============================Mechanical Settings=========================== //=========================================================================== +// @section homing + //#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing +// @section extras + //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. // A single Z stepper driver is usually used to drive 2 stepper motors. @@ -100,6 +112,30 @@ // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. //#define Z_DUAL_STEPPER_DRIVERS +#ifdef Z_DUAL_STEPPER_DRIVERS + + // Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper. + // That way the machine is capable to align the bed during home, since both Z steppers are homed. + // There is also an implementation of M666 (software endstops adjustment) to this feature. + // After Z homing, this adjustment is applied to just one of the steppers in order to align the bed. + // One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2. + // If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive. + // Play a little bit with small adjustments (0.5mm) and check the behaviour. + // The M119 (endstops report) will start reporting the Z2 Endstop as well. + + #define Z_DUAL_ENDSTOPS + + #ifdef Z_DUAL_ENDSTOPS + #define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis. + #define Z2_DIR_PIN E2_DIR_PIN + #define Z2_ENABLE_PIN E2_ENABLE_PIN + #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) + const bool Z2_MAX_ENDSTOP_INVERTING = false; + #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #endif + +#endif // Z_DUAL_STEPPER_DRIVERS + // Same again but for Y Axis. //#define Y_DUAL_STEPPER_DRIVERS @@ -112,57 +148,59 @@ // allowing faster printing speeds. //#define DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE -// Configuration for second X-carriage -// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; -// the second x-carriage always homes to the maximum endstop. -#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 EXTRUDER_OFFSET_X value for the second extruder provides a software - // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops - // without modifying the firmware (through the "M218 T1 X???" command). - // Remember: you should set the second extruder x-offset to 0 in your slicer. - -// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) -#define X2_ENABLE_PIN 29 -#define X2_STEP_PIN 25 -#define X2_DIR_PIN 23 - -// There are a few selectable movement modes for dual x-carriages using M605 S -// Mode 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) -// Mode 1: 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: 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 0 - -// Default settings in "Auto-park Mode" -#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder -#define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - -// Default x offset in duplication mode (typically set to half print bed width) -#define DEFAULT_DUPLICATION_X_OFFSET 100 + // Configuration for second X-carriage + // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; + // the second x-carriage always homes to the maximum endstop. + #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 EXTRUDER_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) + #define X2_ENABLE_PIN 29 + #define X2_STEP_PIN 25 + #define X2_DIR_PIN 23 + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 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) + // Mode 1: 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: 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 0 + + // Default settings in "Auto-park Mode" + #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder + #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 #endif //DUAL_X_CARRIAGE +// @section homing + //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: -#define X_HOME_RETRACT_MM 5 -#define Y_HOME_RETRACT_MM 5 -#define Z_HOME_RETRACT_MM 2 -#define HOMING_BUMP_DIVISOR {10, 10, 20} // Re-Bump Speed Divisor (Divides the Homing Feedrate) +#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 this is defined, if both x and y are to be homed, a diagonal move will be performed initially. +// @section machine + #define AXIS_RELATIVE_MODES {false, false, false, false} -#ifdef CONFIG_STEPPERS_TOSHIBA -#define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers -#else -#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step) -#endif + +// @section machine + //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 @@ -175,11 +213,15 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +// @section lcd + #ifdef ULTIPANEL #define MANUAL_FEEDRATE {120*60, 120*60, 18*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel #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 @@ -214,34 +256,48 @@ //=========================================================================== #define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again -#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? -#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. - -#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. -// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. -// using: -#define MENU_ADDAUTOSTART - -// Show a progress bar on HD44780 LCDs for SD printing -//#define LCD_PROGRESS_BAR - -#ifdef LCD_PROGRESS_BAR - // Amount of time (ms) to show the bar - #define PROGRESS_BAR_BAR_TIME 2000 - // Amount of time (ms) to show the status message - #define PROGRESS_BAR_MSG_TIME 3000 - // Amount of time (ms) to retain the status message (0=forever) - #define PROGRESS_MSG_EXPIRE 0 - // Enable this to show messages for MSG_TIME then hide them - //#define PROGRESS_MSG_ONCE -#endif +// @section lcd + +#ifdef SDSUPPORT + + // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted + // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT + // in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should + // be commented out otherwise + #define SDCARDDETECTINVERTED + + #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + + #define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. + // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. + // using: + //#define MENU_ADDAUTOSTART + + // Show a progress bar on HD44780 LCDs for SD printing + //#define LCD_PROGRESS_BAR + + #ifdef LCD_PROGRESS_BAR + // Amount of time (ms) to show the bar + #define PROGRESS_BAR_BAR_TIME 2000 + // Amount of time (ms) to show the status message + #define PROGRESS_BAR_MSG_TIME 3000 + // Amount of time (ms) to retain the status message (0=forever) + #define PROGRESS_MSG_EXPIRE 0 + // Enable this to show messages for MSG_TIME then hide them + //#define PROGRESS_MSG_ONCE + #endif + +#endif // SDSUPPORT + +// @section more // 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 @@ -256,6 +312,8 @@ // Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled. //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED +// @section lcd + // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process // it can e.g. be used to change z-positions in the print startup phase in real-time // does not respect endstops! @@ -266,12 +324,14 @@ #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements #endif +// @section extruder + // extruder advance constant (s2/mm3) // // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2 // -// Hooke's law says: force = k * distance -// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant +// Hooke's law says: force = k * distance +// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant // so: v ^ 2 is proportional to number of steps we advance the extruder //#define ADVANCE @@ -279,7 +339,9 @@ #define EXTRUDER_ADVANCE_K .0 #define D_FILAMENT 1.75 #define STEPS_MM_E 100.47095761381482 -#endif // ADVANCE +#endif + +// @section extras // Arc interpretation settings: #define MM_PER_ARC_SEGMENT 1 @@ -287,11 +349,7 @@ const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement -// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted -// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT -// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should -// be commented out otherwise -#define SDCARDDETECTINVERTED +// @section temperature // Control heater 0 and heater 1 in parallel. //#define HEATERS_PARALLEL @@ -300,19 +358,23 @@ const unsigned int dropsegments=5; //everything with less than this number of st //=============================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, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. -#if defined SDSUPPORT +#ifdef 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 more //The ASCII buffer for receiving from the serial: #define MAX_CMD_SIZE 96 #define BUFSIZE 5 +// @section fwretract // Firmware based and LCD controlled retract // M207 and M208 can be used to define parameters for the retraction. @@ -344,6 +406,143 @@ const unsigned int dropsegments=5; //everything with less than this number of st #endif #endif +/******************************************************************************\ + * enable this section if you have TMC26X motor drivers. + * you need to import the TMC26XStepper library into the arduino IDE for this + ******************************************************************************/ + +// @section tmc + +//#define HAVE_TMCDRIVER +#ifdef HAVE_TMCDRIVER + +// #define X_IS_TMC + #define X_MAX_CURRENT 1000 //in mA + #define X_SENSE_RESISTOR 91 //in mOhms + #define X_MICROSTEPS 16 //number of microsteps + +// #define X2_IS_TMC + #define X2_MAX_CURRENT 1000 //in mA + #define X2_SENSE_RESISTOR 91 //in mOhms + #define X2_MICROSTEPS 16 //number of microsteps + +// #define Y_IS_TMC + #define Y_MAX_CURRENT 1000 //in mA + #define Y_SENSE_RESISTOR 91 //in mOhms + #define Y_MICROSTEPS 16 //number of microsteps + +// #define Y2_IS_TMC + #define Y2_MAX_CURRENT 1000 //in mA + #define Y2_SENSE_RESISTOR 91 //in mOhms + #define Y2_MICROSTEPS 16 //number of microsteps + +// #define Z_IS_TMC + #define Z_MAX_CURRENT 1000 //in mA + #define Z_SENSE_RESISTOR 91 //in mOhms + #define Z_MICROSTEPS 16 //number of microsteps + +// #define Z2_IS_TMC + #define Z2_MAX_CURRENT 1000 //in mA + #define Z2_SENSE_RESISTOR 91 //in mOhms + #define Z2_MICROSTEPS 16 //number of microsteps + +// #define E0_IS_TMC + #define E0_MAX_CURRENT 1000 //in mA + #define E0_SENSE_RESISTOR 91 //in mOhms + #define E0_MICROSTEPS 16 //number of microsteps + +// #define E1_IS_TMC + #define E1_MAX_CURRENT 1000 //in mA + #define E1_SENSE_RESISTOR 91 //in mOhms + #define E1_MICROSTEPS 16 //number of microsteps + +// #define E2_IS_TMC + #define E2_MAX_CURRENT 1000 //in mA + #define E2_SENSE_RESISTOR 91 //in mOhms + #define E2_MICROSTEPS 16 //number of microsteps + +// #define E3_IS_TMC + #define E3_MAX_CURRENT 1000 //in mA + #define E3_SENSE_RESISTOR 91 //in mOhms + #define E3_MICROSTEPS 16 //number of microsteps + +#endif + +/******************************************************************************\ + * enable this section if you have L6470 motor drivers. + * you need to import the L6470 library into the arduino IDE for this + ******************************************************************************/ + +// @section l6470 + +//#define HAVE_L6470DRIVER +#ifdef HAVE_L6470DRIVER + +// #define X_IS_L6470 + #define X_MICROSTEPS 16 //number of microsteps + #define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #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_IS_L6470 + #define X2_MICROSTEPS 16 //number of microsteps + #define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y_IS_L6470 + #define Y_MICROSTEPS 16 //number of microsteps + #define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y2_IS_L6470 + #define Y2_MICROSTEPS 16 //number of microsteps + #define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z_IS_L6470 + #define Z_MICROSTEPS 16 //number of microsteps + #define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z2_IS_L6470 + #define Z2_MICROSTEPS 16 //number of microsteps + #define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E0_IS_L6470 + #define E0_MICROSTEPS 16 //number of microsteps + #define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E1_IS_L6470 + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E2_IS_L6470 + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E3_IS_L6470 + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +#endif + #include "Conditionals.h" #include "SanityCheck.h" diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 0baf7de1c..2562010ea 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -1,4 +1,4 @@ -#ifndef CONFIGURATION_H +#ifndef CONFIGURATION_H #define CONFIGURATION_H #include "boards.h" @@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated: // 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_VERSION "1.0.2" +#define STRING_VERSION "1.0.3 dev" #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. @@ -62,8 +62,9 @@ Here are some standard links for getting your machine calibrated: #define MOTHERBOARD BOARD_RAMPS_13_EFB #endif -// Define this to set a custom name for your generic Mendel, -// #define CUSTOM_MENDEL_NAME "This Mendel" +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "Deltabot" // 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) @@ -107,11 +108,11 @@ Here are some standard links for getting your machine calibrated: // Horizontal offset of the universal joints on the carriages. #define DELTA_CARRIAGE_OFFSET 18.0 // mm -// Effective horizontal distance bridged by diagonal push rods. +// Horizontal distance bridged by diagonal push rods when effector is centered. #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-DELTA_EFFECTOR_OFFSET-DELTA_CARRIAGE_OFFSET) // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). -#define DELTA_PRINTABLE_RADIUS 90 +#define DELTA_PRINTABLE_RADIUS 140 //=========================================================================== @@ -137,7 +138,7 @@ Here are some standard links for getting your machine calibrated: // 10 is 100k RS thermistor 198-961 (4.7k pullup) // 11 is 100k beta 3950 1% thermistor (4.7k pullup) // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) -// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" // 20 is the PT100 circuit found in the Ultimainboard V2.x // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // @@ -151,11 +152,11 @@ Here are some standard links for getting your machine calibrated: // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup // 110 is Pt100 with 1k pullup (non standard) -// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. +// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. // Use it for Testing or Development purposes. NEVER for production machine. // #define DUMMY_THERMISTOR_998_VALUE 25 // #define DUMMY_THERMISTOR_999_VALUE 100 - +// :{ '0': "Not used", '4': "10k !! do not use for a hotend. Bad resolution at high temp. !!", '1': "100k / 4.7k - EPCOS", '51': "100k / 1k - EPCOS", '6': "100k / 4.7k EPCOS - Not as accurate as Table 1", '5': "100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '7': "100k / 4.7k Honeywell 135-104LAG-J01", '71': "100k / 4.7k Honeywell 135-104LAF-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'", '60': "100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '55': "100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '2': "200k / 4.7k - ATC Semitec 204GT-2", '52': "200k / 1k - ATC Semitec 204GT-2", '-2': "Thermocouple + MAX6675 (only for sensor 0)", '-1': "Thermocouple + AD595", '3': "Mendel-parts / 4.7k", '1047': "Pt1000 / 4.7k", '1010': "Pt1000 / 1k (non standard)", '20': "PT100 (Ultimainboard V2.x)", '147': "Pt100 / 4.7k", '110': "Pt100 / 1k (non-standard)", '998': "Dummy 1", '999': "Dummy 2" } #define TEMP_SENSOR_0 -1 #define TEMP_SENSOR_1 -1 #define TEMP_SENSOR_2 0 @@ -217,7 +218,6 @@ Here are some standard links for getting your machine calibrated: // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term #define K1 0.95 //smoothing factor within the PID - #define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // Ultimaker @@ -242,7 +242,7 @@ Here are some standard links for getting your machine calibrated: // Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis // // Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. -// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// If your PID_dT is the default, and correct for your hardware/configuration, that means 7.689Hz, // which is fine for driving a square wave into a resistive load and does not significantly impact you 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, you probably @@ -298,15 +298,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua The system will turn the heater on forever, burning up the filament and anything else around. -After the temperature reaches the target for the first time, this feature will -start measuring for how long the current temperature stays below the target +After the temperature reaches the target for the first time, this feature will +start measuring for how long the current temperature stays below the target minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS). If it stays longer than _PERIOD, it means the thermistor temperature cannot catch up with the target, so something *may be* wrong. Then, to be on the safe side, the system will he halt. -Bear in mind the count down will just start AFTER the first time the +Bear in mind the count down will just start AFTER the first time the thermistor temperature is over the target, so you will have no problem if your extruder heater takes 2 minutes to hit the target on heating. @@ -349,13 +349,14 @@ your extruder heater takes 2 minutes to hit the target on heating. // #define ENDSTOPPULLUP_ZMIN #endif -// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. +const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. //#define DISABLE_MAX_ENDSTOPS #define DISABLE_MIN_ENDSTOPS // Deltas only use min endstops for probing @@ -372,19 +373,18 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DISABLE_E false // For all extruders #define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled +// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. #define INVERT_X_DIR false // DELTA does not invert #define INVERT_Y_DIR false #define INVERT_Z_DIR false - -#define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E3_DIR false // 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 // ENDSTOP SETTINGS: // Sets direction of endstops when homing; 1=MAX, -1=MIN -// deltas always home to max -#define X_HOME_DIR 1 +#define X_HOME_DIR 1 // deltas always home to max #define Y_HOME_DIR 1 #define Z_HOME_DIR 1 @@ -392,12 +392,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. // Travel limits after homing (units are in mm) -#define X_MAX_POS 90 -#define X_MIN_POS -90 -#define Y_MAX_POS 90 -#define Y_MIN_POS -90 -#define Z_MAX_POS MANUAL_Z_HOME_POS +#define X_MIN_POS -DELTA_PRINTABLE_RADIUS +#define Y_MIN_POS -DELTA_PRINTABLE_RADIUS #define Z_MIN_POS 0 +#define X_MAX_POS DELTA_PRINTABLE_RADIUS +#define Y_MAX_POS DELTA_PRINTABLE_RADIUS +#define Z_MAX_POS MANUAL_Z_HOME_POS //=========================================================================== //============================= Filament Runout Sensor ====================== @@ -416,7 +416,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // #define MANUAL_BED_LEVELING // Add display menu option for bed leveling // #define MESH_BED_LEVELING // Enable mesh bed leveling -#if defined(MESH_BED_LEVELING) +#ifdef MANUAL_BED_LEVELING + #define MBL_Z_STEP 0.025 +#endif // MANUAL_BED_LEVELING + +#ifdef MESH_BED_LEVELING #define MESH_MIN_X 10 #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MIN_Y 10 @@ -431,29 +435,59 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //=========================================================================== //#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line) -// Z-Probe Repeatability test is not supported in Deltas yet. +//#define Z_PROBE_REPEATABILITY_TEST // Z-Probe Repeatability test is not supported in Deltas yet. #ifdef ENABLE_AUTO_BED_LEVELING - // Deltas only support grid mode - #define AUTO_BED_LEVELING_GRID + // There are 2 different ways to specify probing locations + // + // - "grid" mode + // Probe several points in a rectangular grid. + // You specify the rectangle and the density of sample points. + // This mode is preferred because there are more measurements. + // + // - "3-point" mode + // Probe 3 arbitrary points on the bed (that aren't colinear) + // You specify the XY coordinates of all 3 points. + + // Enable this to sample the bed in a grid (least squares solution) + // Note: this feature generates 10KB extra code size + #define AUTO_BED_LEVELING_GRID // Deltas only support grid mode + + #ifdef AUTO_BED_LEVELING_GRID + + #define DELTA_PROBABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10) + + #define LEFT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS + #define RIGHT_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS + #define FRONT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS + #define BACK_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS + + #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this - #define DELTA_PROBABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10) - #define LEFT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS - #define RIGHT_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS - #define BACK_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS - #define FRONT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS + // Non-linear bed leveling will be used. + // Compensate by interpolating between the nearest four Z probe values for each point. + // Useful for deltas where the print surface may appear like a bowl or dome shape. + // Works best with ACCURATE_BED_LEVELING_POINTS 5 or higher. + #define AUTO_BED_LEVELING_GRID_POINTS 9 - // Non-linear bed leveling will be used. - // Compensate by interpolating between the nearest four Z probe values for each point. - // Useful for deltas where the print surface may appear like a bowl or dome shape. - // Works best with ACCURATE_BED_LEVELING_POINTS 5 or higher. - #define AUTO_BED_LEVELING_GRID_POINTS 9 + #else // !AUTO_BED_LEVELING_GRID + + // Arbitrary points to probe. A simple cross-product + // is used to estimate the plane of the bed. + #define ABL_PROBE_PT_1_X 15 + #define ABL_PROBE_PT_1_Y 180 + #define ABL_PROBE_PT_2_X 15 + #define ABL_PROBE_PT_2_Y 20 + #define ABL_PROBE_PT_3_X 170 + #define ABL_PROBE_PT_3_Y 20 + + #endif // AUTO_BED_LEVELING_GRID // Offsets to the probe relative to the extruder tip (Hotend - Probe) // X and Y offsets must be integers - #define X_PROBE_OFFSET_FROM_EXTRUDER 0 // -left +right - #define Y_PROBE_OFFSET_FROM_EXTRUDER -10 // -front +behind + #define X_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -left +right + #define Y_PROBE_OFFSET_FROM_EXTRUDER -10 // Probe on: -front +behind #define Z_PROBE_OFFSET_FROM_EXTRUDER -3.5 // -below (always!) #define Z_RAISE_BEFORE_HOMING 4 // (in mm) Raise Z before homing (G28) for Probe Clearance. @@ -464,7 +498,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points #define Z_RAISE_AFTER_PROBING 50 //How much the extruder will be raised after the last probing point. - + +// #define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" //These commands will be executed in the end of G29 routine. + //Useful to retract a deployable probe. + + //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell + //#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. + // Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe // Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN. //#define Z_PROBE_ALLEN_KEY @@ -473,10 +513,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define Z_PROBE_ALLEN_KEY_DEPLOY_Y DELTA_PRINTABLE_RADIUS #define Z_PROBE_ALLEN_KEY_DEPLOY_Z 100 - #define Z_PROBE_ALLEN_KEY_RETRACT_X -64 - #define Z_PROBE_ALLEN_KEY_RETRACT_Y 56 - #define Z_PROBE_ALLEN_KEY_RETRACT_Z 23 - #define Z_PROBE_ALLEN_KEY_RETRACT_DEPTH 20 + #define Z_PROBE_ALLEN_KEY_STOW_X -64 + #define Z_PROBE_ALLEN_KEY_STOW_Y 56 + #define Z_PROBE_ALLEN_KEY_STOW_Z 23 + #define Z_PROBE_ALLEN_KEY_STOW_DEPTH 20 #endif //If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk @@ -503,22 +543,39 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif -#endif // ENABLE_AUTO_BED_LEVELING + // Support for a dedicated Z PROBE endstop separate from the Z MIN endstop. + // If you would like to use both a Z PROBE and a Z MIN endstop together or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP and read the instructions below. + // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. + // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. + // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 + // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. + // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. + // D32 is currently selected in the RAMPS 1.3/1.4 pin file. All other boards will need changes to the respective pins_XXXXX.h file. + // WARNING: Setting the wrong pin may have unexpected and potentially disastrous outcomes. Use with caution and do your homework. + + //#define Z_PROBE_ENDSTOP +#endif // ENABLE_AUTO_BED_LEVELING // The position of the homing switches #define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) -//Manual homing switch locations: +// Manual homing switch locations: // For deltabots this means top and center of the Cartesian print volume. -#define MANUAL_X_HOME_POS 0 -#define MANUAL_Y_HOME_POS 0 -#define MANUAL_Z_HOME_POS 250 // For delta: Distance between nozzle and print surface after homing. +#ifdef MANUAL_HOME_POSITIONS + #define MANUAL_X_HOME_POS 0 + #define MANUAL_Y_HOME_POS 0 + #define MANUAL_Z_HOME_POS 250 // For delta: Distance between nozzle and print surface after homing. +#endif + +/** + * MOVEMENT SETTINGS + */ -//// MOVEMENT SETTINGS -#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E // delta homing speeds must be the same on xyz #define HOMING_FEEDRATE {200*60, 200*60, 200*60, 0} // set the homing speeds (mm/min) @@ -533,7 +590,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration in mm/s^2 for retracts #define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves - // 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. @@ -553,9 +609,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Custom M code points #define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES - #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 - #define Z_PROBE_OFFSET_RANGE_MIN -15 - #define Z_PROBE_OFFSET_RANGE_MAX -5 + #ifdef ENABLE_AUTO_BED_LEVELING + #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 + #define Z_PROBE_OFFSET_RANGE_MIN -20 + #define Z_PROBE_OFFSET_RANGE_MAX 20 + #endif #endif @@ -566,9 +624,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. //define this to enable EEPROM support //#define EEPROM_SETTINGS -//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: -// please keep turned on if you can. -//#define EEPROM_CHITCHAT + +#ifdef EEPROM_SETTINGS + // To disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: + #define EEPROM_CHITCHAT // please keep turned on if you can. +#endif // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 180 @@ -582,13 +642,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //==============================LCD and SD support============================= // Define your display language below. Replace (en) with your language code and uncomment. -// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu +// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu, kana, kana_utf8, test // See also language.h -//#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) +#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) -// Character based displays can have different extended charsets. -#define DISPLAY_CHARSET_HD44780_JAPAN // "ääööüüß23°" -//#define DISPLAY_CHARSET_HD44780_WESTERN // "ÄäÖöÜüß²³°" if you see a '~' instead of a 'arrow_right' at the right of submenuitems - this is the right one. +// Choose ONE of these 3 charsets. This has to match your hardware. Ignored for full graphic display. +// To find out what type you have - compile with (test) - upload - click to get the menu. You'll see two typical lines from the upper half of the charset. +// See also documentation/LCDLanguageFont.md + #define DISPLAY_CHARSET_HD44780_JAPAN // this is the most common hardware + //#define DISPLAY_CHARSET_HD44780_WESTERN + //#define DISPLAY_CHARSET_HD44780_CYRILLIC //#define ULTRA_LCD //general LCD support, also 16x2 //#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) @@ -601,6 +664,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define ULTIPANEL //the UltiPanel as on Thingiverse //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click + // 0 to disable buzzer feedback // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne @@ -648,7 +712,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // #define DELTA_CALIBRATION_MENU /** - * I2C PANELS + * I2C Panels */ //#define LCD_I2C_SAINSMART_YWROBOT @@ -662,7 +726,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Shift register panels // --------------------- // 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection //#define SAV_3DLCD @@ -670,7 +734,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define FAST_PWM_FAN // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency -// which is not ass annoying as with the hardware PWM. On the other hand, if this 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 @@ -715,7 +779,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Servo Endstops // // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. -// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. +// Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500. // //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles @@ -724,9 +788,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of * Support for a filament diameter sensor * Also allows adjustment of diameter at print time (vs at slicing) * Single extruder only at this point (extruder 0) - * + * * Motherboards - * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector + * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E) * 301 - Rambo - uses Analog input 3 * Note may require analog pins to be defined for different motherboards @@ -743,7 +807,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define MAX_MEASUREMENT_DELAY 20 //delay buffer size in bytes (1 byte = 1cm)- limits maximum measurement delay allowable (must be larger than MEASUREMENT_DELAY_CM and lower number saves RAM) //defines used in the code -#define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA //set measured to nominal initially +#define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA //set measured to nominal initially //When using an LCD, uncomment the line below to display the Filament sensor data on the last line instead of status. Status will appear for 5 sec. //#define FILAMENT_LCD_DISPLAY diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index a622d4781..88b76c66e 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -3,6 +3,8 @@ #include "Conditionals.h" +// @section temperature + //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== @@ -13,30 +15,30 @@ #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control //// Heating sanity check: -// This waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature -// If the temperature has not increased at the end of that period, the target temperature is set to zero. +// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature +// If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature // differ by at least 2x WATCH_TEMP_INCREASE //#define WATCH_TEMP_PERIOD 40000 //40 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds #ifdef PIDTEMP - // this adds an experimental additional term to the heatingpower, proportional to the extrusion speed. - // if Kc is choosen well, the additional required power due to increased melting should be compensated. - #define PID_ADD_EXTRUSION_RATE + // 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_ADD_EXTRUSION_RATE #ifdef PID_ADD_EXTRUSION_RATE - #define DEFAULT_Kc (1) //heatingpower=Kc*(e_speed) + #define DEFAULT_Kc (1) //heating power=Kc*(e_speed) #endif #endif //automatic temperature: The hot end target temperature is calculated by all the buffered lines of gcode. //The maximum buffered steps/sec of the extruder motor are called "se". -//You enter the autotemp mode by a M109 S T F +//You enter the autotemp mode by a M109 S B F // the target temperature is set to mintemp+factor*se[steps/sec] and limited by mintemp and maxtemp // you exit the value by any M109 without F* // Also, if the temperature is set to a value Z2 (yes, it is.. think about it) and the Z adjust would be positive. + // Play a little bit with small adjustments (0.5mm) and check the behaviour. + // The M119 (endstops report) will start reporting the Z2 Endstop as well. + + #define Z_DUAL_ENDSTOPS + + #ifdef Z_DUAL_ENDSTOPS + #define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis. + #define Z2_DIR_PIN E2_DIR_PIN + #define Z2_ENABLE_PIN E2_ENABLE_PIN + #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) + const bool Z2_MAX_ENDSTOP_INVERTING = false; + #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #endif + +#endif // Z_DUAL_STEPPER_DRIVERS + // Same again but for Y Axis. //#define Y_DUAL_STEPPER_DRIVERS // Define if the two Y drives need to rotate in opposite directions #define INVERT_Y2_VS_Y_DIR true -// Enable this for dual x-carriage printers. +// Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage // allowing faster printing speeds. //#define DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE -// Configuration for second X-carriage -// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; -// the second x-carriage always homes to the maximum endstop. -#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 EXTRUDER_OFFSET_X value for the second extruder provides a software - // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops - // without modifying the firmware (through the "M218 T1 X???" command). - // Remember: you should set the second extruder x-offset to 0 in your slicer. - -// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) -#define X2_ENABLE_PIN 29 -#define X2_STEP_PIN 25 -#define X2_DIR_PIN 23 - -// There are a few selectable movement modes for dual x-carriages using M605 S -// Mode 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) -// Mode 1: 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: 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 0 - -// Default settings in "Auto-park Mode" -#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder -#define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - -// Default x offset in duplication mode (typically set to half print bed width) -#define DEFAULT_DUPLICATION_X_OFFSET 100 + // Configuration for second X-carriage + // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; + // the second x-carriage always homes to the maximum endstop. + #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 EXTRUDER_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) + #define X2_ENABLE_PIN 29 + #define X2_STEP_PIN 25 + #define X2_DIR_PIN 23 + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 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) + // Mode 1: 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: 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 0 + + // Default settings in "Auto-park Mode" + #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder + #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 #endif //DUAL_X_CARRIAGE - + +// @section homing + //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: -#define X_HOME_RETRACT_MM 5 -#define Y_HOME_RETRACT_MM 5 -#define Z_HOME_RETRACT_MM 5 // deltas need the same for all three axis +#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 axis #define HOMING_BUMP_DIVISOR {10, 10, 20} // Re-Bump Speed Divisor (Divides the Homing Feedrate) - //#define QUICK_HOME //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially. +// @section machine + #define AXIS_RELATIVE_MODES {false, false, false, false} -#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step) +// @section machine //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 @@ -174,11 +213,15 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 -// Feedrates for manual moves along X, Y, Z, E from panel +// @section lcd + #ifdef ULTIPANEL #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel + #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 @@ -214,36 +257,50 @@ //=========================================================================== #define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again -#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? -#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. - -#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the filesystem block order. -// if a file is deleted, it frees a block. hence, the order is not purely cronological. To still have auto0.g accessible, there is again the option to do that. -// using: -//#define MENU_ADDAUTOSTART - -// Show a progress bar on the LCD when printing from SD -//#define LCD_PROGRESS_BAR - -#ifdef LCD_PROGRESS_BAR - // Amount of time (ms) to show the bar - #define PROGRESS_BAR_BAR_TIME 2000 - // Amount of time (ms) to show the status message - #define PROGRESS_BAR_MSG_TIME 2000 - // Amount of time (ms) to retain the status message (0=forever) - #define PROGRESS_MSG_EXPIRE 0 - // Enable this to show messages for MSG_TIME then hide them - //#define PROGRESS_MSG_ONCE -#endif +// @section lcd + +#ifdef SDSUPPORT + + // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted + // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT + // in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should + // be commented out otherwise + #define SDCARDDETECTINVERTED -// The hardware watchdog should reset the Microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation. + #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + + #define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. + // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. + // using: + //#define MENU_ADDAUTOSTART + + // Show a progress bar on HD44780 LCDs for SD printing + //#define LCD_PROGRESS_BAR + + #ifdef LCD_PROGRESS_BAR + // Amount of time (ms) to show the bar + #define PROGRESS_BAR_BAR_TIME 2000 + // Amount of time (ms) to show the status message + #define PROGRESS_BAR_MSG_TIME 3000 + // Amount of time (ms) to retain the status message (0=forever) + #define PROGRESS_MSG_EXPIRE 0 + // Enable this to show messages for MSG_TIME then hide them + //#define PROGRESS_MSG_ONCE + #endif + +#endif // SDSUPPORT + +// @section more + +// 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 #ifdef USE_WATCHDOG @@ -256,8 +313,10 @@ // Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled. //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED +// @section lcd + // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process -// it can e.g. be used to change z-positions in the print startup phase in realtime +// it can e.g. be used to change z-positions in the print startup phase in real-time // does not respect endstops! //#define BABYSTEPPING #ifdef BABYSTEPPING @@ -266,12 +325,14 @@ #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements #endif +// @section extruder + // extruder advance constant (s2/mm3) // // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2 // -// hooke's law says: force = k * distance -// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant +// Hooke's law says: force = k * distance +// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant // so: v ^ 2 is proportional to number of steps we advance the extruder //#define ADVANCE @@ -279,7 +340,9 @@ #define EXTRUDER_ADVANCE_K .0 #define D_FILAMENT 2.85 #define STEPS_MM_E 836 -#endif // ADVANCE +#endif + +// @section extras // Arc interpretation settings: #define MM_PER_ARC_SEGMENT 1 @@ -287,11 +350,7 @@ const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement -// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted -// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT -// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should -// be commented out otherwise -#define SDCARDDETECTINVERTED +// @section temperature // Control heater 0 and heater 1 in parallel. //#define HEATERS_PARALLEL @@ -300,24 +359,28 @@ const unsigned int dropsegments=5; //everything with less than this number of st //=============================Buffers ============================ //=========================================================================== -// 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, i.g. 8,16,32 because shifts and ors are used to do the ringbuffering. -#if defined SDSUPPORT +// @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, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. +#ifdef 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 more -//The ASCII buffer for recieving from the serial: +//The ASCII buffer for receiving from the serial: #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// @section fwretract -// Firmware based and LCD controled retract -// M207 and M208 can be used to define parameters for the retraction. +// Firmware based and LCD controlled retract +// M207 and M208 can be used to define parameters for the retraction. // The retraction can be called by the slicer using G10 and G11 -// until then, intended retractions can be detected by moves that only extrude and the direction. +// until then, intended retractions can be detected by moves that only extrude and the direction. // the moves are than replaced by the firmware controlled ones. // #define FWRETRACT //ONLY PARTIALLY TESTED @@ -344,6 +407,143 @@ const unsigned int dropsegments=5; //everything with less than this number of st #endif #endif +/******************************************************************************\ + * enable this section if you have TMC26X motor drivers. + * you need to import the TMC26XStepper library into the arduino IDE for this + ******************************************************************************/ + +// @section tmc + +//#define HAVE_TMCDRIVER +#ifdef HAVE_TMCDRIVER + +// #define X_IS_TMC + #define X_MAX_CURRENT 1000 //in mA + #define X_SENSE_RESISTOR 91 //in mOhms + #define X_MICROSTEPS 16 //number of microsteps + +// #define X2_IS_TMC + #define X2_MAX_CURRENT 1000 //in mA + #define X2_SENSE_RESISTOR 91 //in mOhms + #define X2_MICROSTEPS 16 //number of microsteps + +// #define Y_IS_TMC + #define Y_MAX_CURRENT 1000 //in mA + #define Y_SENSE_RESISTOR 91 //in mOhms + #define Y_MICROSTEPS 16 //number of microsteps + +// #define Y2_IS_TMC + #define Y2_MAX_CURRENT 1000 //in mA + #define Y2_SENSE_RESISTOR 91 //in mOhms + #define Y2_MICROSTEPS 16 //number of microsteps + +// #define Z_IS_TMC + #define Z_MAX_CURRENT 1000 //in mA + #define Z_SENSE_RESISTOR 91 //in mOhms + #define Z_MICROSTEPS 16 //number of microsteps + +// #define Z2_IS_TMC + #define Z2_MAX_CURRENT 1000 //in mA + #define Z2_SENSE_RESISTOR 91 //in mOhms + #define Z2_MICROSTEPS 16 //number of microsteps + +// #define E0_IS_TMC + #define E0_MAX_CURRENT 1000 //in mA + #define E0_SENSE_RESISTOR 91 //in mOhms + #define E0_MICROSTEPS 16 //number of microsteps + +// #define E1_IS_TMC + #define E1_MAX_CURRENT 1000 //in mA + #define E1_SENSE_RESISTOR 91 //in mOhms + #define E1_MICROSTEPS 16 //number of microsteps + +// #define E2_IS_TMC + #define E2_MAX_CURRENT 1000 //in mA + #define E2_SENSE_RESISTOR 91 //in mOhms + #define E2_MICROSTEPS 16 //number of microsteps + +// #define E3_IS_TMC + #define E3_MAX_CURRENT 1000 //in mA + #define E3_SENSE_RESISTOR 91 //in mOhms + #define E3_MICROSTEPS 16 //number of microsteps + +#endif + +/******************************************************************************\ + * enable this section if you have L6470 motor drivers. + * you need to import the L6470 library into the arduino IDE for this + ******************************************************************************/ + +// @section l6470 + +//#define HAVE_L6470DRIVER +#ifdef HAVE_L6470DRIVER + +// #define X_IS_L6470 + #define X_MICROSTEPS 16 //number of microsteps + #define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #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_IS_L6470 + #define X2_MICROSTEPS 16 //number of microsteps + #define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y_IS_L6470 + #define Y_MICROSTEPS 16 //number of microsteps + #define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y2_IS_L6470 + #define Y2_MICROSTEPS 16 //number of microsteps + #define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z_IS_L6470 + #define Z_MICROSTEPS 16 //number of microsteps + #define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z2_IS_L6470 + #define Z2_MICROSTEPS 16 //number of microsteps + #define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E0_IS_L6470 + #define E0_MICROSTEPS 16 //number of microsteps + #define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E1_IS_L6470 + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E2_IS_L6470 + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E3_IS_L6470 + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +#endif + #include "Conditionals.h" #include "SanityCheck.h" diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 9f5f89ca5..1c6313e93 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -1,4 +1,4 @@ -#ifndef CONFIGURATION_H +#ifndef CONFIGURATION_H #define CONFIGURATION_H #include "boards.h" @@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated: // 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_VERSION "1.0.2" +#define STRING_VERSION "1.0.3 dev" #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. @@ -62,8 +62,9 @@ Here are some standard links for getting your machine calibrated: #define MOTHERBOARD BOARD_RAMPS_13_EFB #endif -// Define this to set a custom name for your generic Mendel, -#define CUSTOM_MENDEL_NAME "Mini Kossel" +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "Mini Kossel" // 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) @@ -107,7 +108,6 @@ Here are some standard links for getting your machine calibrated: // Horizontal offset of the universal joints on the carriages. #define DELTA_CARRIAGE_OFFSET 19.5 // 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) @@ -138,7 +138,7 @@ Here are some standard links for getting your machine calibrated: // 10 is 100k RS thermistor 198-961 (4.7k pullup) // 11 is 100k beta 3950 1% thermistor (4.7k pullup) // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) -// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" // 20 is the PT100 circuit found in the Ultimainboard V2.x // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // @@ -152,11 +152,11 @@ Here are some standard links for getting your machine calibrated: // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup // 110 is Pt100 with 1k pullup (non standard) -// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. +// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. // Use it for Testing or Development purposes. NEVER for production machine. // #define DUMMY_THERMISTOR_998_VALUE 25 // #define DUMMY_THERMISTOR_999_VALUE 100 - +// :{ '0': "Not used", '4': "10k !! do not use for a hotend. Bad resolution at high temp. !!", '1': "100k / 4.7k - EPCOS", '51': "100k / 1k - EPCOS", '6': "100k / 4.7k EPCOS - Not as accurate as Table 1", '5': "100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '7': "100k / 4.7k Honeywell 135-104LAG-J01", '71': "100k / 4.7k Honeywell 135-104LAF-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'", '60': "100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '55': "100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '2': "200k / 4.7k - ATC Semitec 204GT-2", '52': "200k / 1k - ATC Semitec 204GT-2", '-2': "Thermocouple + MAX6675 (only for sensor 0)", '-1': "Thermocouple + AD595", '3': "Mendel-parts / 4.7k", '1047': "Pt1000 / 4.7k", '1010': "Pt1000 / 1k (non standard)", '20': "PT100 (Ultimainboard V2.x)", '147': "Pt100 / 4.7k", '110': "Pt100 / 1k (non-standard)", '998': "Dummy 1", '999': "Dummy 2" } #define TEMP_SENSOR_0 7 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 @@ -218,7 +218,6 @@ Here are some standard links for getting your machine calibrated: // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term #define K1 0.95 //smoothing factor within the PID - #define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // Ultimaker @@ -243,7 +242,7 @@ Here are some standard links for getting your machine calibrated: // Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis // // Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. -// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// If your PID_dT is the default, and correct for your hardware/configuration, that means 7.689Hz, // which is fine for driving a square wave into a resistive load and does not significantly impact you 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, you probably @@ -299,15 +298,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua The system will turn the heater on forever, burning up the filament and anything else around. -After the temperature reaches the target for the first time, this feature will -start measuring for how long the current temperature stays below the target +After the temperature reaches the target for the first time, this feature will +start measuring for how long the current temperature stays below the target minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS). If it stays longer than _PERIOD, it means the thermistor temperature cannot catch up with the target, so something *may be* wrong. Then, to be on the safe side, the system will he halt. -Bear in mind the count down will just start AFTER the first time the +Bear in mind the count down will just start AFTER the first time the thermistor temperature is over the target, so you will have no problem if your extruder heater takes 2 minutes to hit the target on heating. @@ -350,13 +349,14 @@ your extruder heater takes 2 minutes to hit the target on heating. // #define ENDSTOPPULLUP_ZMIN #endif -// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. //#define DISABLE_MAX_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS // Deltas only use min endstops for probing @@ -373,19 +373,18 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define DISABLE_E false // For all extruders #define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled +// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. #define INVERT_X_DIR false // DELTA does not invert #define INVERT_Y_DIR false #define INVERT_Z_DIR false - -#define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E3_DIR false // 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 // ENDSTOP SETTINGS: // Sets direction of endstops when homing; 1=MAX, -1=MIN -// deltas always home to max -#define X_HOME_DIR 1 +#define X_HOME_DIR 1 // deltas always home to max #define Y_HOME_DIR 1 #define Z_HOME_DIR 1 @@ -393,12 +392,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. // Travel limits after homing (units are in mm) -#define X_MAX_POS DELTA_PRINTABLE_RADIUS #define X_MIN_POS -DELTA_PRINTABLE_RADIUS -#define Y_MAX_POS DELTA_PRINTABLE_RADIUS #define Y_MIN_POS -DELTA_PRINTABLE_RADIUS -#define Z_MAX_POS MANUAL_Z_HOME_POS #define Z_MIN_POS 0 +#define X_MAX_POS DELTA_PRINTABLE_RADIUS +#define Y_MAX_POS DELTA_PRINTABLE_RADIUS +#define Z_MAX_POS MANUAL_Z_HOME_POS //=========================================================================== //============================= Filament Runout Sensor ====================== @@ -417,7 +416,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o // #define MANUAL_BED_LEVELING // Add display menu option for bed leveling // #define MESH_BED_LEVELING // Enable mesh bed leveling -#if defined(MESH_BED_LEVELING) +#ifdef MANUAL_BED_LEVELING + #define MBL_Z_STEP 0.025 +#endif // MANUAL_BED_LEVELING + +#ifdef MESH_BED_LEVELING #define MESH_MIN_X 10 #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MIN_Y 10 @@ -432,31 +435,59 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o //=========================================================================== #define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line) -// Z-Probe Repeatability test is not supported in Deltas yet. +// #define Z_PROBE_REPEATABILITY_TEST // Z-Probe Repeatability test is not supported in Deltas yet. #ifdef ENABLE_AUTO_BED_LEVELING - // Deltas only support grid mode - #define AUTO_BED_LEVELING_GRID + // There are 2 different ways to specify probing locations + // + // - "grid" mode + // Probe several points in a rectangular grid. + // You specify the rectangle and the density of sample points. + // This mode is preferred because there are more measurements. + // + // - "3-point" mode + // Probe 3 arbitrary points on the bed (that aren't colinear) + // You specify the XY coordinates of all 3 points. + + // Enable this to sample the bed in a grid (least squares solution) + // Note: this feature generates 10KB extra code size + #define AUTO_BED_LEVELING_GRID // Deltas only support grid mode + + #ifdef AUTO_BED_LEVELING_GRID + + #define DELTA_PROBABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10) - #define DELTA_PROBABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10) - #define LEFT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS - #define RIGHT_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS - #define BACK_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS - #define FRONT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS + #define LEFT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS + #define RIGHT_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS + #define FRONT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS + #define BACK_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS - #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this + #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this - // Non-linear bed leveling will be used. - // Compensate by interpolating between the nearest four Z probe values for each point. - // Useful for deltas where the print surface may appear like a bowl or dome shape. - // Works best with ACCURATE_BED_LEVELING_POINTS 5 or higher. - #define AUTO_BED_LEVELING_GRID_POINTS 9 + // Non-linear bed leveling will be used. + // Compensate by interpolating between the nearest four Z probe values for each point. + // Useful for deltas where the print surface may appear like a bowl or dome shape. + // Works best with ACCURATE_BED_LEVELING_POINTS 5 or higher. + #define AUTO_BED_LEVELING_GRID_POINTS 9 + + #else // !AUTO_BED_LEVELING_GRID + + // Arbitrary points to probe. A simple cross-product + // is used to estimate the plane of the bed. + #define ABL_PROBE_PT_1_X 15 + #define ABL_PROBE_PT_1_Y 180 + #define ABL_PROBE_PT_2_X 15 + #define ABL_PROBE_PT_2_Y 20 + #define ABL_PROBE_PT_3_X 170 + #define ABL_PROBE_PT_3_Y 20 + + #endif // AUTO_BED_LEVELING_GRID // Offsets to the probe relative to the extruder tip (Hotend - Probe) // X and Y offsets must be integers - #define X_PROBE_OFFSET_FROM_EXTRUDER 0 // -left +right - #define Y_PROBE_OFFSET_FROM_EXTRUDER -10 // -front +behind + #define X_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -left +right + #define Y_PROBE_OFFSET_FROM_EXTRUDER -10 // Probe on: -front +behind #define Z_PROBE_OFFSET_FROM_EXTRUDER -3.5 // -below (always!) #define Z_RAISE_BEFORE_HOMING 15 // (in mm) Raise Z before homing (G28) for Probe Clearance. @@ -467,7 +498,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points #define Z_RAISE_AFTER_PROBING 50 //How much the extruder will be raised after the last probing point. - + +// #define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" //These commands will be executed in the end of G29 routine. + //Useful to retract a deployable probe. + + //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell + //#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. + + //If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk + //The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it. + // You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile. + // Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe // Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN. #define Z_PROBE_ALLEN_KEY @@ -476,10 +517,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define Z_PROBE_ALLEN_KEY_DEPLOY_Y DELTA_PRINTABLE_RADIUS #define Z_PROBE_ALLEN_KEY_DEPLOY_Z 100 - #define Z_PROBE_ALLEN_KEY_RETRACT_X -64 - #define Z_PROBE_ALLEN_KEY_RETRACT_Y 56 - #define Z_PROBE_ALLEN_KEY_RETRACT_Z 23 - #define Z_PROBE_ALLEN_KEY_RETRACT_DEPTH 20 + #define Z_PROBE_ALLEN_KEY_STOW_X -64 + #define Z_PROBE_ALLEN_KEY_STOW_Y 56 + #define Z_PROBE_ALLEN_KEY_STOW_Z 23 + #define Z_PROBE_ALLEN_KEY_STOW_DEPTH 20 #endif //If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk @@ -506,22 +547,39 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #endif -#endif // ENABLE_AUTO_BED_LEVELING + // Support for a dedicated Z PROBE endstop separate from the Z MIN endstop. + // If you would like to use both a Z PROBE and a Z MIN endstop together or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP and read the instructions below. + // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. + // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. + // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 + // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. + // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. + // D32 is currently selected in the RAMPS 1.3/1.4 pin file. All other boards will need changes to the respective pins_XXXXX.h file. + // WARNING: Setting the wrong pin may have unexpected and potentially disastrous outcomes. Use with caution and do your homework. + + //#define Z_PROBE_ENDSTOP +#endif // ENABLE_AUTO_BED_LEVELING // The position of the homing switches #define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used #define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) -//Manual homing switch locations: +// Manual homing switch locations: // For deltabots this means top and center of the Cartesian print volume. -#define MANUAL_X_HOME_POS 0 -#define MANUAL_Y_HOME_POS 0 -#define MANUAL_Z_HOME_POS 250 // For delta: Distance between nozzle and print surface after homing. +#ifdef MANUAL_HOME_POSITIONS + #define MANUAL_X_HOME_POS 0 + #define MANUAL_Y_HOME_POS 0 + #define MANUAL_Z_HOME_POS 250 // For delta: Distance between nozzle and print surface after homing. +#endif + +/** + * MOVEMENT SETTINGS + */ -//// MOVEMENT SETTINGS -#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E // delta homing speeds must be the same on xyz #define HOMING_FEEDRATE {200*60, 200*60, 200*60, 0} // set the homing speeds (mm/min) @@ -532,8 +590,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define DEFAULT_MAX_FEEDRATE {500, 500, 500, 25} // (mm/sec) #define DEFAULT_MAX_ACCELERATION {9000,9000,9000,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot. -#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves -#define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for retracts +#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration in mm/s^2 for retracts #define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). @@ -555,9 +613,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o // Custom M code points #define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES - #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 - #define Z_PROBE_OFFSET_RANGE_MIN -15 - #define Z_PROBE_OFFSET_RANGE_MAX -5 + #ifdef ENABLE_AUTO_BED_LEVELING + #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 + #define Z_PROBE_OFFSET_RANGE_MIN -20 + #define Z_PROBE_OFFSET_RANGE_MAX 20 + #endif #endif @@ -568,9 +628,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. //define this to enable EEPROM support //#define EEPROM_SETTINGS -//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: -// please keep turned on if you can. -//#define EEPROM_CHITCHAT + +#ifdef EEPROM_SETTINGS + // To disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: + #define EEPROM_CHITCHAT // please keep turned on if you can. +#endif // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 180 @@ -584,13 +646,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o //==============================LCD and SD support============================= // Define your display language below. Replace (en) with your language code and uncomment. -// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu +// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu, kana, kana_utf8, test // See also language.h -//#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) +#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) -// Character based displays can have different extended charsets. -#define DISPLAY_CHARSET_HD44780_JAPAN // "ääööüüß23°" -//#define DISPLAY_CHARSET_HD44780_WESTERN // "ÄäÖöÜüß²³°" if you see a '~' instead of a 'arrow_right' at the right of submenuitems - this is the right one. +// Choose ONE of these 3 charsets. This has to match your hardware. Ignored for full graphic display. +// To find out what type you have - compile with (test) - upload - click to get the menu. You'll see two typical lines from the upper half of the charset. +// See also documentation/LCDLanguageFont.md + #define DISPLAY_CHARSET_HD44780_JAPAN // this is the most common hardware + //#define DISPLAY_CHARSET_HD44780_WESTERN + //#define DISPLAY_CHARSET_HD44780_CYRILLIC //#define ULTRA_LCD //general LCD support, also 16x2 //#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) @@ -603,6 +668,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o //#define ULTIPANEL //the UltiPanel as on Thingiverse //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click + // 0 to disable buzzer feedback // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne @@ -664,7 +730,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o // Shift register panels // --------------------- // 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection //#define SAV_3DLCD @@ -672,7 +738,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o //#define FAST_PWM_FAN // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency -// which is not ass annoying as with the hardware PWM. On the other hand, if this 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 @@ -717,7 +783,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o // Servo Endstops // // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. -// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. +// Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500. // //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles @@ -726,9 +792,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o * Support for a filament diameter sensor * Also allows adjustment of diameter at print time (vs at slicing) * Single extruder only at this point (extruder 0) - * + * * Motherboards - * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector + * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E) * 301 - Rambo - uses Analog input 3 * Note may require analog pins to be defined for different motherboards @@ -745,7 +811,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define MAX_MEASUREMENT_DELAY 20 //delay buffer size in bytes (1 byte = 1cm)- limits maximum measurement delay allowable (must be larger than MEASUREMENT_DELAY_CM and lower number saves RAM) //defines used in the code -#define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA //set measured to nominal initially +#define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA //set measured to nominal initially //When using an LCD, uncomment the line below to display the Filament sensor data on the last line instead of status. Status will appear for 5 sec. //#define FILAMENT_LCD_DISPLAY diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index a940e3f3e..9b52ede7b 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -3,6 +3,8 @@ #include "Conditionals.h" +// @section temperature + //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== @@ -13,30 +15,30 @@ #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control //// Heating sanity check: -// This waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature -// If the temperature has not increased at the end of that period, the target temperature is set to zero. +// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature +// If the temperature has not increased at the end of that period, the target temperature is set to zero. // It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature // differ by at least 2x WATCH_TEMP_INCREASE //#define WATCH_TEMP_PERIOD 40000 //40 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds #ifdef PIDTEMP - // this adds an experimental additional term to the heatingpower, proportional to the extrusion speed. - // if Kc is choosen well, the additional required power due to increased melting should be compensated. - #define PID_ADD_EXTRUSION_RATE + // 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_ADD_EXTRUSION_RATE #ifdef PID_ADD_EXTRUSION_RATE - #define DEFAULT_Kc (1) //heatingpower=Kc*(e_speed) + #define DEFAULT_Kc (1) //heating power=Kc*(e_speed) #endif #endif //automatic temperature: The hot end target temperature is calculated by all the buffered lines of gcode. //The maximum buffered steps/sec of the extruder motor are called "se". -//You enter the autotemp mode by a M109 S T F +//You enter the autotemp mode by a M109 S B F // the target temperature is set to mintemp+factor*se[steps/sec] and limited by mintemp and maxtemp // you exit the value by any M109 without F* // Also, if the temperature is set to a value Z2 (yes, it is.. think about it) and the Z adjust would be positive. + // Play a little bit with small adjustments (0.5mm) and check the behaviour. + // The M119 (endstops report) will start reporting the Z2 Endstop as well. + + #define Z_DUAL_ENDSTOPS + + #ifdef Z_DUAL_ENDSTOPS + #define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis. + #define Z2_DIR_PIN E2_DIR_PIN + #define Z2_ENABLE_PIN E2_ENABLE_PIN + #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) + const bool Z2_MAX_ENDSTOP_INVERTING = false; + #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #endif + +#endif // Z_DUAL_STEPPER_DRIVERS + // Same again but for Y Axis. //#define Y_DUAL_STEPPER_DRIVERS // Define if the two Y drives need to rotate in opposite directions #define INVERT_Y2_VS_Y_DIR true -// Enable this for dual x-carriage printers. +// Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage // allowing faster printing speeds. //#define DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE -// Configuration for second X-carriage -// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; -// the second x-carriage always homes to the maximum endstop. -#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 EXTRUDER_OFFSET_X value for the second extruder provides a software - // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops - // without modifying the firmware (through the "M218 T1 X???" command). - // Remember: you should set the second extruder x-offset to 0 in your slicer. - -// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) -#define X2_ENABLE_PIN 29 -#define X2_STEP_PIN 25 -#define X2_DIR_PIN 23 - -// There are a few selectable movement modes for dual x-carriages using M605 S -// Mode 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) -// Mode 1: 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: 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 0 - -// Default settings in "Auto-park Mode" -#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder -#define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - -// Default x offset in duplication mode (typically set to half print bed width) -#define DEFAULT_DUPLICATION_X_OFFSET 100 + // Configuration for second X-carriage + // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; + // the second x-carriage always homes to the maximum endstop. + #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 EXTRUDER_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) + #define X2_ENABLE_PIN 29 + #define X2_STEP_PIN 25 + #define X2_DIR_PIN 23 + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 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) + // Mode 1: 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: 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 0 + + // Default settings in "Auto-park Mode" + #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder + #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 #endif //DUAL_X_CARRIAGE - + +// @section homing + //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: -#define X_HOME_RETRACT_MM 5 -#define Y_HOME_RETRACT_MM 5 -#define Z_HOME_RETRACT_MM 5 // deltas need the same for all three axis +#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 axis #define HOMING_BUMP_DIVISOR {10, 10, 20} // Re-Bump Speed Divisor (Divides the Homing Feedrate) - //#define QUICK_HOME //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially. +// @section machine + #define AXIS_RELATIVE_MODES {false, false, false, false} -#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step) +// @section machine //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 @@ -174,11 +213,15 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 -// Feedrates for manual moves along X, Y, Z, E from panel +// @section lcd + #ifdef ULTIPANEL #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel + #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 @@ -213,36 +256,50 @@ //=========================================================================== #define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again -#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? -#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. - -#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the filesystem block order. -// if a file is deleted, it frees a block. hence, the order is not purely cronological. To still have auto0.g accessible, there is again the option to do that. -// using: -//#define MENU_ADDAUTOSTART - -// Show a progress bar on the LCD when printing from SD -//#define LCD_PROGRESS_BAR - -#ifdef LCD_PROGRESS_BAR - // Amount of time (ms) to show the bar - #define PROGRESS_BAR_BAR_TIME 2000 - // Amount of time (ms) to show the status message - #define PROGRESS_BAR_MSG_TIME 2000 - // Amount of time (ms) to retain the status message (0=forever) - #define PROGRESS_MSG_EXPIRE 0 - // Enable this to show messages for MSG_TIME then hide them - //#define PROGRESS_MSG_ONCE -#endif +// @section lcd + +#ifdef SDSUPPORT + + // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted + // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT + // in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should + // be commented out otherwise + #define SDCARDDETECTINVERTED -// The hardware watchdog should reset the Microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation. + #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + + #define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. + // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. + // using: + //#define MENU_ADDAUTOSTART + + // Show a progress bar on HD44780 LCDs for SD printing + //#define LCD_PROGRESS_BAR + + #ifdef LCD_PROGRESS_BAR + // Amount of time (ms) to show the bar + #define PROGRESS_BAR_BAR_TIME 2000 + // Amount of time (ms) to show the status message + #define PROGRESS_BAR_MSG_TIME 3000 + // Amount of time (ms) to retain the status message (0=forever) + #define PROGRESS_MSG_EXPIRE 0 + // Enable this to show messages for MSG_TIME then hide them + //#define PROGRESS_MSG_ONCE + #endif + +#endif // SDSUPPORT + +// @section more + +// 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 #ifdef USE_WATCHDOG @@ -255,8 +312,10 @@ // Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled. //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED +// @section lcd + // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process -// it can e.g. be used to change z-positions in the print startup phase in realtime +// it can e.g. be used to change z-positions in the print startup phase in real-time // does not respect endstops! //#define BABYSTEPPING #ifdef BABYSTEPPING @@ -265,12 +324,14 @@ #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements #endif +// @section extruder + // extruder advance constant (s2/mm3) // // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2 // -// hooke's law says: force = k * distance -// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant +// Hooke's law says: force = k * distance +// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant // so: v ^ 2 is proportional to number of steps we advance the extruder //#define ADVANCE @@ -278,7 +339,9 @@ #define EXTRUDER_ADVANCE_K .0 #define D_FILAMENT 2.85 #define STEPS_MM_E 836 -#endif // ADVANCE +#endif + +// @section extras // Arc interpretation settings: #define MM_PER_ARC_SEGMENT 1 @@ -286,11 +349,7 @@ const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement -// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted -// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT -// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should -// be commented out otherwise -#define SDCARDDETECTINVERTED +// @section temperature // Control heater 0 and heater 1 in parallel. //#define HEATERS_PARALLEL @@ -299,24 +358,28 @@ const unsigned int dropsegments=5; //everything with less than this number of st //=============================Buffers ============================ //=========================================================================== -// 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, i.g. 8,16,32 because shifts and ors are used to do the ringbuffering. -#if defined SDSUPPORT +// @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, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. +#ifdef 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 more -//The ASCII buffer for recieving from the serial: +//The ASCII buffer for receiving from the serial: #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// @section fwretract -// Firmware based and LCD controled retract -// M207 and M208 can be used to define parameters for the retraction. +// Firmware based and LCD controlled retract +// M207 and M208 can be used to define parameters for the retraction. // The retraction can be called by the slicer using G10 and G11 -// until then, intended retractions can be detected by moves that only extrude and the direction. +// until then, intended retractions can be detected by moves that only extrude and the direction. // the moves are than replaced by the firmware controlled ones. // #define FWRETRACT //ONLY PARTIALLY TESTED @@ -343,6 +406,143 @@ const unsigned int dropsegments=5; //everything with less than this number of st #endif #endif +/******************************************************************************\ + * enable this section if you have TMC26X motor drivers. + * you need to import the TMC26XStepper library into the arduino IDE for this + ******************************************************************************/ + +// @section tmc + +//#define HAVE_TMCDRIVER +#ifdef HAVE_TMCDRIVER + +// #define X_IS_TMC + #define X_MAX_CURRENT 1000 //in mA + #define X_SENSE_RESISTOR 91 //in mOhms + #define X_MICROSTEPS 16 //number of microsteps + +// #define X2_IS_TMC + #define X2_MAX_CURRENT 1000 //in mA + #define X2_SENSE_RESISTOR 91 //in mOhms + #define X2_MICROSTEPS 16 //number of microsteps + +// #define Y_IS_TMC + #define Y_MAX_CURRENT 1000 //in mA + #define Y_SENSE_RESISTOR 91 //in mOhms + #define Y_MICROSTEPS 16 //number of microsteps + +// #define Y2_IS_TMC + #define Y2_MAX_CURRENT 1000 //in mA + #define Y2_SENSE_RESISTOR 91 //in mOhms + #define Y2_MICROSTEPS 16 //number of microsteps + +// #define Z_IS_TMC + #define Z_MAX_CURRENT 1000 //in mA + #define Z_SENSE_RESISTOR 91 //in mOhms + #define Z_MICROSTEPS 16 //number of microsteps + +// #define Z2_IS_TMC + #define Z2_MAX_CURRENT 1000 //in mA + #define Z2_SENSE_RESISTOR 91 //in mOhms + #define Z2_MICROSTEPS 16 //number of microsteps + +// #define E0_IS_TMC + #define E0_MAX_CURRENT 1000 //in mA + #define E0_SENSE_RESISTOR 91 //in mOhms + #define E0_MICROSTEPS 16 //number of microsteps + +// #define E1_IS_TMC + #define E1_MAX_CURRENT 1000 //in mA + #define E1_SENSE_RESISTOR 91 //in mOhms + #define E1_MICROSTEPS 16 //number of microsteps + +// #define E2_IS_TMC + #define E2_MAX_CURRENT 1000 //in mA + #define E2_SENSE_RESISTOR 91 //in mOhms + #define E2_MICROSTEPS 16 //number of microsteps + +// #define E3_IS_TMC + #define E3_MAX_CURRENT 1000 //in mA + #define E3_SENSE_RESISTOR 91 //in mOhms + #define E3_MICROSTEPS 16 //number of microsteps + +#endif + +/******************************************************************************\ + * enable this section if you have L6470 motor drivers. + * you need to import the L6470 library into the arduino IDE for this + ******************************************************************************/ + +// @section l6470 + +//#define HAVE_L6470DRIVER +#ifdef HAVE_L6470DRIVER + +// #define X_IS_L6470 + #define X_MICROSTEPS 16 //number of microsteps + #define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #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_IS_L6470 + #define X2_MICROSTEPS 16 //number of microsteps + #define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y_IS_L6470 + #define Y_MICROSTEPS 16 //number of microsteps + #define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y2_IS_L6470 + #define Y2_MICROSTEPS 16 //number of microsteps + #define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z_IS_L6470 + #define Z_MICROSTEPS 16 //number of microsteps + #define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z2_IS_L6470 + #define Z2_MICROSTEPS 16 //number of microsteps + #define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E0_IS_L6470 + #define E0_MICROSTEPS 16 //number of microsteps + #define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E1_IS_L6470 + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E2_IS_L6470 + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E3_IS_L6470 + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +#endif + #include "Conditionals.h" #include "SanityCheck.h" diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index f6561b3af..a01bcb668 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated: // 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_VERSION "1.0.2" +#define STRING_VERSION "1.0.3 dev" #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. @@ -62,8 +62,9 @@ Here are some standard links for getting your machine calibrated: #define MOTHERBOARD BOARD_5DPRINT #endif -// Define this to set a custom name for your generic Mendel, -// #define CUSTOM_MENDEL_NAME "This Mendel" +// 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) @@ -104,7 +105,7 @@ Here are some standard links for getting your machine calibrated: // 10 is 100k RS thermistor 198-961 (4.7k pullup) // 11 is 100k beta 3950 1% thermistor (4.7k pullup) // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) -// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" // 20 is the PT100 circuit found in the Ultimainboard V2.x // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // @@ -118,11 +119,11 @@ Here are some standard links for getting your machine calibrated: // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup // 110 is Pt100 with 1k pullup (non standard) -// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. +// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. // Use it for Testing or Development purposes. NEVER for production machine. // #define DUMMY_THERMISTOR_998_VALUE 25 // #define DUMMY_THERMISTOR_999_VALUE 100 - +// :{ '0': "Not used", '4': "10k !! do not use for a hotend. Bad resolution at high temp. !!", '1': "100k / 4.7k - EPCOS", '51': "100k / 1k - EPCOS", '6': "100k / 4.7k EPCOS - Not as accurate as Table 1", '5': "100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '7': "100k / 4.7k Honeywell 135-104LAG-J01", '71': "100k / 4.7k Honeywell 135-104LAF-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'", '60': "100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '55': "100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '2': "200k / 4.7k - ATC Semitec 204GT-2", '52': "200k / 1k - ATC Semitec 204GT-2", '-2': "Thermocouple + MAX6675 (only for sensor 0)", '-1': "Thermocouple + AD595", '3': "Mendel-parts / 4.7k", '1047': "Pt1000 / 4.7k", '1010': "Pt1000 / 1k (non standard)", '20': "PT100 (Ultimainboard V2.x)", '147': "Pt100 / 4.7k", '110': "Pt100 / 1k (non-standard)", '998': "Dummy 1", '999': "Dummy 2" } #define TEMP_SENSOR_0 1 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 @@ -184,7 +185,6 @@ Here are some standard links for getting your machine calibrated: // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term #define K1 0.95 //smoothing factor within the PID - #define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // Ultimaker @@ -209,7 +209,7 @@ Here are some standard links for getting your machine calibrated: // Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis // // Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. -// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// If your PID_dT is the default, and correct for your hardware/configuration, that means 7.689Hz, // which is fine for driving a square wave into a resistive load and does not significantly impact you 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, you probably @@ -268,15 +268,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua The system will turn the heater on forever, burning up the filament and anything else around. -After the temperature reaches the target for the first time, this feature will -start measuring for how long the current temperature stays below the target +After the temperature reaches the target for the first time, this feature will +start measuring for how long the current temperature stays below the target minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS). If it stays longer than _PERIOD, it means the thermistor temperature cannot catch up with the target, so something *may be* wrong. Then, to be on the safe side, the system will he halt. -Bear in mind the count down will just start AFTER the first time the +Bear in mind the count down will just start AFTER the first time the thermistor temperature is over the target, so you will have no problem if your extruder heater takes 2 minutes to hit the target on heating. @@ -319,13 +319,14 @@ your extruder heater takes 2 minutes to hit the target on heating. // #define ENDSTOPPULLUP_ZMIN #endif -// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. +const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. //#define DISABLE_MAX_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS @@ -342,13 +343,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DISABLE_E false // For all extruders #define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled -#define INVERT_X_DIR false // for Mendel set to false, for Orca set to true -#define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false -#define INVERT_Z_DIR false // for Mendel set to false, for Orca set to true -#define INVERT_E0_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E3_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false +// 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 +#define INVERT_E0_DIR true +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false // ENDSTOP SETTINGS: // Sets direction of endstops when homing; 1=MAX, -1=MIN @@ -360,12 +362,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. // Travel limits after homing (units are in mm) -#define X_MAX_POS 110 #define X_MIN_POS 0 -#define Y_MAX_POS 150 #define Y_MIN_POS 0 -#define Z_MAX_POS 86 #define Z_MIN_POS 0 +#define X_MAX_POS 110 +#define Y_MAX_POS 150 +#define Z_MAX_POS 86 //=========================================================================== //============================= Filament Runout Sensor ====================== @@ -384,7 +386,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // #define MANUAL_BED_LEVELING // Add display menu option for bed leveling // #define MESH_BED_LEVELING // Enable mesh bed leveling -#if defined(MESH_BED_LEVELING) +#ifdef MANUAL_BED_LEVELING + #define MBL_Z_STEP 0.025 +#endif // MANUAL_BED_LEVELING + +#ifdef MESH_BED_LEVELING #define MESH_MIN_X 10 #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MIN_Y 10 @@ -425,13 +431,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define FRONT_PROBE_BED_POSITION 20 #define BACK_PROBE_BED_POSITION 170 - #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this - + #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this + // Set the number of grid points per dimension // You probably don't need more than 3 (squared=9) #define AUTO_BED_LEVELING_GRID_POINTS 2 - #else // !AUTO_BED_LEVELING_GRID // Arbitrary points to probe. A simple cross-product @@ -445,11 +450,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif // AUTO_BED_LEVELING_GRID - // Offsets to the probe relative to the extruder tip (Hotend - Probe) // X and Y offsets must be integers - #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // -left +right - #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // -front +behind + #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // Probe on: -left +right + #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // Probe on: -front +behind #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35 // -below (always!) #define Z_RAISE_BEFORE_HOMING 4 // (in mm) Raise Z before homing (G28) for Probe Clearance. @@ -457,10 +461,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min - #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. + #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points #define Z_RAISE_AFTER_PROBING 15 //How much the extruder will be raised after the last probing point. +// #define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" //These commands will be executed in the end of G29 routine. + //Useful to retract a deployable probe. + //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#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. @@ -488,6 +495,20 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif + // Support for a dedicated Z PROBE endstop separate from the Z MIN endstop. + // If you would like to use both a Z PROBE and a Z MIN endstop together or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP and read the instructions below. + // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. + // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. + // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 + // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. + // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. + // D32 is currently selected in the RAMPS 1.3/1.4 pin file. All other boards will need changes to the respective pins_XXXXX.h file. + // WARNING: Setting the wrong pin may have unexpected and potentially disastrous outcomes. Use with caution and do your homework. + + //#define Z_PROBE_ENDSTOP + #endif // ENABLE_AUTO_BED_LEVELING @@ -495,15 +516,19 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) -//Manual homing switch locations: +// Manual homing switch locations: // For deltabots this means top and center of the Cartesian print volume. -#define MANUAL_X_HOME_POS 0 -#define MANUAL_Y_HOME_POS 0 -#define MANUAL_Z_HOME_POS 0 -//#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +#ifdef MANUAL_HOME_POSITIONS + #define MANUAL_X_HOME_POS 0 + #define MANUAL_Y_HOME_POS 0 + #define MANUAL_Z_HOME_POS 0 + //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +#endif + +/** + * MOVEMENT SETTINGS + */ -//// MOVEMENT SETTINGS -#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define HOMING_FEEDRATE {1500, 1500, 120, 0} // set the homing speeds (mm/min) ***** MakiBox A6 ***** // default settings @@ -535,9 +560,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Custom M code points #define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES - #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 - #define Z_PROBE_OFFSET_RANGE_MIN -15 - #define Z_PROBE_OFFSET_RANGE_MAX -5 + #ifdef ENABLE_AUTO_BED_LEVELING + #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 + #define Z_PROBE_OFFSET_RANGE_MIN -20 + #define Z_PROBE_OFFSET_RANGE_MAX 20 + #endif #endif @@ -548,9 +575,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. //define this to enable EEPROM support #define EEPROM_SETTINGS -//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: -// please keep turned on if you can. -//#define EEPROM_CHITCHAT + +#ifdef EEPROM_SETTINGS + // To disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: + #define EEPROM_CHITCHAT // please keep turned on if you can. +#endif // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 180 @@ -564,13 +593,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //==============================LCD and SD support============================= // Define your display language below. Replace (en) with your language code and uncomment. -// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu +// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu, kana, kana_utf8, test // See also language.h //#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) -// Character based displays can have different extended charsets. -#define DISPLAY_CHARSET_HD44780_JAPAN // "ääööüüß23°" -//#define DISPLAY_CHARSET_HD44780_WESTERN // "ÄäÖöÜüß²³°" if you see a '~' instead of a 'arrow_right' at the right of submenuitems - this is the right one. +// Choose ONE of these 3 charsets. This has to match your hardware. Ignored for full graphic display. +// To find out what type you have - compile with (test) - upload - click to get the menu. You'll see two typical lines from the upper half of the charset. +// See also documentation/LCDLanguageFont.md + #define DISPLAY_CHARSET_HD44780_JAPAN // this is the most common hardware + //#define DISPLAY_CHARSET_HD44780_WESTERN + //#define DISPLAY_CHARSET_HD44780_CYRILLIC //#define ULTRA_LCD //general LCD support, also 16x2 //#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) @@ -583,6 +615,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define ULTIPANEL //the UltiPanel as on Thingiverse //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click + // 0 to disable buzzer feedback // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne @@ -637,7 +670,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Shift register panels // --------------------- // 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection //#define SAV_3DLCD @@ -645,7 +678,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define FAST_PWM_FAN // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency -// which is not ass annoying as with the hardware PWM. On the other hand, if this 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 @@ -690,7 +723,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Servo Endstops // // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. -// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. +// Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500. // //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles @@ -699,9 +732,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of * Support for a filament diameter sensor * Also allows adjustment of diameter at print time (vs at slicing) * Single extruder only at this point (extruder 0) - * + * * Motherboards - * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector + * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E) * 301 - Rambo - uses Analog input 3 * Note may require analog pins to be defined for different motherboards diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 12c3d71d4..7b63732a6 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -3,6 +3,8 @@ #include "Conditionals.h" +// @section temperature + //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== @@ -32,7 +34,7 @@ //automatic temperature: The hot end target temperature is calculated by all the buffered lines of gcode. //The maximum buffered steps/sec of the extruder motor are called "se". -//You enter the autotemp mode by a M109 S T F +//You enter the autotemp mode by a M109 S B F // the target temperature is set to mintemp+factor*se[steps/sec] and limited by mintemp and maxtemp // you exit the value by any M109 without F* // Also, if the temperature is set to a value Z2 (yes, it is.. think about it) and the Z adjust would be positive. + // Play a little bit with small adjustments (0.5mm) and check the behaviour. + // The M119 (endstops report) will start reporting the Z2 Endstop as well. + + #define Z_DUAL_ENDSTOPS + + #ifdef Z_DUAL_ENDSTOPS + #define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis. + #define Z2_DIR_PIN E2_DIR_PIN + #define Z2_ENABLE_PIN E2_ENABLE_PIN + #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) + const bool Z2_MAX_ENDSTOP_INVERTING = false; + #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #endif + +#endif // Z_DUAL_STEPPER_DRIVERS + // Same again but for Y Axis. //#define Y_DUAL_STEPPER_DRIVERS @@ -112,54 +148,58 @@ // allowing faster printing speeds. //#define DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE -// Configuration for second X-carriage -// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; -// the second x-carriage always homes to the maximum endstop. -#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 EXTRUDER_OFFSET_X value for the second extruder provides a software - // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops - // without modifying the firmware (through the "M218 T1 X???" command). - // Remember: you should set the second extruder x-offset to 0 in your slicer. - -// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) -#define X2_ENABLE_PIN 29 -#define X2_STEP_PIN 25 -#define X2_DIR_PIN 23 - -// There are a few selectable movement modes for dual x-carriages using M605 S -// Mode 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) -// Mode 1: 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: 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 0 - -// Default settings in "Auto-park Mode" -#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder -#define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - -// Default x offset in duplication mode (typically set to half print bed width) -#define DEFAULT_DUPLICATION_X_OFFSET 100 + // Configuration for second X-carriage + // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; + // the second x-carriage always homes to the maximum endstop. + #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 EXTRUDER_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) + #define X2_ENABLE_PIN 29 + #define X2_STEP_PIN 25 + #define X2_DIR_PIN 23 + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 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) + // Mode 1: 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: 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 0 + + // Default settings in "Auto-park Mode" + #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder + #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 #endif //DUAL_X_CARRIAGE +// @section homing + //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: -#define X_HOME_RETRACT_MM 5 -#define Y_HOME_RETRACT_MM 5 -#define Z_HOME_RETRACT_MM 2 -#define HOMING_BUMP_DIVISOR {10, 10, 20} // Re-Bump Speed Divisor (Divides the Homing Feedrate) +#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 this is defined, if both x and y are to be homed, a diagonal move will be performed initially. +// @section machine + #define AXIS_RELATIVE_MODES {false, false, false, false} -#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step) +// @section machine //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 @@ -173,11 +213,15 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +// @section lcd + #ifdef ULTIPANEL #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel #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 @@ -205,7 +249,6 @@ // Number of channels available for I2C digipot, For Azteeg X3 Pro we have 8 #define DIGIPOT_I2C_NUM_CHANNELS 4 // 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} #define DIGIPOT_I2C_MOTOR_CURRENTS {1.7, 1.7, 1.7, 1.7} //=========================================================================== @@ -213,34 +256,48 @@ //=========================================================================== #define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again -#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? -#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. - -#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. -// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. -// using: -//#define MENU_ADDAUTOSTART - -// Show a progress bar on the LCD when printing from SD -//#define LCD_PROGRESS_BAR - -#ifdef LCD_PROGRESS_BAR - // Amount of time (ms) to show the bar - #define PROGRESS_BAR_BAR_TIME 2000 - // Amount of time (ms) to show the status message - #define PROGRESS_BAR_MSG_TIME 2000 - // Amount of time (ms) to retain the status message (0=forever) - #define PROGRESS_MSG_EXPIRE 0 - // Enable this to show messages for MSG_TIME then hide them - //#define PROGRESS_MSG_ONCE -#endif +// @section lcd + +#ifdef SDSUPPORT + + // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted + // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT + // in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should + // be commented out otherwise + //#define SDCARDDETECTINVERTED + + #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + + #define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. + // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. + // using: + //#define MENU_ADDAUTOSTART + + // Show a progress bar on HD44780 LCDs for SD printing + //#define LCD_PROGRESS_BAR + + #ifdef LCD_PROGRESS_BAR + // Amount of time (ms) to show the bar + #define PROGRESS_BAR_BAR_TIME 2000 + // Amount of time (ms) to show the status message + #define PROGRESS_BAR_MSG_TIME 3000 + // Amount of time (ms) to retain the status message (0=forever) + #define PROGRESS_MSG_EXPIRE 0 + // Enable this to show messages for MSG_TIME then hide them + //#define PROGRESS_MSG_ONCE + #endif + +#endif // SDSUPPORT + +// @section more // 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 @@ -255,6 +312,8 @@ // Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled. //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED +// @section lcd + // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process // it can e.g. be used to change z-positions in the print startup phase in real-time // does not respect endstops! @@ -265,12 +324,14 @@ #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements #endif +// @section extruder + // extruder advance constant (s2/mm3) // // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2 // -// Hooke's law says: force = k * distance -// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant +// Hooke's law says: force = k * distance +// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant // so: v ^ 2 is proportional to number of steps we advance the extruder //#define ADVANCE @@ -278,7 +339,9 @@ #define EXTRUDER_ADVANCE_K .0 #define D_FILAMENT 2.85 #define STEPS_MM_E 836 -#endif // ADVANCE +#endif + +// @section extras // Arc interpretation settings: #define MM_PER_ARC_SEGMENT 1 @@ -286,11 +349,7 @@ const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement -// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted -// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT -// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should -// be commented out otherwise -//#define SDCARDDETECTINVERTED +// @section temperature // Control heater 0 and heater 1 in parallel. //#define HEATERS_PARALLEL @@ -299,19 +358,23 @@ const unsigned int dropsegments=5; //everything with less than this number of st //=============================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, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. -#if defined SDSUPPORT +#ifdef 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 more //The ASCII buffer for receiving from the serial: #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// @section fwretract // Firmware based and LCD controlled retract // M207 and M208 can be used to define parameters for the retraction. @@ -323,9 +386,11 @@ const unsigned int dropsegments=5; //everything with less than this number of st #ifdef FWRETRACT #define MIN_RETRACT 0.1 //minimum extruded mm to accept a automatic gcode retraction attempt #define RETRACT_LENGTH 3 //default retract length (positive mm) + #define RETRACT_LENGTH_SWAP 13 //default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 //default feedrate for retracting (mm/s) #define RETRACT_ZLIFT 0 //default retract Z-lift #define RETRACT_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) #endif @@ -341,6 +406,143 @@ const unsigned int dropsegments=5; //everything with less than this number of st #endif #endif +/******************************************************************************\ + * enable this section if you have TMC26X motor drivers. + * you need to import the TMC26XStepper library into the arduino IDE for this + ******************************************************************************/ + +// @section tmc + +//#define HAVE_TMCDRIVER +#ifdef HAVE_TMCDRIVER + +// #define X_IS_TMC + #define X_MAX_CURRENT 1000 //in mA + #define X_SENSE_RESISTOR 91 //in mOhms + #define X_MICROSTEPS 16 //number of microsteps + +// #define X2_IS_TMC + #define X2_MAX_CURRENT 1000 //in mA + #define X2_SENSE_RESISTOR 91 //in mOhms + #define X2_MICROSTEPS 16 //number of microsteps + +// #define Y_IS_TMC + #define Y_MAX_CURRENT 1000 //in mA + #define Y_SENSE_RESISTOR 91 //in mOhms + #define Y_MICROSTEPS 16 //number of microsteps + +// #define Y2_IS_TMC + #define Y2_MAX_CURRENT 1000 //in mA + #define Y2_SENSE_RESISTOR 91 //in mOhms + #define Y2_MICROSTEPS 16 //number of microsteps + +// #define Z_IS_TMC + #define Z_MAX_CURRENT 1000 //in mA + #define Z_SENSE_RESISTOR 91 //in mOhms + #define Z_MICROSTEPS 16 //number of microsteps + +// #define Z2_IS_TMC + #define Z2_MAX_CURRENT 1000 //in mA + #define Z2_SENSE_RESISTOR 91 //in mOhms + #define Z2_MICROSTEPS 16 //number of microsteps + +// #define E0_IS_TMC + #define E0_MAX_CURRENT 1000 //in mA + #define E0_SENSE_RESISTOR 91 //in mOhms + #define E0_MICROSTEPS 16 //number of microsteps + +// #define E1_IS_TMC + #define E1_MAX_CURRENT 1000 //in mA + #define E1_SENSE_RESISTOR 91 //in mOhms + #define E1_MICROSTEPS 16 //number of microsteps + +// #define E2_IS_TMC + #define E2_MAX_CURRENT 1000 //in mA + #define E2_SENSE_RESISTOR 91 //in mOhms + #define E2_MICROSTEPS 16 //number of microsteps + +// #define E3_IS_TMC + #define E3_MAX_CURRENT 1000 //in mA + #define E3_SENSE_RESISTOR 91 //in mOhms + #define E3_MICROSTEPS 16 //number of microsteps + +#endif + +/******************************************************************************\ + * enable this section if you have L6470 motor drivers. + * you need to import the L6470 library into the arduino IDE for this + ******************************************************************************/ + +// @section l6470 + +//#define HAVE_L6470DRIVER +#ifdef HAVE_L6470DRIVER + +// #define X_IS_L6470 + #define X_MICROSTEPS 16 //number of microsteps + #define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #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_IS_L6470 + #define X2_MICROSTEPS 16 //number of microsteps + #define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y_IS_L6470 + #define Y_MICROSTEPS 16 //number of microsteps + #define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y2_IS_L6470 + #define Y2_MICROSTEPS 16 //number of microsteps + #define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z_IS_L6470 + #define Z_MICROSTEPS 16 //number of microsteps + #define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z2_IS_L6470 + #define Z2_MICROSTEPS 16 //number of microsteps + #define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E0_IS_L6470 + #define E0_MICROSTEPS 16 //number of microsteps + #define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E1_IS_L6470 + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E2_IS_L6470 + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E3_IS_L6470 + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +#endif + #include "Conditionals.h" #include "SanityCheck.h" diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 17928b536..423822a86 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated: // 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_VERSION "1.0.2" +#define STRING_VERSION "1.0.3 dev" #define STRING_URL "reprap.org" #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. @@ -62,8 +62,9 @@ Here are some standard links for getting your machine calibrated: #define MOTHERBOARD BOARD_OMCA #endif -// Define this to set a custom name for your generic Mendel, -// #define CUSTOM_MENDEL_NAME "This Mendel" +// 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) @@ -104,7 +105,7 @@ Here are some standard links for getting your machine calibrated: // 10 is 100k RS thermistor 198-961 (4.7k pullup) // 11 is 100k beta 3950 1% thermistor (4.7k pullup) // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) -// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" // 20 is the PT100 circuit found in the Ultimainboard V2.x // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // @@ -118,11 +119,11 @@ Here are some standard links for getting your machine calibrated: // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup // 110 is Pt100 with 1k pullup (non standard) -// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. +// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. // Use it for Testing or Development purposes. NEVER for production machine. // #define DUMMY_THERMISTOR_998_VALUE 25 // #define DUMMY_THERMISTOR_999_VALUE 100 - +// :{ '0': "Not used", '4': "10k !! do not use for a hotend. Bad resolution at high temp. !!", '1': "100k / 4.7k - EPCOS", '51': "100k / 1k - EPCOS", '6': "100k / 4.7k EPCOS - Not as accurate as Table 1", '5': "100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '7': "100k / 4.7k Honeywell 135-104LAG-J01", '71': "100k / 4.7k Honeywell 135-104LAF-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'", '60': "100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '55': "100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '2': "200k / 4.7k - ATC Semitec 204GT-2", '52': "200k / 1k - ATC Semitec 204GT-2", '-2': "Thermocouple + MAX6675 (only for sensor 0)", '-1': "Thermocouple + AD595", '3': "Mendel-parts / 4.7k", '1047': "Pt1000 / 4.7k", '1010': "Pt1000 / 1k (non standard)", '20': "PT100 (Ultimainboard V2.x)", '147': "Pt100 / 4.7k", '110': "Pt100 / 1k (non-standard)", '998': "Dummy 1", '999': "Dummy 2" } #define TEMP_SENSOR_0 5 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 @@ -184,7 +185,6 @@ Here are some standard links for getting your machine calibrated: // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term #define K1 0.95 //smoothing factor within the PID - #define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // J-Head Mk V-B @@ -194,8 +194,8 @@ Here are some standard links for getting your machine calibrated: // Ultimaker // #define DEFAULT_Kp 22.2 -// #define DEFAULT_Ki 1.08 -// #define DEFAULT_Kd 114 +// #define DEFAULT_Ki 1.08 +// #define DEFAULT_Kd 114 // MakerGear // #define DEFAULT_Kp 7.0 @@ -214,7 +214,7 @@ Here are some standard links for getting your machine calibrated: // Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis // // Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. -// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// If your PID_dT is the default, and correct for your hardware/configuration, that means 7.689Hz, // which is fine for driving a square wave into a resistive load and does not significantly impact you 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, you probably @@ -270,15 +270,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua The system will turn the heater on forever, burning up the filament and anything else around. -After the temperature reaches the target for the first time, this feature will -start measuring for how long the current temperature stays below the target +After the temperature reaches the target for the first time, this feature will +start measuring for how long the current temperature stays below the target minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS). If it stays longer than _PERIOD, it means the thermistor temperature cannot catch up with the target, so something *may be* wrong. Then, to be on the safe side, the system will he halt. -Bear in mind the count down will just start AFTER the first time the +Bear in mind the count down will just start AFTER the first time the thermistor temperature is over the target, so you will have no problem if your extruder heater takes 2 minutes to hit the target on heating. @@ -321,13 +321,14 @@ your extruder heater takes 2 minutes to hit the target on heating. // #define ENDSTOPPULLUP_ZMIN #endif -// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. +const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. //#define DISABLE_MAX_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS @@ -344,13 +345,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DISABLE_E false // For all extruders #define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled -#define INVERT_X_DIR false // for Mendel set to false, for Orca set to true -#define INVERT_Y_DIR true // for Mendel set to true, for Orca set to false -#define INVERT_Z_DIR false // for Mendel set to false, for Orca set to true -#define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E3_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false +// 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 +#define INVERT_E0_DIR false +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false // ENDSTOP SETTINGS: // Sets direction of endstops when homing; 1=MAX, -1=MIN @@ -362,12 +364,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below. // Travel limits after homing (units are in mm) -#define X_MAX_POS 205 #define X_MIN_POS 0 -#define Y_MAX_POS 205 #define Y_MIN_POS 0 -#define Z_MAX_POS 120 #define Z_MIN_POS 0 +#define X_MAX_POS 205 +#define Y_MAX_POS 205 +#define Z_MAX_POS 120 //=========================================================================== //============================= Filament Runout Sensor ====================== @@ -386,7 +388,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // #define MANUAL_BED_LEVELING // Add display menu option for bed leveling // #define MESH_BED_LEVELING // Enable mesh bed leveling -#if defined(MESH_BED_LEVELING) +#ifdef MANUAL_BED_LEVELING + #define MBL_Z_STEP 0.025 +#endif // MANUAL_BED_LEVELING + +#ifdef MESH_BED_LEVELING #define MESH_MIN_X 10 #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) #define MESH_MIN_Y 10 @@ -426,14 +432,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 #define BACK_PROBE_BED_POSITION 170 - - #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this + + #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this // Set the number of grid points per dimension // You probably don't need more than 3 (squared=9) #define AUTO_BED_LEVELING_GRID_POINTS 2 - #else // !AUTO_BED_LEVELING_GRID // Arbitrary points to probe. A simple cross-product @@ -447,11 +452,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif // AUTO_BED_LEVELING_GRID - // Offsets to the probe relative to the extruder tip (Hotend - Probe) // X and Y offsets must be integers - #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // -left +right - #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // -front +behind + #define X_PROBE_OFFSET_FROM_EXTRUDER -25 // Probe on: -left +right + #define Y_PROBE_OFFSET_FROM_EXTRUDER -29 // Probe on: -front +behind #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35 // -below (always!) #define Z_RAISE_BEFORE_HOMING 4 // (in mm) Raise Z before homing (G28) for Probe Clearance. @@ -459,10 +463,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min - #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. + #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points #define Z_RAISE_AFTER_PROBING 15 //How much the extruder will be raised after the last probing point. +// #define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" //These commands will be executed in the end of G29 routine. + //Useful to retract a deployable probe. + //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#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. @@ -490,6 +497,20 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #endif + // Support for a dedicated Z PROBE endstop separate from the Z MIN endstop. + // If you would like to use both a Z PROBE and a Z MIN endstop together or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP and read the instructions below. + // If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28. + // WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print. + // To use a separate Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board. + // If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below. + // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, otherwise connect to ground and D32 + // for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed. + // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. + // D32 is currently selected in the RAMPS 1.3/1.4 pin file. All other boards will need changes to the respective pins_XXXXX.h file. + // WARNING: Setting the wrong pin may have unexpected and potentially disastrous outcomes. Use with caution and do your homework. + + //#define Z_PROBE_ENDSTOP + #endif // ENABLE_AUTO_BED_LEVELING @@ -497,15 +518,19 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) -//Manual homing switch locations: +// Manual homing switch locations: // For deltabots this means top and center of the Cartesian print volume. -#define MANUAL_X_HOME_POS 0 -#define MANUAL_Y_HOME_POS 0 -#define MANUAL_Z_HOME_POS 0 -//#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +#ifdef MANUAL_HOME_POSITIONS + #define MANUAL_X_HOME_POS 0 + #define MANUAL_Y_HOME_POS 0 + #define MANUAL_Z_HOME_POS 0 + //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. +#endif + +/** + * MOVEMENT SETTINGS + */ -//// MOVEMENT SETTINGS -#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0} // set the homing speeds (mm/min) // default settings @@ -522,7 +547,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration in mm/s^2 for retracts #define DEFAULT_TRAVEL_ACCELERATION 500 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves - // 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. @@ -542,9 +566,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Custom M code points #define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES - #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 - #define Z_PROBE_OFFSET_RANGE_MIN -15 - #define Z_PROBE_OFFSET_RANGE_MAX -5 + #ifdef ENABLE_AUTO_BED_LEVELING + #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 + #define Z_PROBE_OFFSET_RANGE_MIN -20 + #define Z_PROBE_OFFSET_RANGE_MAX 20 + #endif #endif @@ -555,9 +581,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. //define this to enable EEPROM support //#define EEPROM_SETTINGS -//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: -// please keep turned on if you can. -//#define EEPROM_CHITCHAT + +#ifdef EEPROM_SETTINGS + // To disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: + #define EEPROM_CHITCHAT // please keep turned on if you can. +#endif // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 180 @@ -571,13 +599,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //==============================LCD and SD support============================= // Define your display language below. Replace (en) with your language code and uncomment. -// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu +// en, pl, fr, de, es, ru, it, pt, pt-br, fi, an, nl, ca, eu, kana, kana_utf8, test // See also language.h //#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) -// Character based displays can have different extended charsets. -#define DISPLAY_CHARSET_HD44780_JAPAN // "ääööüüß23°" -//#define DISPLAY_CHARSET_HD44780_WESTERN // "ÄäÖöÜüß²³°" if you see a '~' instead of a 'arrow_right' at the right of submenuitems - this is the right one. +// Choose ONE of these 3 charsets. This has to match your hardware. Ignored for full graphic display. +// To find out what type you have - compile with (test) - upload - click to get the menu. You'll see two typical lines from the upper half of the charset. +// See also documentation/LCDLanguageFont.md + #define DISPLAY_CHARSET_HD44780_JAPAN // this is the most common hardware + //#define DISPLAY_CHARSET_HD44780_WESTERN + //#define DISPLAY_CHARSET_HD44780_CYRILLIC //#define ULTRA_LCD //general LCD support, also 16x2 //#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) @@ -590,6 +621,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define ULTIPANEL //the UltiPanel as on Thingiverse //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click + // 0 to disable buzzer feedback // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne @@ -644,7 +676,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Shift register panels // --------------------- // 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection //#define SAV_3DLCD @@ -652,7 +684,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define FAST_PWM_FAN // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency -// which is not ass annoying as with the hardware PWM. On the other hand, if this 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 @@ -697,7 +729,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Servo Endstops // // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes. -// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500. +// Use M851 to set the z-probe vertical offset from the nozzle. Store that setting with M500. // //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles @@ -706,9 +738,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of * Support for a filament diameter sensor * Also allows adjustment of diameter at print time (vs at slicing) * Single extruder only at this point (extruder 0) - * + * * Motherboards - * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector + * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E) * 301 - Rambo - uses Analog input 3 * Note may require analog pins to be defined for different motherboards diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 14d2019cc..d221f080b 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -3,6 +3,8 @@ #include "Conditionals.h" +// @section temperature + //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== @@ -46,6 +48,8 @@ //The M105 command return, besides traditional information, the ADC value read from temperature sensors. //#define SHOW_TEMP_ADC_VALUES +// @section extruder + // extruder run-out prevention. //if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded //#define EXTRUDER_RUNOUT_PREVENT @@ -55,6 +59,8 @@ #define EXTRUDER_RUNOUT_SPEED 1500. //extrusion speed #define EXTRUDER_RUNOUT_EXTRUDE 100 +// @section temperature + //These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements. //The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET" #define TEMP_SENSOR_AD595_OFFSET 0.0 @@ -72,15 +78,17 @@ // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 +// @section extruder + // Extruder cooling fans // Configure fan pin outputs to automatically turn on/off when the associated // extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. // 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 EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +#define EXTRUDER_0_AUTO_FAN_PIN -1 +#define EXTRUDER_1_AUTO_FAN_PIN -1 +#define EXTRUDER_2_AUTO_FAN_PIN -1 +#define EXTRUDER_3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed @@ -89,8 +97,12 @@ //=============================Mechanical Settings=========================== //=========================================================================== +// @section homing + #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing +// @section extras + //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. // A single Z stepper driver is usually used to drive 2 stepper motors. @@ -100,6 +112,30 @@ // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. //#define Z_DUAL_STEPPER_DRIVERS +#ifdef Z_DUAL_STEPPER_DRIVERS + + // Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper. + // That way the machine is capable to align the bed during home, since both Z steppers are homed. + // There is also an implementation of M666 (software endstops adjustment) to this feature. + // After Z homing, this adjustment is applied to just one of the steppers in order to align the bed. + // One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2. + // If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive. + // Play a little bit with small adjustments (0.5mm) and check the behaviour. + // The M119 (endstops report) will start reporting the Z2 Endstop as well. + + #define Z_DUAL_ENDSTOPS + + #ifdef Z_DUAL_ENDSTOPS + #define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis. + #define Z2_DIR_PIN E2_DIR_PIN + #define Z2_ENABLE_PIN E2_ENABLE_PIN + #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) + const bool Z2_MAX_ENDSTOP_INVERTING = false; + #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #endif + +#endif // Z_DUAL_STEPPER_DRIVERS + // Same again but for Y Axis. //#define Y_DUAL_STEPPER_DRIVERS @@ -112,57 +148,59 @@ // allowing faster printing speeds. //#define DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE -// Configuration for second X-carriage -// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; -// the second x-carriage always homes to the maximum endstop. -#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 EXTRUDER_OFFSET_X value for the second extruder provides a software - // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops - // without modifying the firmware (through the "M218 T1 X???" command). - // Remember: you should set the second extruder x-offset to 0 in your slicer. - -// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) -#define X2_ENABLE_PIN 29 -#define X2_STEP_PIN 25 -#define X2_DIR_PIN 23 - -// There are a few selectable movement modes for dual x-carriages using M605 S -// Mode 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) -// Mode 1: 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: 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 0 - -// Default settings in "Auto-park Mode" -#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder -#define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - -// Default x offset in duplication mode (typically set to half print bed width) -#define DEFAULT_DUPLICATION_X_OFFSET 100 + // Configuration for second X-carriage + // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; + // the second x-carriage always homes to the maximum endstop. + #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 EXTRUDER_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h) + #define X2_ENABLE_PIN 29 + #define X2_STEP_PIN 25 + #define X2_DIR_PIN 23 + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 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) + // Mode 1: 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: 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 0 + + // Default settings in "Auto-park Mode" + #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder + #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 #endif //DUAL_X_CARRIAGE +// @section homing + //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: -#define X_HOME_RETRACT_MM 5 -#define Y_HOME_RETRACT_MM 5 -#define Z_HOME_RETRACT_MM 1 -#define HOMING_BUMP_DIVISOR {10, 10, 20} // Re-Bump Speed Divisor (Divides the Homing Feedrate) +#define X_HOME_BUMP_MM 5 +#define Y_HOME_BUMP_MM 5 +#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 this is defined, if both x and y are to be homed, a diagonal move will be performed initially. +// @section machine + #define AXIS_RELATIVE_MODES {false, false, false, false} -#ifdef CONFIG_STEPPERS_TOSHIBA -#define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers -#else -#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step) -#endif + +// @section machine + //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 @@ -175,11 +213,15 @@ #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINTRAVELFEEDRATE 0.0 +// @section lcd + #ifdef ULTIPANEL #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel #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 @@ -214,34 +256,48 @@ //=========================================================================== #define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again -#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? -#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. - -#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. -// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. -// using: -//#define MENU_ADDAUTOSTART - -// Show a progress bar on the LCD when printing from SD? -//#define LCD_PROGRESS_BAR - -#ifdef LCD_PROGRESS_BAR - // Amount of time (ms) to show the bar - #define PROGRESS_BAR_BAR_TIME 2000 - // Amount of time (ms) to show the status message - #define PROGRESS_BAR_MSG_TIME 3000 - // Amount of time (ms) to retain the status message (0=forever) - #define PROGRESS_MSG_EXPIRE 0 - // Enable this to show messages for MSG_TIME then hide them - //#define PROGRESS_MSG_ONCE -#endif +// @section lcd + +#ifdef SDSUPPORT + + // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted + // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT + // in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should + // be commented out otherwise + #define SDCARDDETECTINVERTED + + #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + + #define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. + // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. + // using: + //#define MENU_ADDAUTOSTART + + // Show a progress bar on HD44780 LCDs for SD printing + //#define LCD_PROGRESS_BAR + + #ifdef LCD_PROGRESS_BAR + // Amount of time (ms) to show the bar + #define PROGRESS_BAR_BAR_TIME 2000 + // Amount of time (ms) to show the status message + #define PROGRESS_BAR_MSG_TIME 3000 + // Amount of time (ms) to retain the status message (0=forever) + #define PROGRESS_MSG_EXPIRE 0 + // Enable this to show messages for MSG_TIME then hide them + //#define PROGRESS_MSG_ONCE + #endif + +#endif // SDSUPPORT + +// @section more // 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 @@ -256,6 +312,8 @@ // Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled. //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED +// @section lcd + // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process // it can e.g. be used to change z-positions in the print startup phase in real-time // does not respect endstops! @@ -266,24 +324,24 @@ #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements #endif +// @section extruder + // extruder advance constant (s2/mm3) // // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2 // -// Hooke's law says: force = k * distance -// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant +// Hooke's law says: force = k * distance +// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant // so: v ^ 2 is proportional to number of steps we advance the extruder //#define ADVANCE #ifdef ADVANCE #define EXTRUDER_ADVANCE_K .0 - #define D_FILAMENT 2.85 #define STEPS_MM_E 836 - #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) - #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA) +#endif -#endif // ADVANCE +// @section extras // Arc interpretation settings: #define MM_PER_ARC_SEGMENT 1 @@ -291,11 +349,7 @@ const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement -// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted -// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT -// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should -// be commented out otherwise -#define SDCARDDETECTINVERTED +// @section temperature // Control heater 0 and heater 1 in parallel. //#define HEATERS_PARALLEL @@ -304,19 +358,23 @@ const unsigned int dropsegments=5; //everything with less than this number of st //=============================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, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. -#if defined SDSUPPORT +#ifdef 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 more //The ASCII buffer for receiving from the serial: #define MAX_CMD_SIZE 96 #define BUFSIZE 4 +// @section fwretract // Firmware based and LCD controlled retract // M207 and M208 can be used to define parameters for the retraction. @@ -348,6 +406,143 @@ const unsigned int dropsegments=5; //everything with less than this number of st #endif #endif +/******************************************************************************\ + * enable this section if you have TMC26X motor drivers. + * you need to import the TMC26XStepper library into the arduino IDE for this + ******************************************************************************/ + +// @section tmc + +//#define HAVE_TMCDRIVER +#ifdef HAVE_TMCDRIVER + +// #define X_IS_TMC + #define X_MAX_CURRENT 1000 //in mA + #define X_SENSE_RESISTOR 91 //in mOhms + #define X_MICROSTEPS 16 //number of microsteps + +// #define X2_IS_TMC + #define X2_MAX_CURRENT 1000 //in mA + #define X2_SENSE_RESISTOR 91 //in mOhms + #define X2_MICROSTEPS 16 //number of microsteps + +// #define Y_IS_TMC + #define Y_MAX_CURRENT 1000 //in mA + #define Y_SENSE_RESISTOR 91 //in mOhms + #define Y_MICROSTEPS 16 //number of microsteps + +// #define Y2_IS_TMC + #define Y2_MAX_CURRENT 1000 //in mA + #define Y2_SENSE_RESISTOR 91 //in mOhms + #define Y2_MICROSTEPS 16 //number of microsteps + +// #define Z_IS_TMC + #define Z_MAX_CURRENT 1000 //in mA + #define Z_SENSE_RESISTOR 91 //in mOhms + #define Z_MICROSTEPS 16 //number of microsteps + +// #define Z2_IS_TMC + #define Z2_MAX_CURRENT 1000 //in mA + #define Z2_SENSE_RESISTOR 91 //in mOhms + #define Z2_MICROSTEPS 16 //number of microsteps + +// #define E0_IS_TMC + #define E0_MAX_CURRENT 1000 //in mA + #define E0_SENSE_RESISTOR 91 //in mOhms + #define E0_MICROSTEPS 16 //number of microsteps + +// #define E1_IS_TMC + #define E1_MAX_CURRENT 1000 //in mA + #define E1_SENSE_RESISTOR 91 //in mOhms + #define E1_MICROSTEPS 16 //number of microsteps + +// #define E2_IS_TMC + #define E2_MAX_CURRENT 1000 //in mA + #define E2_SENSE_RESISTOR 91 //in mOhms + #define E2_MICROSTEPS 16 //number of microsteps + +// #define E3_IS_TMC + #define E3_MAX_CURRENT 1000 //in mA + #define E3_SENSE_RESISTOR 91 //in mOhms + #define E3_MICROSTEPS 16 //number of microsteps + +#endif + +/******************************************************************************\ + * enable this section if you have L6470 motor drivers. + * you need to import the L6470 library into the arduino IDE for this + ******************************************************************************/ + +// @section l6470 + +//#define HAVE_L6470DRIVER +#ifdef HAVE_L6470DRIVER + +// #define X_IS_L6470 + #define X_MICROSTEPS 16 //number of microsteps + #define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #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_IS_L6470 + #define X2_MICROSTEPS 16 //number of microsteps + #define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y_IS_L6470 + #define Y_MICROSTEPS 16 //number of microsteps + #define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Y2_IS_L6470 + #define Y2_MICROSTEPS 16 //number of microsteps + #define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z_IS_L6470 + #define Z_MICROSTEPS 16 //number of microsteps + #define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define Z2_IS_L6470 + #define Z2_MICROSTEPS 16 //number of microsteps + #define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E0_IS_L6470 + #define E0_MICROSTEPS 16 //number of microsteps + #define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E1_IS_L6470 + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_MICROSTEPS 16 //number of microsteps + #define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E2_IS_L6470 + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_MICROSTEPS 16 //number of microsteps + #define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +// #define E3_IS_L6470 + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_MICROSTEPS 16 //number of microsteps + #define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high + #define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off + #define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall + +#endif + #include "Conditionals.h" #include "SanityCheck.h" diff --git a/Marlin/fastio.h b/Marlin/fastio.h index 3087e87f2..0e3b34d25 100644 --- a/Marlin/fastio.h +++ b/Marlin/fastio.h @@ -91,7 +91,7 @@ added as necessary or if I feel like it- not a comprehensive list! */ -#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega328__) || defined (__AVR_ATmega328P__) +#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__) // UART #define RXD DIO0 #define TXD DIO1 @@ -426,7 +426,7 @@ pins #define PD7_PWM NULL #endif /* _AVR_ATmega{168,328,328P}__ */ -#if defined (__AVR_ATmega644__) || defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644PA__) || defined (__AVR_ATmega1284P__) +#if defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__) // UART #define RXD DIO8 #define TXD DIO9 @@ -929,7 +929,7 @@ pins #define PD7_PWM OCR2A #endif /* _AVR_ATmega{644,644P,644PA}__ */ -#if defined (__AVR_ATmega1280__) || defined (__AVR_ATmega2560__) +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) // UART #define RXD DIO0 #define TXD DIO1 @@ -2024,7 +2024,7 @@ pins #endif -#if defined (__AVR_AT90USB1287__) || defined (__AVR_AT90USB1286__) || defined (__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) +#if defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) // SPI #define SCK DIO9 #define MISO DIO11 @@ -3322,7 +3322,7 @@ Teensy 28 29 30 31 32 33 34 35 20 21 22 23 24 25 26 27 10 11 12 13 14 15 16 17 #endif // __AVR_AT90usbxxx__ -#if defined (__AVR_ATmega1281__) || defined (__AVR_ATmega2561__) +#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) // UART #define RXD DIO0 #define TXD DIO1 diff --git a/Marlin/fonts/HD44780_C.fon b/Marlin/fonts/HD44780_C.fon new file mode 100644 index 000000000..bb9ca2a50 Binary files /dev/null and b/Marlin/fonts/HD44780_C.fon differ diff --git a/Marlin/fonts/HD44780_J.fon b/Marlin/fonts/HD44780_J.fon new file mode 100644 index 000000000..80527ef74 Binary files /dev/null and b/Marlin/fonts/HD44780_J.fon differ diff --git a/Marlin/fonts/HD44780_W.fon b/Marlin/fonts/HD44780_W.fon new file mode 100644 index 000000000..e478dbb08 Binary files /dev/null and b/Marlin/fonts/HD44780_W.fon differ diff --git a/Marlin/fonts/ISO10646-1-Marlin.fon b/Marlin/fonts/ISO10646-1-Marlin.fon deleted file mode 100644 index e9e4cfc2c..000000000 Binary files a/Marlin/fonts/ISO10646-1-Marlin.fon and /dev/null differ diff --git a/Marlin/fonts/ISO10646-5_Cyrillic.fon b/Marlin/fonts/ISO10646-5_Cyrillic.fon new file mode 100644 index 000000000..f52970cbc Binary files /dev/null and b/Marlin/fonts/ISO10646-5_Cyrillic.fon differ diff --git a/Marlin/fonts/ISO10646_Kana.fon b/Marlin/fonts/ISO10646_Kana.fon new file mode 100644 index 000000000..305ca983f Binary files /dev/null and b/Marlin/fonts/ISO10646_Kana.fon differ diff --git a/Marlin/fonts/README.fonts b/Marlin/fonts/README.fonts new file mode 100644 index 000000000..f227c079a --- /dev/null +++ b/Marlin/fonts/README.fonts @@ -0,0 +1,6 @@ +The fonts are created with Fony.exe (http://hukka.ncn.fi/?fony) because Fontforge didn't do what I want (probably lack off experience). +In Fony export the fonts to bdf-format. Maybe another one can edit them with Fontforge. +Then run make_fonts.bat what calls bdf2u8g.exe with the needed parameters to produce the .h files. +The .h files must be edited to replace '#include "u8g.h"' with '#include ', replace 'U8G_FONT_SECTION' with 'U8G_SECTION', insert '.progmem.' right behind the first '"' and moved to the main directory. + +Especially the Kana and Cyrillic fonts should be revised by someone who knows what he/she does. I am only a west-European with very little knowledge about this scripts. diff --git a/Marlin/fonts/bdf2u8g.exe b/Marlin/fonts/bdf2u8g.exe new file mode 100644 index 000000000..1e51b2656 Binary files /dev/null and b/Marlin/fonts/bdf2u8g.exe differ diff --git a/Marlin/fonts/make_fonts.bat b/Marlin/fonts/make_fonts.bat index 4684ffa63..ca50def71 100644 --- a/Marlin/fonts/make_fonts.bat +++ b/Marlin/fonts/make_fonts.bat @@ -3,6 +3,5 @@ .\bdf2u8g.exe -b 32 -e 255 HD44780_C.bdf HD44780_C_5x7 dogm_font_data_HD44780_C.h .\bdf2u8g.exe -b 32 -e 255 HD44780_J.bdf HD44780_J_5x7 dogm_font_data_HD44780_J.h .\bdf2u8g.exe -b 32 -e 255 ISO10646-1.bdf ISO10646_1_5x7 dogm_font_data_ISO10646_1.h -.\bdf2u8g.exe -b 32 -e 255 ISO10646-1-Marlin.bdf ISO10646_1_Marlin_5x7 dogm_font_data_ISO10646_1_Marlin.h .\bdf2u8g.exe -b 32 -e 255 ISO10646_5_Cyrillic.bdf ISO10646_5_Cyrillic_5x7 dogm_font_data_ISO10646_5_Cyrillic.h .\bdf2u8g.exe -b 32 -e 255 ISO10646_Kana.bdf ISO10646_Kana_5x7 dogm_font_data_ISO10646_Kana.h diff --git a/Marlin/language.h b/Marlin/language.h index 9e348c929..ba5f3f700 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -11,30 +11,36 @@ // // ==> ALWAYS TRY TO COMPILE MARLIN WITH/WITHOUT "ULTIPANEL" / "ULTRALCD" / "SDSUPPORT" #define IN "Configuration.h" // ==> ALSO TRY ALL AVAILABLE LANGUAGE OPTIONS +// See also documentation/LCDLanguageFont.md // Languages -// en English -// pl Polish -// fr French -// de German -// es Spanish -// ru Russian -// it Italian -// pt Portuguese -// pt-br Portuguese (Brazil) -// fi Finnish -// an Aragonese -// nl Dutch -// ca Catalan -// eu Basque-Euskera +// en English +// pl Polish +// fr French +// de German +// es Spanish +// ru Russian +// it Italian +// pt Portuguese +// pt-br Portuguese (Brazil) +// fi Finnish +// an Aragonese +// nl Dutch +// ca Catalan +// eu Basque-Euskera +// kana Japanese +// kana_utf Japanese #ifndef LANGUAGE_INCLUDE // pick your language from the list above #define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) #endif +#ifdef HAS_AUTOMATIC_VERSIONING + #include "_Version.h" +#endif + #define PROTOCOL_VERSION "1.0" -#define FIRMWARE_URL "https://github.com/MarlinFirmware/Marlin" #if MB(ULTIMAKER)|| MB(ULTIMAKER_OLD)|| MB(ULTIMAIN_2) #define MACHINE_NAME "Ultimaker" @@ -57,12 +63,33 @@ #elif MB(HEPHESTOS) #define MACHINE_NAME "HEPHESTOS" #define FIRMWARE_URL "http://www.bq.com/gb/downloads-prusa-i3-hephestos.html" -#else // Default firmware set to Mendel - #define MACHINE_NAME "Mendel" +#elif MB(BRAINWAVE_PRO) + #define MACHINE_NAME "Kossel Pro" + #ifndef FIRMWARE_URL + #define FIRMWARE_URL "https://github.com/OpenBeamUSA/Marlin/" + #endif +#else + #ifndef MACHINE_NAME + #define MACHINE_NAME "3D Printer" + #endif #endif #ifdef CUSTOM_MENDEL_NAME - #define MACHINE_NAME CUSTOM_MENDEL_NAME + #error CUSTOM_MENDEL_NAME deprecated - use CUSTOM_MACHINE_NAME + #define CUSTOM_MACHINE_NAME CUSTOM_MENDEL_NAME +#endif + +#ifdef CUSTOM_MACHINE_NAME + #undef MACHINE_NAME + #define MACHINE_NAME CUSTOM_MACHINE_NAME +#endif + +#ifndef FIRMWARE_URL + #define FIRMWARE_URL "https://github.com/MarlinFirmware/Marlin" +#endif + +#ifndef BUILD_VERSION + #define BUILD_VERSION "V1; Sprinter/grbl mashup for gen6" #endif #ifndef MACHINE_UUID @@ -83,7 +110,7 @@ // Serial Console Messages (do not translate those!) -#define MSG_Enqueing "enqueing \"" +#define MSG_Enqueueing "enqueueing \"" #define MSG_POWERUP "PowerUp" #define MSG_EXTERNAL_RESET " External Reset" #define MSG_BROWNOUT_RESET " Brown out Reset" @@ -113,7 +140,7 @@ #define MSG_HEATING_COMPLETE "Heating done." #define MSG_BED_HEATING "Bed Heating." #define MSG_BED_DONE "Bed done." -#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n" +#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin " BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n" #define MSG_COUNT_X " Count X: " #define MSG_ERR_KILLED "Printer halted. kill() called!" #define MSG_ERR_STOPPED "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)" @@ -129,6 +156,7 @@ #define MSG_Z_MIN "z_min: " #define MSG_Z_MAX "z_max: " #define MSG_Z2_MAX "z2_max: " +#define MSG_Z_PROBE "z_probe: " #define MSG_M119_REPORT "Reporting endstop status" #define MSG_ENDSTOP_HIT "TRIGGERED" #define MSG_ENDSTOP_OPEN "open" @@ -200,65 +228,9 @@ // LCD Menu Messages -// Add your own character. Reference: https://github.com/MarlinFirmware/Marlin/pull/1434 photos -// and https://www.sparkfun.com/datasheets/LCD/HD44780.pdf page 17-18 -#ifdef DOGLCD - #define STR_Ae "\304" // 'Ä' U8glib - #define STR_ae "\344" // 'ä' - #define STR_Oe "\326" // 'Ö' - #define STR_oe STR_Oe // 'ö' - #define STR_Ue "\334" // 'Ü' - #define STR_ue STR_Ue // 'ü' - #define STR_sz "\337" // 'ß' - #define STR_h2 "\262" // '²' - #define STR_h3 "\263" // '³' - #define STR_Deg "\260" // '°' - #define STR_THERMOMETER "\377" -#else - #ifdef DISPLAY_CHARSET_HD44780_JAPAN // HD44780 ROM Code: A00 (Japan) - #define STR_ae "\xe1" - #define STR_Ae STR_ae - #define STR_oe "\357" - #define STR_Oe STR_oe - #define STR_ue "\365" - #define STR_Ue STR_ue - #define STR_sz "\342" - #define STR_h2 "2" - #define STR_h3 "3" - #define STR_Deg "\271" - #define STR_THERMOMETER "\002" - #elif defined(DISPLAY_CHARSET_HD44780_WESTERN) // HD44780 ROM Code: A02 (Western) - #define STR_Ae "\216" - #define STR_ae "\204" - #define STR_Oe "\211" - #define STR_oe "\204" - #define STR_Ue "\212" - #define STR_ue "\201" - #define STR_sz "\160" - #define STR_h2 "\262" - #define STR_h3 "\263" - #define STR_Deg "\337" - #define STR_THERMOMETER "\002" - #endif +#if !(defined( DISPLAY_CHARSET_HD44780_JAPAN ) || defined( DISPLAY_CHARSET_HD44780_WESTERN ) || defined( DISPLAY_CHARSET_HD44780_CYRILLIC )) + #define DISPLAY_CHARSET_HD44780_JAPAN #endif -/* -#define TESTSTRING000 "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017" -#define TESTSTRING020 "\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -#define TESTSTRING040 "\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057" -#define TESTSTRING060 "\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077" -#define TESTSTRING100 "\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117" -#define TESTSTRING120 "\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137" -#define TESTSTRING140 "\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157" -#define TESTSTRING160 "\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177" -#define TESTSTRING200 "\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217" -#define TESTSTRING220 "\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237" -#define TESTSTRING240 "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257" -#define TESTSTRING260 "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277" -#define TESTSTRING300 "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317" -#define TESTSTRING320 "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337" -#define TESTSTRING340 "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357" -#define TESTSTRING360 "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377" -*/ #include LANGUAGE_INCLUDE #include "language_en.h" diff --git a/Marlin/language_an.h b/Marlin/language_an.h index e26c7d868..60309d1ae 100644 --- a/Marlin/language_an.h +++ b/Marlin/language_an.h @@ -2,12 +2,17 @@ * Aragonese * * LCD Menu Messages - * Please note these are limited to 17 characters! + * See also documentation/LCDLanguageFont.md * */ #ifndef LANGUAGE_AN_H #define LANGUAGE_AN_H +#define MAPPER_NON +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_1 + #define WELCOME_MSG MACHINE_NAME " parada." #define MSG_SD_INSERTED "Tarcheta colocada" #define MSG_SD_REMOVED "Tarcheta retirada" @@ -46,9 +51,9 @@ #define MSG_FAN_SPEED "Ixoriador" #define MSG_FLOW "Fluxo" #define MSG_CONTROL "Control" -#define MSG_MIN "\002 Min" -#define MSG_MAX "\002 Max" -#define MSG_FACTOR "\002 Fact" +#define MSG_MIN LCD_STR_THERMOMETER " Min" +#define MSG_MAX LCD_STR_THERMOMETER " Max" +#define MSG_FACTOR LCD_STR_THERMOMETER " Fact" #define MSG_AUTOTEMP "Autotemp" #define MSG_ON "On" #define MSG_OFF "Off" @@ -118,6 +123,8 @@ #define MSG_BABYSTEP_Y "Babystep Y" #define MSG_BABYSTEP_Z "Babystep Z" #define MSG_ENDSTOP_ABORT "Endstop abort" +#define MSG_END_HOUR "hours" +#define MSG_END_MINUTE "minutes" #ifdef DELTA_CALIBRATION_MENU #define MSG_DELTA_CALIBRATE "Delta Calibration" diff --git a/Marlin/language_ca.h b/Marlin/language_ca.h index e7f837d5d..35eb03829 100644 --- a/Marlin/language_ca.h +++ b/Marlin/language_ca.h @@ -2,12 +2,18 @@ * Catalan * * LCD Menu Messages - * Please note these are limited to 17 characters! + * See also documentation/LCDLanguageFont.md * */ #ifndef LANGUAGE_CA_H #define LANGUAGE_CA_H +//#define MAPPER_NON +#define MAPPER_C2C3 // because of "ó" +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_1 + #define WELCOME_MSG MACHINE_NAME " preparada." #define MSG_SD_INSERTED "SD detectada." #define MSG_SD_REMOVED "SD expulsada." @@ -46,9 +52,9 @@ #define MSG_FAN_SPEED "Vel. Ventilador" #define MSG_FLOW "Fluxe" #define MSG_CONTROL "Control" -#define MSG_MIN " \002 Min" -#define MSG_MAX " \002 Max" -#define MSG_FACTOR " \002 Fact" +#define MSG_MIN LCD_STR_THERMOMETER " Min" +#define MSG_MAX LCD_STR_THERMOMETER " Max" +#define MSG_FACTOR LCD_STR_THERMOMETER " Fact" #define MSG_AUTOTEMP "Autotemp" #define MSG_ON "On " #define MSG_OFF "Off" @@ -76,7 +82,7 @@ #define MSG_TEMPERATURE "Temperatura" #define MSG_MOTION "Moviment" #define MSG_VOLUMETRIC "Filament" -#define MSG_VOLUMETRIC_ENABLED "E in mm3" +#define MSG_VOLUMETRIC_ENABLED "E in mm3" #define MSG_FILAMENT_SIZE_EXTRUDER_0 "Fil. Dia. 1" #define MSG_FILAMENT_SIZE_EXTRUDER_1 "Fil. Dia. 2" #define MSG_FILAMENT_SIZE_EXTRUDER_2 "Fil. Dia. 3" @@ -118,6 +124,8 @@ #define MSG_BABYSTEP_Y "Babystep Y" #define MSG_BABYSTEP_Z "Babystep Z" #define MSG_ENDSTOP_ABORT "Endstop abort" +#define MSG_END_HOUR "hours" +#define MSG_END_MINUTE "minutes" #ifdef DELTA_CALIBRATION_MENU #define MSG_DELTA_CALIBRATE "Delta Calibration" diff --git a/Marlin/language_de.h b/Marlin/language_de.h index d41df208d..8c8496f02 100644 --- a/Marlin/language_de.h +++ b/Marlin/language_de.h @@ -2,32 +2,37 @@ * German * * LCD Menu Messages - * Please note these are limited to 17 characters! + * See also documentation/LCDLanguageFont.md * */ #ifndef LANGUAGE_DE_H #define LANGUAGE_DE_H +#define MAPPER_C2C3 +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_1 + #define WELCOME_MSG MACHINE_NAME " Bereit." #define MSG_SD_INSERTED "SDKarte erkannt." #define MSG_SD_REMOVED "SDKarte entfernt." -#define MSG_MAIN "Hauptmen" STR_ue +#define MSG_MAIN "Hauptmenü" #define MSG_AUTOSTART "Autostart" #define MSG_DISABLE_STEPPERS "Motoren Aus" // M84 #define MSG_AUTO_HOME "Home" // G28 #define MSG_SET_HOME_OFFSETS "Setze Home hier" #define MSG_SET_ORIGIN "Setze Null hier" //"G92 X0 Y0 Z0" commented out in ultralcd.cpp -#define MSG_PREHEAT_PLA "Vorw" STR_ae "rmen PLA" -#define MSG_PREHEAT_PLA_N "Vorw" STR_ae "rmen PLA " +#define MSG_PREHEAT_PLA "Vorwärmen PLA" +#define MSG_PREHEAT_PLA_N "Vorwärmen PLA " #define MSG_PREHEAT_PLA_ALL "Vorw. PLA Alle" #define MSG_PREHEAT_PLA_BEDONLY "Vorw. PLA Bett" -#define MSG_PREHEAT_PLA_SETTINGS "Vorw" STR_ae "rm. PLA Ein." -#define MSG_PREHEAT_ABS "Vorw" STR_ae "rmen ABS" -#define MSG_PREHEAT_ABS_N "Vorw" STR_ae "rmen ABS " +#define MSG_PREHEAT_PLA_SETTINGS "Vorwärm. PLA Ein." +#define MSG_PREHEAT_ABS "Vorwärmen ABS" +#define MSG_PREHEAT_ABS_N "Vorwärmen ABS " #define MSG_PREHEAT_ABS_ALL "Vorw. ABS Alle" #define MSG_PREHEAT_ABS_BEDONLY "Vorw. ABS Bett" -#define MSG_PREHEAT_ABS_SETTINGS "Vorw" STR_ae "rm. ABS Ein." -#define MSG_COOLDOWN "Abk" STR_ue "hlen" +#define MSG_PREHEAT_ABS_SETTINGS "Vorwärm. ABS Ein." +#define MSG_COOLDOWN "Abkühlen" #define MSG_SWITCH_PS_ON "Netzteil Ein" #define MSG_SWITCH_PS_OFF "Netzteil Aus" #define MSG_RETRACT "Retract" @@ -40,14 +45,14 @@ #define MSG_MOVE_1MM " 1.0 mm" #define MSG_MOVE_10MM "10.0 mm" #define MSG_SPEED "Geschw." -#define MSG_NOZZLE "D" STR_ue "se" +#define MSG_NOZZLE "Düse" #define MSG_BED "Bett" -#define MSG_FAN_SPEED "L" STR_ue "ftergeschw." +#define MSG_FAN_SPEED "Lüftergeschw." #define MSG_FLOW "Fluss" #define MSG_CONTROL "Einstellungen" -#define MSG_MIN STR_THERMOMETER " Min" -#define MSG_MAX STR_THERMOMETER " Max" -#define MSG_FACTOR STR_THERMOMETER " Faktor" +#define MSG_MIN LCD_STR_THERMOMETER " Min" +#define MSG_MAX LCD_STR_THERMOMETER " Max" +#define MSG_FACTOR LCD_STR_THERMOMETER " Faktor" #define MSG_AUTOTEMP "AutoTemp" #define MSG_ON "Ein" #define MSG_OFF "Aus" @@ -75,7 +80,7 @@ #define MSG_TEMPERATURE "Temperatur" #define MSG_MOTION "Bewegung" #define MSG_VOLUMETRIC "Filament" -#define MSG_VOLUMETRIC_ENABLED "E in mm" STR_h3 +#define MSG_VOLUMETRIC_ENABLED "E in mm³" #define MSG_FILAMENT_SIZE_EXTRUDER_0 "Filament D 1" #define MSG_FILAMENT_SIZE_EXTRUDER_1 "Filament D 2" #define MSG_FILAMENT_SIZE_EXTRUDER_2 "Filament D 3" @@ -117,6 +122,8 @@ #define MSG_BABYSTEP_Y "Babystep Y" #define MSG_BABYSTEP_Z "Babystep Z" #define MSG_ENDSTOP_ABORT "Endstop Abbr. Ein" +#define MSG_END_HOUR "Stunden" +#define MSG_END_MINUTE "Minuten" #ifdef DELTA_CALIBRATION_MENU #define MSG_DELTA_CALIBRATE "Delta Kalibrieren" diff --git a/Marlin/language_en.h b/Marlin/language_en.h index 0998d22ad..9d61167cc 100644 --- a/Marlin/language_en.h +++ b/Marlin/language_en.h @@ -2,12 +2,22 @@ * English * * LCD Menu Messages - * Please note these are limited to 17 characters! + * Se also documentation/LCDLanguageFont.md * */ #ifndef LANGUAGE_EN_H #define LANGUAGE_EN_H +#if !( defined(MAPPER_NON)|| defined(MAPPER_C2C3)|| defined(MAPPER_D0D1)|| defined(MAPPER_D0D1_MOD)|| defined(MAPPER_E382E383) ) + #define MAPPER_NON // For direct asci codes +#endif + +//#define SIMULATE_ROMFONT //Comment in to see what is seen on the character based displays +#if !( defined(SIMULATE_ROMFONT)|| defined(DISPLAY_CHARSET_ISO10646_1)|| defined(DISPLAY_CHARSET_ISO10646_5)|| defined(DISPLAY_CHARSET_ISO10646_KANA) ) + #define DISPLAY_CHARSET_ISO10646_1 // use the better font on full graphic displays. +#endif + + #ifndef WELCOME_MSG #define WELCOME_MSG MACHINE_NAME " ready." #endif @@ -159,13 +169,13 @@ #define MSG_CONTROL "Control" #endif #ifndef MSG_MIN -#define MSG_MIN " " STR_THERMOMETER " Min" +#define MSG_MIN " "LCD_STR_THERMOMETER " Min" #endif #ifndef MSG_MAX -#define MSG_MAX " " STR_THERMOMETER " Max" +#define MSG_MAX " "LCD_STR_THERMOMETER " Max" #endif #ifndef MSG_FACTOR -#define MSG_FACTOR " " STR_THERMOMETER " Fact" +#define MSG_FACTOR " "LCD_STR_THERMOMETER " Fact" #endif #ifndef MSG_AUTOTEMP #define MSG_AUTOTEMP "Autotemp" @@ -261,7 +271,7 @@ #define MSG_VOLUMETRIC "Filament" #endif #ifndef MSG_VOLUMETRIC_ENABLED -#define MSG_VOLUMETRIC_ENABLED "E in mm" STR_h3 +#define MSG_VOLUMETRIC_ENABLED "E in mm3" #endif #ifndef MSG_FILAMENT_SIZE_EXTRUDER_0 #define MSG_FILAMENT_SIZE_EXTRUDER_0 "Fil. Dia. 1" @@ -407,6 +417,12 @@ #ifndef MSG_ERR_MAXTEMP_BED #define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED" #endif +#ifndef MSG_END_HOUR +#define MSG_END_HOUR "hours" +#endif +#ifndef MSG_END_MINUTE +#define MSG_END_MINUTE "minutes" +#endif #ifdef DELTA_CALIBRATION_MENU #ifndef MSG_DELTA_CALIBRATE diff --git a/Marlin/language_es.h b/Marlin/language_es.h index 2d7b785bd..92f903ceb 100644 --- a/Marlin/language_es.h +++ b/Marlin/language_es.h @@ -2,12 +2,17 @@ * Spanish * * LCD Menu Messages - * Please note these are limited to 17 characters! + * See also documentation/LCDLanguageFont.md * */ #ifndef LANGUAGE_ES_H #define LANGUAGE_ES_H +#define MAPPER_NON +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_1 + #define WELCOME_MSG MACHINE_NAME " lista." #define MSG_SD_INSERTED "Tarjeta colocada" #define MSG_SD_REMOVED "Tarjeta retirada" @@ -46,9 +51,9 @@ #define MSG_FAN_SPEED "Ventilador" #define MSG_FLOW "Flujo" #define MSG_CONTROL "Control" -#define MSG_MIN "\002 Min" -#define MSG_MAX "\002 Max" -#define MSG_FACTOR "\002 Fact" +#define MSG_MIN LCD_STR_THERMOMETER " Min" +#define MSG_MAX LCD_STR_THERMOMETER " Max" +#define MSG_FACTOR LCD_STR_THERMOMETER " Fact" #define MSG_AUTOTEMP "Autotemp" #define MSG_ON "On" #define MSG_OFF "Off" @@ -118,6 +123,8 @@ #define MSG_BABYSTEP_Y "Babystep Y" #define MSG_BABYSTEP_Z "Babystep Z" #define MSG_ENDSTOP_ABORT "Endstop abort" +#define MSG_END_HOUR "horas" +#define MSG_END_MINUTE "minutos" #ifdef DELTA_CALIBRATION_MENU #define MSG_DELTA_CALIBRATE "Delta Calibration" diff --git a/Marlin/language_eu.h b/Marlin/language_eu.h index 0f615d5a3..6f6fd8b66 100644 --- a/Marlin/language_eu.h +++ b/Marlin/language_eu.h @@ -2,12 +2,17 @@ * Basque-Euskera * * LCD Menu Messages - * Please note these are limited to 17 characters! + * See also documentation/LCDLanguageFont.md * */ #ifndef LANGUAGE_EU_H #define LANGUAGE_EU_H +#define MAPPER_NON +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_1 + #define WELCOME_MSG MACHINE_NAME " prest." #define MSG_SD_INSERTED "Txartela sartuta" #define MSG_SD_REMOVED "Txartela kenduta" @@ -46,9 +51,9 @@ #define MSG_FAN_SPEED "Haizagailua" #define MSG_FLOW "Fluxua" #define MSG_CONTROL "Kontrola" -#define MSG_MIN " \002 Min" -#define MSG_MAX " \002 Max" -#define MSG_FACTOR " \002 Faktorea" +#define MSG_MIN LCD_STR_THERMOMETER " Min" +#define MSG_MAX LCD_STR_THERMOMETER " Max" +#define MSG_FACTOR LCD_STR_THERMOMETER " Faktorea" #define MSG_AUTOTEMP "Auto tenperatura" #define MSG_ON "On " #define MSG_OFF "Off" @@ -118,6 +123,8 @@ #define MSG_BABYSTEP_Y "Babystep Y" #define MSG_BABYSTEP_Z "Babystep Z" #define MSG_ENDSTOP_ABORT "Endstop deuseztat" +#define MSG_END_HOUR "hours" +#define MSG_END_MINUTE "minutes" #ifdef DELTA_CALIBRATION_MENU #define MSG_DELTA_CALIBRATE "Delta Calibration" diff --git a/Marlin/language_fi.h b/Marlin/language_fi.h index 62fdc7638..2bb192ee6 100644 --- a/Marlin/language_fi.h +++ b/Marlin/language_fi.h @@ -2,12 +2,17 @@ * Finnish * * LCD Menu Messages - * Please note these are limited to 17 characters! + * See also documentation/LCDLanguageFont.md * */ #ifndef LANGUAGE_FI_H #define LANGUAGE_FI_H +#define MAPPER_C2C3 +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_1 + #define WELCOME_MSG MACHINE_NAME " valmis." #define MSG_SD_INSERTED "Kortti asetettu" #define MSG_SD_REMOVED "Kortti poistettu" @@ -17,21 +22,21 @@ #define MSG_AUTO_HOME "Aja referenssiin" #define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_ORIGIN "Aseta origo" -#define MSG_PREHEAT_PLA "Esil" STR_ae "mmit" STR_ae " PLA" -#define MSG_PREHEAT_PLA_N "Esil" STR_ae "mmit" STR_ae " PLA " -#define MSG_PREHEAT_PLA_ALL "Esil" STR_ae ". PLA Kaikki" -#define MSG_PREHEAT_PLA_BEDONLY "Esil" STR_ae ". PLA Alusta" -#define MSG_PREHEAT_PLA_SETTINGS "Esil" STR_ae "mm. PLA konf" -#define MSG_PREHEAT_ABS "Esil" STR_ae "mmit" STR_ae " ABS" -#define MSG_PREHEAT_ABS_N "Esil" STR_ae "mmit" STR_ae " ABS " -#define MSG_PREHEAT_ABS_ALL "Esil" STR_ae ". ABS Kaikki" -#define MSG_PREHEAT_ABS_BEDONLY "Esil" STR_ae ". ABS Alusta" -#define MSG_PREHEAT_ABS_SETTINGS "Esil" STR_ae "mm. ABS konf" -#define MSG_COOLDOWN "J" STR_ae "" STR_ae "hdyt" STR_ae "" -#define MSG_SWITCH_PS_ON "Virta p" STR_ae "" STR_ae "lle" +#define MSG_PREHEAT_PLA "Esilämmitä PLA" +#define MSG_PREHEAT_PLA_N "Esilämmitä PLA " +#define MSG_PREHEAT_PLA_ALL "Esilä. PLA Kaikki" +#define MSG_PREHEAT_PLA_BEDONLY "Esilä. PLA Alusta" +#define MSG_PREHEAT_PLA_SETTINGS "Esilämm. PLA konf" +#define MSG_PREHEAT_ABS "Esilämmitä ABS" +#define MSG_PREHEAT_ABS_N "Esilämmitä ABS " +#define MSG_PREHEAT_ABS_ALL "Esilä. ABS Kaikki" +#define MSG_PREHEAT_ABS_BEDONLY "Esilä. ABS Alusta" +#define MSG_PREHEAT_ABS_SETTINGS "Esilämm. ABS konf" +#define MSG_COOLDOWN "Jäähdytä" +#define MSG_SWITCH_PS_ON "Virta päälle" #define MSG_SWITCH_PS_OFF "Virta pois" #define MSG_EXTRUDE "Pursota" -#define MSG_RETRACT "Ved" STR_ae " takaisin" +#define MSG_RETRACT "Vedä takaisin" #define MSG_MOVE_AXIS "Liikuta akseleita" #define MSG_MOVE_X "Liikuta X" #define MSG_MOVE_Y "Liikuta Y" @@ -46,9 +51,9 @@ #define MSG_FAN_SPEED "Tuul. nopeus" #define MSG_FLOW "Virtaus" #define MSG_CONTROL "Kontrolli" -#define MSG_MIN STR_THERMOMETER " Min" -#define MSG_MAX STR_THERMOMETER " Max" -#define MSG_FACTOR STR_THERMOMETER " Kerr" +#define MSG_MIN LCD_STR_THERMOMETER " Min" +#define MSG_MAX LCD_STR_THERMOMETER " Max" +#define MSG_FACTOR LCD_STR_THERMOMETER " Kerr" #define MSG_AUTOTEMP "Autotemp" #define MSG_ON "On " #define MSG_OFF "Off" @@ -73,10 +78,10 @@ #define MSG_YSTEPS "Ysteps/mm" #define MSG_ZSTEPS "Zsteps/mm" #define MSG_ESTEPS "Esteps/mm" -#define MSG_TEMPERATURE "L" STR_ae "mp" STR_oe "tila" +#define MSG_TEMPERATURE "Lämpötila" #define MSG_MOTION "Liike" #define MSG_VOLUMETRIC "Filament" -#define MSG_VOLUMETRIC_ENABLED "E in mm3" +#define MSG_VOLUMETRIC_ENABLED "E in mm³" #define MSG_FILAMENT_SIZE_EXTRUDER_0 "Fil. Dia. 1" #define MSG_FILAMENT_SIZE_EXTRUDER_1 "Fil. Dia. 2" #define MSG_FILAMENT_SIZE_EXTRUDER_2 "Fil. Dia. 3" @@ -84,13 +89,13 @@ #define MSG_STORE_EPROM "Tallenna muistiin" #define MSG_LOAD_EPROM "Lataa muistista" #define MSG_RESTORE_FAILSAFE "Palauta oletus" -#define MSG_REFRESH "P" STR_ae "ivit" STR_ae "" +#define MSG_REFRESH "Päivitä" #define MSG_WATCH "Seuraa" #define MSG_PREPARE "Valmistele" -#define MSG_TUNE "S" STR_ae "" STR_ae "d" STR_ae "" -#define MSG_PAUSE_PRINT "Keskeyt" STR_ae " tulostus" +#define MSG_TUNE "Säädä" +#define MSG_PAUSE_PRINT "Keskeytä tulostus" #define MSG_RESUME_PRINT "Jatka tulostusta" -#define MSG_STOP_PRINT "Pys" STR_ae "yt" STR_ae " tulostus" +#define MSG_STOP_PRINT "Pysäytä tulostus" #define MSG_CARD_MENU "Korttivalikko" #define MSG_NO_CARD "Ei korttia" #define MSG_DWELL "Nukkumassa..." @@ -100,9 +105,9 @@ #define MSG_NO_MOVE "Ei liiketta." #define MSG_KILLED "KILLED. " #define MSG_STOPPED "STOPPED. " -#define MSG_CONTROL_RETRACT "Ved" STR_ae " mm" -#define MSG_CONTROL_RETRACT_SWAP "Va. Ved" STR_ae " mm" -#define MSG_CONTROL_RETRACTF "Ved" STR_ae " V" +#define MSG_CONTROL_RETRACT "Vedä mm" +#define MSG_CONTROL_RETRACT_SWAP "Va. Vedä mm" +#define MSG_CONTROL_RETRACTF "Vedä V" #define MSG_CONTROL_RETRACT_ZLIFT "Z mm" #define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm" #define MSG_CONTROL_RETRACT_RECOVER_SWAP "Va. UnRet +mm" @@ -118,6 +123,8 @@ #define MSG_BABYSTEP_Y "Babystep Y" #define MSG_BABYSTEP_Z "Babystep Z" #define MSG_ENDSTOP_ABORT "Endstop abort" +#define MSG_END_HOUR "hours" +#define MSG_END_MINUTE "minutes" #ifdef DELTA_CALIBRATION_MENU #define MSG_DELTA_CALIBRATE "Delta Kalibrointi" @@ -127,4 +134,4 @@ #define MSG_DELTA_CALIBRATE_CENTER "Kalibroi Center" #endif // DELTA_CALIBRATION_MENU -#endif // LANGUAGE_FI_H \ No newline at end of file +#endif // LANGUAGE_FI_H diff --git a/Marlin/language_fr.h b/Marlin/language_fr.h index 8019f96a5..be526a723 100644 --- a/Marlin/language_fr.h +++ b/Marlin/language_fr.h @@ -2,12 +2,18 @@ * French * * LCD Menu Messages - * Please note these are limited to 17 characters! + * See also documentation/LCDLanguageFont.md * */ #ifndef LANGUAGE_FR_H #define LANGUAGE_FR_H +#define MAPPER_NON +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_1 + + #define WELCOME_MSG MACHINE_NAME " prete." #define MSG_SD_INSERTED "Carte inseree" #define MSG_SD_REMOVED "Carte retiree" @@ -46,9 +52,9 @@ #define MSG_FAN_SPEED "Vite. ventilateur" #define MSG_FLOW "Flux" #define MSG_CONTROL "Controler" -#define MSG_MIN " \002 Min" -#define MSG_MAX " \002 Max" -#define MSG_FACTOR " \002 Facteur" +#define MSG_MIN LCD_STR_THERMOMETER " Min" +#define MSG_MAX LCD_STR_THERMOMETER " Max" +#define MSG_FACTOR LCD_STR_THERMOMETER " Facteur" #define MSG_AUTOTEMP "Temp. Auto." #define MSG_ON "Marche " #define MSG_OFF "Arret" @@ -76,7 +82,7 @@ #define MSG_TEMPERATURE "Temperature" #define MSG_MOTION "Mouvement" #define MSG_VOLUMETRIC "Filament" -#define MSG_VOLUMETRIC_ENABLED "E in mm3" +#define MSG_VOLUMETRIC_ENABLED "E in mm3" #define MSG_FILAMENT_SIZE_EXTRUDER_0 "Fil. Dia. 1" #define MSG_FILAMENT_SIZE_EXTRUDER_1 "Fil. Dia. 2" #define MSG_FILAMENT_SIZE_EXTRUDER_2 "Fil. Dia. 3" @@ -118,6 +124,8 @@ #define MSG_BABYSTEP_Y "Babystep Y" #define MSG_BABYSTEP_Z "Babystep Z" #define MSG_ENDSTOP_ABORT "Butee abandon" +#define MSG_END_HOUR "heures" +#define MSG_END_MINUTE "minutes" #ifdef DELTA_CALIBRATION_MENU #define MSG_DELTA_CALIBRATE "Delta Calibration" diff --git a/Marlin/language_it.h b/Marlin/language_it.h index b0b644231..752107376 100644 --- a/Marlin/language_it.h +++ b/Marlin/language_it.h @@ -2,12 +2,17 @@ * Italian * * LCD Menu Messages - * Please note these are limited to 17 characters! + * See also documentation/LCDLanguageFont.md * */ #ifndef LANGUAGE_IT_H #define LANGUAGE_IT_H +#define MAPPER_NON +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_1 + #define WELCOME_MSG MACHINE_NAME " pronto." #define MSG_SD_INSERTED "SD Card inserita" #define MSG_SD_REMOVED "SD Card rimossa" @@ -46,9 +51,9 @@ #define MSG_FAN_SPEED "Ventola" #define MSG_FLOW "Flusso" #define MSG_CONTROL "Controllo" -#define MSG_MIN " \002 Min" -#define MSG_MAX " \002 Max" -#define MSG_FACTOR " \002 Fact" +#define MSG_MIN LCD_STR_THERMOMETER " Min" +#define MSG_MAX LCD_STR_THERMOMETER " Max" +#define MSG_FACTOR LCD_STR_THERMOMETER " Fact" #define MSG_AUTOTEMP "Autotemp" #define MSG_ON "ON " #define MSG_OFF "OFF" @@ -119,6 +124,8 @@ #define MSG_BABYSTEP_Y "Babystep Y" #define MSG_BABYSTEP_Z "Babystep Z" #define MSG_ENDSTOP_ABORT "Finecorsa abort" +#define MSG_END_HOUR "ore" +#define MSG_END_MINUTE "minuti" #ifdef DELTA_CALIBRATION_MENU #define MSG_DELTA_CALIBRATE "Calibraz. Delta" diff --git a/Marlin/language_kana.h b/Marlin/language_kana.h new file mode 100644 index 000000000..9a05b6bbe --- /dev/null +++ b/Marlin/language_kana.h @@ -0,0 +1,149 @@ +/** + * Japanese (Kana) + * + * LCD Menu Messages + * See also documentation/LCDLanguageFont.md + * + */ + +#ifndef LANGUAGE_KANA_H +#define LANGUAGE_KANA_H + +#define MAPPER_NON +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_KANA + +// 片仮名表示定義 +#define WELCOME_MSG MACHINE_NAME " ready." +#define MSG_SD_INSERTED "\xb6\xb0\xc4\xde\x20\xbf\xb3\xc6\xad\xb3\xbb\xda\xcf\xbc\xc0" // "Card inserted" +#define MSG_SD_REMOVED "\xb6\xb0\xc4\xde\xb6xde\xb1\xd8\xcf\xbe\xdd" // "Card removed" +#define MSG_MAIN "\xd2\xb2\xdd" // "Main" +#define MSG_AUTOSTART "\xbc\xde\xc4\xde\xb3\xb6\xb2\xbc" // "Autostart" +#define MSG_DISABLE_STEPPERS "\xd3\xb0\xc0\xb0\xc3\xde\xdd\xb9\xde\xdd\x20\xb5\xcc" // "Disable steppers" +#define MSG_AUTO_HOME "\xb9\xde\xdd\xc3\xdd\xc6\xb2\xc4\xde\xb3" // "Auto home" +#define MSG_SET_HOME_OFFSETS "\xb7\xbc\xde\xad\xdd\xb5\xcc\xbe\xaf\xc4\xbe\xaf\xc3\xb2" // "Set home offsets" +#define MSG_SET_ORIGIN "\xb7\xbc\xde\xad\xdd\xbe\xaf\xc4" // "Set origin" +#define MSG_PREHEAT_PLA "PLA \xd6\xc8\xc2" // "Preheat PLA" +#define MSG_PREHEAT_PLA_N MSG_PREHEAT_PLA " " +#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " \xbd\xcd\xde\xc3" // " All" +#define MSG_PREHEAT_PLA_BEDONLY MSG_PREHEAT_PLA " \xcd\xde\xaf\xc4\xde" // "Bed" +#define MSG_PREHEAT_PLA_SETTINGS MSG_PREHEAT_PLA " \xbe\xaf\xc3\xb2" // "conf" +#define MSG_PREHEAT_ABS "ABS \xd6\xc8\xc2" // "Preheat ABS" +#define MSG_PREHEAT_ABS_N MSG_PREHEAT_ABS " " +#define MSG_PREHEAT_ABS_ALL MSG_PREHEAT_ABS " \xbd\xcd\xde\xc3" // " All" +#define MSG_PREHEAT_ABS_BEDONLY MSG_PREHEAT_ABS " \xcd\xde\xaf\xc4\xde" // "Bed" +#define MSG_PREHEAT_ABS_SETTINGS MSG_PREHEAT_ABS " \xbe\xaf\xc3\xb2" // "conf" +#define MSG_COOLDOWN "\xb6\xc8\xc2\xc3\xb2\xbc" // "Cooldown" +#define MSG_SWITCH_PS_ON "\xc3\xde\xdd\xb9\xdd\xde\x20\xb5\xdd" // "Switch power on" +#define MSG_SWITCH_PS_OFF "\xc3\xde\xdd\xb9\xdd\xde\x20\xb5\xcc" // "Switch power off" +#define MSG_EXTRUDE "\xb5\xbc\xc0\xde\xbc" // "Extrude" +#define MSG_RETRACT "\xd8\xc4\xd7\xb8\xc4" // "Retract" +#define MSG_MOVE_AXIS "\xbc\xde\xb8\xb2\xc4\xde\xb3" // "Move axis" +#define MSG_MOVE_X "X\xbc\xde\xb8\x20\xb2\xc4\xde\xb3" // "Move X" +#define MSG_MOVE_Y "Y\xbc\xde\xb8\x20\xb2\xc4\xde\xb3" // "Move Y" +#define MSG_MOVE_Z "Z\xbc\xde\xb8\x20\xb2\xc4\xde\xb3" // "Move Z" +#define MSG_MOVE_E "\xb4\xb8\xbd\xc4\xd9\xb0\xc0\xde\xb0" // "Extruder" +#define MSG_MOVE_01MM "0.1mm \xb2\xc4\xde\xb3" // "Move 0.1mm" +#define MSG_MOVE_1MM " 1mm \xb2\xc4\xde\xb3" // "Move 1mm" +#define MSG_MOVE_10MM " 10mm \xb2\xc4\xde\xb3" // "Move 10mm" +#define MSG_SPEED "\xbd\xcb\xdf\xb0\xc4\xde" // "Speed" +#define MSG_NOZZLE "\xc9\xbd\xde\xd9" // "Nozzle" +#define MSG_BED "\xcd\xde\xaf\xc4\xde" // "Bed" +#define MSG_FAN_SPEED "\xcc\xa7\xdd\xbf\xb8\xc4\xde" // "Fan speed" +#define MSG_FLOW "\xb5\xb8\xd8\xd8\xae\xb3" // "Flow" +#define MSG_CONTROL "\xba\xdd\xc4\xdb\xb0\xd9" // "Control" +#define MSG_MIN LCD_STR_THERMOMETER " Min" +#define MSG_MAX LCD_STR_THERMOMETER " Max" +#define MSG_FACTOR LCD_STR_THERMOMETER " Fact" +#define MSG_AUTOTEMP "\xbc\xde\xc4\xde\xb3\xb5\xdd\xc4\xde" // "Autotemp" +#define MSG_ON "On " +#define MSG_OFF "Off" +#define MSG_PID_P "PID-P" +#define MSG_PID_I "PID-I" +#define MSG_PID_D "PID-D" +#define MSG_PID_C "PID-C" +#define MSG_ACC "\xb6\xbf\xb8\xc4\xde" // "Accel" +#define MSG_VXY_JERK "Vxy-jerk" +#define MSG_VZ_JERK "Vz-jerk" +#define MSG_VE_JERK "Ve-jerk" +#define MSG_VMAX "Vmax " +#define MSG_X "x" +#define MSG_Y "y" +#define MSG_Z "z" +#define MSG_E "e" +#define MSG_VMIN "Vmin" +#define MSG_VTRAV_MIN "VTrav min" +#define MSG_AMAX "Amax " +#define MSG_A_RETRACT "A-retract" +#define MSG_XSTEPS "Xsteps/mm" +#define MSG_YSTEPS "Ysteps/mm" +#define MSG_ZSTEPS "Zsteps/mm" +#define MSG_ESTEPS "Esteps/mm" +#define MSG_TEMPERATURE "\xb5\xdd\xc4\xde" // "Temperature" +#define MSG_MOTION "\xb3\xba\xde\xb7\xbe\xaf\xc3\xb2" // "Motion" +#define MSG_VOLUMETRIC "\xcc\xa8\xd7\xd2\xdd\xc4" // "Filament" +#define MSG_VOLUMETRIC_ENABLED "E in mm3" +#define MSG_FILAMENT_SIZE_EXTRUDER_0 "Fil. Dia. 1" +#define MSG_FILAMENT_SIZE_EXTRUDER_1 "Fil. Dia. 2" +#define MSG_FILAMENT_SIZE_EXTRUDER_2 "Fil. Dia. 3" +#define MSG_FILAMENT_SIZE_EXTRUDER_3 "Fil. Dia. 4" +#define MSG_CONTRAST "LCD\xba\xdd\xc4\xd7\xbd\xc4" // "LCD contrast" +#define MSG_STORE_EPROM "\xd2\xd3\xd8\xcd\xb6\xb8\xc9\xb3" // "Store memory" +#define MSG_LOAD_EPROM "\xd2\xd3\xd8\xb6\xd7\xd6\xd0\ba\xd0" // "Load memory" +#define MSG_RESTORE_FAILSAFE "\xbe\xaf\xc3\xb2\xd8\xbe\xaf\xc4" // "Restore failsafe" +#define MSG_REFRESH "\xd8\xcc\xda\xaf\xbc\xad" // "Refresh" +#define MSG_WATCH "\xb2\xdd\xcc\xab" // "Info screen" +#define MSG_PREPARE "\xbc\xde\xad\xdd\xcb\xde\xbe\xaf\xc3\xb2" // "Prepare" +#define MSG_TUNE "\xc1\xae\xb3\xbe\xb2" // "Tune" +#define MSG_PAUSE_PRINT "\xb2\xc1\xbc\xde\xc3\xb2\xbc" // "Pause print" +#define MSG_RESUME_PRINT "\xcc\xdf\xd8\xdd\xc4\xbb\xb2\xb6\xb2" // "Resume print" +#define MSG_STOP_PRINT "\xcc\xdf\xd8\xdd\xc4\xc3\xb2\xbc" // "Stop print" +#define MSG_CARD_MENU "SD\xb6\xb0\xc4\xde\xb6\xd7\xcc\xdf\xd8\xdd\xc4" // "Print from SD" +#define MSG_NO_CARD "SD\xb6\xb0\xc4\xde\xb6\xde\xb1\xd8\xcf\xbe\xdd" // "No SD card" +#define MSG_DWELL "\xbd\xd8\xb0\xcc\xdf" // "Sleep..." +#define MSG_USERWAIT "\xbc\xca\xde\xd7\xb9\xb5\xcf\xc1\xb8\xc0\xde\xbb\xb2" // "Wait for user..." +#define MSG_RESUMING "\xcc\xdf\xd8\xdd\xc4\xbb\xb2\xb6\xb2" // "Resuming print" +#define MSG_PRINT_ABORTED "\xcc\xdf\xd8\xdd\xc4\xc1\xad\xb3\xbc\xbb\xda\xcf\xbc\xc0" // "Print aborted" +#define MSG_NO_MOVE "\xb3\xba\xde\xb7\xcf\xbe\xdd" // "No move." +#define MSG_KILLED "\xbc\xae\xb3\xb7\xae" // "KILLED. " +#define MSG_STOPPED "\xc3\xb2\xbc\xbc\xcf\xbc\xc0" // "STOPPED. " +#define MSG_CONTROL_RETRACT "Retract mm" +#define MSG_CONTROL_RETRACT_SWAP "Swap Re.mm" +#define MSG_CONTROL_RETRACTF "Retract V" +#define MSG_CONTROL_RETRACT_ZLIFT "Hop mm" +#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm" +#define MSG_CONTROL_RETRACT_RECOVER_SWAP "S UnRet+mm" +#define MSG_CONTROL_RETRACT_RECOVERF "UnRet V" +#define MSG_AUTORETRACT "AutoRetr." +#define MSG_FILAMENTCHANGE "\xcc\xa8\xd7\xd2\xdd\xc4\xba\xb3\xb6\xdd" // "Change filament" +#define MSG_INIT_SDCARD "SD\xb6\xb0\xc4\xde\xbb\xb2\xd6\xd0\xba\xd0" // "Init. SD card" +#define MSG_CNG_SDCARD "SD\xb6\xb0\xc4\xde\xba\xb3\xb6\xdd" // "Change SD card" +#define MSG_ZPROBE_OUT "Z\xcc\xdf\xdb\xb0\xcc\xde \xcd\xde\xaf\xc4\xee\xb6\xde\xb2" // "Z probe out. bed" +#define MSG_POSITION_UNKNOWN "\xb9\xde\xdd\xc3\xdd\xcaXY\xb2\xc4\xde\xb3\xba\xdeZ" // "Home X/Y before Z" +#define MSG_ZPROBE_ZOFFSET "Z\xb5\xcc\xbe\xaf\xc4" // "Z Offset" +#define MSG_BABYSTEP_X "\xcb\xde\xc4\xde\xb3 X" // "Babystep X" +#define MSG_BABYSTEP_Y "\xcb\xde\xc4\xde\xb3 Y" // "Babystep Y" +#define MSG_BABYSTEP_Z "\xcb\xde\xc4\xde\xb3 Z" // "Babystep Z" +#define MSG_ENDSTOP_ABORT "Endstop abort" +#define MSG_END_HOUR "hours" +#define MSG_END_MINUTE "minutes" + +/* These are from language.h. PLEASE DON'T TRANSLATE! All translatable messages can be found in language_en.h +#define MSG_HEATING "\xb6\xc8\xc2\xc1\xad\xb3..." // "Heating..." +#define MSG_HEATING_COMPLETE "\xb6\xc8\xc2\xb6\xdd\xd8x\xae\xb3" // "Heating done." +#define MSG_BED_HEATING "\xcd\xde\xaf\xc4\xde\xb6\xc8\xc2\xc1\xad\xb3" // "Bed Heating." +#define MSG_BED_DONE "\xcd\xde\xaf\xc4\xde\xb6\xc8\xc2\xb6\xdd\xd8x\xae\xb3" // "Bed done." +#define MSG_ENDSTOPS_HIT "endstops hit: " + ^ typho +*/ + +#ifdef DELTA_CALIBRATION_MENU + #define MSG_DELTA_CALIBRATE "Delta Calibration" + #define MSG_DELTA_CALIBRATE_X "Calibrate X" + #define MSG_DELTA_CALIBRATE_Y "Calibrate Y" + #define MSG_DELTA_CALIBRATE_Z "Calibrate Z" + #define MSG_DELTA_CALIBRATE_CENTER "Calibrate Center" +#endif // DELTA_CALIBRATION_MENU + +#endif // LANGUAGE_KANA_H diff --git a/Marlin/language_kana_utf8.h b/Marlin/language_kana_utf8.h new file mode 100644 index 000000000..4bb58a1ed --- /dev/null +++ b/Marlin/language_kana_utf8.h @@ -0,0 +1,144 @@ +/** + * Japanese (Kana UTF8 version) + * + * LCD Menu Messages + * See also documentation/LCDLanguageFont.md + * + */ + +#ifndef LANGUAGE_KANA_UTF_H +#define LANGUAGE_KANA_UTF_H + +#define MAPPER_E382E383 +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_KANA + +// This is very crude replacement of the codes used in language_kana.h from somebody who really does not know what he is doing. +// Just to show the potential benefit of unicode. +// This translation can be improved by using the full charset of unicode codeblock U+30A0 to U+30FF. + +// 片仮名表示定義 +#define WELCOME_MSG MACHINE_NAME " ready." +#define MSG_SD_INSERTED "セード ンウニユウアレマシタ" // "Card inserted" +#define MSG_SD_REMOVED "セードゼアリマセン" // "Card removed" +#define MSG_MAIN "ナイン" // "Main" +#define MSG_AUTOSTART "ヅドウセイシ" // "Autostart" +#define MSG_DISABLE_STEPPERS "モーターデンゲン オフ" // "Disable steppers" +#define MSG_AUTO_HOME "ゲンテンニイドウ" // "Auto home" +#define MSG_SET_HOME_OFFSETS "キヅユンオフセツトセツテイ" // "Set home offsets" +#define MSG_SET_ORIGIN "キヅユンセツト" // "Set origin" +#define MSG_PREHEAT_PLA "PLA ヨネシ" // "Preheat PLA" +#define MSG_PREHEAT_PLA_N MSG_PREHEAT_PLA " " +#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " スベテ" // " All" +#define MSG_PREHEAT_PLA_BEDONLY MSG_PREHEAT_PLA " ベツド" // "Bed" +#define MSG_PREHEAT_PLA_SETTINGS MSG_PREHEAT_PLA " セツテイ" // "conf" +#define MSG_PREHEAT_ABS "ABS ヨネシ" // "Preheat ABS" +#define MSG_PREHEAT_ABS_N MSG_PREHEAT_ABS " " +#define MSG_PREHEAT_ABS_ALL MSG_PREHEAT_ABS " スベテ" // " All" +#define MSG_PREHEAT_ABS_BEDONLY MSG_PREHEAT_ABS " ベツド" // "Bed" +#define MSG_PREHEAT_ABS_SETTINGS MSG_PREHEAT_ABS " セツテイ" // "conf" +#define MSG_COOLDOWN "セネシテイシ" // "Cooldown" +#define MSG_SWITCH_PS_ON "デンケゾ オン" // "Switch power on" +#define MSG_SWITCH_PS_OFF "デンケゾ オフ" // "Switch power off" +#define MSG_EXTRUDE "オシダシ" // "Extrude" +#define MSG_RETRACT "リトラケト" // "Retract" +#define MSG_MOVE_AXIS "ヅケイドウ" // "Move axis" +#define MSG_MOVE_X "Xヅケ イドウ" // "Move X" +#define MSG_MOVE_Y "Yヅケ イドウ" // "Move Y" +#define MSG_MOVE_Z "Zヅケ イドウ" // "Move Z" +#define MSG_MOVE_E "エケストルーダー" // "Extruder" +#define MSG_MOVE_01MM "0.1mm イドウ" // "Move 0.1mm" +#define MSG_MOVE_1MM " 1mm イドウ" // "Move 1mm" +#define MSG_MOVE_10MM " 10mm イドウ" // "Move 10mm" +#define MSG_SPEED "スヒ゜ード" // "Speed" +#define MSG_NOZZLE "ノズル" // "Nozzle" +#define MSG_BED "ベツド" // "Bed" +#define MSG_FAN_SPEED "ファンンケド" // "Fan speed" +#define MSG_FLOW "オケリリョウ" // "Flow" +#define MSG_CONTROL "コントロール" // "Control" +#define MSG_MIN LCD_STR_THERMOMETER " Min" +#define MSG_MAX LCD_STR_THERMOMETER " Max" +#define MSG_FACTOR LCD_STR_THERMOMETER " Fact" +#define MSG_AUTOTEMP "ヅドウオンド" // "Autotemp" +#define MSG_ON "On " +#define MSG_OFF "Off" +#define MSG_PID_P "PID-P" +#define MSG_PID_I "PID-I" +#define MSG_PID_D "PID-D" +#define MSG_PID_C "PID-C" +#define MSG_ACC "センケド" // "Accel" +#define MSG_VXY_JERK "Vxy-jerk" +#define MSG_VZ_JERK "Vz-jerk" +#define MSG_VE_JERK "Ve-jerk" +#define MSG_VMAX "Vmax " +#define MSG_X "x" +#define MSG_Y "y" +#define MSG_Z "z" +#define MSG_E "e" +#define MSG_VMIN "Vmin" +#define MSG_VTRAV_MIN "VTrav min" +#define MSG_AMAX "Amax " +#define MSG_A_RETRACT "A-retract" +#define MSG_XSTEPS "Xsteps/mm" +#define MSG_YSTEPS "Ysteps/mm" +#define MSG_ZSTEPS "Zsteps/mm" +#define MSG_ESTEPS "Esteps/mm" +#define MSG_TEMPERATURE "オンド" // "Temperature" +#define MSG_MOTION "ウゴキセツテイ" // "Motion" +#define MSG_VOLUMETRIC "フィラナント" // "Filament" +#define MSG_VOLUMETRIC_ENABLED "E in mm3" +#define MSG_FILAMENT_SIZE_EXTRUDER_0 "Fil. Dia. 1" +#define MSG_FILAMENT_SIZE_EXTRUDER_1 "Fil. Dia. 2" +#define MSG_FILAMENT_SIZE_EXTRUDER_2 "Fil. Dia. 3" +#define MSG_FILAMENT_SIZE_EXTRUDER_3 "Fil. Dia. 4" +#define MSG_CONTRAST "LCDコントラスト" // "LCD contrast" +#define MSG_STORE_EPROM "ナモリヘセケノウ" // "Store memory" +#define MSG_LOAD_EPROM "ナモリセラヨミbaミ" // "Load memory" +#define MSG_RESTORE_FAILSAFE "セツテイリセツト" // "Restore failsafe" +#define MSG_REFRESH "リフレツシユ" // "Refresh" +#define MSG_WATCH "インフォ" // "Info screen" +#define MSG_PREPARE "ヅユンゼセツテイ" //"Prepare" +#define MSG_TUNE "チョウセイ" // "Tune" +#define MSG_PAUSE_PRINT "イチヅテイシ" // "Pause print" +#define MSG_RESUME_PRINT "プリントアイセイ" // "Resume print" +#define MSG_STOP_PRINT "プリントテイシ" // "Stop print" +#define MSG_CARD_MENU "SDセードセラプリント" // "Print from SD" +#define MSG_NO_CARD "SDセードゼアリマセン" // "No SD card" +#define MSG_DWELL "スリープ" // "Sleep..." +#define MSG_USERWAIT "シバラケオマチケダアイ" // "Wait for user..." +#define MSG_RESUMING "プリントアイセイ" // "Resuming print" +#define MSG_PRINT_ABORTED "プリントチユウシアレマシタ" // "Print aborted" +#define MSG_NO_MOVE "ウゴキマセン" // "No move." +#define MSG_KILLED "ショウキョ" // "KILLED. " +#define MSG_STOPPED "テイシシマシタ" // "STOPPED. " +#define MSG_CONTROL_RETRACT "Retract mm" +#define MSG_CONTROL_RETRACT_SWAP "Swap Re.mm" +#define MSG_CONTROL_RETRACTF "Retract V" +#define MSG_CONTROL_RETRACT_ZLIFT "Hop mm" +#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm" +#define MSG_CONTROL_RETRACT_RECOVER_SWAP "S UnRet+mm" +#define MSG_CONTROL_RETRACT_RECOVERF "UnRet V" +#define MSG_AUTORETRACT "AutoRetr." +#define MSG_FILAMENTCHANGE "フィラナントコウセン" // "Change filament" +#define MSG_INIT_SDCARD "SDセードアイヨミコミ" // "Init. SD card" +#define MSG_CNG_SDCARD "SDセードコウセン" // "Change SD card" +#define MSG_ZPROBE_OUT "Zプローブ ベツトnゼイ" // "Z probe out. bed" +#define MSG_POSITION_UNKNOWN "ゲンテンハXYイドウゴZ" // "Home X/Y before Z" +#define MSG_ZPROBE_ZOFFSET "Zオフセツト" // "Z Offset" +#define MSG_BABYSTEP_X "ゼドウ X" // "Babystep X" +#define MSG_BABYSTEP_Y "ゼドウ Y" // "Babystep Y" +#define MSG_BABYSTEP_Z "ゼドウ Z" // "Babystep Z" +#define MSG_ENDSTOP_ABORT "Endstop abort" +#define MSG_END_HOUR "hours" +#define MSG_END_MINUTE "minutes" + +#ifdef DELTA_CALIBRATION_MENU + #define MSG_DELTA_CALIBRATE "Delta Calibration" + #define MSG_DELTA_CALIBRATE_X "Calibrate X" + #define MSG_DELTA_CALIBRATE_Y "Calibrate Y" + #define MSG_DELTA_CALIBRATE_Z "Calibrate Z" + #define MSG_DELTA_CALIBRATE_CENTER "Calibrate Center" +#endif // DELTA_CALIBRATION_MENU + +#endif // LANGUAGE_KANA_UTF_H diff --git a/Marlin/language_nl.h b/Marlin/language_nl.h index 7de2f9a8e..4e1ea6de7 100644 --- a/Marlin/language_nl.h +++ b/Marlin/language_nl.h @@ -2,12 +2,17 @@ * Dutch * * LCD Menu Messages - * Please note these are limited to 17 characters! + * See also documentation/LCDLanguageFont.md * */ #ifndef LANGUAGE_NL_H #define LANGUAGE_NL_H +#define MAPPER_NON +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_1 + #define WELCOME_MSG MACHINE_NAME " gereed." #define MSG_SD_INSERTED "Kaart ingestoken" #define MSG_SD_REMOVED "Kaart verwijderd" @@ -46,9 +51,9 @@ #define MSG_FAN_SPEED "Fan snelheid" #define MSG_FLOW "Flow" #define MSG_CONTROL "Control" -#define MSG_MIN " \002 Min" -#define MSG_MAX " \002 Max" -#define MSG_FACTOR " \002 Fact" +#define MSG_MIN LCD_STR_THERMOMETER " Min" +#define MSG_MAX LCD_STR_THERMOMETER " Max" +#define MSG_FACTOR LCD_STR_THERMOMETER " Fact" #define MSG_AUTOTEMP "Autotemp" #define MSG_ON "Aan " #define MSG_OFF "Uit" @@ -118,6 +123,8 @@ #define MSG_BABYSTEP_Y "Babystap Y" #define MSG_BABYSTEP_Z "Babystap Z" #define MSG_ENDSTOP_ABORT "Endstop afbr." +#define MSG_END_HOUR "hours" +#define MSG_END_MINUTE "minutes" #ifdef DELTA_CALIBRATION_MENU #define MSG_DELTA_CALIBRATE "Delta Calibration" diff --git a/Marlin/language_pl.h b/Marlin/language_pl.h index 93ccf4046..5e5d02869 100644 --- a/Marlin/language_pl.h +++ b/Marlin/language_pl.h @@ -2,12 +2,17 @@ * Polish * * LCD Menu Messages - * Please note these are limited to 17 characters! + * See also documentation/LCDLanguageFont.md * */ #ifndef LANGUAGE_PL_H #define LANGUAGE_PL_H +#define MAPPER_NON +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_1 + #define WELCOME_MSG MACHINE_NAME " gotowy." #define MSG_SD_INSERTED "Karta wlozona" #define MSG_SD_REMOVED "Karta usunieta" @@ -46,9 +51,9 @@ #define MSG_FAN_SPEED "Obroty wiatraka" #define MSG_FLOW "Przeplyw" #define MSG_CONTROL "Ustawienia" -#define MSG_MIN " \002 Min" -#define MSG_MAX " \002 Max" -#define MSG_FACTOR " \002 Mnoznik" +#define MSG_MIN LCD_STR_THERMOMETER " Min" +#define MSG_MAX LCD_STR_THERMOMETER " Max" +#define MSG_FACTOR LCD_STR_THERMOMETER " Mnoznik" #define MSG_AUTOTEMP "Auto. temperatura" #define MSG_ON "Wl. " #define MSG_OFF "Wyl." @@ -84,7 +89,7 @@ #define MSG_STORE_EPROM "Zapisz w pamieci" #define MSG_LOAD_EPROM "Wczytaj z pamieci" #define MSG_RESTORE_FAILSAFE "Ustaw. fabryczne" -#define MSG_REFRESH "\004Odswiez" +#define MSG_REFRESH LCD_STR_REFRESH " Odswiez" #define MSG_WATCH "Ekran glowny" #define MSG_PREPARE "Przygotuj" #define MSG_TUNE "Strojenie" @@ -118,6 +123,9 @@ #define MSG_BABYSTEP_Y "Babystep Y" #define MSG_BABYSTEP_Z "Babystep Z" #define MSG_ENDSTOP_ABORT "Blad wyl. kranc." +#define MSG_END_HOUR "hours" +#define MSG_END_MINUTE "minutes" + #ifdef DELTA_CALIBRATION_MENU #define MSG_DELTA_CALIBRATE "Delta Calibration" diff --git a/Marlin/language_pt-br.h b/Marlin/language_pt-br.h index 924b6e4db..90e2ae7ec 100644 --- a/Marlin/language_pt-br.h +++ b/Marlin/language_pt-br.h @@ -2,16 +2,21 @@ * Portuguese (Brazil) * * LCD Menu Messages - * Please note these are limited to 17 characters! + * See also documentation/LCDLanguageFont.md * */ #ifndef LANGUAGE_PT_BR_H #define LANGUAGE_PT_BR_H +#define MAPPER_NON +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_1 + #define WELCOME_MSG MACHINE_NAME " pronto." #define MSG_SD_INSERTED "Cartao inserido" #define MSG_SD_REMOVED "Cartao removido" -#define MSG_MAIN " Menu principal \003" +#define MSG_MAIN " Menu principal" #define MSG_AUTOSTART "Autostart" #define MSG_DISABLE_STEPPERS " Apagar motores" #define MSG_AUTO_HOME "Ir para origen" @@ -20,19 +25,19 @@ #define MSG_PREHEAT_PLA "Pre-aquecer PLA" #define MSG_PREHEAT_PLA_N "Pre-aquecer PLA " #define MSG_PREHEAT_PLA_ALL "Pre-aq. PLA Tudo" -#define MSG_PREHEAT_PLA_BEDONLY "Pre-aq. PLA \002Base" +#define MSG_PREHEAT_PLA_BEDONLY "Pre-aq. PLA " LCD_STR_THERMOMETER "Base" #define MSG_PREHEAT_PLA_SETTINGS "PLA setting" #define MSG_PREHEAT_ABS "Pre-aquecer ABS" #define MSG_PREHEAT_ABS_N "Pre-aquecer ABS " #define MSG_PREHEAT_ABS_ALL "Pre-aq. ABS Tudo" -#define MSG_PREHEAT_ABS_BEDONLY "Pre-aq. ABS \002Base" +#define MSG_PREHEAT_ABS_BEDONLY "Pre-aq. ABS " LCD_STR_THERMOMETER "Base" #define MSG_PREHEAT_ABS_SETTINGS "ABS setting" #define MSG_COOLDOWN "Esfriar" #define MSG_SWITCH_PS_ON "Switch Power On" #define MSG_SWITCH_PS_OFF "Switch Power Off" #define MSG_EXTRUDE "Extrudar" #define MSG_RETRACT "Retrair" -#define MSG_MOVE_AXIS "Mover eixo \x7E" +#define MSG_MOVE_AXIS "Mover eixo" #define MSG_MOVE_X "Move X" #define MSG_MOVE_Y "Move Y" #define MSG_MOVE_Z "Move Z" @@ -41,14 +46,14 @@ #define MSG_MOVE_1MM "Move 1mm" #define MSG_MOVE_10MM "Move 10mm" #define MSG_SPEED "Velocidade" -#define MSG_NOZZLE "\002Nozzle" -#define MSG_BED "\002Base" +#define MSG_NOZZLE LCD_STR_THERMOMETER " Nozzle" +#define MSG_BED LCD_STR_THERMOMETER " Base" #define MSG_FAN_SPEED "Velocidade vento." #define MSG_FLOW "Fluxo" -#define MSG_CONTROL "Controle \003" -#define MSG_MIN "\002 Min" -#define MSG_MAX "\002 Max" -#define MSG_FACTOR "\002 Fact" +#define MSG_CONTROL "Controle" +#define MSG_MIN LCD_STR_THERMOMETER " Min" +#define MSG_MAX LCD_STR_THERMOMETER " Max" +#define MSG_FACTOR LCD_STR_THERMOMETER " Fact" #define MSG_AUTOTEMP "Autotemp" #define MSG_ON "On " #define MSG_OFF "Off" @@ -76,7 +81,7 @@ #define MSG_TEMPERATURE "Temperatura" #define MSG_MOTION "Movimento" #define MSG_VOLUMETRIC "Filament" -#define MSG_VOLUMETRIC_ENABLED "E in mm3" +#define MSG_VOLUMETRIC_ENABLED "E in mm3" #define MSG_FILAMENT_SIZE_EXTRUDER_0 "Fil. Dia. 1" #define MSG_FILAMENT_SIZE_EXTRUDER_1 "Fil. Dia. 2" #define MSG_FILAMENT_SIZE_EXTRUDER_2 "Fil. Dia. 3" @@ -84,10 +89,10 @@ #define MSG_STORE_EPROM "Guardar memoria" #define MSG_LOAD_EPROM "Carregar memoria" #define MSG_RESTORE_FAILSAFE "Rest. de emergen." -#define MSG_REFRESH "\004Recarregar" -#define MSG_WATCH "Monitorar \003" -#define MSG_PREPARE "Preparar \x7E" -#define MSG_TUNE "Tune \x7E" +#define MSG_REFRESH LCD_STR_REFRESH " Recarregar" +#define MSG_WATCH "Monitorar" +#define MSG_PREPARE "Preparar" +#define MSG_TUNE "Tune" #define MSG_PAUSE_PRINT "Pausar impressao" #define MSG_RESUME_PRINT "Resumir impressao" #define MSG_STOP_PRINT "Parar impressao" @@ -118,6 +123,8 @@ #define MSG_BABYSTEP_Y "Babystep Y" #define MSG_BABYSTEP_Z "Babystep Z" #define MSG_ENDSTOP_ABORT "Endstop abort" +#define MSG_END_HOUR "horas" +#define MSG_END_MINUTE "minutos" #ifdef DELTA_CALIBRATION_MENU #define MSG_DELTA_CALIBRATE "Delta Calibration" diff --git a/Marlin/language_pt.h b/Marlin/language_pt.h index 90c4b5c6c..f1335be8a 100644 --- a/Marlin/language_pt.h +++ b/Marlin/language_pt.h @@ -2,16 +2,21 @@ * Portuguese * * LCD Menu Messages - * Please note these are limited to 17 characters! + * See also documentation/LCDLanguageFont.md * */ #ifndef LANGUAGE_PT_H #define LANGUAGE_PT_H +#define MAPPER_NON +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_1 + #define WELCOME_MSG MACHINE_NAME " pronto." #define MSG_SD_INSERTED "Cartao inserido" #define MSG_SD_REMOVED "Cartao removido" -#define MSG_MAIN " Menu principal \003" +#define MSG_MAIN " Menu principal" #define MSG_AUTOSTART "Autostart" #define MSG_DISABLE_STEPPERS " Desligar motores" #define MSG_AUTO_HOME "Ir para home" @@ -20,19 +25,19 @@ #define MSG_PREHEAT_PLA "Pre-aquecer PLA" #define MSG_PREHEAT_PLA_N "Pre-aquecer PLA " #define MSG_PREHEAT_PLA_ALL "Pre-aq. PLA Tudo" -#define MSG_PREHEAT_PLA_BEDONLY "Pre-aq. PLA \002Base" +#define MSG_PREHEAT_PLA_BEDONLY "Pre-aq. PLA " LCD_STR_THERMOMETER "Base" #define MSG_PREHEAT_PLA_SETTINGS "PLA definicoes" #define MSG_PREHEAT_ABS "Pre-aquecer ABS" #define MSG_PREHEAT_ABS_N "Pre-aquecer ABS " #define MSG_PREHEAT_ABS_ALL "Pre-aq. ABS Tudo" -#define MSG_PREHEAT_ABS_BEDONLY "Pre-aq. ABS \002Base" +#define MSG_PREHEAT_ABS_BEDONLY "Pre-aq. ABS " LCD_STR_THERMOMETER "Base" #define MSG_PREHEAT_ABS_SETTINGS "ABS definicoes" #define MSG_COOLDOWN "Arrefecer" #define MSG_SWITCH_PS_ON "Ligar" #define MSG_SWITCH_PS_OFF "Desligar" #define MSG_EXTRUDE "Extrudir" #define MSG_RETRACT "Retrair" -#define MSG_MOVE_AXIS "Mover eixo \x7E" +#define MSG_MOVE_AXIS "Mover eixo" #define MSG_MOVE_X "Mover X" #define MSG_MOVE_Y "Mover Y" #define MSG_MOVE_Z "Mover Z" @@ -41,14 +46,14 @@ #define MSG_MOVE_1MM "Mover 1mm" #define MSG_MOVE_10MM "Mover 10mm" #define MSG_SPEED "Velocidade" -#define MSG_NOZZLE "\002Bico" -#define MSG_BED "\002Base" +#define MSG_NOZZLE LCD_STR_THERMOMETER "Bico" +#define MSG_BED LCD_STR_THERMOMETER "Base" #define MSG_FAN_SPEED "Velocidade do ar." #define MSG_FLOW "Fluxo" -#define MSG_CONTROL "Controlo \003" -#define MSG_MIN "\002 Min" -#define MSG_MAX "\002 Max" -#define MSG_FACTOR "\002 Fact" +#define MSG_CONTROL "Controlo" +#define MSG_MIN LCD_STR_THERMOMETER " Min" +#define MSG_MAX LCD_STR_THERMOMETER " Max" +#define MSG_FACTOR LCD_STR_THERMOMETER " Fact" #define MSG_AUTOTEMP "Autotemp" #define MSG_ON "On " #define MSG_OFF "Off" @@ -76,7 +81,7 @@ #define MSG_TEMPERATURE "Temperatura" #define MSG_MOTION "Movimento" #define MSG_VOLUMETRIC "Filamento" -#define MSG_VOLUMETRIC_ENABLED "E in mm3" +#define MSG_VOLUMETRIC_ENABLED "E in mm3" #define MSG_FILAMENT_SIZE_EXTRUDER_0 "Fil. Diam. 1" #define MSG_FILAMENT_SIZE_EXTRUDER_1 "Fil. Diam. 2" #define MSG_FILAMENT_SIZE_EXTRUDER_2 "Fil. Diam. 3" @@ -84,10 +89,10 @@ #define MSG_STORE_EPROM "Guardar na memoria" #define MSG_LOAD_EPROM "Carregar da memoria" #define MSG_RESTORE_FAILSAFE "Rest. de emergen." -#define MSG_REFRESH "\004Recarregar" -#define MSG_WATCH "Monitorar \003" -#define MSG_PREPARE "Preparar \x7E" -#define MSG_TUNE "Afinar \x7E" +#define MSG_REFRESH LCD_STR_REFRESH " Recarregar" +#define MSG_WATCH "Monitorar" +#define MSG_PREPARE "Preparar" +#define MSG_TUNE "Afinar" #define MSG_PAUSE_PRINT "Pausar impressao" #define MSG_RESUME_PRINT "Resumir impressao" #define MSG_STOP_PRINT "Parar impressao" @@ -118,6 +123,8 @@ #define MSG_BABYSTEP_Y "Babystep Y" #define MSG_BABYSTEP_Z "Babystep Z" #define MSG_ENDSTOP_ABORT "Endstop abort." +#define MSG_END_HOUR "horas" +#define MSG_END_MINUTE "minutos" #ifdef DELTA_CALIBRATION_MENU #define MSG_DELTA_CALIBRATE "Delta Calibracao" diff --git a/Marlin/language_ru.h b/Marlin/language_ru.h index bcab50b79..62cc57e39 100644 --- a/Marlin/language_ru.h +++ b/Marlin/language_ru.h @@ -1,14 +1,17 @@ -/** +/** * Russian * * LCD Menu Messages - * Please note these are limited to 17 characters! + * See also documentation/LCDLanguageFont.md * */ #ifndef LANGUAGE_RU_H #define LANGUAGE_RU_H -#define LANGUAGE_RU +#define MAPPER_D0D1 // For Cyrillic +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT +#define DISPLAY_CHARSET_ISO10646_5 #define WELCOME_MSG MACHINE_NAME " Готов." #define MSG_SD_INSERTED "Карта вставлена" @@ -42,6 +45,7 @@ #define MSG_MOVE_01MM "Move 0.1mm" #define MSG_MOVE_1MM "Move 1mm" #define MSG_MOVE_10MM "Move 10mm" +#define MSG_LEVEL_BED "Настр. уровня кровати" #define MSG_SPEED "Скорость" #define MSG_NOZZLE LCD_STR_THERMOMETER " Фильера" #define MSG_BED LCD_STR_THERMOMETER " Кровать" @@ -120,6 +124,8 @@ #define MSG_BABYSTEP_Y "Babystep Y" #define MSG_BABYSTEP_Z "Babystep Z" #define MSG_ENDSTOP_ABORT "Endstop abort" +#define MSG_END_HOUR "hours" +#define MSG_END_MINUTE "minutes" #ifdef DELTA_CALIBRATION_MENU #define MSG_DELTA_CALIBRATE "Delta Calibration" diff --git a/Marlin/language_test.h b/Marlin/language_test.h new file mode 100644 index 000000000..57505bc13 --- /dev/null +++ b/Marlin/language_test.h @@ -0,0 +1,215 @@ +/** + * TEST + * + * LCD Menu Messages + * See also documentation/LCDLanguageFont.md + * + */ +#ifndef LANGUAGE_TEST_H +#define LANGUAGE_TEST_H + +// Select ONE of the following Mappers. +// They decide what to do with a symbol in the area of [0x80:0xFF]. They take a symbol of this language file and make them point +// into an array with 128 cells, where they'll find the place of the symbol of the font in use. +// +// a.)For ASCII coded Language_xx.h files like (en) there are no occurrences of symbols above 0x7F so no mapper is needed. +// If such a symbol appears it is mapped directly into the font. This is the case for the language files we used until now, with all the STR_XX or +// "\xxx" symbols. All Symbols are only one byte long. +// b.) For Unicoded Language_xx.h files (currently ru, de and kana_utf8 ) the non ASCII [0x00-0x7F] symbols are represented by more then one byte. +// In the case of two bytes the first is pointing to a 'codepage' and the second to a place in the codepage. These codepages contain 64 symbols. +// So two of them can be mapped. For most of the European languages the necessary symbols are contained in the pages C2 and C3. Cyrillic uses D0 +// and D1. +// c.) For katakana (one of the Japanese symbol sets) Unicode uses 3 bytes. Here the second byte also points to a codepage and byte 3 to the symbol. +// I hope the pages E282 and E283 are sufficient to write katakana. +// Kanji (an other Japanese symbol set) uses far more than two codepages. So currently I don't see a chance to map the Unicodes. Its not +// impossible to have a close to direct mapping but will need giant conversion tables and fonts (we don't want to have in a embedded system). + + +#define MAPPER_NON // For direct asci codes ( until now all languages except ru, de, fi, kana_utf8, ... ) +//#define MAPPER_C2C3 // For most European languages when language file is in utf8 +//#define MAPPER_D0D1 // For Cyrillic +//#define MAPPER_E382E383 // For Katakana + +// Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h +//#define SIMULATE_ROMFONT + +// Select the better font for full graphic displays. +//#define DISPLAY_CHARSET_ISO10646_1 +//#define DISPLAY_CHARSET_ISO10646_5 +//#define DISPLAY_CHARSET_ISO10646_KANA + + + +// next 5 lines select variants in this file only +#define DISPLAYTEST +//#define WEST +//#define CYRIL +//#define KANA + + +// TESTSTRINGS + +#define STRG_ASCII_2 " !\"#$%&'()*+,-./" +#define STRG_ASCII_3 "0123456789:;<=>?" +#define STRG_ASCII_4 "@ABCDEFGHIJKLMNO" +#define STRG_ASCII_5 "PQRSTUVWXYZ[\]^_" +#define STRG_ASCII_6 "`abcdefghijklmno" +#define STRG_ASCII_7 "pqrstuvwxyz{|}~" + +#define STRG_C2_8 "" +#define STRG_C2_9 "" +#define STRG_C2_a " ¡¢£¤¥¦§¨©ª«¬­®¯" +#define STRG_C2_b "°±²³´µ¶·¸¹º»¼½¾¿" +#define STRG_C3_8 "ÈÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ" +#define STRG_C3_9 "ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß" +#define STRG_C3_a "àáâãäåæçèéêëìíîï" +#define STRG_C3_b "ðñòóôõö÷øùúûüýþÿ" + +#define STRG_D0_8 "ЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏ" +#define STRG_D0_9 "АБВГДЕЖЗИЙКЛМНОП" +#define STRG_D0_a "РСТУФХЦЧШЩЪЫЬЭЮЯ" +#define STRG_D0_b "абвгдежзийклмноп" +#define STRG_D1_8 "рстуфхцчшщъыьэюя" +#define STRG_D1_9 "ѐёђѓєѕіїјљњћќѝўџ" +#define STRG_D1_a "ѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯ" +#define STRG_D1_b "ѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿ" + +#define STRG_E382_8 "よめもゃやゅゆょよらりるれろゎわ" +#define STRG_E382_9 "ゐゑをんゔゕゖ゗゘゙゚゛ ゜ゝゞゟ" +#define STRG_E382_a "゠ァアィイゥウェエォオカガキギク" +#define STRG_E382_b "グケゲコゴサザシジスズセゼソゾタ" +#define STRG_E383_8 "トチヂッツヅテデトドナニヌネノハ" +#define STRG_E383_9 "バパヒビピフブプヘベペホボポマミ" +#define STRG_E383_a "ムメモャヤュユョヨラリルレロヮワ" +#define STRG_E383_b "ヰヱヲンヴヵヶヷヸヹヺ・ーヽヾヿ" + +#define STRG_OKTAL_0 "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017" +#define STRG_OKTAL_1 "\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define STRG_OKTAL_2 "\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057" +#define STRG_OKTAL_3 "\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077" +#define STRG_OKTAL_4 "\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117" +#define STRG_OKTAL_5 "\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137" +#define STRG_OKTAL_6 "\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157" +#define STRG_OKTAL_7 "\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177" +#define STRG_OKTAL_8 "\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217" +#define STRG_OKTAL_9 "\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237" +#define STRG_OKTAL_a "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257" +#define STRG_OKTAL_b "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277" +#define STRG_OKTAL_c "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317" +#define STRG_OKTAL_d "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337" +#define STRG_OKTAL_e "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357" +#define STRG_OKTAL_f "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377" + +#ifdef DISPLAYTEST + #define WELCOME_MSG "Language TEST" + + #define MSG_WATCH "Display test" + #define MSG_PREPARE STRG_OKTAL_b + #define MSG_CONTROL STRG_OKTAL_c +#endif + +#ifdef WEST + #define WELCOME_MSG "Language TEST" + + #define MSG_WATCH "\001\002\003\004\005\006\007\010\011" + #define MSG_PREPARE "UTF8" + #define MSG_CONTROL "ASCII" + + //#define MSG_MAIN ".." + #define MSG_DISABLE_STEPPERS STRG_C2_8 + #define MSG_AUTO_HOME STRG_C2_9 + #define MSG_SET_HOME_OFFSETS STRG_C2_a + #define MSG_PREHEAT_PLA STRG_C2_b + #define MSG_PREHEAT_ABS STRG_C3_8 + #define MSG_COOLDOWN STRG_C3_9 + #define MSG_SWITCH_PS_OFF STRG_C3_a + #define MSG_MOVE_AXIS STRG_C3_b + + #define MSG_MAIN STRG_OKTAL_2 + #define MSG_TEMPERATURE STRG_OKTAL_3 + #define MSG_MOTION STRG_OKTAL_4 + #define MSG_VOLUMETRIC STRG_OKTAL_5 + #define MSG_CONTRAST STRG_OKTAL_6 + #define MSG_RESTORE_FAILSAFE STRG_OKTAL_7 + + #define MSG_NOZZLE STRG_OKTAL_8 + #define MSG_FAN_SPEED STRG_OKTAL_9 + #define MSG_AUTOTEMP STRG_OKTAL_a + #define MSG_MIN STRG_OKTAL_b + #define MSG_MAX STRG_OKTAL_c + #define MSG_FACTOR STRG_OKTAL_d + #define MSG_PID_P STRG_OKTAL_e + #define MSG_PID_I STRG_OKTAL_f + +#endif + +#ifdef CYRIL + #define WELCOME_MSG "Language TEST" + + #define MSG_WATCH "\001\002\003\004\005\006\007\010\011" + #define MSG_PREPARE "UTF8" + #define MSG_CONTROL "ASCII" + + //#define MSG_MAIN ".." + #define MSG_DISABLE_STEPPERS STRG_D0_8 + #define MSG_AUTO_HOME STRG_D0_9 + #define MSG_SET_HOME_OFFSETS STRG_D0_a + #define MSG_PREHEAT_PLA STRG_D0_b + #define MSG_PREHEAT_ABS STRG_D1_8 + #define MSG_COOLDOWN STRG_D1_9 + #define MSG_SWITCH_PS_OFF STRG_D1_a + #define MSG_MOVE_AXIS STRG_D1_b + + #define MSG_MAIN STRG_OKTAL_2 + #define MSG_TEMPERATURE STRG_OKTAL_3 + #define MSG_MOTION STRG_OKTAL_4 + #define MSG_VOLUMETRIC STRG_OKTAL_5 + #define MSG_CONTRAST STRG_OKTAL_6 + #define MSG_RESTORE_FAILSAFE STRG_OKTAL_7 + + #define MSG_NOZZLE STRG_OKTAL_8 + #define MSG_FAN_SPEED STRG_OKTAL_9 + #define MSG_AUTOTEMP STRG_OKTAL_a + #define MSG_MIN STRG_OKTAL_b + #define MSG_MAX STRG_OKTAL_c + #define MSG_FACTOR STRG_OKTAL_d + #define MSG_PID_P STRG_OKTAL_e + #define MSG_PID_I STRG_OKTAL_f + +#endif + +#if defined( KANA ) + #define WELCOME_MSG "Language TEST" + + #define MSG_WATCH "\001\002\003\004\005\006\007\010\011" + #define MSG_PREPARE "UTF8" + #define MSG_CONTROL "ASCII" + + //#define MSG_MAIN ".." + #define MSG_DISABLE_STEPPERS STRG_E382_8 + #define MSG_AUTO_HOME STRG_E382_9 + #define MSG_SET_HOME_OFFSETS STRG_E382_a + #define MSG_PREHEAT_PLA STRG_E382_b + #define MSG_PREHEAT_ABS STRG_E383_8 + #define MSG_COOLDOWN STRG_E383_9 + #define MSG_SWITCH_PS_OFF STRG_E383_a + #define MSG_MOVE_AXIS STRG_E383_b + + #define MSG_MAIN STRG_OKTAL_2 + #define MSG_TEMPERATURE STRG_OKTAL_3 + #define MSG_MOTION STRG_OKTAL_4 + #define MSG_VOLUMETRIC STRG_OKTAL_5 + #define MSG_CONTRAST STRG_OKTAL_6 + #define MSG_RESTORE_FAILSAFE STRG_OKTAL_7 + + #define MSG_NOZZLE STRG_OKTAL_8 + #define MSG_FAN_SPEED STRG_OKTAL_9 + #define MSG_AUTOTEMP STRG_OKTAL_a + #define MSG_MIN STRG_OKTAL_b + #define MSG_MAX STRG_OKTAL_c + #define MSG_FACTOR STRG_OKTAL_d + #define MSG_PID_P STRG_OKTAL_e + #define MSG_PID_I STRG_OKTAL_f +#endif + +#endif // LANGUAGE_TEST_H diff --git a/Marlin/mesh_bed_leveling.cpp b/Marlin/mesh_bed_leveling.cpp index b383fe589..a48a6e619 100644 --- a/Marlin/mesh_bed_leveling.cpp +++ b/Marlin/mesh_bed_leveling.cpp @@ -1,20 +1,16 @@ #include "mesh_bed_leveling.h" -#if defined(MESH_BED_LEVELING) +#ifdef MESH_BED_LEVELING -mesh_bed_leveling mbl; + mesh_bed_leveling mbl; -mesh_bed_leveling::mesh_bed_leveling() { - reset(); -} - -void mesh_bed_leveling::reset() { - for (int y=0; y get_x(i) && i < MESH_NUM_X_POINTS-1) { - i++; - } - return i-1; + int i = 1; + while (x > get_x(i) && i < MESH_NUM_X_POINTS-1) i++; + return i - 1; } int select_y_index(float y) { - int i = 1; - while (y > get_y(i) && i < MESH_NUM_Y_POINTS-1) { - i++; - } - return i-1; + int i = 1; + while (y > get_y(i) && i < MESH_NUM_Y_POINTS - 1) i++; + return i - 1; } float calc_z0(float a0, float a1, float z1, float a2, float z2) { - float delta_z = (z2 - z1)/(a2 - a1); - float delta_a = a0 - a1; - return z1 + delta_a * delta_z; + float delta_z = (z2 - z1)/(a2 - a1); + float delta_a = a0 - a1; + return z1 + delta_a * delta_z; } float get_z(float x0, float y0) { - int x_index = select_x_index(x0); - int y_index = select_y_index(y0); - float z1 = calc_z0(x0, - get_x(x_index), z_values[y_index][x_index], - get_x(x_index+1), z_values[y_index][x_index+1]); - float z2 = calc_z0(x0, - get_x(x_index), z_values[y_index+1][x_index], - get_x(x_index+1), z_values[y_index+1][x_index+1]); - float z0 = calc_z0(y0, - get_y(y_index), z1, - get_y(y_index+1), z2); - return z0; + int x_index = select_x_index(x0); + int y_index = select_y_index(y0); + float z1 = calc_z0(x0, + get_x(x_index), z_values[y_index][x_index], + get_x(x_index+1), z_values[y_index][x_index+1]); + float z2 = calc_z0(x0, + get_x(x_index), z_values[y_index+1][x_index], + get_x(x_index+1), z_values[y_index+1][x_index+1]); + float z0 = calc_z0(y0, + get_y(y_index), z1, + get_y(y_index+1), z2); + return z0; } -}; + }; -extern mesh_bed_leveling mbl; + extern mesh_bed_leveling mbl; #endif // MESH_BED_LEVELING diff --git a/Marlin/pins.h b/Marlin/pins.h index 939dab5e6..e5af0af17 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -127,10 +127,13 @@ #define _E3_PINS #if EXTRUDERS > 1 + #undef _E1_PINS #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, HEATER_1_PIN, analogInputToDigitalPin(TEMP_1_PIN), #if EXTRUDERS > 2 + #undef _E2_PINS #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, HEATER_2_PIN, analogInputToDigitalPin(TEMP_2_PIN), #if EXTRUDERS > 3 + #undef _E3_PINS #define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, HEATER_3_PIN, analogInputToDigitalPin(TEMP_3_PIN), #endif #endif @@ -167,17 +170,27 @@ #endif #ifdef DISABLE_MAX_ENDSTOPS + #undef X_MAX_PIN + #undef Y_MAX_PIN + #undef Z_MAX_PIN #define X_MAX_PIN -1 #define Y_MAX_PIN -1 #define Z_MAX_PIN -1 #endif #ifdef DISABLE_MIN_ENDSTOPS + #undef X_MIN_PIN + #undef Y_MIN_PIN + #undef Z_MIN_PIN #define X_MIN_PIN -1 #define Y_MIN_PIN -1 #define Z_MIN_PIN -1 #endif +#if defined(DISABLE_Z_PROBE_ENDSTOP) || !defined(Z_PROBE_ENDSTOP) // Allow code to compile regardless of Z_PROBE_ENDSTOP setting. + #define Z_PROBE_PIN -1 +#endif + #ifdef DISABLE_XMAX_ENDSTOP #undef X_MAX_PIN #define X_MAX_PIN -1 @@ -207,8 +220,11 @@ #define Z_MIN_PIN -1 #endif -#define SENSITIVE_PINS { 0, 1, X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, PS_ON_PIN, \ - HEATER_BED_PIN, FAN_PIN, \ +#define SENSITIVE_PINS { 0, 1, \ + X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, \ + Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, \ + Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_PROBE_PIN, \ + PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, \ _E0_PINS _E1_PINS _E2_PINS _E3_PINS \ analogInputToDigitalPin(TEMP_BED_PIN) \ } diff --git a/Marlin/pins_3DRAG.h b/Marlin/pins_3DRAG.h index 9db6b56e4..fa54eea61 100644 --- a/Marlin/pins_3DRAG.h +++ b/Marlin/pins_3DRAG.h @@ -4,18 +4,25 @@ #include "pins_RAMPS_13.h" +#undef Z_ENABLE_PIN #define Z_ENABLE_PIN 63 +#undef X_MAX_PIN +#undef Y_MAX_PIN +#undef Z_MAX_PIN #define X_MAX_PIN 2 #define Y_MAX_PIN 15 #define Z_MAX_PIN -1 +#undef SDSS #define SDSS 25//53 -#define BEEPER 33 - +#undef FAN_PIN #define FAN_PIN 8 +#undef HEATER_1_PIN +#undef HEATER_2_PIN +#undef HEATER_BED_PIN #define HEATER_0_PIN 10 #define HEATER_1_PIN 12 #define HEATER_2_PIN 6 @@ -23,8 +30,15 @@ #define HEATER_BED_PIN 9 // BED #if defined(ULTRA_LCD) && defined(NEWPANEL) + #undef BEEPER #define BEEPER -1 + #undef LCD_PINS_RS + #undef LCD_PINS_ENABLE + #undef LCD_PINS_D4 + #undef LCD_PINS_D5 + #undef LCD_PINS_D6 + #undef LCD_PINS_D7 #define LCD_PINS_RS 27 #define LCD_PINS_ENABLE 29 #define LCD_PINS_D4 37 @@ -33,7 +47,15 @@ #define LCD_PINS_D7 31 // Buttons + #undef BTN_EN1 + #undef BTN_EN2 + #undef BTN_ENC #define BTN_EN1 16 #define BTN_EN2 17 #define BTN_ENC 23 //the click + +#else + + #define BEEPER 33 + #endif // ULTRA_LCD && NEWPANEL diff --git a/Marlin/pins_5DPRINT.h b/Marlin/pins_5DPRINT.h index 20e69ef36..b483326d3 100644 --- a/Marlin/pins_5DPRINT.h +++ b/Marlin/pins_5DPRINT.h @@ -64,6 +64,15 @@ // Microstepping pins // Note that the pin mapping is not from fastio.h // See Sd2PinMap.h for the pin configurations + +#undef X_MS1_PIN +#undef X_MS2_PIN +#undef Y_MS1_PIN +#undef Y_MS2_PIN +#undef Z_MS1_PIN +#undef Z_MS2_PIN +#undef E0_MS1_PIN +#undef E0_MS2_PIN #define X_MS1_PIN 25 #define X_MS2_PIN 26 #define Y_MS1_PIN 9 diff --git a/Marlin/pins_AZTEEG_X3.h b/Marlin/pins_AZTEEG_X3.h index d346e0bd2..ea98f95c5 100644 --- a/Marlin/pins_AZTEEG_X3.h +++ b/Marlin/pins_AZTEEG_X3.h @@ -7,7 +7,30 @@ #define FAN_PIN 9 // (Sprinter config) #define HEATER_1_PIN -1 -#ifdef TEMP_STAT_LEDS +//LCD Pins// + +#if defined(VIKI2) || defined(miniVIKI) + #define BEEPER 33 + // Pins for DOGM SPI LCD Support + #define DOGLCD_A0 31 + #define DOGLCD_CS 32 + #define LCD_SCREEN_ROT_180 + + //The encoder and click button + #define BTN_EN1 22 + #define BTN_EN2 7 + #define BTN_ENC 12 //the click switch + + #define SDSS 53 + #define SDCARDDETECT -1 // Pin 49 if using display sd interface + + #ifdef TEMP_STAT_LEDS + #define STAT_LED_RED 64 + #define STAT_LED_BLUE 63 + #endif +#endif + +#elif define TEMP_STAT_LEDS #define STAT_LED_RED 6 #define STAT_LED_BLUE 11 #endif diff --git a/Marlin/pins_AZTEEG_X3_PRO.h b/Marlin/pins_AZTEEG_X3_PRO.h index 5d0d70db6..83de4520e 100644 --- a/Marlin/pins_AZTEEG_X3_PRO.h +++ b/Marlin/pins_AZTEEG_X3_PRO.h @@ -4,9 +4,42 @@ #include "pins_RAMPS_13.h" -#define FAN_PIN 9 // (Sprinter config) +#undef FAN_PIN +#define FAN_PIN 6 //Part Cooling System #define BEEPER 33 +#define CONTROLLERFAN_PIN 4 //Pin used for the fan to cool motherboard (-1 to disable) +//Fans/Water Pump to cool the hotend cool side. +#define EXTRUDER_0_AUTO_FAN_PIN 5 +#define EXTRUDER_1_AUTO_FAN_PIN 5 +#define EXTRUDER_2_AUTO_FAN_PIN 5 +#define EXTRUDER_3_AUTO_FAN_PIN 5 +// +//This section is to swap the MIN and MAX pins because the X3 Pro comes with only +//MIN endstops soldered onto the board. Delta code wants the homing endstops to be +//the MAX so I swapped them here. +// + #ifdef DELTA + #undef X_MIN_PIN + #undef X_MAX_PIN + #undef Y_MIN_PIN + #undef Y_MAX_PIN + #undef Z_MIN_PIN + #undef Z_MAX_PIN + #define X_MIN_PIN 2 + #define X_MAX_PIN 3 + #define Y_MIN_PIN 15 + #define Y_MAX_PIN 14 + #define Z_MIN_PIN 19 + #define Z_MAX_PIN 18 + #endif +// + #ifdef Z_PROBE_ENDSTOP +//#undef Z_MIN_PIN +//#define Z_MIN_PIN 15 + #define Z_PROBE_PIN 19 + #endif +// #define E2_STEP_PIN 23 #define E2_DIR_PIN 25 #define E2_ENABLE_PIN 40 @@ -19,7 +52,10 @@ #define E4_DIR_PIN 37 #define E4_ENABLE_PIN 42 -#define HEATER_1_PIN -1 +#undef HEATER_1_PIN +#undef HEATER_2_PIN +#undef HEATER_3_PIN +#define HEATER_1_PIN 9 #define HEATER_2_PIN 16 #define HEATER_3_PIN 17 #define HEATER_4_PIN 4 @@ -27,8 +63,58 @@ #define HEATER_6_PIN 6 #define HEATER_7_PIN 11 +#undef TEMP_2_PIN +#undef TEMP_3_PIN #define TEMP_2_PIN 12 // ANALOG NUMBERING #define TEMP_3_PIN 11 // ANALOG NUMBERING #define TEMP_4_PIN 10 // ANALOG NUMBERING #define TC1 4 // ANALOG NUMBERING Thermo couple on Azteeg X3Pro #define TC2 5 // ANALOG NUMBERING Thermo couple on Azteeg X3Pro + +// +//These Servo pins are for when they are defined. Tested for usage with bed leveling +//on a Delta with 1 servo. Running through the Z servo endstop in code. +//Physical wire attachment was done on EXT1 on the GND, 5V, and D47 pins. +// + #undef SERVO0_PIN + #undef SERVO1_PIN + #undef SERVO2_PIN + #undef SERVO3_PIN + + #ifdef NUM_SERVOS + #define SERVO0_PIN 47 + #if NUM_SERVOS > 1 + #define SERVO1_PIN -1 + #if NUM_SERVOS > 2 + #define SERVO2_PIN -1 + #if NUM_SERVOS > 3 + #define SERVO3_PIN -1 + #endif + #endif + #endif + #endif + +//LCD Pins// + + #if defined(VIKI2) || defined(miniVIKI) + #define BEEPER 33 + // Pins for DOGM SPI LCD Support + #define DOGLCD_A0 44 + #define DOGLCD_CS 45 + #define LCD_SCREEN_ROT_180 + + //The encoder and click button + #define BTN_EN1 22 + #define BTN_EN2 7 + #define BTN_ENC 39 //the click switch + + #define SDSS 53 + #define SDCARDDETECT 49 + + #define KILL_PIN 31 + #endif + + #ifdef TEMP_STAT_LEDS + #define STAT_LED_RED 32 + #define STAT_LED_BLUE 35 + #endif diff --git a/Marlin/pins_BAM_DICE_DUE.h b/Marlin/pins_BAM_DICE_DUE.h index c3123d043..fba7f1b8c 100644 --- a/Marlin/pins_BAM_DICE_DUE.h +++ b/Marlin/pins_BAM_DICE_DUE.h @@ -4,8 +4,13 @@ #include "pins_RAMPS_13.h" +#undef FAN_PIN #define FAN_PIN 9 // (Sprinter config) + +#undef HEATER_1_PIN #define HEATER_1_PIN -1 +#undef TEMP_0_PIN +#undef TEMP_1_PIN #define TEMP_0_PIN 9 // ANALOG NUMBERING #define TEMP_1_PIN 11 // ANALOG NUMBERING diff --git a/Marlin/pins_FELIX2.h b/Marlin/pins_FELIX2.h index 5b31c8de6..f54de3453 100644 --- a/Marlin/pins_FELIX2.h +++ b/Marlin/pins_FELIX2.h @@ -4,13 +4,23 @@ #include "pins_RAMPS_13.h" +#undef X_MAX_PIN +#undef Y_MAX_PIN +#undef Z_MAX_PIN #define X_MAX_PIN -1 #define Y_MAX_PIN -1 #define Z_MAX_PIN -1 +#undef Y2_STEP_PIN +#undef Y2_DIR_PIN +#undef Y2_ENABLE_PIN #define Y2_STEP_PIN -1 #define Y2_DIR_PIN -1 #define Y2_ENABLE_PIN -1 + +#undef Z2_STEP_PIN +#undef Z2_DIR_PIN +#undef Z2_ENABLE_PIN #define Z2_STEP_PIN -1 #define Z2_DIR_PIN -1 #define Z2_ENABLE_PIN -1 @@ -19,11 +29,14 @@ #define E1_DIR_PIN 34 #define E1_ENABLE_PIN 30 +#undef SDPOWER #define SDPOWER 1 +#undef FAN_PIN #define FAN_PIN 9 // (Sprinter config) #define PS_ON_PIN 12 +#undef HEATER_1_PIN #define HEATER_1_PIN 7 // EXTRUDER 2 #if defined(ULTRA_LCD) && defined(NEWPANEL) diff --git a/Marlin/pins_HEPHESTOS.h b/Marlin/pins_HEPHESTOS.h index 8fc5ba643..ec8d3fab2 100644 --- a/Marlin/pins_HEPHESTOS.h +++ b/Marlin/pins_HEPHESTOS.h @@ -4,5 +4,8 @@ #include "pins_RAMPS_13.h" +#undef FAN_PIN #define FAN_PIN 9 // (Sprinter config) + +#undef HEATER_1_PIN #define HEATER_1_PIN -1 diff --git a/Marlin/pins_PRINTRBOARD.h b/Marlin/pins_PRINTRBOARD.h index 2bf6efd14..74deb9157 100644 --- a/Marlin/pins_PRINTRBOARD.h +++ b/Marlin/pins_PRINTRBOARD.h @@ -59,6 +59,8 @@ #define TEMP_1_PIN -1 #define TEMP_2_PIN -1 +////LCD Pin Setup//// + #define SDPOWER -1 #define SDSS 8 #define LED_PIN -1 @@ -86,3 +88,24 @@ //not connected to a pin #define SDCARDDETECT -1 #endif // ULTRA_LCD && NEWPANEL + +#if defined(VIKI2) || defined(miniVIKI) + #define BEEPER 32 //FastIO + // Pins for DOGM SPI LCD Support + #define DOGLCD_A0 42 //Non-FastIO + #define DOGLCD_CS 43 //Non-FastIO + #define LCD_SCREEN_ROT_180 + + //The encoder and click button (FastIO Pins) + #define BTN_EN1 26 + #define BTN_EN2 27 + #define BTN_ENC 47 //the click switch + + #define SDSS 45 + #define SDCARDDETECT -1 // FastIO (Manual says 72 I'm not certain cause I can't test) + + #ifdef TEMP_STAT_LEDS + #define STAT_LED_RED 12 //Non-FastIO + #define STAT_LED_BLUE 10 //Non-FastIO + #endif +#endif diff --git a/Marlin/pins_RAMBO.h b/Marlin/pins_RAMBO.h index 3849e2948..6d782b9d9 100644 --- a/Marlin/pins_RAMBO.h +++ b/Marlin/pins_RAMBO.h @@ -22,6 +22,17 @@ #endif #endif +#undef X_MS1_PIN +#undef X_MS2_PIN +#undef Y_MS1_PIN +#undef Y_MS2_PIN +#undef Z_MS1_PIN +#undef Z_MS2_PIN +#undef E0_MS1_PIN +#undef E0_MS2_PIN +#undef E1_MS1_PIN +#undef E1_MS2_PIN + #define X_STEP_PIN 37 #define X_DIR_PIN 48 #define X_MIN_PIN 12 @@ -75,6 +86,7 @@ #define E1_MS1_PIN 63 #define E1_MS2_PIN 64 +#undef DIGIPOTSS_PIN #define DIGIPOTSS_PIN 38 #define DIGIPOT_CHANNELS {4,5,3,0,1} // X Y Z E0 E1 digipot channels to stepper driver mapping @@ -148,6 +160,26 @@ #endif // ULTRA_LCD +#if defined(VIKI2) || defined(miniVIKI) + #define BEEPER 44 + // Pins for DOGM SPI LCD Support + #define DOGLCD_A0 70 + #define DOGLCD_CS 71 + #define LCD_SCREEN_ROT_180 + + //The encoder and click button + #define BTN_EN1 85 + #define BTN_EN2 84 + #define BTN_ENC 83 //the click switch + + #define SDCARDDETECT -1 // Pin 72 if using easy adapter board + + #ifdef TEMP_STAT_LEDS + #define STAT_LED_RED 22 + #define STAT_LED_BLUE 32 + #endif +#endif // VIKI2/miniVIKI + #ifdef FILAMENT_SENSOR //Filip added pin for Filament sensor analog input #define FILWIDTH_PIN 3 diff --git a/Marlin/pins_RAMPS_13.h b/Marlin/pins_RAMPS_13.h index 71287f683..af1d2d3bb 100644 --- a/Marlin/pins_RAMPS_13.h +++ b/Marlin/pins_RAMPS_13.h @@ -34,11 +34,16 @@ #define Z_ENABLE_PIN 62 #define Z_MIN_PIN 18 #define Z_MAX_PIN 19 +#define Z_PROBE_PIN -1 #define Y2_STEP_PIN 36 #define Y2_DIR_PIN 34 #define Y2_ENABLE_PIN 30 +#undef Z2_STEP_PIN +#undef Z2_DIR_PIN +#undef Z2_ENABLE_PIN + #define Z2_STEP_PIN 36 #define Z2_DIR_PIN 34 #define Z2_ENABLE_PIN 30 @@ -61,7 +66,12 @@ #define FILWIDTH_PIN 5 #endif -#if defined(FILAMENT_RUNOUT_SENSOR) +#ifdef Z_PROBE_ENDSTOP + // Define a pin to use as the signal pin on Arduino for the Z_PROBE endstop. + #define Z_PROBE_PIN 32 +#endif + +#ifdef FILAMENT_RUNOUT_SENSOR // define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector #define FILRUNOUT_PIN 4 #endif diff --git a/Marlin/pins_WITBOX.h b/Marlin/pins_WITBOX.h index a4eb0e313..037b38de8 100644 --- a/Marlin/pins_WITBOX.h +++ b/Marlin/pins_WITBOX.h @@ -4,5 +4,8 @@ #include "pins_RAMPS_13.h" +#undef FAN_PIN #define FAN_PIN 9 // (Sprinter config) + +#undef HEATER_1_PIN #define HEATER_1_PIN -1 diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index a1ef453c0..060be3007 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -58,16 +58,16 @@ #include "ultralcd.h" #include "language.h" -#if defined(MESH_BED_LEVELING) +#ifdef MESH_BED_LEVELING #include "mesh_bed_leveling.h" -#endif // MESH_BED_LEVELING +#endif //=========================================================================== //============================= public variables ============================ //=========================================================================== -unsigned long minsegmenttime; -float max_feedrate[NUM_AXIS]; // set the max speeds +millis_t minsegmenttime; +float max_feedrate[NUM_AXIS]; // Max speeds in mm per minute float axis_steps_per_unit[NUM_AXIS]; unsigned long max_acceleration_units_per_sq_second[NUM_AXIS]; // Use M201 to override by software float minimumfeedrate; @@ -87,7 +87,7 @@ unsigned long axis_steps_per_sqr_second[NUM_AXIS]; 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 }; -#endif // #ifdef ENABLE_AUTO_BED_LEVELING +#endif // ENABLE_AUTO_BED_LEVELING // The current position of the tool in absolute steps long position[NUM_AXIS]; //rescaled from extern when axis_steps_per_unit are changed by gcode @@ -113,9 +113,6 @@ volatile unsigned char block_buffer_tail; // Index of the block to pro //=========================================================================== //=============================private variables ============================ //=========================================================================== -#ifdef PREVENT_DANGEROUS_EXTRUDE - float extrude_min_temp = EXTRUDE_MINTEMP; -#endif #ifdef XY_FREQUENCY_LIMIT // Used for the frequency limit #define MAX_FREQ_TIME (1000000.0/XY_FREQUENCY_LIMIT) @@ -162,8 +159,8 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi unsigned long final_rate = ceil(block->nominal_rate * exit_factor); // (step/min) // Limit minimal step rate (Otherwise the timer will overflow.) - if (initial_rate < 120) initial_rate = 120; - if (final_rate < 120) final_rate = 120; + NOLESS(initial_rate, 120); + NOLESS(final_rate, 120); long acceleration = block->acceleration_st; int32_t accelerate_steps = ceil(estimate_acceleration_distance(initial_rate, block->nominal_rate, acceleration)); @@ -342,7 +339,7 @@ void planner_recalculate_trapezoids() { // b. No speed reduction within one block requires faster deceleration than the one, true constant // acceleration. // 2. Go over every block in chronological order and dial down junction speed reduction values if -// a. The speed increase within one block would require faster accelleration than the one, true +// a. The speed increase within one block would require faster acceleration than the one, true // constant acceleration. // // When these stages are complete all blocks have an entry_factor that will allow all speed changes to @@ -385,16 +382,18 @@ void plan_init() { } float t = autotemp_min + high * autotemp_factor; - if (t < autotemp_min) t = autotemp_min; - if (t > autotemp_max) t = autotemp_max; - if (oldt > t) t = AUTOTEMP_OLDWEIGHT * oldt + (1 - AUTOTEMP_OLDWEIGHT) * t; + t = constrain(t, autotemp_min, autotemp_max); + if (oldt > t) { + t *= (1 - AUTOTEMP_OLDWEIGHT); + t += AUTOTEMP_OLDWEIGHT * oldt; + } oldt = t; setTargetHotend0(t); } #endif void check_axes_activity() { - unsigned char axis_active[NUM_AXIS], + unsigned char axis_active[NUM_AXIS] = { 0 }, tail_fan_speed = fanSpeed; #ifdef BARICUDA unsigned char tail_valve_pressure = ValvePressure, @@ -427,9 +426,9 @@ void check_axes_activity() { disable_e3(); } - #if defined(FAN_PIN) && FAN_PIN > -1 // HAS_FAN + #if HAS_FAN #ifdef FAN_KICKSTART_TIME - static unsigned long fan_kick_end; + static millis_t fan_kick_end; if (tail_fan_speed) { if (fan_kick_end == 0) { // Just starting up fan - run at full power. @@ -447,17 +446,17 @@ void check_axes_activity() { #else analogWrite(FAN_PIN, tail_fan_speed); #endif //!FAN_SOFT_PWM - #endif //FAN_PIN > -1 + #endif // HAS_FAN #ifdef AUTOTEMP getHighESpeed(); #endif #ifdef BARICUDA - #if defined(HEATER_1_PIN) && HEATER_1_PIN > -1 // HAS_HEATER_1 + #if HAS_HEATER_1 analogWrite(HEATER_1_PIN,tail_valve_pressure); #endif - #if defined(HEATER_2_PIN) && HEATER_2_PIN > -1 // HAS_HEATER_2 + #if HAS_HEATER_2 analogWrite(HEATER_2_PIN,tail_e_to_p_pressure); #endif #endif @@ -472,7 +471,7 @@ float junction_deviation = 0.1; void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate, const uint8_t &extruder) #else void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder) -#endif //ENABLE_AUTO_BED_LEVELING +#endif // ENABLE_AUTO_BED_LEVELING { // Calculate the buffer head after we push this byte int next_buffer_head = next_block_index(block_buffer_head); @@ -487,9 +486,7 @@ float junction_deviation = 0.1; #ifdef MESH_BED_LEVELING if (mbl.active) z += mbl.get_z(x, y); - #endif - - #ifdef ENABLE_AUTO_BED_LEVELING + #elif defined(ENABLE_AUTO_BED_LEVELING) apply_rotation_xyz(plan_bed_level_matrix, x, y, z); #endif @@ -509,14 +506,16 @@ float junction_deviation = 0.1; #ifdef PREVENT_DANGEROUS_EXTRUDE if (de) { - if (degHotend(active_extruder) < extrude_min_temp) { - position[E_AXIS] = target[E_AXIS]; //behave as if the move really took place, but ignore E part + if (degHotend(extruder) < extrude_min_temp) { + position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part + de = 0; // no difference SERIAL_ECHO_START; SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); } #ifdef PREVENT_LENGTHY_EXTRUDE if (labs(de) > axis_steps_per_unit[E_AXIS] * EXTRUDE_MAXLENGTH) { position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part + de = 0; // no difference SERIAL_ECHO_START; SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); } @@ -544,8 +543,8 @@ float junction_deviation = 0.1; block->steps[Z_AXIS] = labs(dz); block->steps[E_AXIS] = labs(de); - block->steps[E_AXIS] *= volumetric_multiplier[active_extruder]; - block->steps[E_AXIS] *= extrudemultiply; + block->steps[E_AXIS] *= volumetric_multiplier[extruder]; + block->steps[E_AXIS] *= extruder_multiply[extruder]; block->steps[E_AXIS] /= 100; block->step_event_count = max(block->steps[X_AXIS], max(block->steps[Y_AXIS], max(block->steps[Z_AXIS], block->steps[E_AXIS]))); @@ -614,7 +613,7 @@ float junction_deviation = 0.1; #if EXTRUDERS > 1 case 1: enable_e1(); - g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE*2; + g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE * 2; if (g_uc_extruder_last_move[0] == 0) disable_e0(); #if EXTRUDERS > 2 if (g_uc_extruder_last_move[2] == 0) disable_e2(); @@ -626,7 +625,7 @@ float junction_deviation = 0.1; #if EXTRUDERS > 2 case 2: enable_e2(); - g_uc_extruder_last_move[2] = BLOCK_BUFFER_SIZE*2; + g_uc_extruder_last_move[2] = BLOCK_BUFFER_SIZE * 2; if (g_uc_extruder_last_move[0] == 0) disable_e0(); if (g_uc_extruder_last_move[1] == 0) disable_e1(); #if EXTRUDERS > 3 @@ -636,7 +635,7 @@ float junction_deviation = 0.1; #if EXTRUDERS > 3 case 3: enable_e3(); - g_uc_extruder_last_move[3] = BLOCK_BUFFER_SIZE*2; + g_uc_extruder_last_move[3] = BLOCK_BUFFER_SIZE * 2; if (g_uc_extruder_last_move[0] == 0) disable_e0(); if (g_uc_extruder_last_move[1] == 0) disable_e1(); if (g_uc_extruder_last_move[2] == 0) disable_e2(); @@ -654,10 +653,10 @@ float junction_deviation = 0.1; } } - if (block->steps[E_AXIS]) { - if (feed_rate < minimumfeedrate) feed_rate = minimumfeedrate; - } - else if (feed_rate < mintravelfeedrate) feed_rate = mintravelfeedrate; + if (block->steps[E_AXIS]) + NOLESS(feed_rate, minimumfeedrate); + else + NOLESS(feed_rate, mintravelfeedrate); /** * This part of the code calculates the total length of the movement. @@ -679,7 +678,7 @@ float junction_deviation = 0.1; delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS]; #endif delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS]; - delta_mm[E_AXIS] = (de / axis_steps_per_unit[E_AXIS]) * volumetric_multiplier[active_extruder] * extrudemultiply / 100.0; + delta_mm[E_AXIS] = (de / axis_steps_per_unit[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiply[extruder] / 100.0; if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) { block->millimeters = fabs(delta_mm[E_AXIS]); @@ -701,26 +700,26 @@ float junction_deviation = 0.1; int moves_queued = movesplanned(); - // slow down when de buffer starts to empty, rather than wait at the corner for a buffer refill - bool mq = moves_queued > 1 && moves_queued < BLOCK_BUFFER_SIZE / 2; - #ifdef OLD_SLOWDOWN - if (mq) feed_rate *= 2.0 * moves_queued / BLOCK_BUFFER_SIZE; - #endif - - #ifdef SLOWDOWN - // segment time im micro seconds - unsigned long segment_time = lround(1000000.0/inverse_second); - if (mq) { - if (segment_time < minsegmenttime) { - // buffer is draining, add extra time. The amount of time added increases if the buffer is still emptied more. - inverse_second = 1000000.0 / (segment_time + lround(2 * (minsegmenttime - segment_time) / moves_queued)); - #ifdef XY_FREQUENCY_LIMIT - segment_time = lround(1000000.0 / inverse_second); - #endif + // Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill + #if defined(OLD_SLOWDOWN) || defined(SLOWDOWN) + bool mq = moves_queued > 1 && moves_queued < BLOCK_BUFFER_SIZE / 2; + #ifdef OLD_SLOWDOWN + if (mq) feed_rate *= 2.0 * moves_queued / BLOCK_BUFFER_SIZE; + #endif + #ifdef SLOWDOWN + // segment time im micro seconds + unsigned long segment_time = lround(1000000.0/inverse_second); + if (mq) { + if (segment_time < minsegmenttime) { + // buffer is draining, add extra time. The amount of time added increases if the buffer is still emptied more. + inverse_second = 1000000.0 / (segment_time + lround(2 * (minsegmenttime - segment_time) / moves_queued)); + #ifdef XY_FREQUENCY_LIMIT + segment_time = lround(1000000.0 / inverse_second); + #endif + } } - } + #endif #endif - // END OF SLOW DOWN SECTION block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0 block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0 @@ -977,10 +976,10 @@ float junction_deviation = 0.1; void plan_set_position(const float &x, const float &y, const float &z, const float &e) #endif // ENABLE_AUTO_BED_LEVELING || MESH_BED_LEVELING { - #ifdef ENABLE_AUTO_BED_LEVELING - apply_rotation_xyz(plan_bed_level_matrix, x, y, z); - #elif defined(MESH_BED_LEVELING) + #ifdef MESH_BED_LEVELING if (mbl.active) z += mbl.get_z(x, y); + #elif defined(ENABLE_AUTO_BED_LEVELING) + apply_rotation_xyz(plan_bed_level_matrix, x, y, z); #endif float nx = position[X_AXIS] = lround(x * axis_steps_per_unit[X_AXIS]); @@ -998,10 +997,6 @@ void plan_set_e_position(const float &e) { st_set_e_position(position[E_AXIS]); } -#ifdef PREVENT_DANGEROUS_EXTRUDE - void set_extrude_min_temp(float temp) { extrude_min_temp = temp; } -#endif - // Calculate the steps/s^2 acceleration rates, based on the mm/s^s void reset_acceleration_rates() { for (int i = 0; i < NUM_AXIS; i++) diff --git a/Marlin/planner.h b/Marlin/planner.h index ed219fa23..d96aa8c11 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -80,26 +80,42 @@ extern volatile unsigned char block_buffer_tail; FORCE_INLINE uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); } #if defined(ENABLE_AUTO_BED_LEVELING) || defined(MESH_BED_LEVELING) + #if defined(ENABLE_AUTO_BED_LEVELING) #include "vector_3.h" - // this holds the required transform to compensate for bed level + + // Transform required to compensate for bed level extern matrix_3x3 plan_bed_level_matrix; - // Get the position applying the bed level matrix if enabled + + /** + * Get the position applying the bed level matrix + */ vector_3 plan_get_position(); #endif // ENABLE_AUTO_BED_LEVELING - // Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in - // millimeters. Feed rate specifies the speed of the motion. + + /** + * Add a new linear movement to the buffer. x, y, z are the signed, absolute target position in + * millimeters. Feed rate specifies the (target) speed of the motion. + */ void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate, const uint8_t &extruder); - // Set position. Used for G92 instructions. + + /** + * Set the planner positions. Used for G92 instructions. + * Multiplies by axis_steps_per_unit[] to set stepper positions. + * Clears previous speed values. + */ void plan_set_position(float x, float y, float z, const float &e); + #else + void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder); void plan_set_position(const float &x, const float &y, const float &z, const float &e); + #endif // ENABLE_AUTO_BED_LEVELING || MESH_BED_LEVELING void plan_set_e_position(const float &e); -extern unsigned long minsegmenttime; +extern millis_t minsegmenttime; extern float max_feedrate[NUM_AXIS]; // set the max speeds extern float axis_steps_per_unit[NUM_AXIS]; extern unsigned long max_acceleration_units_per_sq_second[NUM_AXIS]; // Use M201 to override by software @@ -145,10 +161,6 @@ FORCE_INLINE block_t *plan_get_current_block() { return NULL; } -#ifdef PREVENT_DANGEROUS_EXTRUDE - void set_extrude_min_temp(float temp); -#endif - void reset_acceleration_rates(); -#endif //PLANNER_H +#endif // PLANNER_H diff --git a/Marlin/qr_solve.cpp b/Marlin/qr_solve.cpp index f19d989d4..4202db067 100644 --- a/Marlin/qr_solve.cpp +++ b/Marlin/qr_solve.cpp @@ -607,7 +607,6 @@ double dnrm2 ( int n, double x[], int incx ) double norm; double scale; double ssq; - double value; if ( n < 1 || incx < 1 ) { diff --git a/Marlin/scripts/g29_auto.py b/Marlin/scripts/g29_auto.py new file mode 100644 index 000000000..884e62b2a --- /dev/null +++ b/Marlin/scripts/g29_auto.py @@ -0,0 +1,186 @@ +#!/usr/bin/python3 + +# This file is for preprocessing gcode and the new G29 Autobedleveling from Marlin +# It will analyse the first 2 Layer and return the maximum size for this part +# After this it will replace with g29_keyword = ';MarlinG29Script' with the new G29 LRFB +# the new file will be created in the same folder. + +# your gcode-file/folder +folder = './' +my_file = 'test.gcode' + +# this is the minimum of G1 instructions which should be between 2 different heights +min_g1 = 3 + +# maximum number of lines to parse, I don't want to parse the complete file +# only the first plane is we are interested in +max_g1 = 100000000 + +# g29 keyword +g29_keyword = 'g29' +g29_keyword = g29_keyword.upper() + +# output filename +output_file = folder + 'g29_' + my_file +# input filename +input_file = folder + my_file + +# minimum scan size +min_size = 40 +probing_points = 3 # points x points + +# other stuff +min_x = 500 +min_y = min_x +max_x = -500 +max_y = max_x +last_z = 0.001 + +layer = 0 +lines_of_g1 = 0 + +gcode = [] + + +# return only g1-lines +def has_g1(line): + return line[:2].upper() == "G1" + + +# find position in g1 (x,y,z) +def find_axis(line, axis): + found = False + number = "" + for char in line: + if found: + if char == ".": + number += char + elif char == "-": + number += char + else: + try: + int(char) + number += char + except ValueError: + break + else: + found = char.upper() == axis.upper() + try: + return float(number) + except ValueError: + return None + + +# save the min or max-values for each axis +def set_mima(line): + global min_x, max_x, min_y, max_y, last_z + + current_x = find_axis(line, 'x') + current_y = find_axis(line, 'y') + + if current_x is not None: + min_x = min(current_x, min_x) + max_x = max(current_x, max_x) + if current_y is not None: + min_y = min(current_y, min_y) + max_y = max(current_y, max_y) + + return min_x, max_x, min_y, max_y + + +# find z in the code and return it +def find_z(gcode, start_at_line=0): + for i in range(start_at_line, len(gcode)): + my_z = find_axis(gcode[i], 'Z') + if my_z is not None: + return my_z, i + + +def z_parse(gcode, start_at_line=0, end_at_line=0): + i = start_at_line + all_z = [] + line_between_z = [] + z_at_line = [] + # last_z = 0 + last_i = -1 + + while len(gcode) > i: + try: + z, i = find_z(gcode, i + 1) + except TypeError: + break + + all_z.append(z) + z_at_line.append(i) + temp_line = i - last_i -1 + line_between_z.append(i - last_i - 1) + # last_z = z + last_i = i + if 0 < end_at_line <= i or temp_line >= min_g1: + # print('break at line {} at heigth {}'.format(i, z)) + break + + line_between_z = line_between_z[1:] + return all_z, line_between_z, z_at_line + + +# get the lines which should be the first layer +def get_lines(gcode, minimum): + i = 0 + all_z, line_between_z, z_at_line = z_parse(gcode, end_at_line=max_g1) + for count in line_between_z: + i += 1 + if count > minimum: + # print('layer: {}:{}'.format(z_at_line[i-1], z_at_line[i])) + return z_at_line[i - 1], z_at_line[i] + + +with open(input_file, 'r') as file: + lines = 0 + for line in file: + lines += 1 + if lines > 1000: + break + if has_g1(line): + gcode.append(line) +file.close() + +start, end = get_lines(gcode, min_g1) +for i in range(start, end): + set_mima(gcode[i]) + +print('x_min:{} x_max:{}\ny_min:{} y_max:{}'.format(min_x, max_x, min_y, max_y)) + +# resize min/max - values for minimum scan +if max_x - min_x < min_size: + offset_x = int((min_size - (max_x - min_x)) / 2 + 0.5) # int round up + # print('min_x! with {}'.format(int(max_x - min_x))) + min_x = int(min_x) - offset_x + max_x = int(max_x) + offset_x +if max_y - min_y < min_size: + offset_y = int((min_size - (max_y - min_y)) / 2 + 0.5) # int round up + # print('min_y! with {}'.format(int(max_y - min_y))) + min_y = int(min_y) - offset_y + max_y = int(max_y) + offset_y + + +new_command = 'G29 L{0} R{1} F{2} B{3} P{4}\n'.format(min_x, + max_x, + min_y, + max_y, + probing_points) + +out_file = open(output_file, 'w') +in_file = open(input_file, 'r') + +for line in in_file: + if line[:len(g29_keyword)].upper() == g29_keyword: + out_file.write(new_command) + print('write G29') + else: + out_file.write(line) + +file.close() +out_file.close() + +print('auto G29 finished') diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 8be4b98af..f11cc0430 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -76,6 +76,7 @@ volatile long endstops_stepsTotal, endstops_stepsDone; static volatile bool endstop_x_hit = false; static volatile bool endstop_y_hit = false; static volatile bool endstop_z_hit = false; +static volatile bool endstop_z_probe_hit = false; // Leaving this in even if Z_PROBE_ENDSTOP isn't defined, keeps code below cleaner. #ifdef it and usage below to save space. #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED bool abort_on_endstop_hit = false; @@ -85,18 +86,30 @@ static volatile bool endstop_z_hit = false; int motor_current_setting[3] = DEFAULT_PWM_MOTOR_CURRENT; #endif -static bool old_x_min_endstop = false, - old_x_max_endstop = false, - old_y_min_endstop = false, - old_y_max_endstop = false, - old_z_min_endstop = false, - #ifndef Z_DUAL_ENDSTOPS - old_z_max_endstop = false; - #else - old_z_max_endstop = false, - old_z2_min_endstop = false, - old_z2_max_endstop = false; - #endif +#if HAS_X_MIN + static bool old_x_min_endstop = false; +#endif +#if HAS_X_MAX + static bool old_x_max_endstop = false; +#endif +#if HAS_Y_MIN + static bool old_y_min_endstop = false; +#endif +#if HAS_Y_MAX + static bool old_y_max_endstop = false; +#endif + +static bool old_z_min_endstop = false; +static bool old_z_max_endstop = false; + +#ifdef Z_DUAL_ENDSTOPS + static bool old_z2_min_endstop = false; + static bool old_z2_max_endstop = false; +#endif + +#ifdef Z_PROBE_ENDSTOP // No need to check for valid pin, SanityCheck.h already does this. + static bool old_z_probe_endstop = false; +#endif static bool check_endstops = true; @@ -155,7 +168,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; Z2_STEP_WRITE(v); \ } #else - #define Z_APPLY_STEP(v,Q) Z_STEP_WRITE(v), Z2_STEP_WRITE(v) + #define Z_APPLY_STEP(v,Q) { Z_STEP_WRITE(v); Z2_STEP_WRITE(v); } #endif #else #define Z_APPLY_DIR(v,Q) Z_DIR_WRITE(v) @@ -240,11 +253,11 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; #define DISABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 &= ~BIT(OCIE1A) void endstops_hit_on_purpose() { - endstop_x_hit = endstop_y_hit = endstop_z_hit = false; + endstop_x_hit = endstop_y_hit = endstop_z_hit = endstop_z_probe_hit = false; // #ifdef endstop_z_probe_hit = to save space if needed. } void checkHitEndstops() { - if (endstop_x_hit || endstop_y_hit || endstop_z_hit) { + if (endstop_x_hit || endstop_y_hit || endstop_z_hit || endstop_z_probe_hit) { // #ifdef || endstop_z_probe_hit to save space if needed. SERIAL_ECHO_START; SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT); if (endstop_x_hit) { @@ -259,6 +272,12 @@ void checkHitEndstops() { SERIAL_ECHOPAIR(" Z:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]); LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z"); } + #ifdef Z_PROBE_ENDSTOP + if (endstop_z_probe_hit) { + SERIAL_ECHOPAIR(" Z_PROBE:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]); + LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP"); + } + #endif SERIAL_EOL; endstops_hit_on_purpose(); @@ -374,7 +393,9 @@ ISR(TIMER1_COMPA_vect) { { current_block = NULL; plan_discard_current_block(); - if ((cleaning_buffer_counter == 1) && (SD_FINISHED_STEPPERRELEASE)) enquecommands_P(PSTR(SD_FINISHED_RELEASECOMMAND)); + #ifdef SD_FINISHED_RELEASECOMMAND + if ((cleaning_buffer_counter == 1) && (SD_FINISHED_STEPPERRELEASE)) enqueuecommands_P(PSTR(SD_FINISHED_RELEASECOMMAND)); + #endif cleaning_buffer_counter--; OCR1A = 200; return; @@ -445,7 +466,7 @@ ISR(TIMER1_COMPA_vect) { #ifdef COREXY // Head direction in -X axis for CoreXY bots. // If DeltaX == -DeltaY, the movement is only in Y axis - if (current_block->steps[A_AXIS] != current_block->steps[B_AXIS] || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) + if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) { if (TEST(out_bits, X_HEAD)) #else if (TEST(out_bits, X_AXIS)) // stepping along -X axis (regular cartesians bot) @@ -456,7 +477,7 @@ ISR(TIMER1_COMPA_vect) { if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) || (current_block->active_extruder != 0 && X2_HOME_DIR == -1)) #endif { - #if defined(X_MIN_PIN) && X_MIN_PIN >= 0 + #if HAS_X_MIN UPDATE_ENDSTOP(x, X, min, MIN); #endif } @@ -467,109 +488,162 @@ ISR(TIMER1_COMPA_vect) { if ((current_block->active_extruder == 0 && X_HOME_DIR == 1) || (current_block->active_extruder != 0 && X2_HOME_DIR == 1)) #endif { - #if defined(X_MAX_PIN) && X_MAX_PIN >= 0 + #if HAS_X_MAX UPDATE_ENDSTOP(x, X, max, MAX); #endif } } #ifdef COREXY + } // Head direction in -Y axis for CoreXY bots. // If DeltaX == DeltaY, the movement is only in X axis - if (current_block->steps[A_AXIS] != current_block->steps[B_AXIS] || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS))) + if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS))) { if (TEST(out_bits, Y_HEAD)) #else if (TEST(out_bits, Y_AXIS)) // -direction #endif { // -direction - #if defined(Y_MIN_PIN) && Y_MIN_PIN >= 0 + #if HAS_Y_MIN UPDATE_ENDSTOP(y, Y, min, MIN); #endif } else { // +direction - #if defined(Y_MAX_PIN) && Y_MAX_PIN >= 0 + #if HAS_Y_MAX UPDATE_ENDSTOP(y, Y, max, MAX); #endif } + #ifdef COREXY + } + #endif } if (TEST(out_bits, Z_AXIS)) { // -direction + Z_APPLY_DIR(INVERT_Z_DIR,0); count_direction[Z_AXIS] = -1; - if (check_endstops) - { - #if defined(Z_MIN_PIN) && Z_MIN_PIN > -1 - #ifndef Z_DUAL_ENDSTOPS - UPDATE_ENDSTOP(z, Z, min, MIN); - #else - bool z_min_endstop=(READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); - #if defined(Z2_MIN_PIN) && Z2_MIN_PIN > -1 - bool z2_min_endstop=(READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING); - #else - bool z2_min_endstop=z_min_endstop; - #endif - if(((z_min_endstop && old_z_min_endstop) || (z2_min_endstop && old_z2_min_endstop)) && (current_block->steps[Z_AXIS] > 0)) - { + + if (check_endstops) { + + #if HAS_Z_MIN + + #ifdef Z_DUAL_ENDSTOPS + + bool z_min_endstop = READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING, + z2_min_endstop = + #if HAS_Z2_MIN + READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING + #else + z_min_endstop + #endif + ; + + bool z_min_both = z_min_endstop && old_z_min_endstop, + z2_min_both = z2_min_endstop && old_z2_min_endstop; + if ((z_min_both || z2_min_both) && current_block->steps[Z_AXIS] > 0) { endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS]; - endstop_z_hit=true; - if (!(performing_homing) || ((performing_homing)&&(z_min_endstop && old_z_min_endstop)&&(z2_min_endstop && old_z2_min_endstop))) //if not performing home or if both endstops were trigged during homing... - { + endstop_z_hit = true; + if (!performing_homing || (performing_homing && z_min_both && z2_min_both)) //if not performing home or if both endstops were trigged during homing... step_events_completed = current_block->step_event_count; - } } old_z_min_endstop = z_min_endstop; old_z2_min_endstop = z2_min_endstop; - #endif + + #else // !Z_DUAL_ENDSTOPS + + UPDATE_ENDSTOP(z, Z, min, MIN); + + #endif // !Z_DUAL_ENDSTOPS + + #endif // Z_MIN_PIN + + #ifdef Z_PROBE_ENDSTOP + UPDATE_ENDSTOP(z, Z, probe, PROBE); + z_probe_endstop=(READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING); + if(z_probe_endstop && old_z_probe_endstop) + { + endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS]; + endstop_z_probe_hit=true; + +// if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true"); + } + old_z_probe_endstop = z_probe_endstop; #endif - } + + } // check_endstops + } else { // +direction + Z_APPLY_DIR(!INVERT_Z_DIR,0); count_direction[Z_AXIS] = 1; + if (check_endstops) { - #if defined(Z_MAX_PIN) && Z_MAX_PIN >= 0 - #ifndef Z_DUAL_ENDSTOPS - UPDATE_ENDSTOP(z, Z, max, MAX); - #else - bool z_max_endstop=(READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING); - #if defined(Z2_MAX_PIN) && Z2_MAX_PIN > -1 - bool z2_max_endstop=(READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING); - #else - bool z2_max_endstop=z_max_endstop; - #endif - if(((z_max_endstop && old_z_max_endstop) || (z2_max_endstop && old_z2_max_endstop)) && (current_block->steps[Z_AXIS] > 0)) - { + + #if HAS_Z_MAX + + #ifdef Z_DUAL_ENDSTOPS + + bool z_max_endstop = READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING, + z2_max_endstop = + #if HAS_Z2_MAX + READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING + #else + z_max_endstop + #endif + ; + + bool z_max_both = z_max_endstop && old_z_max_endstop, + z2_max_both = z2_max_endstop && old_z2_max_endstop; + if ((z_max_both || z2_max_both) && current_block->steps[Z_AXIS] > 0) { endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS]; - endstop_z_hit=true; + endstop_z_hit = true; -// if (z_max_endstop && old_z_max_endstop) SERIAL_ECHOLN("z_max_endstop = true"); -// if (z2_max_endstop && old_z2_max_endstop) SERIAL_ECHOLN("z2_max_endstop = true"); + // if (z_max_both) SERIAL_ECHOLN("z_max_endstop = true"); + // if (z2_max_both) SERIAL_ECHOLN("z2_max_endstop = true"); - - if (!(performing_homing) || ((performing_homing)&&(z_max_endstop && old_z_max_endstop)&&(z2_max_endstop && old_z2_max_endstop))) //if not performing home or if both endstops were trigged during homing... - { + if (!performing_homing || (performing_homing && z_max_both && z2_max_both)) //if not performing home or if both endstops were trigged during homing... step_events_completed = current_block->step_event_count; - } } old_z_max_endstop = z_max_endstop; old_z2_max_endstop = z2_max_endstop; - #endif + + #else // !Z_DUAL_ENDSTOPS + + UPDATE_ENDSTOP(z, Z, max, MAX); + + #endif // !Z_DUAL_ENDSTOPS + + #endif // Z_MAX_PIN + + #ifdef Z_PROBE_ENDSTOP + UPDATE_ENDSTOP(z, Z, probe, PROBE); + z_probe_endstop=(READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING); + if(z_probe_endstop && old_z_probe_endstop) + { + endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS]; + endstop_z_probe_hit=true; +// if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true"); + } + old_z_probe_endstop = z_probe_endstop; #endif - } - } + + } // check_endstops + + } // +direction #ifndef ADVANCE if (TEST(out_bits, E_AXIS)) { // -direction REV_E_DIR(); - count_direction[E_AXIS]=-1; + count_direction[E_AXIS] = -1; } else { // +direction NORM_E_DIR(); - count_direction[E_AXIS]=1; + count_direction[E_AXIS] = 1; } #endif //!ADVANCE // Take multiple steps per interrupt (For high speed moves) - for (int8_t i=0; i < step_loops; i++) { + for (int8_t i = 0; i < step_loops; i++) { #ifndef AT90USB MSerial.checkRx(); // Check for serial chars. #endif @@ -635,10 +709,10 @@ ISR(TIMER1_COMPA_vect) { step_events_completed++; if (step_events_completed >= current_block->step_event_count) break; } - // Calculare new timer value + // Calculate new timer value unsigned short timer; unsigned short step_rate; - if (step_events_completed <= (unsigned long int)current_block->accelerate_until) { + if (step_events_completed <= (unsigned long)current_block->accelerate_until) { MultiU24X24toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate); acc_step_rate += current_block->initial_rate; @@ -662,7 +736,7 @@ ISR(TIMER1_COMPA_vect) { #endif } - else if (step_events_completed > (unsigned long int)current_block->decelerate_after) { + else if (step_events_completed > (unsigned long)current_block->decelerate_after) { MultiU24X24toH16(step_rate, deceleration_time, current_block->acceleration_rate); if (step_rate > acc_step_rate) { // Check step_rate stays positive @@ -791,133 +865,140 @@ void st_init() { #endif // Initialize Dir Pins - #if defined(X_DIR_PIN) && X_DIR_PIN >= 0 + #if HAS_X_DIR X_DIR_INIT; #endif - #if defined(X2_DIR_PIN) && X2_DIR_PIN >= 0 + #if HAS_X2_DIR X2_DIR_INIT; #endif - #if defined(Y_DIR_PIN) && Y_DIR_PIN >= 0 + #if HAS_Y_DIR Y_DIR_INIT; - #if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_DIR_PIN) && Y2_DIR_PIN >= 0 + #if defined(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_DIR Y2_DIR_INIT; #endif #endif - #if defined(Z_DIR_PIN) && Z_DIR_PIN >= 0 + #if HAS_Z_DIR Z_DIR_INIT; - #if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_DIR_PIN) && Z2_DIR_PIN >= 0 + #if defined(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_DIR Z2_DIR_INIT; #endif #endif - #if defined(E0_DIR_PIN) && E0_DIR_PIN >= 0 + #if HAS_E0_DIR E0_DIR_INIT; #endif - #if defined(E1_DIR_PIN) && E1_DIR_PIN >= 0 + #if HAS_E1_DIR E1_DIR_INIT; #endif - #if defined(E2_DIR_PIN) && E2_DIR_PIN >= 0 + #if HAS_E2_DIR E2_DIR_INIT; #endif - #if defined(E3_DIR_PIN) && E3_DIR_PIN >= 0 + #if HAS_E3_DIR E3_DIR_INIT; #endif //Initialize Enable Pins - steppers default to disabled. - #if defined(X_ENABLE_PIN) && X_ENABLE_PIN >= 0 + #if HAS_X_ENABLE X_ENABLE_INIT; if (!X_ENABLE_ON) X_ENABLE_WRITE(HIGH); #endif - #if defined(X2_ENABLE_PIN) && X2_ENABLE_PIN >= 0 + #if HAS_X2_ENABLE X2_ENABLE_INIT; if (!X_ENABLE_ON) X2_ENABLE_WRITE(HIGH); #endif - #if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN >= 0 + #if HAS_Y_ENABLE Y_ENABLE_INIT; if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH); - #if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_ENABLE_PIN) && Y2_ENABLE_PIN >= 0 + #if defined(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE Y2_ENABLE_INIT; if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH); #endif #endif - #if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN >= 0 + #if HAS_Z_ENABLE Z_ENABLE_INIT; if (!Z_ENABLE_ON) Z_ENABLE_WRITE(HIGH); - #if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_ENABLE_PIN) && Z2_ENABLE_PIN >= 0 + #if defined(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_ENABLE Z2_ENABLE_INIT; if (!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH); #endif #endif - #if defined(E0_ENABLE_PIN) && E0_ENABLE_PIN >= 0 + #if HAS_E0_ENABLE E0_ENABLE_INIT; if (!E_ENABLE_ON) E0_ENABLE_WRITE(HIGH); #endif - #if defined(E1_ENABLE_PIN) && E1_ENABLE_PIN >= 0 + #if HAS_E1_ENABLE E1_ENABLE_INIT; if (!E_ENABLE_ON) E1_ENABLE_WRITE(HIGH); #endif - #if defined(E2_ENABLE_PIN) && E2_ENABLE_PIN >= 0 + #if HAS_E2_ENABLE E2_ENABLE_INIT; if (!E_ENABLE_ON) E2_ENABLE_WRITE(HIGH); #endif - #if defined(E3_ENABLE_PIN) && E3_ENABLE_PIN >= 0 + #if HAS_E3_ENABLE E3_ENABLE_INIT; if (!E_ENABLE_ON) E3_ENABLE_WRITE(HIGH); #endif //endstops and pullups - #if defined(X_MIN_PIN) && X_MIN_PIN >= 0 + #if HAS_X_MIN SET_INPUT(X_MIN_PIN); #ifdef ENDSTOPPULLUP_XMIN WRITE(X_MIN_PIN,HIGH); #endif #endif - #if defined(Y_MIN_PIN) && Y_MIN_PIN >= 0 + #if HAS_Y_MIN SET_INPUT(Y_MIN_PIN); #ifdef ENDSTOPPULLUP_YMIN WRITE(Y_MIN_PIN,HIGH); #endif #endif - #if defined(Z_MIN_PIN) && Z_MIN_PIN >= 0 + #if HAS_Z_MIN SET_INPUT(Z_MIN_PIN); #ifdef ENDSTOPPULLUP_ZMIN WRITE(Z_MIN_PIN,HIGH); #endif #endif - #if defined(X_MAX_PIN) && X_MAX_PIN >= 0 + #if HAS_X_MAX SET_INPUT(X_MAX_PIN); #ifdef ENDSTOPPULLUP_XMAX WRITE(X_MAX_PIN,HIGH); #endif #endif - #if defined(Y_MAX_PIN) && Y_MAX_PIN >= 0 + #if HAS_Y_MAX SET_INPUT(Y_MAX_PIN); #ifdef ENDSTOPPULLUP_YMAX WRITE(Y_MAX_PIN,HIGH); #endif #endif - #if defined(Z_MAX_PIN) && Z_MAX_PIN >= 0 + #if HAS_Z_MAX SET_INPUT(Z_MAX_PIN); #ifdef ENDSTOPPULLUP_ZMAX WRITE(Z_MAX_PIN,HIGH); #endif #endif - #if defined(Z2_MAX_PIN) && Z2_MAX_PIN >= 0 + #if HAS_Z2_MAX SET_INPUT(Z2_MAX_PIN); #ifdef ENDSTOPPULLUP_ZMAX WRITE(Z2_MAX_PIN,HIGH); #endif #endif +#if (defined(Z_PROBE_PIN) && Z_PROBE_PIN >= 0) && defined(Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used. + SET_INPUT(Z_PROBE_PIN); + #ifdef ENDSTOPPULLUP_ZPROBE + WRITE(Z_PROBE_PIN,HIGH); + #endif +#endif + #define AXIS_INIT(axis, AXIS, PIN) \ AXIS ##_STEP_INIT; \ AXIS ##_STEP_WRITE(INVERT_## PIN ##_STEP_PIN); \ @@ -926,36 +1007,36 @@ void st_init() { #define E_AXIS_INIT(NUM) AXIS_INIT(e## NUM, E## NUM, E) // Initialize Step Pins - #if defined(X_STEP_PIN) && X_STEP_PIN >= 0 + #if HAS_X_STEP AXIS_INIT(x, X, X); #endif - #if defined(X2_STEP_PIN) && X2_STEP_PIN >= 0 + #if HAS_X2_STEP AXIS_INIT(x, X2, X); #endif - #if defined(Y_STEP_PIN) && Y_STEP_PIN >= 0 - #if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_STEP_PIN) && Y2_STEP_PIN >= 0 + #if HAS_Y_STEP + #if defined(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_STEP Y2_STEP_INIT; Y2_STEP_WRITE(INVERT_Y_STEP_PIN); #endif AXIS_INIT(y, Y, Y); #endif - #if defined(Z_STEP_PIN) && Z_STEP_PIN >= 0 - #if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_STEP_PIN) && Z2_STEP_PIN >= 0 + #if HAS_Z_STEP + #if defined(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_STEP Z2_STEP_INIT; Z2_STEP_WRITE(INVERT_Z_STEP_PIN); #endif AXIS_INIT(z, Z, Z); #endif - #if defined(E0_STEP_PIN) && E0_STEP_PIN >= 0 + #if HAS_E0_STEP E_AXIS_INIT(0); #endif - #if defined(E1_STEP_PIN) && E1_STEP_PIN >= 0 + #if HAS_E1_STEP E_AXIS_INIT(1); #endif - #if defined(E2_STEP_PIN) && E2_STEP_PIN >= 0 + #if HAS_E2_STEP E_AXIS_INIT(2); #endif - #if defined(E3_STEP_PIN) && E3_STEP_PIN >= 0 + #if HAS_E3_STEP E_AXIS_INIT(3); #endif @@ -985,10 +1066,7 @@ void st_init() { TCCR0A &= ~BIT(WGM01); TCCR0A &= ~BIT(WGM00); #endif - e_steps[0] = 0; - e_steps[1] = 0; - e_steps[2] = 0; - e_steps[3] = 0; + e_steps[0] = e_steps[1] = e_steps[2] = e_steps[3] = 0; TIMSK0 |= BIT(OCIE0A); #endif //ADVANCE @@ -1040,13 +1118,7 @@ long st_get_position(uint8_t axis) { void finishAndDisableSteppers() { st_synchronize(); - disable_x(); - disable_y(); - disable_z(); - disable_e0(); - disable_e1(); - disable_e2(); - disable_e3(); + disable_all_steppers(); } void quickStop() { @@ -1176,14 +1248,12 @@ void digipot_current(uint8_t driver, int current) { } void microstep_init() { - const uint8_t microstep_modes[] = MICROSTEP_MODES; - - #if defined(E1_MS1_PIN) && E1_MS1_PIN >= 0 + #if HAS_MICROSTEPS_E1 pinMode(E1_MS1_PIN,OUTPUT); - pinMode(E1_MS2_PIN,OUTPUT); + pinMode(E1_MS2_PIN,OUTPUT); #endif - #if defined(X_MS1_PIN) && X_MS1_PIN >= 0 + #if HAS_MICROSTEPS pinMode(X_MS1_PIN,OUTPUT); pinMode(X_MS2_PIN,OUTPUT); pinMode(Y_MS1_PIN,OUTPUT); @@ -1192,7 +1262,9 @@ void microstep_init() { pinMode(Z_MS2_PIN,OUTPUT); pinMode(E0_MS1_PIN,OUTPUT); pinMode(E0_MS2_PIN,OUTPUT); - for (int i = 0; i <= 4; i++) microstep_mode(i, microstep_modes[i]); + const uint8_t microstep_modes[] = MICROSTEP_MODES; + for (uint16_t i = 0; i < sizeof(microstep_modes) / sizeof(microstep_modes[0]); i++) + microstep_mode(i, microstep_modes[i]); #endif } @@ -1202,7 +1274,7 @@ void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2) { case 1: digitalWrite(Y_MS1_PIN, ms1); break; case 2: digitalWrite(Z_MS1_PIN, ms1); break; case 3: digitalWrite(E0_MS1_PIN, ms1); break; - #if defined(E1_MS1_PIN) && E1_MS1_PIN >= 0 + #if HAS_MICROSTEPS_E1 case 4: digitalWrite(E1_MS1_PIN, ms1); break; #endif } @@ -1241,7 +1313,7 @@ void microstep_readings() { SERIAL_PROTOCOLPGM("E0: "); SERIAL_PROTOCOL(digitalRead(E0_MS1_PIN)); SERIAL_PROTOCOLLN(digitalRead(E0_MS2_PIN)); - #if defined(E1_MS1_PIN) && E1_MS1_PIN >= 0 + #if HAS_MICROSTEPS_E1 SERIAL_PROTOCOLPGM("E1: "); SERIAL_PROTOCOL(digitalRead(E1_MS1_PIN)); SERIAL_PROTOCOLLN(digitalRead(E1_MS2_PIN)); diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 713d0312f..69a2877e7 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -1,5 +1,5 @@ /* - temperature.c - temperature control + temperature.cpp - temperature control Part of Marlin Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -16,18 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - */ - -/* - This firmware is a mashup between Sprinter and grbl. - (https://github.com/kliment/Sprinter) - (https://github.com/simen/grbl/tree) - - It has preliminary support for Matthew Roberts advance algorithm - http://reprap.org/pipermail/reprap-dev/2011-May/003323.html - - */ - +*/ #include "Marlin.h" #include "ultralcd.h" @@ -45,14 +34,18 @@ #define K2 (1.0-K1) #endif +#if defined(PIDTEMPBED) || defined(PIDTEMP) + #define PID_dT ((OVERSAMPLENR * 12.0)/(F_CPU / 64.0 / 256.0)) +#endif + //=========================================================================== //============================= public variables ============================ //=========================================================================== -int target_temperature[EXTRUDERS] = { 0 }; +int target_temperature[4] = { 0 }; int target_temperature_bed = 0; -int current_temperature_raw[EXTRUDERS] = { 0 }; -float current_temperature[EXTRUDERS] = { 0.0 }; +int current_temperature_raw[4] = { 0 }; +float current_temperature[4] = { 0.0 }; int current_temperature_bed_raw = 0; float current_temperature_bed = 0.0; #ifdef TEMP_SENSOR_1_AS_REDUNDANT @@ -79,6 +72,22 @@ unsigned char soft_pwm_bed; #ifdef FILAMENT_SENSOR int current_raw_filwidth = 0; //Holds measured filament diameter - one extruder only #endif + +#define HAS_HEATER_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0) +#define HAS_BED_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_BED_PERIOD) && THERMAL_RUNAWAY_PROTECTION_BED_PERIOD > 0 && TEMP_SENSOR_BED != 0) +#if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION + enum TRState { TRReset, TRInactive, TRFirstHeating, TRStable, TRRunaway }; + void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc); + #if HAS_HEATER_THERMAL_PROTECTION + static TRState thermal_runaway_state_machine[4] = { TRReset, TRReset, TRReset, TRReset }; + static millis_t thermal_runaway_timer[4]; // = {0,0,0,0}; + #endif + #if HAS_BED_THERMAL_PROTECTION + static TRState thermal_runaway_bed_state_machine = TRReset; + static millis_t thermal_runaway_bed_timer; + #endif +#endif + //=========================================================================== //=============================private variables============================ //=========================================================================== @@ -109,7 +118,7 @@ static volatile bool temp_meas_ready = false; static float temp_iState_min_bed; static float temp_iState_max_bed; #else //PIDTEMPBED - static unsigned long previous_millis_bed_heater; + static millis_t next_bed_check_ms; #endif //PIDTEMPBED static unsigned char soft_pwm[EXTRUDERS]; @@ -117,7 +126,7 @@ static volatile bool temp_meas_ready = false; static unsigned char soft_pwm_fan; #endif #if HAS_AUTO_FAN - static unsigned long extruder_autofan_last_check; + static millis_t next_auto_fan_check_ms; #endif #ifdef PIDTEMP @@ -162,7 +171,7 @@ static void updateTemperaturesFromRawValues(); #ifdef WATCH_TEMP_PERIOD int watch_start_temp[EXTRUDERS] = { 0 }; - unsigned long watchmillis[EXTRUDERS] = { 0 }; + millis_t watchmillis[EXTRUDERS] = { 0 }; #endif //WATCH_TEMP_PERIOD #ifndef SOFT_PWM_SCALE @@ -187,7 +196,7 @@ void PID_autotune(float temp, int extruder, int ncycles) int cycles = 0; bool heating = true; - unsigned long temp_millis = millis(), t1 = temp_millis, t2 = temp_millis; + millis_t temp_ms = millis(), t1 = temp_ms, t2 = temp_ms; long t_high = 0, t_low = 0; long bias, d; @@ -196,7 +205,7 @@ void PID_autotune(float temp, int extruder, int ncycles) float max = 0, min = 10000; #if HAS_AUTO_FAN - unsigned long extruder_autofan_last_check = temp_millis; + millis_t next_auto_fan_check_ms = temp_ms + 2500; #endif if (extruder >= EXTRUDERS @@ -210,7 +219,7 @@ void PID_autotune(float temp, int extruder, int ncycles) SERIAL_ECHOLN(MSG_PID_AUTOTUNE_START); - disable_heater(); // switch off all heaters. + disable_all_heaters(); // switch off all heaters. if (extruder < 0) soft_pwm_bed = bias = d = MAX_BED_POWER / 2; @@ -218,11 +227,11 @@ void PID_autotune(float temp, int extruder, int ncycles) soft_pwm[extruder] = bias = d = PID_MAX / 2; // PID Tuning loop - for(;;) { + for (;;) { - unsigned long ms = millis(); + millis_t ms = millis(); - if (temp_meas_ready == true) { // temp sample ready + if (temp_meas_ready) { // temp sample ready updateTemperaturesFromRawValues(); input = (extruder<0)?current_temperature_bed:current_temperature[extruder]; @@ -231,9 +240,9 @@ void PID_autotune(float temp, int extruder, int ncycles) min = min(min, input); #if HAS_AUTO_FAN - if (ms > extruder_autofan_last_check + 2500) { + if (ms > next_auto_fan_check_ms) { checkExtruderAutoFans(); - extruder_autofan_last_check = ms; + next_auto_fan_check_ms = ms + 2500; } #endif @@ -308,7 +317,7 @@ void PID_autotune(float temp, int extruder, int ncycles) return; } // Every 2 seconds... - if (ms > temp_millis + 2000) { + if (ms > temp_ms + 2000) { int p; if (extruder < 0) { p = soft_pwm_bed; @@ -323,7 +332,7 @@ void PID_autotune(float temp, int extruder, int ncycles) SERIAL_PROTOCOLPGM(MSG_AT); SERIAL_PROTOCOLLN(p); - temp_millis = ms; + temp_ms = ms; } // every 2 seconds // Over 2 minutes? if (((ms - t1) + (ms - t2)) > (10L*60L*1000L*2L)) { @@ -434,7 +443,7 @@ void checkExtruderAutoFans() // Temperature Error Handlers // inline void _temp_error(int e, const char *msg1, const char *msg2) { - if (!IsStopped()) { + if (IsRunning()) { SERIAL_ERROR_START; if (e >= 0) SERIAL_ERRORLN((int)e); serialprintPGM(msg1); @@ -449,11 +458,11 @@ inline void _temp_error(int e, const char *msg1, const char *msg2) { } void max_temp_error(uint8_t e) { - disable_heater(); + disable_all_heaters(); _temp_error(e, PSTR(MSG_MAXTEMP_EXTRUDER_OFF), PSTR(MSG_ERR_MAXTEMP)); } void min_temp_error(uint8_t e) { - disable_heater(); + disable_all_heaters(); _temp_error(e, PSTR(MSG_MINTEMP_EXTRUDER_OFF), PSTR(MSG_ERR_MINTEMP)); } void bed_max_temp_error(void) { @@ -570,18 +579,34 @@ float get_pid_output(int e) { } #endif +/** + * Manage heating activities for extruder hot-ends and a heated bed + * - Acquire updated temperature readings + * - Invoke thermal runaway protection + * - Manage extruder auto-fan + * - Apply filament width to the extrusion rate (may move) + * - Update the heated bed PID output value + */ void manage_heater() { if (!temp_meas_ready) return; updateTemperaturesFromRawValues(); - unsigned long ms = millis(); + #ifdef HEATER_0_USES_MAX6675 + float ct = current_temperature[0]; + if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0); + if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0); + #endif //HEATER_0_USES_MAX6675 + + #if defined(WATCH_TEMP_PERIOD) || !defined(PIDTEMPBED) || HAS_AUTO_FAN + millis_t ms = millis(); + #endif // Loop through all extruders for (int e = 0; e < EXTRUDERS; e++) { - #if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0 + #if HAS_HEATER_THERMAL_PROTECTION thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_RUNAWAY_PROTECTION_PERIOD, THERMAL_RUNAWAY_PROTECTION_HYSTERESIS); #endif @@ -606,29 +631,44 @@ void manage_heater() { #ifdef TEMP_SENSOR_1_AS_REDUNDANT if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) { - disable_heater(); - _temp_error(-1, MSG_EXTRUDER_SWITCHED_OFF, MSG_ERR_REDUNDANT_TEMP); + disable_all_heaters(); + _temp_error(0, PSTR(MSG_EXTRUDER_SWITCHED_OFF), PSTR(MSG_ERR_REDUNDANT_TEMP)); } - #endif //TEMP_SENSOR_1_AS_REDUNDANT + #endif // TEMP_SENSOR_1_AS_REDUNDANT } // Extruders Loop #if HAS_AUTO_FAN - if (ms > extruder_autofan_last_check + 2500) { // only need to check fan state very infrequently + if (ms > next_auto_fan_check_ms) { // only need to check fan state very infrequently checkExtruderAutoFans(); - extruder_autofan_last_check = ms; + next_auto_fan_check_ms = ms + 2500; } #endif - + + // Control the extruder rate based on the width sensor + #ifdef FILAMENT_SENSOR + if (filament_sensor) { + meas_shift_index = delay_index1 - meas_delay_cm; + if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1; //loop around buffer if needed + + // Get the delayed info and add 100 to reconstitute to a percent of + // the nominal filament diameter then square it to get an area + meas_shift_index = constrain(meas_shift_index, 0, MAX_MEASUREMENT_DELAY); + float vm = pow((measurement_delay[meas_shift_index] + 100.0) / 100.0, 2); + if (vm < 0.01) vm = 0.01; + volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] = vm; + } + #endif //FILAMENT_SENSOR + #ifndef PIDTEMPBED - if (ms < previous_millis_bed_heater + BED_CHECK_INTERVAL) return; - previous_millis_bed_heater = ms; - #endif //PIDTEMPBED + if (ms < next_bed_check_ms) return; + next_bed_check_ms = ms + BED_CHECK_INTERVAL; + #endif #if TEMP_SENSOR_BED != 0 - #if defined(THERMAL_RUNAWAY_PROTECTION_BED_PERIOD) && THERMAL_RUNAWAY_PROTECTION_BED_PERIOD > 0 - thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, 9, THERMAL_RUNAWAY_PROTECTION_BED_PERIOD, THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS); + #if HAS_BED_THERMAL_PROTECTION + thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, -1, THERMAL_RUNAWAY_PROTECTION_BED_PERIOD, THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS); #endif #ifdef PIDTEMPBED @@ -636,22 +676,22 @@ void manage_heater() { soft_pwm_bed = current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP ? (int)pid_output >> 1 : 0; - #elif !defined(BED_LIMIT_SWITCHING) - // Check if temperature is within the correct range + #elif defined(BED_LIMIT_SWITCHING) + // Check if temperature is within the correct band if (current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP) { - soft_pwm_bed = current_temperature_bed < target_temperature_bed ? MAX_BED_POWER >> 1 : 0; + if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS) + soft_pwm_bed = 0; + else if (current_temperature_bed <= target_temperature_bed - BED_HYSTERESIS) + soft_pwm_bed = MAX_BED_POWER >> 1; } else { soft_pwm_bed = 0; WRITE_HEATER_BED(LOW); } - #else //#ifdef BED_LIMIT_SWITCHING - // Check if temperature is within the correct band + #else // BED_LIMIT_SWITCHING + // Check if temperature is within the correct range if (current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP) { - if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS) - soft_pwm_bed = 0; - else if (current_temperature_bed <= target_temperature_bed - BED_HYSTERESIS) - soft_pwm_bed = MAX_BED_POWER >> 1; + soft_pwm_bed = current_temperature_bed < target_temperature_bed ? MAX_BED_POWER >> 1 : 0; } else { soft_pwm_bed = 0; @@ -659,56 +699,36 @@ void manage_heater() { } #endif #endif //TEMP_SENSOR_BED != 0 - - // Control the extruder rate based on the width sensor - #ifdef FILAMENT_SENSOR - if (filament_sensor) { - meas_shift_index = delay_index1 - meas_delay_cm; - if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1; //loop around buffer if needed - - // Get the delayed info and add 100 to reconstitute to a percent of - // the nominal filament diameter then square it to get an area - meas_shift_index = constrain(meas_shift_index, 0, MAX_MEASUREMENT_DELAY); - float vm = pow((measurement_delay[meas_shift_index] + 100.0) / 100.0, 2); - if (vm < 0.01) vm = 0.01; - volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] = vm; - } - #endif //FILAMENT_SENSOR } #define PGM_RD_W(x) (short)pgm_read_word(&x) // Derived from RepRap FiveD extruder::getTemperature() // For hot end temperature measurement. static float analog2temp(int raw, uint8_t e) { -#ifdef TEMP_SENSOR_1_AS_REDUNDANT - if (e > EXTRUDERS) -#else - if (e >= EXTRUDERS) -#endif - { + #ifdef TEMP_SENSOR_1_AS_REDUNDANT + if (e > EXTRUDERS) + #else + if (e >= EXTRUDERS) + #endif + { SERIAL_ERROR_START; SERIAL_ERROR((int)e); SERIAL_ERRORLNPGM(MSG_INVALID_EXTRUDER_NUM); kill(); return 0.0; - } + } + #ifdef HEATER_0_USES_MAX6675 - if (e == 0) - { - return 0.25 * raw; - } + if (e == 0) return 0.25 * raw; #endif - if(heater_ttbl_map[e] != NULL) - { + if (heater_ttbl_map[e] != NULL) { float celsius = 0; uint8_t i; short (*tt)[][2] = (short (*)[][2])(heater_ttbl_map[e]); - for (i=1; i raw) - { + for (i = 1; i < heater_ttbllen_map[e]; i++) { + if (PGM_RD_W((*tt)[i][0]) > raw) { celsius = PGM_RD_W((*tt)[i-1][1]) + (raw - PGM_RD_W((*tt)[i-1][0])) * (float)(PGM_RD_W((*tt)[i][1]) - PGM_RD_W((*tt)[i-1][1])) / @@ -732,10 +752,8 @@ static float analog2tempBed(int raw) { float celsius = 0; byte i; - for (i=1; i raw) - { + for (i = 1; i < BEDTEMPTABLE_LEN; i++) { + if (PGM_RD_W(BEDTEMPTABLE[i][0]) > raw) { celsius = PGM_RD_W(BEDTEMPTABLE[i-1][1]) + (raw - PGM_RD_W(BEDTEMPTABLE[i-1][0])) * (float)(PGM_RD_W(BEDTEMPTABLE[i][1]) - PGM_RD_W(BEDTEMPTABLE[i-1][1])) / @@ -799,11 +817,11 @@ static void updateTemperaturesFromRawValues() { #endif - - - -void tp_init() -{ +/** + * Initialize the temperature manager + * The manager is implemented by periodic calls to manage_heater() + */ +void tp_init() { #if MB(RUMBA) && ((TEMP_SENSOR_0==-1)||(TEMP_SENSOR_1==-1)||(TEMP_SENSOR_2==-1)||(TEMP_SENSOR_BED==-1)) //disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector MCUCR=BIT(JTD); @@ -975,7 +993,7 @@ void tp_init() void setWatch() { #ifdef WATCH_TEMP_PERIOD - unsigned long ms = millis(); + millis_t ms = millis(); for (int e = 0; e < EXTRUDERS; e++) { if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE * 2)) { watch_start_temp[e] = degHotend(e); @@ -985,72 +1003,75 @@ void setWatch() { #endif } -#if defined(THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0 -void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) -{ -/* - SERIAL_ECHO_START; - SERIAL_ECHO("Thermal Thermal Runaway Running. Heater ID:"); - SERIAL_ECHO(heater_id); - SERIAL_ECHO(" ; State:"); - SERIAL_ECHO(*state); - SERIAL_ECHO(" ; Timer:"); - SERIAL_ECHO(*timer); - SERIAL_ECHO(" ; Temperature:"); - SERIAL_ECHO(temperature); - SERIAL_ECHO(" ; Target Temp:"); - SERIAL_ECHO(target_temperature); - SERIAL_ECHOLN(""); -*/ - if ((target_temperature == 0) || thermal_runaway) - { - *state = 0; - *timer = 0; - return; - } - switch (*state) - { - case 0: // "Heater Inactive" state - if (target_temperature > 0) *state = 1; - break; - case 1: // "First Heating" state - if (temperature >= target_temperature) *state = 2; - break; - case 2: // "Temperature Stable" state - { - unsigned long ms = millis(); - if (temperature >= (target_temperature - hysteresis_degc)) - { - *timer = ms; - } - else if ( (ms - *timer) > ((unsigned long) period_seconds) * 1000) - { +#if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION + + void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) { + + static float tr_target_temperature[EXTRUDERS+1] = { 0.0 }; + + /* + SERIAL_ECHO_START; + SERIAL_ECHOPGM("Thermal Thermal Runaway Running. Heater ID: "); + if (heater_id < 0) SERIAL_ECHOPGM("bed"); else SERIAL_ECHOPGM(heater_id); + SERIAL_ECHOPGM(" ; State:"); + SERIAL_ECHOPGM(*state); + SERIAL_ECHOPGM(" ; Timer:"); + SERIAL_ECHOPGM(*timer); + SERIAL_ECHOPGM(" ; Temperature:"); + SERIAL_ECHOPGM(temperature); + SERIAL_ECHOPGM(" ; Target Temp:"); + SERIAL_ECHOPGM(target_temperature); + SERIAL_EOL; + */ + + int heater_index = heater_id >= 0 ? heater_id : EXTRUDERS; + + // If the target temperature changes, restart + if (tr_target_temperature[heater_index] != target_temperature) + *state = TRReset; + + switch (*state) { + case TRReset: + *timer = 0; + *state = TRInactive; + break; + // Inactive state waits for a target temperature to be set + case TRInactive: + if (target_temperature > 0) { + tr_target_temperature[heater_index] = target_temperature; + *state = TRFirstHeating; + } + break; + // When first heating, wait for the temperature to be reached then go to Stable state + case TRFirstHeating: + if (temperature >= tr_target_temperature[heater_index]) *state = TRStable; + break; + // While the temperature is stable watch for a bad temperature + case TRStable: + // If the temperature is over the target (-hysteresis) restart the timer + if (temperature >= tr_target_temperature[heater_index] - hysteresis_degc) + *timer = millis(); + // If the timer goes too long without a reset, trigger shutdown + else if (millis() > *timer + period_seconds * 1000UL) + *state = TRRunaway; + break; + case TRRunaway: SERIAL_ERROR_START; SERIAL_ERRORLNPGM(MSG_THERMAL_RUNAWAY_STOP); - SERIAL_ERRORLN((int)heater_id); - LCD_ALERTMESSAGEPGM(MSG_THERMAL_RUNAWAY); // translatable - thermal_runaway = true; - while(1) - { - disable_heater(); - disable_x(); - disable_y(); - disable_z(); - disable_e0(); - disable_e1(); - disable_e2(); - disable_e3(); + if (heater_id < 0) SERIAL_ERRORLNPGM("bed"); else SERIAL_ERRORLN(heater_id); + LCD_ALERTMESSAGEPGM(MSG_THERMAL_RUNAWAY); + disable_all_heaters(); + disable_all_steppers(); + for (;;) { manage_heater(); lcd_update(); } - } - } break; + } } -} -#endif //THERMAL_RUNAWAY_PROTECTION_PERIOD +#endif // HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION -void disable_heater() { +void disable_all_heaters() { for (int i=0; i= OVERSAMPLENR) { // 10 * 16 * 1/(16000000/64/256) = 164ms. - if (!temp_meas_ready) { //Only update the raw values if they have been read. Else we could be updating them during reading. - #ifndef HEATER_0_USES_MAX6675 - current_temperature_raw[0] = raw_temp_value[0]; - #endif - #if EXTRUDERS > 1 - current_temperature_raw[1] = raw_temp_value[1]; - #if EXTRUDERS > 2 - current_temperature_raw[2] = raw_temp_value[2]; - #if EXTRUDERS > 3 - current_temperature_raw[3] = raw_temp_value[3]; - #endif - #endif - #endif - #ifdef TEMP_SENSOR_1_AS_REDUNDANT - redundant_temperature_raw = raw_temp_value[1]; - #endif - current_temperature_bed_raw = raw_temp_bed_value; - } //!temp_meas_ready + // Update the raw values if they've been read. Else we could be updating them during reading. + if (!temp_meas_ready) set_current_temp_raw(); // Filament Sensor - can be read any time since IIR filtering is used #if HAS_FILAMENT_SENSOR current_raw_filwidth = raw_filwidth_value >> 10; // Divide to get to 0-16384 range since we used 1/128 IIR filter approach #endif - temp_meas_ready = true; temp_count = 0; - for (int i = 0; i < TEMP_SENSOR_COUNT; i++) raw_temp_value[i] = 0; + for (int i = 0; i < 4; i++) raw_temp_value[i] = 0; raw_temp_bed_value = 0; - #ifdef HEATER_0_USES_MAX6675 - float ct = current_temperature[0]; - if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0); - if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0); - #else + #if HAS_TEMP_0 && !defined(HEATER_0_USES_MAX6675) #if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP #define GE0 <= #else @@ -1520,38 +1543,37 @@ ISR(TIMER0_COMPB_vect) { if (minttemp_raw[0] GE0 current_temperature_raw[0]) min_temp_error(0); #endif - #if EXTRUDERS > 1 + #if HAS_TEMP_1 #if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP #define GE1 <= #else #define GE1 >= #endif if (current_temperature_raw[1] GE1 maxttemp_raw[1]) max_temp_error(1); - if (minttemp_raw[1] GE0 current_temperature_raw[1]) min_temp_error(1); + if (minttemp_raw[1] GE1 current_temperature_raw[1]) min_temp_error(1); + #endif // TEMP_SENSOR_1 - #if EXTRUDERS > 2 - #if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP - #define GE2 <= - #else - #define GE2 >= - #endif - if (current_temperature_raw[2] GE2 maxttemp_raw[2]) max_temp_error(2); - if (minttemp_raw[2] GE0 current_temperature_raw[2]) min_temp_error(2); - - #if EXTRUDERS > 3 - #if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP - #define GE3 <= - #else - #define GE3 >= - #endif - if (current_temperature_raw[3] GE3 maxttemp_raw[3]) max_temp_error(3); - if (minttemp_raw[3] GE0 current_temperature_raw[3]) min_temp_error(3); + #if HAS_TEMP_2 + #if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP + #define GE2 <= + #else + #define GE2 >= + #endif + if (current_temperature_raw[2] GE2 maxttemp_raw[2]) max_temp_error(2); + if (minttemp_raw[2] GE2 current_temperature_raw[2]) min_temp_error(2); + #endif // TEMP_SENSOR_2 - #endif // EXTRUDERS > 3 - #endif // EXTRUDERS > 2 - #endif // EXTRUDERS > 1 + #if HAS_TEMP_3 + #if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP + #define GE3 <= + #else + #define GE3 >= + #endif + if (current_temperature_raw[3] GE3 maxttemp_raw[3]) max_temp_error(3); + if (minttemp_raw[3] GE3 current_temperature_raw[3]) min_temp_error(3); + #endif // TEMP_SENSOR_3 - #if defined(BED_MAXTEMP) && (TEMP_SENSOR_BED != 0) + #if HAS_TEMP_BED #if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP #define GEBED <= #else @@ -1566,16 +1588,16 @@ ISR(TIMER0_COMPB_vect) { } // temp_count >= OVERSAMPLENR #ifdef BABYSTEPPING - for (uint8_t axis=X_AXIS; axis<=Z_AXIS; axis++) { - int curTodo=babystepsTodo[axis]; //get rid of volatile for performance + for (uint8_t axis = X_AXIS; axis <= Z_AXIS; axis++) { + int curTodo = babystepsTodo[axis]; //get rid of volatile for performance if (curTodo > 0) { babystep(axis,/*fwd*/true); - babystepsTodo[axis]--; //less to do next time + babystepsTodo[axis]--; //fewer to do next time } - else if(curTodo < 0) { + else if (curTodo < 0) { babystep(axis,/*fwd*/false); - babystepsTodo[axis]++; //less to do next time + babystepsTodo[axis]++; //fewer to do next time } } #endif //BABYSTEPPING diff --git a/Marlin/temperature.h b/Marlin/temperature.h index b29fc2b57..f9effaa9e 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -18,8 +18,8 @@ along with Grbl. If not, see . */ -#ifndef temperature_h -#define temperature_h +#ifndef TEMPERATURE_H +#define TEMPERATURE_H #include "Marlin.h" #include "planner.h" @@ -41,10 +41,10 @@ void manage_heater(); //it is critical that this is called periodically. // low level conversion routines // do not use these routines and variables outside of temperature.cpp -extern int target_temperature[EXTRUDERS]; -extern float current_temperature[EXTRUDERS]; +extern int target_temperature[4]; +extern float current_temperature[4]; #ifdef SHOW_TEMP_ADC_VALUES - extern int current_temperature_raw[EXTRUDERS]; + extern int current_temperature_raw[4]; extern int current_temperature_bed_raw; #endif extern int target_temperature_bed; @@ -53,7 +53,7 @@ extern float current_temperature_bed; extern float redundant_temperature; #endif -#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1 +#if HAS_CONTROLLERFAN extern unsigned char soft_pwm_bed; #endif @@ -72,11 +72,11 @@ extern float current_temperature_bed; float unscalePID_d(float d); #endif + #ifdef PIDTEMPBED extern float bedKp,bedKi,bedKd; #endif - #ifdef BABYSTEPPING extern volatile int babystepsTodo[3]; #endif @@ -105,57 +105,38 @@ FORCE_INLINE bool isHeatingBed() { return target_temperature_bed > current_tempe FORCE_INLINE bool isCoolingHotend(uint8_t extruder) { return target_temperature[extruder] < current_temperature[extruder]; } FORCE_INLINE bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; } -#define degHotend0() degHotend(0) -#define degTargetHotend0() degTargetHotend(0) -#define setTargetHotend0(_celsius) setTargetHotend((_celsius), 0) -#define isHeatingHotend0() isHeatingHotend(0) -#define isCoolingHotend0() isCoolingHotend(0) +#define HOTEND_ROUTINES(NR) \ + FORCE_INLINE float degHotend##NR() { return degHotend(NR); } \ + FORCE_INLINE float degTargetHotend##NR() { return degTargetHotend(NR); } \ + FORCE_INLINE void setTargetHotend##NR(const float c) { setTargetHotend(c, NR); } \ + FORCE_INLINE bool isHeatingHotend##NR() { return isHeatingHotend(NR); } \ + FORCE_INLINE bool isCoolingHotend##NR() { return isCoolingHotend(NR); } +HOTEND_ROUTINES(0); #if EXTRUDERS > 1 - #define degHotend1() degHotend(1) - #define degTargetHotend1() degTargetHotend(1) - #define setTargetHotend1(_celsius) setTargetHotend((_celsius), 1) - #define isHeatingHotend1() isHeatingHotend(1) - #define isCoolingHotend1() isCoolingHotend(1) + HOTEND_ROUTINES(1); #else - #define setTargetHotend1(_celsius) do{}while(0) + #define setTargetHotend1(c) do{}while(0) #endif #if EXTRUDERS > 2 - #define degHotend2() degHotend(2) - #define degTargetHotend2() degTargetHotend(2) - #define setTargetHotend2(_celsius) setTargetHotend((_celsius), 2) - #define isHeatingHotend2() isHeatingHotend(2) - #define isCoolingHotend2() isCoolingHotend(2) + HOTEND_ROUTINES(2); #else - #define setTargetHotend2(_celsius) do{}while(0) + #define setTargetHotend2(c) do{}while(0) #endif #if EXTRUDERS > 3 - #define degHotend3() degHotend(3) - #define degTargetHotend3() degTargetHotend(3) - #define setTargetHotend3(_celsius) setTargetHotend((_celsius), 3) - #define isHeatingHotend3() isHeatingHotend(3) - #define isCoolingHotend3() isCoolingHotend(3) + HOTEND_ROUTINES(3); #else - #define setTargetHotend3(_celsius) do{}while(0) -#endif -#if EXTRUDERS > 4 - #error Invalid number of extruders + #define setTargetHotend3(c) do{}while(0) #endif int getHeaterPower(int heater); -void disable_heater(); +void disable_all_heaters(); void setWatch(); void updatePID(); -#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0 -void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc); -static int thermal_runaway_state_machine[4]; // = {0,0,0,0}; -static unsigned long thermal_runaway_timer[4]; // = {0,0,0,0}; -static bool thermal_runaway = false; -#if TEMP_SENSOR_BED != 0 - static int thermal_runaway_bed_state_machine; - static unsigned long thermal_runaway_bed_timer; -#endif -#endif +void PID_autotune(float temp, int extruder, int ncycles); + +void setExtruderAutoFanState(int pin, bool state); +void checkExtruderAutoFans(); FORCE_INLINE void autotempShutdown() { #ifdef AUTOTEMP @@ -167,9 +148,4 @@ FORCE_INLINE void autotempShutdown() { #endif } -void PID_autotune(float temp, int extruder, int ncycles); - -void setExtruderAutoFanState(int pin, bool state); -void checkExtruderAutoFans(); - -#endif +#endif // TEMPERATURE_H diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 0c27e7d50..d0fe358ac 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -22,212 +22,213 @@ int absPreheatHPBTemp; int absPreheatFanSpeed; #ifdef FILAMENT_LCD_DISPLAY - unsigned long message_millis = 0; + millis_t previous_lcd_status_ms = 0; #endif -#ifdef ULTIPANEL - static float manual_feedrate[] = MANUAL_FEEDRATE; -#endif // ULTIPANEL - /* !Configuration settings */ //Function pointer to menu functions. typedef void (*menuFunc_t)(); uint8_t lcd_status_message_level; -char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG; +char lcd_status_message[3*LCD_WIDTH+1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1 #ifdef DOGLCD -#include "dogm_lcd_implementation.h" + #include "dogm_lcd_implementation.h" #else -#include "ultralcd_implementation_hitachi_HD44780.h" + #include "ultralcd_implementation_hitachi_HD44780.h" #endif -/* Different menus */ +// The main status screen static void lcd_status_screen(); -#ifdef ULTIPANEL -extern bool powersupply; -static void lcd_main_menu(); -static void lcd_tune_menu(); -static void lcd_prepare_menu(); -static void lcd_move_menu(); -static void lcd_control_menu(); -static void lcd_control_temperature_menu(); -static void lcd_control_temperature_preheat_pla_settings_menu(); -static void lcd_control_temperature_preheat_abs_settings_menu(); -static void lcd_control_motion_menu(); -static void lcd_control_volumetric_menu(); -#ifdef DOGLCD -static void lcd_set_contrast(); -#endif -#ifdef FWRETRACT -static void lcd_control_retract_menu(); -#endif -static void lcd_sdcard_menu(); -#ifdef DELTA_CALIBRATION_MENU -static void lcd_delta_calibrate_menu(); -#endif // DELTA_CALIBRATION_MENU - -#if defined(MANUAL_BED_LEVELING) -#include "mesh_bed_leveling.h" -static void _lcd_level_bed(); -static void _lcd_level_bed_homing(); -static void lcd_level_bed(); -#endif // MANUAL_BED_LEVELING +#ifdef ULTIPANEL -static void lcd_quick_feedback();//Cause an LCD refresh, and give the user visual or audible feedback that something has happened - -/* Different types of actions that can be used in menu items. */ -static void menu_action_back(menuFunc_t data); -static void menu_action_submenu(menuFunc_t data); -static void menu_action_gcode(const char* pgcode); -static void menu_action_function(menuFunc_t data); -static void menu_action_sdfile(const char* filename, char* longFilename); -static void menu_action_sddirectory(const char* filename, char* longFilename); -static void menu_action_setting_edit_bool(const char* pstr, bool* ptr); -static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue); -static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue); -static void menu_action_setting_edit_float32(const char* pstr, float* ptr, float minValue, float maxValue); -static void menu_action_setting_edit_float43(const char* pstr, float* ptr, float minValue, float maxValue); -static void menu_action_setting_edit_float5(const char* pstr, float* ptr, float minValue, float maxValue); -static void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue); -static void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue); -static void menu_action_setting_edit_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue); -static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callbackFunc); -static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callbackFunc); -static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); -static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); -static void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); -static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); -static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); -static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); -static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc); - -#define ENCODER_FEEDRATE_DEADZONE 10 - -#if !defined(LCD_I2C_VIKI) - #ifndef ENCODER_STEPS_PER_MENU_ITEM - #define ENCODER_STEPS_PER_MENU_ITEM 5 + #if HAS_POWER_SWITCH + extern bool powersupply; #endif - #ifndef ENCODER_PULSES_PER_STEP - #define ENCODER_PULSES_PER_STEP 1 + static float manual_feedrate[] = MANUAL_FEEDRATE; + static void lcd_main_menu(); + static void lcd_tune_menu(); + static void lcd_prepare_menu(); + static void lcd_move_menu(); + static void lcd_control_menu(); + static void lcd_control_temperature_menu(); + static void lcd_control_temperature_preheat_pla_settings_menu(); + static void lcd_control_temperature_preheat_abs_settings_menu(); + static void lcd_control_motion_menu(); + static void lcd_control_volumetric_menu(); + #ifdef HAS_LCD_CONTRAST + static void lcd_set_contrast(); #endif -#else - #ifndef ENCODER_STEPS_PER_MENU_ITEM - #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation + #ifdef FWRETRACT + static void lcd_control_retract_menu(); #endif - #ifndef ENCODER_PULSES_PER_STEP - #define ENCODER_PULSES_PER_STEP 1 + static void lcd_sdcard_menu(); + + #ifdef DELTA_CALIBRATION_MENU + static void lcd_delta_calibrate_menu(); #endif -#endif + #if defined(MANUAL_BED_LEVELING) + #include "mesh_bed_leveling.h" + static void _lcd_level_bed(); + static void _lcd_level_bed_homing(); + static void lcd_level_bed(); + #endif -/* Helper macros for menus */ - -/** - * START_MENU generates the init code for a menu function - */ -#define START_MENU() do { \ - encoderRateMultiplierEnabled = false; \ - if (encoderPosition > 0x8000) encoderPosition = 0; \ - uint8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \ - if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \ - uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \ - bool wasClicked = LCD_CLICKED, itemSelected; \ - if (wasClicked) lcd_quick_feedback(); \ - for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \ - _menuItemNr = 0; - -/** - * MENU_ITEM generates draw & handler code for a menu item, potentially calling: - * - * lcd_implementation_drawmenu_[type](sel, row, label, arg3...) - * menu_action_[type](arg3...) - * - * Examples: - * MENU_ITEM(back, MSG_WATCH, lcd_status_screen) - * lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH), lcd_status_screen) - * menu_action_back(lcd_status_screen) - * - * MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause) - * lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause) - * menu_action_function(lcd_sdcard_pause) - * - * MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999) - * MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedmultiply, 10, 999) - * lcd_implementation_drawmenu_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedmultiply, 10, 999) - * menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedmultiply, 10, 999) - * - */ -#define MENU_ITEM(type, label, args...) do { \ - if (_menuItemNr == _lineNr) { \ - itemSelected = encoderLine == _menuItemNr; \ - if (lcdDrawUpdate) \ - lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \ - if (wasClicked && itemSelected) { \ - menu_action_ ## type(args); \ - return; \ - } \ - } \ - _menuItemNr++; \ -} while(0) + /* Different types of actions that can be used in menu items. */ + static void menu_action_back(menuFunc_t data); + static void menu_action_submenu(menuFunc_t data); + static void menu_action_gcode(const char* pgcode); + static void menu_action_function(menuFunc_t data); + static void menu_action_sdfile(const char* filename, char* longFilename); + static void menu_action_sddirectory(const char* filename, char* longFilename); + static void menu_action_setting_edit_bool(const char* pstr, bool* ptr); + static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue); + static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue); + static void menu_action_setting_edit_float32(const char* pstr, float* ptr, float minValue, float maxValue); + static void menu_action_setting_edit_float43(const char* pstr, float* ptr, float minValue, float maxValue); + static void menu_action_setting_edit_float5(const char* pstr, float* ptr, float minValue, float maxValue); + static void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue); + static void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue); + static void menu_action_setting_edit_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue); + static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callbackFunc); + static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callbackFunc); + static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); + static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); + static void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); + static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); + static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); + static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); + static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc); + + #define ENCODER_FEEDRATE_DEADZONE 10 + + #if !defined(LCD_I2C_VIKI) + #ifndef ENCODER_STEPS_PER_MENU_ITEM + #define ENCODER_STEPS_PER_MENU_ITEM 5 + #endif + #ifndef ENCODER_PULSES_PER_STEP + #define ENCODER_PULSES_PER_STEP 1 + #endif + #else + #ifndef ENCODER_STEPS_PER_MENU_ITEM + #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation + #endif + #ifndef ENCODER_PULSES_PER_STEP + #define ENCODER_PULSES_PER_STEP 1 + #endif + #endif + + + /* Helper macros for menus */ + + /** + * START_MENU generates the init code for a menu function + */ + #define START_MENU() do { \ + encoderRateMultiplierEnabled = false; \ + if (encoderPosition > 0x8000) encoderPosition = 0; \ + uint8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \ + if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \ + uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \ + bool wasClicked = LCD_CLICKED, itemSelected; \ + for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \ + _menuItemNr = 0; -#ifdef ENCODER_RATE_MULTIPLIER /** - * MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item + * MENU_ITEM generates draw & handler code for a menu item, potentially calling: + * + * lcd_implementation_drawmenu_[type](sel, row, label, arg3...) + * menu_action_[type](arg3...) + * + * Examples: + * MENU_ITEM(back, MSG_WATCH, lcd_status_screen) + * lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH), lcd_status_screen) + * menu_action_back(lcd_status_screen) + * + * MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause) + * lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause) + * menu_action_function(lcd_sdcard_pause) + * + * MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_multiplier, 10, 999) + * MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedrate_multiplier, 10, 999) + * lcd_implementation_drawmenu_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedrate_multiplier, 10, 999) + * menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_multiplier, 10, 999) + * */ - #define MENU_MULTIPLIER_ITEM(type, label, args...) do { \ + #define MENU_ITEM(type, label, args...) do { \ if (_menuItemNr == _lineNr) { \ itemSelected = encoderLine == _menuItemNr; \ if (lcdDrawUpdate) \ lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \ if (wasClicked && itemSelected) { \ - encoderRateMultiplierEnabled = true; \ - lastEncoderMovementMillis = 0; \ + lcd_quick_feedback(); \ menu_action_ ## type(args); \ return; \ } \ } \ _menuItemNr++; \ } while(0) -#endif //ENCODER_RATE_MULTIPLIER - -#define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0) -#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) -#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) -#ifdef ENCODER_RATE_MULTIPLIER - #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) - #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) -#else //!ENCODER_RATE_MULTIPLIER - #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) - #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) -#endif //!ENCODER_RATE_MULTIPLIER -#define END_MENU() \ - if (encoderLine >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\ - if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \ - } } while(0) - -/** Used variables to keep track of the menu */ -#ifndef REPRAPWORLD_KEYPAD -volatile uint8_t buttons;//Contains the bits of the currently pressed buttons. -#else -volatile uint8_t buttons_reprapworld_keypad; // to store the reprapworld_keypad shift register values -#endif -#ifdef LCD_HAS_SLOW_BUTTONS -volatile uint8_t slow_buttons;//Contains the bits of the currently pressed buttons. -#endif -uint8_t currentMenuViewOffset; /* scroll offset in the current menu */ -uint32_t blocking_enc; -uint8_t lastEncoderBits; -uint32_t encoderPosition; -#if (SDCARDDETECT > 0) -bool lcd_oldcardstatus; -#endif -#endif //ULTIPANEL + + #ifdef ENCODER_RATE_MULTIPLIER + /** + * MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item + */ + #define MENU_MULTIPLIER_ITEM(type, label, args...) do { \ + if (_menuItemNr == _lineNr) { \ + itemSelected = encoderLine == _menuItemNr; \ + if (lcdDrawUpdate) \ + lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \ + if (wasClicked && itemSelected) { \ + lcd_quick_feedback(); \ + encoderRateMultiplierEnabled = true; \ + lastEncoderMovementMillis = 0; \ + menu_action_ ## type(args); \ + return; \ + } \ + } \ + _menuItemNr++; \ + } while(0) + #endif //ENCODER_RATE_MULTIPLIER + + #define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0) + #define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) + #define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) + #ifdef ENCODER_RATE_MULTIPLIER + #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) + #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) + #else //!ENCODER_RATE_MULTIPLIER + #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) + #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) + #endif //!ENCODER_RATE_MULTIPLIER + #define END_MENU() \ + if (encoderLine >= _menuItemNr) { encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; }\ + if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \ + } } while(0) + + /** Used variables to keep track of the menu */ + #ifndef REPRAPWORLD_KEYPAD + volatile uint8_t buttons; // Bits of the pressed buttons. + #else + volatile uint8_t buttons_reprapworld_keypad; // The reprapworld_keypad shift register values + #endif + #ifdef LCD_HAS_SLOW_BUTTONS + volatile uint8_t slow_buttons; // Bits of the pressed buttons. + #endif + uint8_t currentMenuViewOffset; /* scroll offset in the current menu */ + millis_t next_button_update_ms; + uint8_t lastEncoderBits; + uint32_t encoderPosition; + #if (SDCARDDETECT > 0) + bool lcd_oldcardstatus; + #endif + +#endif // ULTIPANEL menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */ -uint32_t lcd_next_update_millis; +millis_t next_lcd_update_ms; uint8_t lcd_status_update_delay; bool ignore_click = false; bool wait_for_unclick; @@ -245,130 +246,117 @@ menuFunc_t callbackFunc; // place-holders for Ki and Kd edits float raw_Ki, raw_Kd; -static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool feedback=true) { +static void lcd_goto_menu(menuFunc_t menu, const bool feedback=false, const uint32_t encoder=0) { if (currentMenu != menu) { currentMenu = menu; - encoderPosition = encoder; - if (feedback) lcd_quick_feedback(); - + #ifdef NEWPANEL + encoderPosition = encoder; + if (feedback) lcd_quick_feedback(); + #endif // For LCD_PROGRESS_BAR re-initialize the custom characters - #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD) + #ifdef LCD_PROGRESS_BAR lcd_set_custom_characters(menu == lcd_status_screen); #endif } } /* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent */ -static void lcd_status_screen() -{ +static void lcd_status_screen() { encoderRateMultiplierEnabled = false; - #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD) - uint16_t mil = millis(); + + #ifdef LCD_PROGRESS_BAR + millis_t ms = millis(); #ifndef PROGRESS_MSG_ONCE - if (mil > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) { - progressBarTick = mil; + if (ms > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) { + progressBarTick = ms; } #endif #if PROGRESS_MSG_EXPIRE > 0 - // keep the message alive if paused, count down otherwise - if (messageTick > 0) { + // Handle message expire + if (expireStatusMillis > 0) { if (card.isFileOpen()) { + // Expire the message when printing is active if (IS_SD_PRINTING) { - if ((mil-messageTick) >= PROGRESS_MSG_EXPIRE) { + // Expire the message when printing is active + if (ms >= expireStatusMillis) { lcd_status_message[0] = '\0'; - messageTick = 0; + expireStatusMillis = 0; } } else { - messageTick += LCD_UPDATE_INTERVAL; + expireStatusMillis += LCD_UPDATE_INTERVAL; } } else { - messageTick = 0; + expireStatusMillis = 0; } } #endif #endif //LCD_PROGRESS_BAR - if (lcd_status_update_delay) - lcd_status_update_delay--; - else - lcdDrawUpdate = 1; + lcd_implementation_status_screen(); - if (lcdDrawUpdate) { - lcd_implementation_status_screen(); - lcd_status_update_delay = 10; /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */ - } - -#ifdef ULTIPANEL + #ifdef ULTIPANEL bool current_click = LCD_CLICKED; if (ignore_click) { - if (wait_for_unclick) { - if (!current_click) { - ignore_click = wait_for_unclick = false; - } - else { - current_click = false; - } - } - else if (current_click) { - lcd_quick_feedback(); - wait_for_unclick = true; - current_click = false; - } + if (wait_for_unclick) { + if (!current_click) + ignore_click = wait_for_unclick = false; + else + current_click = false; + } + else if (current_click) { + lcd_quick_feedback(); + wait_for_unclick = true; + current_click = false; + } } - if (current_click) - { - lcd_goto_menu(lcd_main_menu); - lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. - #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD) - currentMenu == lcd_status_screen - #endif - ); - #ifdef FILAMENT_LCD_DISPLAY - message_millis = millis(); // get status message to show up for a while + if (current_click) { + lcd_goto_menu(lcd_main_menu, true); + lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. + #ifdef LCD_PROGRESS_BAR + currentMenu == lcd_status_screen #endif + ); + #ifdef FILAMENT_LCD_DISPLAY + previous_lcd_status_ms = millis(); // get status message to show up for a while + #endif } -#ifdef ULTIPANEL_FEEDMULTIPLY - // Dead zone at 100% feedrate - if ((feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100) || - (feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100)) - { - encoderPosition = 0; - feedmultiply = 100; - } - - if (feedmultiply == 100 && int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE) - { - feedmultiply += int(encoderPosition) - ENCODER_FEEDRATE_DEADZONE; - encoderPosition = 0; - } - else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE) - { - feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE; + #ifdef ULTIPANEL_FEEDMULTIPLY + // Dead zone at 100% feedrate + if ((feedrate_multiplier < 100 && (feedrate_multiplier + int(encoderPosition)) > 100) || + (feedrate_multiplier > 100 && (feedrate_multiplier + int(encoderPosition)) < 100)) { encoderPosition = 0; - } - else if (feedmultiply != 100) - { - feedmultiply += int(encoderPosition); + feedrate_multiplier = 100; + } + if (feedrate_multiplier == 100) { + if (int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE) { + feedrate_multiplier += int(encoderPosition) - ENCODER_FEEDRATE_DEADZONE; + encoderPosition = 0; + } + else if (int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE) { + feedrate_multiplier += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE; + encoderPosition = 0; + } + } + else { + feedrate_multiplier += int(encoderPosition); encoderPosition = 0; - } -#endif //ULTIPANEL_FEEDMULTIPLY + } + #endif // ULTIPANEL_FEEDMULTIPLY - if (feedmultiply < 10) - feedmultiply = 10; - else if (feedmultiply > 999) - feedmultiply = 999; -#endif //ULTIPANEL + feedrate_multiplier = constrain(feedrate_multiplier, 10, 999); + + #endif //ULTIPANEL } #ifdef ULTIPANEL -static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen, 0, false); } +static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen); } static void lcd_sdcard_pause() { card.pauseSDPrint(); } @@ -380,7 +368,7 @@ static void lcd_sdcard_stop() { card.closefile(); autotempShutdown(); cancel_heatup = true; - lcd_setstatus(MSG_PRINT_ABORTED); + lcd_setstatus(MSG_PRINT_ABORTED, true); } /* Menu implementation */ @@ -425,7 +413,7 @@ static void lcd_main_menu() { END_MENU(); } -#if defined( SDSUPPORT ) && defined( MENU_ADDAUTOSTART ) +#if defined(SDSUPPORT) && defined(MENU_ADDAUTOSTART) static void lcd_autostart_sd() { card.autostart_index = 0; card.setroot(); @@ -434,7 +422,7 @@ static void lcd_main_menu() { #endif void lcd_set_home_offsets() { - for(int8_t i=0; i < NUM_AXIS; i++) { + for (int8_t i=0; i < NUM_AXIS; i++) { if (i != E_AXIS) { home_offset[i] -= current_position[i]; current_position[i] = 0.0; @@ -443,7 +431,7 @@ void lcd_set_home_offsets() { plan_set_position(0.0, 0.0, 0.0, current_position[E_AXIS]); // Audio feedback - enquecommands_P(PSTR("M300 S659 P200\nM300 S698 P200")); + enqueuecommands_P(PSTR("M300 S659 P200\nM300 S698 P200")); lcd_return_to_status(); } @@ -468,7 +456,7 @@ void lcd_set_home_offsets() { static void lcd_tune_menu() { START_MENU(); MENU_ITEM(back, MSG_MAIN, lcd_main_menu); - MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999); + MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_multiplier, 10, 999); #if TEMP_SENSOR_0 != 0 MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15); #endif @@ -485,7 +473,7 @@ static void lcd_tune_menu() { MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15); #endif MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255); - MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999); + MENU_ITEM_EDIT(int3, MSG_FLOW, &extruder_multiply[active_extruder], 10, 999); MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F0, &extruder_multiply[0], 10, 999); #if TEMP_SENSOR_1 != 0 MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F1, &extruder_multiply[1], 10, 999); @@ -520,22 +508,21 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } -#if TEMP_SENSOR_1 != 0 //2nd extruder preheat - void lcd_preheat_pla1() { _lcd_preheat(1, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } - void lcd_preheat_abs1() { _lcd_preheat(1, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } -#endif //2nd extruder preheat - -#if TEMP_SENSOR_2 != 0 //3 extruder preheat - void lcd_preheat_pla2() { _lcd_preheat(2, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } - void lcd_preheat_abs2() { _lcd_preheat(2, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } -#endif //3 extruder preheat +#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0 //more than one extruder present -#if TEMP_SENSOR_3 != 0 //4 extruder preheat - void lcd_preheat_pla3() { _lcd_preheat(3, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } - void lcd_preheat_abs3() { _lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } -#endif //4 extruder preheat + #if TEMP_SENSOR_1 != 0 + void lcd_preheat_pla1() { _lcd_preheat(1, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } + void lcd_preheat_abs1() { _lcd_preheat(1, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } + #endif + #if TEMP_SENSOR_2 != 0 + void lcd_preheat_pla2() { _lcd_preheat(2, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } + void lcd_preheat_abs2() { _lcd_preheat(2, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } + #endif + #if TEMP_SENSOR_3 != 0 + void lcd_preheat_pla3() { _lcd_preheat(3, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } + void lcd_preheat_abs3() { _lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } + #endif -#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //more than one extruder present void lcd_preheat_pla0123() { setTargetHotend0(plaPreheatHotendTemp); setTargetHotend1(plaPreheatHotendTemp); @@ -548,54 +535,54 @@ void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTem setTargetHotend2(absPreheatHotendTemp); _lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } -#endif //more than one extruder present -void lcd_preheat_pla_bedonly() { _lcd_preheat(0, 0, plaPreheatHPBTemp, plaPreheatFanSpeed); } -void lcd_preheat_abs_bedonly() { _lcd_preheat(0, 0, absPreheatHPBTemp, absPreheatFanSpeed); } + #if TEMP_SENSOR_0 != 0 -static void lcd_preheat_pla_menu() { - START_MENU(); - MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu); - MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H1, lcd_preheat_pla0); - #if TEMP_SENSOR_1 != 0 //2 extruder preheat - MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H2, lcd_preheat_pla1); - #endif //2 extruder preheat - #if TEMP_SENSOR_2 != 0 //3 extruder preheat - MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H3, lcd_preheat_pla2); - #endif //3 extruder preheat - #if TEMP_SENSOR_3 != 0 //4 extruder preheat - MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H4, lcd_preheat_pla3); - #endif //4 extruder preheat - #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //all extruder preheat - MENU_ITEM(function, MSG_PREHEAT_PLA_ALL, lcd_preheat_pla0123); - #endif //all extruder preheat - #if TEMP_SENSOR_BED != 0 - MENU_ITEM(function, MSG_PREHEAT_PLA_BEDONLY, lcd_preheat_pla_bedonly); - #endif - END_MENU(); -} + void lcd_preheat_pla_bedonly() { _lcd_preheat(0, 0, plaPreheatHPBTemp, plaPreheatFanSpeed); } + void lcd_preheat_abs_bedonly() { _lcd_preheat(0, 0, absPreheatHPBTemp, absPreheatFanSpeed); } -static void lcd_preheat_abs_menu() { - START_MENU(); - MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu); - MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H1, lcd_preheat_abs0); - #if TEMP_SENSOR_1 != 0 //2 extruder preheat - MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H2, lcd_preheat_abs1); - #endif //2 extruder preheat - #if TEMP_SENSOR_2 != 0 //3 extruder preheat - MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H3, lcd_preheat_abs2); - #endif //3 extruder preheat - #if TEMP_SENSOR_3 != 0 //4 extruder preheat - MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H4, lcd_preheat_abs3); - #endif //4 extruder preheat - #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //all extruder preheat - MENU_ITEM(function, MSG_PREHEAT_ABS_ALL, lcd_preheat_abs0123); - #endif //all extruder preheat - #if TEMP_SENSOR_BED != 0 - MENU_ITEM(function, MSG_PREHEAT_ABS_BEDONLY, lcd_preheat_abs_bedonly); + static void lcd_preheat_pla_menu() { + START_MENU(); + MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu); + MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H1, lcd_preheat_pla0); + #if TEMP_SENSOR_1 != 0 + MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H2, lcd_preheat_pla1); + #endif + #if TEMP_SENSOR_2 != 0 + MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H3, lcd_preheat_pla2); + #endif + #if TEMP_SENSOR_3 != 0 + MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H4, lcd_preheat_pla3); + #endif + MENU_ITEM(function, MSG_PREHEAT_PLA_ALL, lcd_preheat_pla0123); + #if TEMP_SENSOR_BED != 0 + MENU_ITEM(function, MSG_PREHEAT_PLA_BEDONLY, lcd_preheat_pla_bedonly); + #endif + END_MENU(); + } + + static void lcd_preheat_abs_menu() { + START_MENU(); + MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu); + MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H1, lcd_preheat_abs0); + #if TEMP_SENSOR_1 != 0 + MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H2, lcd_preheat_abs1); + #endif + #if TEMP_SENSOR_2 != 0 + MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H3, lcd_preheat_abs2); + #endif + #if TEMP_SENSOR_3 != 0 + MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H4, lcd_preheat_abs3); + #endif + MENU_ITEM(function, MSG_PREHEAT_ABS_ALL, lcd_preheat_abs0123); + #if TEMP_SENSOR_BED != 0 + MENU_ITEM(function, MSG_PREHEAT_ABS_BEDONLY, lcd_preheat_abs_bedonly); + #endif + END_MENU(); + } #endif - END_MENU(); -} + +#endif // more than one temperature sensor present void lcd_cooldown() { setTargetHotend0(0); @@ -617,8 +604,9 @@ static void lcd_prepare_menu() { MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); MENU_ITEM(function, MSG_SET_HOME_OFFSETS, lcd_set_home_offsets); //MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0")); + #if TEMP_SENSOR_0 != 0 - #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_BED != 0 + #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0 MENU_ITEM(submenu, MSG_PREHEAT_PLA, lcd_preheat_pla_menu); MENU_ITEM(submenu, MSG_PREHEAT_ABS, lcd_preheat_abs_menu); #else @@ -626,15 +614,16 @@ static void lcd_prepare_menu() { MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs0); #endif #endif + MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown); - #if defined(POWER_SUPPLY) && POWER_SUPPLY > 0 && defined(PS_ON_PIN) && PS_ON_PIN > -1 - if (powersupply) { + + #if HAS_POWER_SWITCH + if (powersupply) MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81")); - } - else { + else MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80")); - } #endif + MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu); #if defined(MANUAL_BED_LEVELING) @@ -645,8 +634,8 @@ static void lcd_prepare_menu() { } #ifdef DELTA_CALIBRATION_MENU -static void lcd_delta_calibrate_menu() -{ + + static void lcd_delta_calibrate_menu() { START_MENU(); MENU_ITEM(back, MSG_MAIN, lcd_main_menu); MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); @@ -655,9 +644,19 @@ static void lcd_delta_calibrate_menu() MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_Z, PSTR("G0 F8000 X0 Y90 Z0")); MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_CENTER, PSTR("G0 F8000 X0 Y0 Z0")); END_MENU(); -} + } + #endif // DELTA_CALIBRATION_MENU +inline void line_to_current() { + #ifdef DELTA + calculate_delta(current_position); + plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder); + #else + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder); + #endif +} + float move_menu_scale; static void lcd_move_menu_axis(); @@ -668,12 +667,7 @@ static void _lcd_move(const char *name, int axis, int min, int max) { if (min_software_endstops && current_position[axis] < min) current_position[axis] = min; if (max_software_endstops && current_position[axis] > max) current_position[axis] = max; encoderPosition = 0; - #ifdef DELTA - calculate_delta(current_position); - plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder); - #else - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder); - #endif + line_to_current(); lcdDrawUpdate = 1; } if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis])); @@ -682,17 +676,11 @@ static void _lcd_move(const char *name, int axis, int min, int max) { static void lcd_move_x() { _lcd_move(PSTR("X"), X_AXIS, X_MIN_POS, X_MAX_POS); } static void lcd_move_y() { _lcd_move(PSTR("Y"), Y_AXIS, Y_MIN_POS, Y_MAX_POS); } static void lcd_move_z() { _lcd_move(PSTR("Z"), Z_AXIS, Z_MIN_POS, Z_MAX_POS); } - static void lcd_move_e() { if (encoderPosition != 0) { current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale; encoderPosition = 0; - #ifdef DELTA - calculate_delta(current_position); - plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[E_AXIS]/60, active_extruder); - #else - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[E_AXIS]/60, active_extruder); - #endif + line_to_current(); lcdDrawUpdate = 1; } if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS])); @@ -741,7 +729,7 @@ static void lcd_control_menu() { MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu); MENU_ITEM(submenu, MSG_VOLUMETRIC, lcd_control_volumetric_menu); - #ifdef DOGLCD + #ifdef HAS_LCD_CONTRAST //MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63); MENU_ITEM(submenu, MSG_CONTRAST, lcd_set_contrast); #endif @@ -911,7 +899,7 @@ static void lcd_control_motion_menu() { START_MENU(); MENU_ITEM(back, MSG_CONTROL, lcd_control_menu); #ifdef ENABLE_AUTO_BED_LEVELING - MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, 0.0, 50); + MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX); #endif MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 10, 99000); MENU_ITEM_EDIT(float3, MSG_VXY_JERK, &max_xy_jerk, 1, 990); @@ -965,44 +953,39 @@ static void lcd_control_volumetric_menu() { END_MENU(); } -#ifdef DOGLCD - -static void lcd_set_contrast() { - if (encoderPosition != 0) { - lcd_contrast -= encoderPosition; - if (lcd_contrast < 0) lcd_contrast = 0; - else if (lcd_contrast > 63) lcd_contrast = 63; - encoderPosition = 0; - lcdDrawUpdate = 1; - u8g.setContrast(lcd_contrast); +#ifdef HAS_LCD_CONTRAST + static void lcd_set_contrast() { + if (encoderPosition != 0) { + lcd_contrast -= encoderPosition; + lcd_contrast &= 0x3F; + encoderPosition = 0; + lcdDrawUpdate = 1; + u8g.setContrast(lcd_contrast); + } + if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast)); + if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu); } - if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast)); - if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu); -} - -#endif //DOGLCD +#endif // HAS_LCD_CONTRAST #ifdef FWRETRACT - -static void lcd_control_retract_menu() { - START_MENU(); - MENU_ITEM(back, MSG_CONTROL, lcd_control_menu); - MENU_ITEM_EDIT(bool, MSG_AUTORETRACT, &autoretract_enabled); - MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT, &retract_length, 0, 100); - #if EXTRUDERS > 1 - MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_SWAP, &retract_length_swap, 0, 100); - #endif - MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACTF, &retract_feedrate, 1, 999); - MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_ZLIFT, &retract_zlift, 0, 999); - MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER, &retract_recover_length, 0, 100); - #if EXTRUDERS > 1 - MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER_SWAP, &retract_recover_length_swap, 0, 100); - #endif - MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &retract_recover_feedrate, 1, 999); - END_MENU(); -} - -#endif //FWRETRACT + static void lcd_control_retract_menu() { + START_MENU(); + MENU_ITEM(back, MSG_CONTROL, lcd_control_menu); + MENU_ITEM_EDIT(bool, MSG_AUTORETRACT, &autoretract_enabled); + MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT, &retract_length, 0, 100); + #if EXTRUDERS > 1 + MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_SWAP, &retract_length_swap, 0, 100); + #endif + MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACTF, &retract_feedrate, 1, 999); + MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_ZLIFT, &retract_zlift, 0, 999); + MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER, &retract_recover_length, 0, 100); + #if EXTRUDERS > 1 + MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER_SWAP, &retract_recover_length_swap, 0, 100); + #endif + MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &retract_recover_feedrate, 1, 999); + END_MENU(); + } +#endif // FWRETRACT #if SDCARDDETECT == -1 static void lcd_sd_refresh() { @@ -1031,13 +1014,14 @@ void lcd_sdcard_menu() { MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir); } - for(uint16_t i = 0; i < fileCnt; i++) { + for (uint16_t i = 0; i < fileCnt; i++) { if (_menuItemNr == _lineNr) { - #ifndef SDCARD_RATHERRECENTFIRST - card.getfilename(i); - #else - card.getfilename(fileCnt-1-i); - #endif + card.getfilename( + #ifdef SDCARD_RATHERRECENTFIRST + fileCnt-1 - + #endif + i + ); if (card.filenameIsDir) MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename); else @@ -1128,30 +1112,57 @@ menu_edit_type(unsigned long, long5, ftostr5, 0.01) lcd_move_y(); } static void reprapworld_keypad_move_home() { - enquecommands_P((PSTR("G28"))); // move all axis home + enqueuecommands_P((PSTR("G28"))); // move all axis home } #endif //REPRAPWORLD_KEYPAD /** End of menus **/ -static void lcd_quick_feedback() { +void lcd_quick_feedback() { lcdDrawUpdate = 2; - blocking_enc = millis() + 500; - lcd_implementation_quick_feedback(); + next_button_update_ms = millis() + 500; + + #ifdef LCD_USE_I2C_BUZZER + #ifndef LCD_FEEDBACK_FREQUENCY_HZ + #define LCD_FEEDBACK_FREQUENCY_HZ 100 + #endif + #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS + #define LCD_FEEDBACK_FREQUENCY_DURATION_MS (1000/6) + #endif + lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); + #elif defined(BEEPER) && BEEPER > -1 + SET_OUTPUT(BEEPER); + #ifndef LCD_FEEDBACK_FREQUENCY_HZ + #define LCD_FEEDBACK_FREQUENCY_HZ 5000 + #endif + #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS + #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2 + #endif + const uint16_t delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2; + uint16_t i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000; + while (i--) { + WRITE(BEEPER,HIGH); + delayMicroseconds(delay); + WRITE(BEEPER,LOW); + delayMicroseconds(delay); + } + const uint16_t j = max(10000 - LCD_FEEDBACK_FREQUENCY_DURATION_MS * 1000, 0); + if (j) delayMicroseconds(j); + #endif } /** Menu action functions **/ static void menu_action_back(menuFunc_t data) { lcd_goto_menu(data); } static void menu_action_submenu(menuFunc_t data) { lcd_goto_menu(data); } -static void menu_action_gcode(const char* pgcode) { enquecommands_P(pgcode); } +static void menu_action_gcode(const char* pgcode) { enqueuecommands_P(pgcode); } static void menu_action_function(menuFunc_t data) { (*data)(); } static void menu_action_sdfile(const char* filename, char* longFilename) { char cmd[30]; char* c; sprintf_P(cmd, PSTR("M23 %s"), filename); for(c = &cmd[4]; *c; c++) *c = tolower(*c); - enquecommand(cmd); - enquecommands_P(PSTR("M24")); + enqueuecommand(cmd); + enqueuecommands_P(PSTR("M24")); lcd_return_to_status(); } static void menu_action_sddirectory(const char* filename, char* longFilename) { @@ -1238,7 +1249,9 @@ int lcd_strlen_P(const char *s) { } void lcd_update() { - static unsigned long timeoutToStatus = 0; + #ifdef ULTIPANEL + static millis_t return_to_status_ms = 0; + #endif #ifdef LCD_HAS_SLOW_BUTTONS slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context @@ -1251,7 +1264,7 @@ void lcd_update() { lcdDrawUpdate = 2; lcd_oldcardstatus = IS_SD_INSERTED; lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. - #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD) + #ifdef LCD_PROGRESS_BAR currentMenu == lcd_status_screen #endif ); @@ -1266,9 +1279,9 @@ void lcd_update() { } } #endif//CARDINSERTED - - uint32_t ms = millis(); - if (ms > lcd_next_update_millis) { + + millis_t ms = millis(); + if (ms > next_lcd_update_ms) { #ifdef ULTIPANEL @@ -1314,30 +1327,39 @@ void lcd_update() { } lastEncoderMovementMillis = ms; - } + } // encoderRateMultiplierEnabled #endif //ENCODER_RATE_MULTIPLIER - lcdDrawUpdate = 1; encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP; encoderDiff = 0; } - timeoutToStatus = ms + LCD_TIMEOUT_TO_STATUS; + return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; + lcdDrawUpdate = 1; } - #endif //ULTIPANEL + if (currentMenu == lcd_status_screen) { + if (!lcd_status_update_delay) { + lcdDrawUpdate = 1; + lcd_status_update_delay = 10; /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */ + } + else { + lcd_status_update_delay--; + } + } #ifdef DOGLCD // Changes due to different driver architecture of the DOGM display - blink++; // Variable for fan animation and alive dot - u8g.firstPage(); - do { - u8g.setFont(FONT_MENU); - u8g.setPrintPos(125, 0); - if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot - u8g.drawPixel(127, 63); // draw alive dot - u8g.setColorIndex(1); // black on white - (*currentMenu)(); - if (!lcdDrawUpdate) break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next() - } while( u8g.nextPage() ); + if (lcdDrawUpdate) { + blink++; // Variable for fan animation and alive dot + u8g.firstPage(); + do { + lcd_setFont(FONT_MENU); + u8g.setPrintPos(125, 0); + if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot + u8g.drawPixel(127, 63); // draw alive dot + u8g.setColorIndex(1); // black on white + (*currentMenu)(); + } while( u8g.nextPage() ); + } #else (*currentMenu)(); #endif @@ -1347,20 +1369,24 @@ void lcd_update() { #endif #ifdef ULTIPANEL + + // Return to Status Screen after a timeout if (currentMenu != lcd_status_screen && - #if defined(MANUAL_BED_LEVELING) - currentMenu != _lcd_level_bed && - currentMenu != _lcd_level_bed_homing && - #endif // MANUAL_BED_LEVELING - millis() > timeoutToStatus) { + #ifdef MANUAL_BED_LEVELING + currentMenu != _lcd_level_bed && + currentMenu != _lcd_level_bed_homing && + #endif + millis() > return_to_status_ms + ) { lcd_return_to_status(); lcdDrawUpdate = 2; } - #endif //ULTIPANEL + + #endif // ULTIPANEL if (lcdDrawUpdate == 2) lcd_implementation_clear(); if (lcdDrawUpdate) lcdDrawUpdate--; - lcd_next_update_millis = millis() + LCD_UPDATE_INTERVAL; + next_lcd_update_ms = millis() + LCD_UPDATE_INTERVAL; } } @@ -1369,42 +1395,52 @@ void lcd_ignore_click(bool b) { wait_for_unclick = false; } -void lcd_finishstatus() { - int len = lcd_strlen(lcd_status_message); - if (len > 0) { - while (len < LCD_WIDTH) { - lcd_status_message[len++] = ' '; - } - } - lcd_status_message[LCD_WIDTH] = '\0'; - #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD) +void lcd_finishstatus(bool persist=false) { + #ifdef LCD_PROGRESS_BAR + progressBarTick = millis(); #if PROGRESS_MSG_EXPIRE > 0 - messageTick = + expireStatusMillis = persist ? 0 : progressBarTick + PROGRESS_MSG_EXPIRE; #endif - progressBarTick = millis(); #endif lcdDrawUpdate = 2; #ifdef FILAMENT_LCD_DISPLAY - message_millis = millis(); //get status message to show up for a while + previous_lcd_status_ms = millis(); //get status message to show up for a while #endif } -void lcd_setstatus(const char* message) { - if (lcd_status_message_level > 0) return; - strncpy(lcd_status_message, message, LCD_WIDTH); - lcd_finishstatus(); +#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 + void dontExpireStatus() { expireStatusMillis = 0; } +#endif + +void set_utf_strlen(char *s, uint8_t n) { + uint8_t i = 0, j = 0; + while (s[i] && (j < n)) { + if ((s[i] & 0xc0u) != 0x80u) j++; + i++; + } + while (j++ < n) s[i++] = ' '; + s[i] = 0; } -void lcd_setstatuspgm(const char* message) { +void lcd_setstatus(const char* message, bool persist) { if (lcd_status_message_level > 0) return; - strncpy_P(lcd_status_message, message, LCD_WIDTH); - lcd_finishstatus(); + strncpy(lcd_status_message, message, 3*LCD_WIDTH); + set_utf_strlen(lcd_status_message, LCD_WIDTH); + lcd_finishstatus(persist); +} + +void lcd_setstatuspgm(const char* message, uint8_t level) { + if (level >= lcd_status_message_level) { + strncpy_P(lcd_status_message, message, 3*LCD_WIDTH); + set_utf_strlen(lcd_status_message, LCD_WIDTH); + lcd_status_message_level = level; + lcd_finishstatus(level > 0); + } } void lcd_setalertstatuspgm(const char* message) { - lcd_setstatuspgm(message); - lcd_status_message_level = 1; + lcd_setstatuspgm(message, 1); #ifdef ULTIPANEL lcd_return_to_status(); #endif @@ -1412,9 +1448,9 @@ void lcd_setalertstatuspgm(const char* message) { void lcd_reset_alert_level() { lcd_status_message_level = 0; } -#ifdef DOGLCD +#ifdef HAS_LCD_CONTRAST void lcd_setcontrast(uint8_t value) { - lcd_contrast = value & 63; + lcd_contrast = value & 0x3F; u8g.setContrast(lcd_contrast); } #endif @@ -1439,7 +1475,7 @@ void lcd_buttons_update() { if (READ(BTN_EN1) == 0) newbutton |= EN_A; if (READ(BTN_EN2) == 0) newbutton |= EN_B; #if BTN_ENC > 0 - if (millis() > blocking_enc && READ(BTN_ENC) == 0) newbutton |= EN_C; + if (millis() > next_button_update_ms && READ(BTN_ENC) == 0) newbutton |= EN_C; #endif buttons = newbutton; #ifdef LCD_HAS_SLOW_BUTTONS @@ -1517,70 +1553,62 @@ bool lcd_clicked() { return LCD_CLICKED; } #endif //ULTIPANEL -/********************************/ -/** Float conversion utilities **/ -/********************************/ -// convert float to string with +123.4 format +/*********************************/ +/** Number to string conversion **/ +/*********************************/ + char conv[8]; -char *ftostr3(const float &x) -{ + +// Convert float to string with +123.4 format +char *ftostr3(const float &x) { return itostr3((int)x); } -char *itostr2(const uint8_t &x) -{ +// Convert int to string with 12 format +char *itostr2(const uint8_t &x) { //sprintf(conv,"%5.1f",x); - int xx=x; - conv[0]=(xx/10)%10+'0'; - conv[1]=(xx)%10+'0'; - conv[2]=0; + int xx = x; + conv[0] = (xx / 10) % 10 + '0'; + conv[1] = xx % 10 + '0'; + conv[2] = 0; return conv; } -// Convert float to string with 123.4 format, dropping sign -char *ftostr31(const float &x) -{ - int xx=x*10; - conv[0]=(xx>=0)?'+':'-'; - xx=abs(xx); - conv[1]=(xx/1000)%10+'0'; - conv[2]=(xx/100)%10+'0'; - conv[3]=(xx/10)%10+'0'; - conv[4]='.'; - conv[5]=(xx)%10+'0'; - conv[6]=0; +// Convert float to string with +123.4 format +char *ftostr31(const float &x) { + int xx = abs(x * 10); + conv[0] = (x >= 0) ? '+' : '-'; + conv[1] = (xx / 1000) % 10 + '0'; + conv[2] = (xx / 100) % 10 + '0'; + conv[3] = (xx / 10) % 10 + '0'; + conv[4] = '.'; + conv[5] = xx % 10 + '0'; + conv[6] = 0; return conv; } -// Convert float to string with 123.4 format -char *ftostr31ns(const float &x) -{ - int xx=x*10; - //conv[0]=(xx>=0)?'+':'-'; - xx=abs(xx); - conv[0]=(xx/1000)%10+'0'; - conv[1]=(xx/100)%10+'0'; - conv[2]=(xx/10)%10+'0'; - conv[3]='.'; - conv[4]=(xx)%10+'0'; - conv[5]=0; +// Convert float to string with 123.4 format, dropping sign +char *ftostr31ns(const float &x) { + int xx = abs(x * 10); + conv[0] = (xx / 1000) % 10 + '0'; + conv[1] = (xx / 100) % 10 + '0'; + conv[2] = (xx / 10) % 10 + '0'; + conv[3] = '.'; + conv[4] = xx % 10 + '0'; + conv[5] = 0; return conv; } -char *ftostr32(const float &x) -{ - long xx=x*100; - if (xx >= 0) - conv[0]=(xx/10000)%10+'0'; - else - conv[0]='-'; - xx=abs(xx); - conv[1]=(xx/1000)%10+'0'; - conv[2]=(xx/100)%10+'0'; - conv[3]='.'; - conv[4]=(xx/10)%10+'0'; - conv[5]=(xx)%10+'0'; - conv[6]=0; +// Convert float to string with 123.4 format +char *ftostr32(const float &x) { + long xx = abs(x * 100); + conv[0] = x >= 0 ? (xx / 10000) % 10 + '0' : '-'; + conv[1] = (xx / 1000) % 10 + '0'; + conv[2] = (xx / 100) % 10 + '0'; + conv[3] = '.'; + conv[4] = (xx / 10) % 10 + '0'; + conv[5] = xx % 10 + '0'; + conv[6] = 0; return conv; } @@ -1601,7 +1629,7 @@ char *ftostr43(const float &x) return conv; } -//Float to string with 1.23 format +// Convert float to string with 1.23 format char *ftostr12ns(const float &x) { long xx=x*100; @@ -1615,7 +1643,7 @@ char *ftostr12ns(const float &x) return conv; } -// convert float to space-padded string with -_23.4_ format +// Convert float to space-padded string with -_23.4_ format char *ftostr32sp(const float &x) { long xx = abs(x * 100); uint8_t dig; @@ -1661,58 +1689,51 @@ char *ftostr32sp(const float &x) { return conv; } -char *itostr31(const int &xx) -{ - conv[0]=(xx>=0)?'+':'-'; - conv[1]=(xx/1000)%10+'0'; - conv[2]=(xx/100)%10+'0'; - conv[3]=(xx/10)%10+'0'; - conv[4]='.'; - conv[5]=(xx)%10+'0'; - conv[6]=0; +// Convert int to lj string with +123.0 format +char *itostr31(const int &x) { + conv[0] = x >= 0 ? '+' : '-'; + int xx = abs(x); + conv[1] = (xx / 100) % 10 + '0'; + conv[2] = (xx / 10) % 10 + '0'; + conv[3] = xx % 10 + '0'; + conv[4] = '.'; + conv[5] = '0'; + conv[6] = 0; return conv; } // Convert int to rj string with 123 or -12 format -char *itostr3(const int &x) -{ +char *itostr3(const int &x) { int xx = x; if (xx < 0) { - conv[0]='-'; + conv[0] = '-'; xx = -xx; - } else if (xx >= 100) - conv[0]=(xx/100)%10+'0'; - else - conv[0]=' '; - if (xx >= 10) - conv[1]=(xx/10)%10+'0'; + } else - conv[1]=' '; - conv[2]=(xx)%10+'0'; - conv[3]=0; + conv[0] = xx >= 100 ? (xx / 100) % 10 + '0' : ' '; + + conv[1] = xx >= 10 ? (xx / 10) % 10 + '0' : ' '; + conv[2] = xx % 10 + '0'; + conv[3] = 0; return conv; } // Convert int to lj string with 123 format -char *itostr3left(const int &xx) -{ - if (xx >= 100) - { - conv[0]=(xx/100)%10+'0'; - conv[1]=(xx/10)%10+'0'; - conv[2]=(xx)%10+'0'; - conv[3]=0; +char *itostr3left(const int &xx) { + if (xx >= 100) { + conv[0] = (xx / 100) % 10 + '0'; + conv[1] = (xx / 10) % 10 + '0'; + conv[2] = xx % 10 + '0'; + conv[3] = 0; } - else if (xx >= 10) - { - conv[0]=(xx/10)%10+'0'; - conv[1]=(xx)%10+'0'; - conv[2]=0; + else if (xx >= 10) { + conv[0] = (xx / 10) % 10 + '0'; + conv[1] = xx % 10 + '0'; + conv[2] = 0; } - else - { - conv[0]=(xx)%10+'0'; - conv[1]=0; + else { + conv[0] = xx % 10 + '0'; + conv[1] = 0; } return conv; } @@ -1740,106 +1761,109 @@ char *ftostr5(const float &x) { } // Convert float to string with +1234.5 format -char *ftostr51(const float &x) -{ - long xx=x*10; - conv[0]=(xx>=0)?'+':'-'; - xx=abs(xx); - conv[1]=(xx/10000)%10+'0'; - conv[2]=(xx/1000)%10+'0'; - conv[3]=(xx/100)%10+'0'; - conv[4]=(xx/10)%10+'0'; - conv[5]='.'; - conv[6]=(xx)%10+'0'; - conv[7]=0; +char *ftostr51(const float &x) { + long xx = abs(x * 10); + conv[0] = (x >= 0) ? '+' : '-'; + conv[1] = (xx / 10000) % 10 + '0'; + conv[2] = (xx / 1000) % 10 + '0'; + conv[3] = (xx / 100) % 10 + '0'; + conv[4] = (xx / 10) % 10 + '0'; + conv[5] = '.'; + conv[6] = xx % 10 + '0'; + conv[7] = 0; return conv; } // Convert float to string with +123.45 format -char *ftostr52(const float &x) -{ - long xx=x*100; - conv[0]=(xx>=0)?'+':'-'; - xx=abs(xx); - conv[1]=(xx/10000)%10+'0'; - conv[2]=(xx/1000)%10+'0'; - conv[3]=(xx/100)%10+'0'; - conv[4]='.'; - conv[5]=(xx/10)%10+'0'; - conv[6]=(xx)%10+'0'; - conv[7]=0; +char *ftostr52(const float &x) { + conv[0] = (x >= 0) ? '+' : '-'; + long xx = abs(x * 100); + conv[1] = (xx / 10000) % 10 + '0'; + conv[2] = (xx / 1000) % 10 + '0'; + conv[3] = (xx / 100) % 10 + '0'; + conv[4] = '.'; + conv[5] = (xx / 10) % 10 + '0'; + conv[6] = xx % 10 + '0'; + conv[7] = 0; return conv; } -#if defined(MANUAL_BED_LEVELING) -static int _lcd_level_bed_position; -static void _lcd_level_bed() -{ - if (encoderPosition != 0) { - refresh_cmd_timeout(); - current_position[Z_AXIS] += float((int)encoderPosition) * 0.05; - if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS; - if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS; - encoderPosition = 0; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[Z_AXIS]/60, active_extruder); - lcdDrawUpdate = 1; - } - if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr32(current_position[Z_AXIS])); - static bool debounce_click = false; - if (LCD_CLICKED) { - if (!debounce_click) { - debounce_click = true; - int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS; - int iy = _lcd_level_bed_position / MESH_NUM_X_POINTS; - mbl.set_z(ix, iy, current_position[Z_AXIS]); - _lcd_level_bed_position++; - if (_lcd_level_bed_position == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) { - current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder); - mbl.active = 1; - enquecommands_P(PSTR("G28")); - lcd_return_to_status(); - } else { - current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder); - ix = _lcd_level_bed_position % MESH_NUM_X_POINTS; - iy = _lcd_level_bed_position / MESH_NUM_X_POINTS; +#ifdef MANUAL_BED_LEVELING + + static int _lcd_level_bed_position; + static void _lcd_level_bed() { + if (encoderPosition != 0) { + refresh_cmd_timeout(); + current_position[Z_AXIS] += float((int)encoderPosition) * MBL_Z_STEP; + if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS; + if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS; + encoderPosition = 0; + line_to_current(); + lcdDrawUpdate = 2; + } + if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr43(current_position[Z_AXIS])); + static bool debounce_click = false; + if (LCD_CLICKED) { + if (!debounce_click) { + debounce_click = true; + int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS; + int iy = _lcd_level_bed_position / MESH_NUM_X_POINTS; if (iy&1) { // Zig zag ix = (MESH_NUM_X_POINTS - 1) - ix; } - current_position[X_AXIS] = mbl.get_x(ix); - current_position[Y_AXIS] = mbl.get_y(iy); - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder); - lcdDrawUpdate = 1; + mbl.set_z(ix, iy, current_position[Z_AXIS]); + _lcd_level_bed_position++; + if (_lcd_level_bed_position == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) { + current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; + line_to_current(); + mbl.active = 1; + enqueuecommands_P(PSTR("G28")); + lcd_return_to_status(); + } else { + current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; + line_to_current(); + ix = _lcd_level_bed_position % MESH_NUM_X_POINTS; + iy = _lcd_level_bed_position / MESH_NUM_X_POINTS; + if (iy&1) { // Zig zag + ix = (MESH_NUM_X_POINTS - 1) - ix; + } + current_position[X_AXIS] = mbl.get_x(ix); + current_position[Y_AXIS] = mbl.get_y(iy); + line_to_current(); + lcdDrawUpdate = 2; + } } + } else { + debounce_click = false; } - } else { - debounce_click = false; } -} -static void _lcd_level_bed_homing() -{ - if (axis_known_position[X_AXIS] && - axis_known_position[Y_AXIS] && - axis_known_position[Z_AXIS]) { - current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; - plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); - current_position[X_AXIS] = MESH_MIN_X; - current_position[Y_AXIS] = MESH_MIN_Y; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder); - _lcd_level_bed_position = 0; - lcd_goto_menu(_lcd_level_bed); + + static void _lcd_level_bed_homing() { + if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("XYZ"), "Homing"); + if (axis_known_position[X_AXIS] && + axis_known_position[Y_AXIS] && + axis_known_position[Z_AXIS]) { + current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; + plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); + current_position[X_AXIS] = MESH_MIN_X; + current_position[Y_AXIS] = MESH_MIN_Y; + line_to_current(); + _lcd_level_bed_position = 0; + lcd_goto_menu(_lcd_level_bed); + } + lcdDrawUpdate = 2; } -} -static void lcd_level_bed() -{ - axis_known_position[X_AXIS] = false; - axis_known_position[Y_AXIS] = false; - axis_known_position[Z_AXIS] = false; - mbl.reset(); - enquecommands_P(PSTR("G28")); - lcd_goto_menu(_lcd_level_bed_homing); -} + + static void lcd_level_bed() { + axis_known_position[X_AXIS] = false; + axis_known_position[Y_AXIS] = false; + axis_known_position[Z_AXIS] = false; + mbl.reset(); + enqueuecommands_P(PSTR("G28")); + lcdDrawUpdate = 2; + lcd_goto_menu(_lcd_level_bed_homing); + } + #endif // MANUAL_BED_LEVELING -#endif //ULTRA_LCD +#endif // ULTRA_LCD diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index befe8fd1e..b8d5cba8a 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -8,19 +8,21 @@ int lcd_strlen_P(const char *s); void lcd_update(); void lcd_init(); - void lcd_setstatus(const char* message); - void lcd_setstatuspgm(const char* message); + void lcd_setstatus(const char* message, const bool persist=false); + void lcd_setstatuspgm(const char* message, const uint8_t level=0); void lcd_setalertstatuspgm(const char* message); void lcd_reset_alert_level(); bool lcd_detected(void); + #if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 + void dontExpireStatus(); + #endif + #ifdef DOGLCD extern int lcd_contrast; void lcd_setcontrast(uint8_t value); #endif - static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD - #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x)) #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x)) @@ -47,10 +49,11 @@ extern bool cancel_heatup; #ifdef FILAMENT_LCD_DISPLAY - extern unsigned long message_millis; + extern millis_t previous_lcd_status_ms; #endif void lcd_buzz(long duration,uint16_t freq); + void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual bool lcd_clicked(); void lcd_ignore_click(bool b=true); @@ -62,14 +65,14 @@ #define LCD_CLICKED (buttons&EN_C) #ifdef REPRAPWORLD_KEYPAD - #define EN_REPRAPWORLD_KEYPAD_F3 BIT(BLEN_REPRAPWORLD_KEYPAD_F3) - #define EN_REPRAPWORLD_KEYPAD_F2 BIT(BLEN_REPRAPWORLD_KEYPAD_F2) - #define EN_REPRAPWORLD_KEYPAD_F1 BIT(BLEN_REPRAPWORLD_KEYPAD_F1) - #define EN_REPRAPWORLD_KEYPAD_UP BIT(BLEN_REPRAPWORLD_KEYPAD_UP) - #define EN_REPRAPWORLD_KEYPAD_RIGHT BIT(BLEN_REPRAPWORLD_KEYPAD_RIGHT) - #define EN_REPRAPWORLD_KEYPAD_MIDDLE BIT(BLEN_REPRAPWORLD_KEYPAD_MIDDLE) - #define EN_REPRAPWORLD_KEYPAD_DOWN BIT(BLEN_REPRAPWORLD_KEYPAD_DOWN) - #define EN_REPRAPWORLD_KEYPAD_LEFT BIT(BLEN_REPRAPWORLD_KEYPAD_LEFT) + #define EN_REPRAPWORLD_KEYPAD_F3 (BIT(BLEN_REPRAPWORLD_KEYPAD_F3)) + #define EN_REPRAPWORLD_KEYPAD_F2 (BIT(BLEN_REPRAPWORLD_KEYPAD_F2)) + #define EN_REPRAPWORLD_KEYPAD_F1 (BIT(BLEN_REPRAPWORLD_KEYPAD_F1)) + #define EN_REPRAPWORLD_KEYPAD_UP (BIT(BLEN_REPRAPWORLD_KEYPAD_UP)) + #define EN_REPRAPWORLD_KEYPAD_RIGHT (BIT(BLEN_REPRAPWORLD_KEYPAD_RIGHT)) + #define EN_REPRAPWORLD_KEYPAD_MIDDLE (BIT(BLEN_REPRAPWORLD_KEYPAD_MIDDLE)) + #define EN_REPRAPWORLD_KEYPAD_DOWN (BIT(BLEN_REPRAPWORLD_KEYPAD_DOWN)) + #define EN_REPRAPWORLD_KEYPAD_LEFT (BIT(BLEN_REPRAPWORLD_KEYPAD_LEFT)) #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1)) #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F2) @@ -97,7 +100,8 @@ #else //no LCD FORCE_INLINE void lcd_update() {} FORCE_INLINE void lcd_init() {} - FORCE_INLINE void lcd_setstatus(const char* message) {} + FORCE_INLINE void lcd_setstatus(const char* message, const bool persist=false) {} + FORCE_INLINE void lcd_setstatuspgm(const char* message, const uint8_t level=0) {} FORCE_INLINE void lcd_buttons_update() {} FORCE_INLINE void lcd_reset_alert_level() {} FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {} diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 044ac95ee..f9ed56a7d 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -179,46 +179,30 @@ // 2 wire Non-latching LCD SR from: // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection #elif defined(SR_LCD_2W_NL) - extern "C" void __cxa_pure_virtual() { while (1); } #include #include #define LCD_CLASS LiquidCrystal_SR LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN); - #else // Standard directly connected LCD implementations - #ifdef LANGUAGE_RU - #include "LiquidCrystalRus.h" - #define LCD_CLASS LiquidCrystalRus - #else - #include - #define LCD_CLASS LiquidCrystal - #endif + #include + #define LCD_CLASS LiquidCrystal LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7 #endif -#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) +#include "utf_mapper.h" + +#ifdef LCD_PROGRESS_BAR static uint16_t progressBarTick = 0; #if PROGRESS_MSG_EXPIRE > 0 - static uint16_t messageTick = 0; + static uint16_t expireStatusMillis = 0; #endif #define LCD_STR_PROGRESS "\x03\x04\x05" #endif -/* Custom characters defined in the first 8 characters of the LCD */ -#define LCD_STR_BEDTEMP "\x00" -#define LCD_STR_DEGREE "\x01" -#define LCD_STR_THERMOMETER "\x02" -#define LCD_STR_UPLEVEL "\x03" -#define LCD_STR_REFRESH "\x04" -#define LCD_STR_FOLDER "\x05" -#define LCD_STR_FEEDRATE "\x06" -#define LCD_STR_CLOCK "\x07" -#define LCD_STR_ARROW_RIGHT "\x7E" /* from the default character set */ - static void lcd_set_custom_characters( - #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) + #ifdef LCD_PROGRESS_BAR bool progress_bar_set=true #endif ) { @@ -303,7 +287,7 @@ static void lcd_set_custom_characters( B00000 }; //thanks Sonny Mounicou - #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) + #ifdef LCD_PROGRESS_BAR static bool char_mode = false; byte progress[3][8] = { { B00000, @@ -364,7 +348,7 @@ static void lcd_set_custom_characters( } static void lcd_implementation_init( - #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) + #ifdef LCD_PROGRESS_BAR bool progress_bar_set=true #endif ) { @@ -394,7 +378,7 @@ static void lcd_implementation_init( #endif lcd_set_custom_characters( - #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) + #ifdef LCD_PROGRESS_BAR progress_bar_set #endif ); @@ -405,15 +389,30 @@ static void lcd_implementation_clear() { lcd.clear(); } + /* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */ -static void lcd_printPGM(const char* str) -{ - char c; - while((c = pgm_read_byte(str++)) != '\0') - { - lcd.write(c); - } +char lcd_printPGM(const char* str) { + char c; + char n = 0; + while((c = pgm_read_byte(str++))) { + n += charset_mapper(c); + } + return n; } + +char lcd_print(char* str) { + char c, n = 0;; + unsigned char i = 0; + while((c = str[i++])) { + n += charset_mapper(c); + } + return n; +} + +unsigned lcd_print(char c) { + return charset_mapper(c); +} + /* Possible status screens: 16x2 |0123456789012345| @@ -432,7 +431,7 @@ Possible status screens: 20x4 |01234567890123456789| |T000/000D B000/000D | - |X+000.0 Y+000.0 Z+000.0| + |X000 Y000 Z000.00| |F100% SD100% T--:--| |Status line.........| @@ -442,141 +441,154 @@ Possible status screens: |F100% SD100% T--:--| |Status line.........| */ -static void lcd_implementation_status_screen() -{ - int tHotend=int(degHotend(0) + 0.5); - int tTarget=int(degTargetHotend(0) + 0.5); +static void lcd_implementation_status_screen() { + int tHotend = int(degHotend(0) + 0.5); + int tTarget = int(degTargetHotend(0) + 0.5); + + #if LCD_WIDTH < 20 -#if LCD_WIDTH < 20 lcd.setCursor(0, 0); lcd.print(itostr3(tHotend)); lcd.print('/'); lcd.print(itostr3left(tTarget)); -# if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 - //If we have an 2nd extruder or heated bed, show that in the top right corner - lcd.setCursor(8, 0); -# if EXTRUDERS > 1 - tHotend = int(degHotend(1) + 0.5); - tTarget = int(degTargetHotend(1) + 0.5); - lcd.print(LCD_STR_THERMOMETER[0]); -# else//Heated bed - tHotend=int(degBed() + 0.5); - tTarget=int(degTargetBed() + 0.5); - lcd.print(LCD_STR_BEDTEMP[0]); -# endif - lcd.print(itostr3(tHotend)); - lcd.print('/'); - lcd.print(itostr3left(tTarget)); -# endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 + #if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 + + // If we have an 2nd extruder or heated bed, show that in the top right corner + lcd.setCursor(8, 0); + #if EXTRUDERS > 1 + tHotend = int(degHotend(1) + 0.5); + tTarget = int(degTargetHotend(1) + 0.5); + lcd.print(LCD_STR_THERMOMETER[0]); + #else // Heated bed + tHotend = int(degBed() + 0.5); + tTarget = int(degTargetBed() + 0.5); + lcd.print(LCD_STR_BEDTEMP[0]); + #endif + lcd.print(itostr3(tHotend)); + lcd.print('/'); + lcd.print(itostr3left(tTarget)); + + #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 + + #else // LCD_WIDTH > 19 -#else//LCD_WIDTH > 19 lcd.setCursor(0, 0); lcd.print(LCD_STR_THERMOMETER[0]); lcd.print(itostr3(tHotend)); lcd.print('/'); lcd.print(itostr3left(tTarget)); lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); - if (tTarget < 10) - lcd.print(' '); - -# if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 - //If we have an 2nd extruder or heated bed, show that in the top right corner - lcd.setCursor(10, 0); -# if EXTRUDERS > 1 - tHotend = int(degHotend(1) + 0.5); - tTarget = int(degTargetHotend(1) + 0.5); - lcd.print(LCD_STR_THERMOMETER[0]); -# else//Heated bed - tHotend=int(degBed() + 0.5); - tTarget=int(degTargetBed() + 0.5); - lcd.print(LCD_STR_BEDTEMP[0]); -# endif - lcd.print(itostr3(tHotend)); - lcd.print('/'); - lcd.print(itostr3left(tTarget)); - lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); - if (tTarget < 10) - lcd.print(' '); -# endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 -#endif//LCD_WIDTH > 19 - -#if LCD_HEIGHT > 2 -//Lines 2 for 4 line LCD -# if LCD_WIDTH < 20 -# ifdef SDSUPPORT - lcd.setCursor(0, 2); - lcd_printPGM(PSTR("SD")); - if (IS_SD_PRINTING) - lcd.print(itostr3(card.percentDone())); - else - lcd_printPGM(PSTR("---")); - lcd.print('%'); -# endif//SDSUPPORT -# else//LCD_WIDTH > 19 -# if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0 - //If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps - tHotend=int(degBed() + 0.5); - tTarget=int(degTargetBed() + 0.5); - - lcd.setCursor(0, 1); - lcd.print(LCD_STR_BEDTEMP[0]); - lcd.print(itostr3(tHotend)); - lcd.print('/'); - lcd.print(itostr3left(tTarget)); - lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); - if (tTarget < 10) - lcd.print(' '); -# else - lcd.setCursor(0,1); - lcd.print('X'); - lcd.print(ftostr3(current_position[X_AXIS])); - lcd_printPGM(PSTR(" Y")); - lcd.print(ftostr3(current_position[Y_AXIS])); -# endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 -# endif//LCD_WIDTH > 19 + if (tTarget < 10) lcd.print(' '); + + #if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 + // If we have an 2nd extruder or heated bed, show that in the top right corner + lcd.setCursor(10, 0); + #if EXTRUDERS > 1 + tHotend = int(degHotend(1) + 0.5); + tTarget = int(degTargetHotend(1) + 0.5); + lcd.print(LCD_STR_THERMOMETER[0]); + #else // Heated bed + tHotend = int(degBed() + 0.5); + tTarget = int(degTargetBed() + 0.5); + lcd.print(LCD_STR_BEDTEMP[0]); + #endif + lcd.print(itostr3(tHotend)); + lcd.print('/'); + lcd.print(itostr3left(tTarget)); + lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); + if (tTarget < 10) lcd.print(' '); + + #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 + + #endif // LCD_WIDTH > 19 + + #if LCD_HEIGHT > 2 + // Lines 2 for 4 line LCD + #if LCD_WIDTH < 20 + #ifdef SDSUPPORT + lcd.setCursor(0, 2); + lcd_printPGM(PSTR("SD")); + if (IS_SD_PRINTING) + lcd.print(itostr3(card.percentDone())); + else + lcd_printPGM(PSTR("---")); + lcd.print('%'); + #endif // SDSUPPORT + + #else // LCD_WIDTH > 19 + + #if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0 + // If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps + tHotend = int(degBed() + 0.5); + tTarget = int(degTargetBed() + 0.5); + + lcd.setCursor(0, 1); + lcd.print(LCD_STR_BEDTEMP[0]); + lcd.print(itostr3(tHotend)); + lcd.print('/'); + lcd.print(itostr3left(tTarget)); + lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); + if (tTarget < 10) lcd.print(' '); + #else + lcd.setCursor(0,1); + lcd.print('X'); + lcd.print(ftostr3(current_position[X_AXIS])); + lcd_printPGM(PSTR(" Y")); + lcd.print(ftostr3(current_position[Y_AXIS])); + #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 + + #endif // LCD_WIDTH > 19 + lcd.setCursor(LCD_WIDTH - 8, 1); lcd.print('Z'); lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001)); -#endif//LCD_HEIGHT > 2 -#if LCD_HEIGHT > 3 + #endif // LCD_HEIGHT > 2 + + #if LCD_HEIGHT > 3 + lcd.setCursor(0, 2); lcd.print(LCD_STR_FEEDRATE[0]); - lcd.print(itostr3(feedmultiply)); + lcd.print(itostr3(feedrate_multiplier)); lcd.print('%'); -# if LCD_WIDTH > 19 -# ifdef SDSUPPORT - lcd.setCursor(7, 2); - lcd_printPGM(PSTR("SD")); - if (IS_SD_PRINTING) + + #if LCD_WIDTH > 19 && defined(SDSUPPORT) + + lcd.setCursor(7, 2); + lcd_printPGM(PSTR("SD")); + if (IS_SD_PRINTING) lcd.print(itostr3(card.percentDone())); - else + else lcd_printPGM(PSTR("---")); - lcd.print('%'); -# endif//SDSUPPORT -# endif//LCD_WIDTH > 19 + lcd.print('%'); + + #endif // LCD_WIDTH > 19 && SDSUPPORT + lcd.setCursor(LCD_WIDTH - 6, 2); lcd.print(LCD_STR_CLOCK[0]); - if(starttime != 0) - { - uint16_t time = millis()/60000 - starttime/60000; - lcd.print(itostr2(time/60)); - lcd.print(':'); - lcd.print(itostr2(time%60)); - }else{ - lcd_printPGM(PSTR("--:--")); + if (print_job_start_ms != 0) { + uint16_t time = millis()/60000 - print_job_start_ms/60000; + lcd.print(itostr2(time/60)); + lcd.print(':'); + lcd.print(itostr2(time%60)); } -#endif + else { + lcd_printPGM(PSTR("--:--")); + } + + #endif // LCD_HEIGHT > 3 + + /** + * Display Progress Bar, Filament display, and/or Status Message on the last line + */ - // Status message line at the bottom lcd.setCursor(0, LCD_HEIGHT - 1); - #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) + #ifdef LCD_PROGRESS_BAR if (card.isFileOpen()) { - uint16_t mil = millis(), diff = mil - progressBarTick; - if (diff >= PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) { + if (millis() >= progressBarTick + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) { // draw the progress bar int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100, cel = tix / 3, rem = tix % 3, i = LCD_WIDTH; @@ -594,11 +606,11 @@ static void lcd_implementation_status_screen() } } //card.isFileOpen - #endif //LCD_PROGRESS_BAR + #elif defined(FILAMENT_LCD_DISPLAY) - //Display both Status message line and Filament display on the last line - #ifdef FILAMENT_LCD_DISPLAY - if (message_millis + 5000 <= millis()) { //display any status for the first 5 sec after screen is initiated + // Show Filament Diameter and Volumetric Multiplier % + // After allowing lcd_status_message to show for 5 seconds + if (millis() >= previous_lcd_status_ms + 5000) { lcd_printPGM(PSTR("Dia ")); lcd.print(ftostr12ns(filament_width_meas)); lcd_printPGM(PSTR(" V")); @@ -606,53 +618,52 @@ static void lcd_implementation_status_screen() lcd.print('%'); return; } - #endif //FILAMENT_LCD_DISPLAY - lcd.print(lcd_status_message); + #endif // FILAMENT_LCD_DISPLAY + + lcd_print(lcd_status_message); } static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) { char c; - uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2); + uint8_t n = LCD_WIDTH - 2; lcd.setCursor(0, row); lcd.print(sel ? pre_char : ' '); while ((c = pgm_read_byte(pstr)) && n > 0) { - lcd.print(c); + n -= lcd_print(c); pstr++; - if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--; } while(n--) lcd.print(' '); lcd.print(post_char); - lcd.print(' '); } + static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char* data) { char c; - uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2) - lcd_strlen(data); + uint8_t n = LCD_WIDTH - 2 - lcd_strlen(data); lcd.setCursor(0, row); lcd.print(sel ? pre_char : ' '); while ((c = pgm_read_byte(pstr)) && n > 0) { - lcd.print(c); + n -= lcd_print(c); pstr++; - if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--; } lcd.print(':'); while (n--) lcd.print(' '); - lcd.print(data); + lcd_print(data); } static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t row, const char* pstr, char pre_char, const char* data) { char c; - uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2) - lcd_strlen_P(data); + uint8_t n = LCD_WIDTH - 2 - lcd_strlen_P(data); lcd.setCursor(0, row); lcd.print(sel ? pre_char : ' '); while ((c = pgm_read_byte(pstr)) && n > 0) { - lcd.print(c); + n -= lcd_print(c); pstr++; - if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--; } lcd.print(':'); while (n--) lcd.print(' '); lcd_printPGM(data); } + #define lcd_implementation_drawmenu_setting_edit_int3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', itostr3(*(data))) #define lcd_implementation_drawmenu_setting_edit_float3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr3(*(data))) #define lcd_implementation_drawmenu_setting_edit_float32(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr32(*(data))) @@ -678,10 +689,11 @@ void lcd_implementation_drawedit(const char* pstr, char* value) { lcd.setCursor(1, 1); lcd_printPGM(pstr); lcd.print(':'); - lcd.setCursor(LCD_WIDTH - (LCD_WIDTH < 20 ? 0 : 1) - lcd_strlen(value), 1); - lcd.print(value); + lcd.setCursor(LCD_WIDTH - lcd_strlen(value), 1); + lcd_print(value); } -static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat) { + +static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat, char post_char) { char c; uint8_t n = LCD_WIDTH - concat; lcd.setCursor(0, row); @@ -691,91 +703,66 @@ static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* ps longFilename[n] = '\0'; } while ((c = *filename) && n > 0) { - lcd.print(c); + n -= lcd_print(c); filename++; - n--; } while (n--) lcd.print(' '); + lcd.print(post_char); } static void lcd_implementation_drawmenu_sdfile(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) { - lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 1); + lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, ' '); } + static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) { - lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2); + lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, LCD_STR_FOLDER[0]); } + #define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]) #define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') -static void lcd_implementation_quick_feedback() -{ - #ifdef LCD_USE_I2C_BUZZER - #if defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS) && defined(LCD_FEEDBACK_FREQUENCY_HZ) - lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); - #else - lcd_buzz(1000/6, 100); - #endif - #elif defined(BEEPER) && BEEPER > -1 - SET_OUTPUT(BEEPER); - #if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS) - const unsigned int delay = 100; - uint8_t i = 10; - #else - const unsigned int delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2; - int8_t i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000; - #endif - while (i--) { - WRITE(BEEPER,HIGH); - delayMicroseconds(delay); - WRITE(BEEPER,LOW); - delayMicroseconds(delay); - } - #endif -} - #ifdef LCD_HAS_STATUS_INDICATORS -static void lcd_implementation_update_indicators() -{ - #if defined(LCD_I2C_PANELOLU2) || defined(LCD_I2C_VIKI) - //set the LEDS - referred to as backlights by the LiquidTWI2 library - static uint8_t ledsprev = 0; - uint8_t leds = 0; - if (target_temperature_bed > 0) leds |= LED_A; - if (target_temperature[0] > 0) leds |= LED_B; - if (fanSpeed) leds |= LED_C; - #if EXTRUDERS > 1 - if (target_temperature[1] > 0) leds |= LED_C; + + static void lcd_implementation_update_indicators() { + #if defined(LCD_I2C_PANELOLU2) || defined(LCD_I2C_VIKI) + //set the LEDS - referred to as backlights by the LiquidTWI2 library + static uint8_t ledsprev = 0; + uint8_t leds = 0; + if (target_temperature_bed > 0) leds |= LED_A; + if (target_temperature[0] > 0) leds |= LED_B; + if (fanSpeed) leds |= LED_C; + #if EXTRUDERS > 1 + if (target_temperature[1] > 0) leds |= LED_C; + #endif + if (leds != ledsprev) { + lcd.setBacklight(leds); + ledsprev = leds; + } #endif - if (leds != ledsprev) { - lcd.setBacklight(leds); - ledsprev = leds; - } - #endif -} -#endif + } + +#endif // LCD_HAS_STATUS_INDICATORS #ifdef LCD_HAS_SLOW_BUTTONS -extern uint32_t blocking_enc; -static uint8_t lcd_implementation_read_slow_buttons() -{ - #ifdef LCD_I2C_TYPE_MCP23017 - uint8_t slow_buttons; - // Reading these buttons this is likely to be too slow to call inside interrupt context - // so they are called during normal lcd_update - slow_buttons = lcd.readButtons() << B_I2C_BTN_OFFSET; - #if defined(LCD_I2C_VIKI) - if(slow_buttons & (B_MI|B_RI)) { //LCD clicked - if(blocking_enc > millis()) { - slow_buttons &= ~(B_MI|B_RI); // Disable LCD clicked buttons if screen is updated - } - } + extern millis_t next_button_update_ms; + + static uint8_t lcd_implementation_read_slow_buttons() { + #ifdef LCD_I2C_TYPE_MCP23017 + uint8_t slow_buttons; + // Reading these buttons this is likely to be too slow to call inside interrupt context + // so they are called during normal lcd_update + slow_buttons = lcd.readButtons() << B_I2C_BTN_OFFSET; + #ifdef LCD_I2C_VIKI + if ((slow_buttons & (B_MI|B_RI)) && millis() < next_button_update_ms) // LCD clicked + slow_buttons &= ~(B_MI|B_RI); // Disable LCD clicked buttons if screen is updated + #endif + return slow_buttons; #endif - return slow_buttons; - #endif -} -#endif + } + +#endif // LCD_HAS_SLOW_BUTTONS #endif //__ULTRALCD_IMPLEMENTATION_HITACHI_HD44780_H diff --git a/Marlin/ultralcd_st7920_u8glib_rrd.h b/Marlin/ultralcd_st7920_u8glib_rrd.h index 6b6c005ad..fbf010982 100644 --- a/Marlin/ultralcd_st7920_u8glib_rrd.h +++ b/Marlin/ultralcd_st7920_u8glib_rrd.h @@ -43,7 +43,7 @@ static void ST7920_SWSPI_SND_8BIT(uint8_t val) #define ST7920_NCS() {WRITE(ST7920_CS_PIN,0);} #define ST7920_SET_CMD() {ST7920_SWSPI_SND_8BIT(0xf8);u8g_10MicroDelay();} #define ST7920_SET_DAT() {ST7920_SWSPI_SND_8BIT(0xfa);u8g_10MicroDelay();} -#define ST7920_WRITE_BYTE(a) {ST7920_SWSPI_SND_8BIT((a)&0xf0);ST7920_SWSPI_SND_8BIT((a)<<4);u8g_10MicroDelay();} +#define ST7920_WRITE_BYTE(a) {ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xf0u));ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4u));u8g_10MicroDelay();} #define ST7920_WRITE_BYTES(p,l) {uint8_t i;for(i=0;i 0xa2 = Ё, 0451 --> 0xb5 = ё + const PROGMEM uint8_t utf_recode[] = + { 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4, // unicode U+0400 to U+047f + // A Б->Ё B Г Д E Ж З // 0 Ѐ Ё Ђ Ѓ Є Ѕ І Ї + 0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,0xa8, // Ј Љ Њ Ћ Ќ Ѝ Ў Џ + // И Й K Л M H O П // 1 А Б В Г Д Е Ж З + 0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab, // И Й К Л М Н О П + // P C T У Ф X Ч ч // 2 Р С Т У Ф Х Г Ч + 0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1, // Ш Щ Ъ Ы Ь Э Ю Я + // Ш Щ Ъ Ы b Э Ю Я // 3 а б в г д е ж з + 0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7, // и й к л м н о п + // a б->ё в г д e ж з // 4 р с т у ф х ц ч + 0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f,0xbe, // ш щ ъ ы ь э ю я + // и й к л м н o п // 5 ѐ ё ђ ѓ є ѕ і ї + 0x70,0x63,0xbf,0x79,0xe4,0x78,0xe5,0xc0, // ј љ њ ћ ќ ѝ ў џ + // p c т y ф x ц ч // 6 Ѡ ѡ Ѣ ѣ Ѥ ѥ Ѧ ѧ + 0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7 // Ѫ ѩ Ѫ ѫ Ѭ ѭ Ѯ ѯ + // ш щ ъ ы ь э ю я // 7 Ѱ ѱ Ѳ ѳ Ѵ ѵ Ѷ ѷ + }; // ѻ ѹ Ѻ ѻ Ѽ ѽ Ѿ ѿ + #elif defined( MAPPER_C2C3 ) + #error( "Western languages on a cyrillic display makes no sense. There are no matching symbols." ); + #elif defined( MAPPER_E382E383 ) + #error( "Katakana on a cyrillic display makes no sense. There are no matching symbols." ); + #endif + #else + #error("Something went wrong in the selection of DISPLAY_CHARSET_HD44780's"); + #endif // DISPLAY_CHARSET_HD44780_CYRILLIC +#endif // SIMULATE_ROMFONT + +#if defined( MAPPER_NON ) + char charset_mapper(char c){ + HARDWARE_CHAR_OUT( c ); + return 1; + } +#elif defined( MAPPER_C2C3 ) + uint8_t utf_hi_char; // UTF-8 high part + bool seen_c2 = false; + char charset_mapper(char c){ + uint8_t d = c; + if ( d >= 0x80 ) { // UTF-8 handling + if ( (d >= 0xc0) && (!seen_c2) ) { + utf_hi_char = d - 0xc2; + seen_c2 = true; + return 0; + } + else if (seen_c2){ + d &= 0x3f; + #ifndef MAPPER_ONE_TO_ONE + HARDWARE_CHAR_OUT( (char) pgm_read_byte_near( utf_recode + d + ( utf_hi_char << 6 ) - 0x20 ) ); + #else + HARDWARE_CHAR_OUT( (char) (0x80 + ( utf_hi_char << 6 ) + d) ) ; + #endif + } + else { + HARDWARE_CHAR_OUT('?'); + } + } + else { + HARDWARE_CHAR_OUT((char) c ); + } + seen_c2 = false; + return 1; + } +#elif defined( MAPPER_D0D1_MOD ) + uint8_t utf_hi_char; // UTF-8 high part + bool seen_d5 = false; + char charset_mapper(char c){ + // it is a Russian alphabet translation + // except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё + uint8_t d = c; + if ( d >= 0x80 ) { // UTF-8 handling + if ((d >= 0xd0) && (!seen_d5)) { + utf_hi_char = d - 0xd0; + seen_d5 = true; + return 0; + } else if (seen_d5) { + d &= 0x3f; + if ( !utf_hi_char && ( d == 1 )) { + HARDWARE_CHAR_OUT((char) 0xa2 ); // Ё + } else if ((utf_hi_char == 1) && (d == 0x11)) { + HARDWARE_CHAR_OUT((char) 0xb5 ); // ё + } else { + HARDWARE_CHAR_OUT((char) pgm_read_byte_near( utf_recode + d + ( utf_hi_char << 6 ) - 0x10 ) ); + } + } + else { + HARDWARE_CHAR_OUT('?'); + } + } else { + HARDWARE_CHAR_OUT((char) c ); + } + seen_d5 = false; + return 1; + } +#elif defined( MAPPER_D0D1 ) + uint8_t utf_hi_char; // UTF-8 high part + bool seen_d5 = false; + char charset_mapper(char c){ + uint8_t d = c; + if ( d >= 0x80u ) { // UTF-8 handling + if ((d >= 0xd0u) && (!seen_d5)) { + utf_hi_char = d - 0xd0u; + seen_d5 = true; + return 0; + } else if (seen_d5) { + d &= 0x3fu; + #ifndef MAPPER_ONE_TO_ONE + HARDWARE_CHAR_OUT( (char) pgm_read_byte_near( utf_recode + d + ( utf_hi_char << 6 ) - 0x20 ) ); + #else + HARDWARE_CHAR_OUT( (char) (0xa0u + ( utf_hi_char << 6 ) + d ) ) ; + #endif + } else { + HARDWARE_CHAR_OUT('?'); + } + } else { + HARDWARE_CHAR_OUT((char) c ); + } + seen_d5 = false; + return 1; + } +#elif defined( MAPPER_E382E383 ) + uint8_t utf_hi_char; // UTF-8 high part + bool seen_e3 = false; + bool seen_82_83 = false; + char charset_mapper(char c){ + uint8_t d = c; + if ( d >= 0x80 ) { // UTF-8 handling + if ( (d == 0xe3) && (seen_e3 == false)) { + seen_e3 = true; + return 0; // eat 0xe3 + } else if ( (d >= 0x82) && (seen_e3 == true) && (seen_82_83 == false)) { + utf_hi_char = d - 0x82; + seen_82_83 = true; + return 0; + } else if ((seen_e3 == true) && (seen_82_83 == true)){ + d &= 0x3f; + #ifndef MAPPER_ONE_TO_ONE + HARDWARE_CHAR_OUT( (char) pgm_read_byte_near( utf_recode + d + ( utf_hi_char << 6 ) - 0x20 ) ); + #else + HARDWARE_CHAR_OUT( (char) (0x80 + ( utf_hi_char << 6 ) + d ) ) ; + #endif + } else { + HARDWARE_CHAR_OUT((char) '?' ); + } + } else { + HARDWARE_CHAR_OUT((char) c ); + } + seen_e3 = false; + seen_82_83 = false; + return 1; + } +#else + #error "You have to define one of the DISPLAY_INPUT_CODE_MAPPERs in your language_xx.h file" // should not occur because (en) will set. +#endif // code mappers + +#endif // UTF_MAPPER_H diff --git a/Marlin/vector_3.cpp b/Marlin/vector_3.cpp index 2e42da553..9eb3465fb 100644 --- a/Marlin/vector_3.cpp +++ b/Marlin/vector_3.cpp @@ -26,57 +26,40 @@ vector_3::vector_3() : x(0), y(0), z(0) { } vector_3::vector_3(float x_, float y_, float z_) : x(x_), y(y_), z(z_) { } -vector_3 vector_3::cross(vector_3 left, vector_3 right) -{ +vector_3 vector_3::cross(vector_3 left, vector_3 right) { return vector_3(left.y * right.z - left.z * right.y, left.z * right.x - left.x * right.z, left.x * right.y - left.y * right.x); } -vector_3 vector_3::operator+(vector_3 v) -{ - return vector_3((x + v.x), (y + v.y), (z + v.z)); -} - -vector_3 vector_3::operator-(vector_3 v) -{ - return vector_3((x - v.x), (y - v.y), (z - v.z)); -} +vector_3 vector_3::operator+(vector_3 v) { return vector_3((x + v.x), (y + v.y), (z + v.z)); } +vector_3 vector_3::operator-(vector_3 v) { return vector_3((x - v.x), (y - v.y), (z - v.z)); } -vector_3 vector_3::get_normal() -{ +vector_3 vector_3::get_normal() { vector_3 normalized = vector_3(x, y, z); normalized.normalize(); return normalized; } -float vector_3::get_length() -{ - float length = sqrt((x * x) + (y * y) + (z * z)); - return length; -} - -void vector_3::normalize() -{ +float vector_3::get_length() { return sqrt((x * x) + (y * y) + (z * z)); } + +void vector_3::normalize() { float length = get_length(); x /= length; y /= length; z /= length; } -void vector_3::apply_rotation(matrix_3x3 matrix) -{ +void vector_3::apply_rotation(matrix_3x3 matrix) { float resultX = x * matrix.matrix[3*0+0] + y * matrix.matrix[3*1+0] + z * matrix.matrix[3*2+0]; float resultY = x * matrix.matrix[3*0+1] + y * matrix.matrix[3*1+1] + z * matrix.matrix[3*2+1]; float resultZ = x * matrix.matrix[3*0+2] + y * matrix.matrix[3*1+2] + z * matrix.matrix[3*2+2]; - x = resultX; y = resultY; z = resultZ; } -void vector_3::debug(char* title) -{ +void vector_3::debug(const char title[]) { SERIAL_PROTOCOL(title); SERIAL_PROTOCOLPGM(" x: "); SERIAL_PROTOCOL_F(x, 6); @@ -87,8 +70,7 @@ void vector_3::debug(char* title) SERIAL_EOL; } -void apply_rotation_xyz(matrix_3x3 matrix, float &x, float& y, float& z) -{ +void apply_rotation_xyz(matrix_3x3 matrix, float &x, float& y, float& z) { vector_3 vector = vector_3(x, y, z); vector.apply_rotation(matrix); x = vector.x; @@ -96,48 +78,41 @@ void apply_rotation_xyz(matrix_3x3 matrix, float &x, float& y, float& z) z = vector.z; } -matrix_3x3 matrix_3x3::create_from_rows(vector_3 row_0, vector_3 row_1, vector_3 row_2) -{ - //row_0.debug("row_0"); - //row_1.debug("row_1"); - //row_2.debug("row_2"); +matrix_3x3 matrix_3x3::create_from_rows(vector_3 row_0, vector_3 row_1, vector_3 row_2) { + //row_0.debug("row_0"); + //row_1.debug("row_1"); + //row_2.debug("row_2"); matrix_3x3 new_matrix; new_matrix.matrix[0] = row_0.x; new_matrix.matrix[1] = row_0.y; new_matrix.matrix[2] = row_0.z; new_matrix.matrix[3] = row_1.x; new_matrix.matrix[4] = row_1.y; new_matrix.matrix[5] = row_1.z; new_matrix.matrix[6] = row_2.x; new_matrix.matrix[7] = row_2.y; new_matrix.matrix[8] = row_2.z; - //new_matrix.debug("new_matrix"); - + //new_matrix.debug("new_matrix"); return new_matrix; } -void matrix_3x3::set_to_identity() -{ +void matrix_3x3::set_to_identity() { matrix[0] = 1; matrix[1] = 0; matrix[2] = 0; matrix[3] = 0; matrix[4] = 1; matrix[5] = 0; matrix[6] = 0; matrix[7] = 0; matrix[8] = 1; } -matrix_3x3 matrix_3x3::create_look_at(vector_3 target) -{ - vector_3 z_row = target.get_normal(); - vector_3 x_row = vector_3(1, 0, -target.x/target.z).get_normal(); - vector_3 y_row = vector_3::cross(z_row, x_row).get_normal(); +matrix_3x3 matrix_3x3::create_look_at(vector_3 target) { + vector_3 z_row = target.get_normal(); + vector_3 x_row = vector_3(1, 0, -target.x/target.z).get_normal(); + vector_3 y_row = vector_3::cross(z_row, x_row).get_normal(); - // x_row.debug("x_row"); - // y_row.debug("y_row"); - // z_row.debug("z_row"); + // x_row.debug("x_row"); + // y_row.debug("y_row"); + // z_row.debug("z_row"); - - // create the matrix already correctly transposed - matrix_3x3 rot = matrix_3x3::create_from_rows(x_row, y_row, z_row); + // create the matrix already correctly transposed + matrix_3x3 rot = matrix_3x3::create_from_rows(x_row, y_row, z_row); - // rot.debug("rot"); - return rot; + // rot.debug("rot"); + return rot; } - -matrix_3x3 matrix_3x3::transpose(matrix_3x3 original) -{ +matrix_3x3 matrix_3x3::transpose(matrix_3x3 original) { matrix_3x3 new_matrix; new_matrix.matrix[0] = original.matrix[0]; new_matrix.matrix[1] = original.matrix[3]; new_matrix.matrix[2] = original.matrix[6]; new_matrix.matrix[3] = original.matrix[1]; new_matrix.matrix[4] = original.matrix[4]; new_matrix.matrix[5] = original.matrix[7]; @@ -145,18 +120,19 @@ matrix_3x3 matrix_3x3::transpose(matrix_3x3 original) return new_matrix; } -void matrix_3x3::debug(char* title) { +void matrix_3x3::debug(const char title[]) { SERIAL_PROTOCOLLN(title); int count = 0; for(int i=0; i<3; i++) { for(int j=0; j<3; j++) { + if (matrix[count] >= 0.0) SERIAL_PROTOCOLCHAR('+'); SERIAL_PROTOCOL_F(matrix[count], 6); - SERIAL_PROTOCOLPGM(" "); + SERIAL_PROTOCOLCHAR(' '); count++; } SERIAL_EOL; } } -#endif // #ifdef ENABLE_AUTO_BED_LEVELING +#endif // ENABLE_AUTO_BED_LEVELING diff --git a/Marlin/vector_3.h b/Marlin/vector_3.h index 0b9decafa..0c5938bac 100644 --- a/Marlin/vector_3.h +++ b/Marlin/vector_3.h @@ -37,7 +37,7 @@ struct vector_3 float get_length(); vector_3 get_normal(); - void debug(char* title); + void debug(const char title[]); void apply_rotation(matrix_3x3 matrix); }; @@ -52,7 +52,7 @@ struct matrix_3x3 void set_to_identity(); - void debug(char* title); + void debug(const char title[]); }; diff --git a/README.md b/README.md index 155e916f5..7cb93c7e2 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,16 @@ * [Auto Bed Leveling](/Documentation/BedLeveling.md) * [Filament Sensor](/Documentation/FilamentSensor.md) * [Ramps Servo Power](/Documentation/RampsServoPower.md) + * [LCD Language - Font - System](Documentation/LCDLanguageFont.md) + * [Mesh Bed Leveling](/Documentation/MeshBedLeveling.md) ##### [RepRap.org Wiki Page](http://reprap.org/wiki/Marlin) ## Quick Information This is a firmware for reprap single-processor electronics setups. -It also works on the Ultimaker PCB. It supports printing from SD card+Folders, and look-ahead trajectory planning. -This firmware is a mashup between [Sprinter](https://github.com/kliment/Sprinter), [grbl](https://github.com/simen/grbl) and many original parts. +It also works on the Ultimaker PCB. It supports printing from SD card+Folders and look-ahead trajectory planning. +This firmware is a mashup between [Sprinter](https://github.com/kliment/Sprinter), [grbl](https://github.com/simen/grbl), and many original parts. ## Current Status: Bug Fixing @@ -27,24 +29,20 @@ We are actively looking for testers. So please try the current development versi [![Coverity Scan Build Status](https://scan.coverity.com/projects/2224/badge.svg)](https://scan.coverity.com/projects/2224) [![Travis Build Status](https://travis-ci.org/MarlinFirmware/Marlin.svg)](https://travis-ci.org/MarlinFirmware/Marlin) -What bugs are we working on: [Bug Fixing Round 3](https://github.com/MarlinFirmware/Marlin/milestones/Bug%20Fixing%20Round%203) - ## Contact -__IRC:__ #marlin-firmware @freenode ([WebChat Client](https://webchat.freenode.net/?channels=marlin-firmware) - -__Mailing List:__ marlin@lists.0l.de ([Subscribe](http://lists.0l.de/mailman/listinfo/marlin), [Archive](http://lists.0l.de/pipermail/marlin/)) +__Google Hangout:__ Hangout ## Credits The current Marlin dev team consists of: - - Erik van der Zalm ([@ErikZalm](https://github.com/ErikZalm)) - - [@daid](https://github.com/daid) + - Scott Lahteine [@thinkyhead] + - Sprinters lead developers are Kliment and caru. -Grbls lead developer is Simen Svale Skogsrud. -Sonney Jeon (Chamnit) improved some parts of grbl +Grbl's lead developer is Simen Svale Skogsrud. +Sonney Jeon (Chamnit) improved some parts of grbl. A fork by bkubicek for the Ultimaker was merged. More features have been added by: