From 3851ac62264bfc1e1e462e6ab0300956c5aa6ef9 Mon Sep 17 00:00:00 2001 From: CONSULitAS Date: Tue, 14 Apr 2015 17:12:42 +0200 Subject: [PATCH 01/50] Example Configuration for K8200 back in sync example_configurations\K8200\Configuration.h: * merge upstream changes from default Configuration.h manually * add some machine specific comments --- .../K8200/Configuration.h | 90 +++++++++++++++---- 1 file changed, 71 insertions(+), 19 deletions(-) diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index df0614b507..1cde25fca3 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -31,10 +31,12 @@ 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. @@ -45,12 +47,16 @@ Here are some standard links for getting your machine calibrated: #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 @@ -71,17 +77,27 @@ Here are some standard links for getting your machine calibrated: // #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 ============================ //=========================================================================== @@ -245,7 +261,7 @@ Here are some standard links for getting your machine calibrated: // #define DEFAULT_bedKi 1.41 // #define DEFAULT_bedKd 1675.16 -//Vellemann K8200 PCB heatbed with standard PCU - calculated with PID Autotune and tested +//Vellemann K8200 PCB heatbed with standard PCU at 60 degreesC - calculated with PID Autotune and tested //from pidautotune #define DEFAULT_bedKp 341.88 #define DEFAULT_bedKi 25.32 @@ -254,6 +270,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 @@ -308,12 +325,16 @@ 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 +// @section homing + // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors @@ -325,6 +346,7 @@ 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 // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). @@ -338,7 +360,15 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #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 @@ -348,20 +378,32 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z true + +// @section extruder + #define DISABLE_E false // For all extruders #define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled +// @section machine + // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. #define INVERT_X_DIR false #define INVERT_Y_DIR false #define INVERT_Z_DIR false -#define INVERT_E0_DIR true + +// @section extruder + +// For direct drive extruder v9 set to true, for geared extruder set to false. +#define INVERT_E0_DIR true // K8200: true for geared default extruder! #define INVERT_E1_DIR true #define INVERT_E2_DIR true #define INVERT_E3_DIR true +// @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 @@ -369,6 +411,8 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #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 @@ -388,14 +432,14 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //#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 #ifdef MANUAL_BED_LEVELING - #define MBL_Z_STEP 0.025 + #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis #endif // MANUAL_BED_LEVELING #ifdef MESH_BED_LEVELING @@ -412,6 +456,8 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //============================= 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. @@ -520,6 +566,8 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #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) @@ -533,6 +581,8 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing. #endif +// @section movement + /** * MOVEMENT SETTINGS */ @@ -549,13 +599,6 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #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. -// #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) @@ -566,6 +609,8 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //============================= Additional Features =========================== //============================================================================= +// @section more + // Custom M code points #define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES @@ -576,6 +621,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #endif #endif +// @section extras // EEPROM // The microcontroller can store settings in the EEPROM, e.g. max velocity... @@ -590,26 +636,30 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #define EEPROM_CHITCHAT // please keep turned on if you can. #endif + +// @section temperature + // Preheat Constants #define PLA_PREHEAT_HOTEND_TEMP 190 -#define PLA_PREHEAT_HPB_TEMP 50 +#define PLA_PREHEAT_HPB_TEMP 50 // K8200: set back to 70 if you have an upgraded heatbed power supply #define PLA_PREHEAT_FAN_SPEED 0 // Insert Value between 0 and 255 #define ABS_PREHEAT_HOTEND_TEMP 240 -#define ABS_PREHEAT_HPB_TEMP 60 +#define ABS_PREHEAT_HPB_TEMP 60 // K8200: set back to 110 if you have an upgraded heatbed power supply #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, kana, kana_utf8, test // See also language.h -//#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) +#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en) // 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_JAPAN // K8200: for Display VM8201 // this is the most common hardware //#define DISPLAY_CHARSET_HD44780_WESTERN //#define DISPLAY_CHARSET_HD44780_CYRILLIC @@ -620,7 +670,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //#define SD_CHECK_AND_RETRY // Use CRC checks and retries on the SD communication //#define ENCODER_PULSES_PER_STEP 1 // Increase if you have a high resolution encoder //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking -#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. +#define ULTIMAKERCONTROLLER // K8200: for Display VM8201 // as available from the Ultimaker online store. //#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 @@ -683,6 +733,8 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //#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 @@ -706,7 +758,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // 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. @@ -760,7 +812,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #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 From cb9ac490d4043356f64a3ef9d67b438c2fd6bfd8 Mon Sep 17 00:00:00 2001 From: elgambitero Date: Tue, 14 Apr 2015 23:14:52 +0200 Subject: [PATCH 02/50] Some minor translations to spanish --- Marlin/language_es.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Marlin/language_es.h b/Marlin/language_es.h index 92f903cebc..168dd0a658 100644 --- a/Marlin/language_es.h +++ b/Marlin/language_es.h @@ -17,7 +17,7 @@ #define MSG_SD_INSERTED "Tarjeta colocada" #define MSG_SD_REMOVED "Tarjeta retirada" #define MSG_MAIN "Menu principal" -#define MSG_AUTOSTART " Autostart" +#define MSG_AUTOSTART "Autostart" #define MSG_DISABLE_STEPPERS "Apagar motores" #define MSG_AUTO_HOME "Llevar al origen" #define MSG_SET_HOME_OFFSETS "Ajustar offsets" @@ -46,7 +46,7 @@ #define MSG_MOVE_1MM "Mover 1mm" #define MSG_MOVE_10MM "Mover 10mm" #define MSG_SPEED "Velocidad" -#define MSG_NOZZLE "Nozzle" +#define MSG_NOZZLE "Fusor" #define MSG_BED "Base" #define MSG_FAN_SPEED "Ventilador" #define MSG_FLOW "Flujo" @@ -80,7 +80,7 @@ #define MSG_ESTEPS "E pasos/mm" #define MSG_TEMPERATURE "Temperatura" #define MSG_MOTION "Movimiento" -#define MSG_VOLUMETRIC "Filament" +#define MSG_VOLUMETRIC "Filamento" #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" @@ -116,22 +116,22 @@ #define MSG_FILAMENTCHANGE "Cambiar filamento" #define MSG_INIT_SDCARD "Iniciando tarjeta" #define MSG_CNG_SDCARD "Cambiar tarjeta" -#define MSG_ZPROBE_OUT "sonda Z fuera" +#define MSG_ZPROBE_OUT "Sonda Z fuera" #define MSG_POSITION_UNKNOWN "Reiniciar X/Y y Z" #define MSG_ZPROBE_ZOFFSET "Offset Z" -#define MSG_BABYSTEP_X "Babystep X" -#define MSG_BABYSTEP_Y "Babystep Y" -#define MSG_BABYSTEP_Z "Babystep Z" +#define MSG_BABYSTEP_X "Micropaso X" +#define MSG_BABYSTEP_Y "Micropaso Y" +#define MSG_BABYSTEP_Z "Micropaso 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" - #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" + #define MSG_DELTA_CALIBRATE "Calibracion Delta" + #define MSG_DELTA_CALIBRATE_X "Calibrar X" + #define MSG_DELTA_CALIBRATE_Y "Calibrar Y" + #define MSG_DELTA_CALIBRATE_Z "Calibrar Z" + #define MSG_DELTA_CALIBRATE_CENTER "Calibrar Centro" #endif // DELTA_CALIBRATION_MENU #endif // LANGUAGE_ES_H From f8389b10768fcf0d04633a70fdeafa96742cb384 Mon Sep 17 00:00:00 2001 From: Bo Herrmannsen Date: Wed, 15 Apr 2015 15:25:18 +0200 Subject: [PATCH 03/50] Update README.md --- README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7cb93c7e26..eeb9091301 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,6 @@ This firmware is a mashup between [Sprinter](https://github.com/kliment/Sprinter ## Current Status: Bug Fixing The Marlin development is currently revived. There's a long list of reported issues and pull requests, which we are working on currently. -We are actively looking for testers. So please try the current development version and report new issues and feedback. [![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) @@ -40,10 +39,9 @@ The current Marlin dev team consists of: - Scott Lahteine [@thinkyhead] - -Sprinters lead developers are Kliment and caru. -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. +## Donation + +If you find our work usefull please consider donating. Donations will be used to pay for our website http://www.marlinfirmware.org/ and to pay some food or rent money for the very active Collaborators More features have been added by: - Lampmaker, @@ -52,7 +50,7 @@ More features have been added by: ## License -Marlin is published under the [GPL license](/Documentation/COPYING.md) because I believe in open development. -Please do not use this code in products (3D printers, CNC etc) that are closed source or are crippled by a patent. +Marlin is published under the [GPL license](/Documentation/COPYING.md) because We believe in open development. +Do not use this code in products (3D printers, CNC etc) that are closed source or are crippled by a patent. [![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=ErikZalm&url=https://github.com/MarlinFirmware/Marlin&title=Marlin&language=&tags=github&category=software) From d0b1f70118104b3bf45bba4ba7edce1ec803c1dd Mon Sep 17 00:00:00 2001 From: Bo Herrmannsen Date: Wed, 15 Apr 2015 16:35:02 +0200 Subject: [PATCH 04/50] Update Compilation.md --- Documentation/Compilation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/Compilation.md b/Documentation/Compilation.md index 56b4f356ca..93c23a627d 100644 --- a/Documentation/Compilation.md +++ b/Documentation/Compilation.md @@ -3,14 +3,14 @@ 1. Install the latest non-beta arduino software IDE/toolset: http://www.arduino.cc/en/Main/Software 2. Download the Marlin firmware - [Latest developement version](https://github.com/MarlinFirmware/Marlin/tree/Development) - - [Stable version](https://github.com/MarlinFirmware/Marlin/tree/Development) + - [Stable version]() 3. In both cases use the "Download Zip" button on the right. 4. Some boards require special files and/or libraries from the ArduinoAddons directory. Take a look at the dedicated [README](/ArduinoAddons/README.md) for details. 5. Start the arduino IDE. - 6. Select Tools -> Board -> Arduino Mega 2560 or your microcontroller + 6. Select Tools -> Board -> Arduino Mega 2560 or your microcontroller 7. Select the correct serial port in Tools ->Serial Port 8. Open Marlin.pde or .ino 9. Click the Verify/Compile button 10. Click the Upload button. If all goes well the firmware is uploading -That's ok. Enjoy Silky Smooth Printing. \ No newline at end of file +That's ok. Enjoy Silky Smooth Printing. From e1b69db6d18ab3f4ea42c6e6711c2077eca79303 Mon Sep 17 00:00:00 2001 From: paclema Date: Wed, 15 Apr 2015 18:17:58 +0200 Subject: [PATCH 05/50] Fixed M48 mismatch between n and P parameter on documentation --- Marlin/Marlin_main.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 475362f2c9..bfde32aa3e 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -122,7 +122,7 @@ * 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] + * M48 - Measure Z_Probe repeatability. M48 [P # 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) @@ -2893,7 +2893,7 @@ inline void gcode_M42() { * M48: Z-Probe repeatability measurement function. * * Usage: - * M48 + * M48 * P = Number of sampled points (4-50, default 10) * X = Sample X position * Y = Sample Y position @@ -2905,10 +2905,6 @@ inline void gcode_M42() { * 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. - * - * The number of samples will default to 10 if not specified. You can use upper or lower case - * letters for any of the options EXCEPT n. n must be in lower case because Marlin uses a capital - * N for its communication protocol and will get horribly confused if you send it a capital N. */ inline void gcode_M48() { @@ -2926,7 +2922,7 @@ inline void gcode_M42() { if (verbose_level > 0) SERIAL_PROTOCOLPGM("M48 Z-Probe Repeatability test\n"); - if (code_seen('P') || code_seen('p') || code_seen('n')) { // `n` for legacy support only - please use `P`! + if (code_seen('P') || code_seen('p')) { // `n` for legacy support only - please use `P`! n_samples = code_value_short(); if (n_samples < 4 || n_samples > 50) { SERIAL_PROTOCOLPGM("?Sample size not plausible (4-50).\n"); From cde5eee2a560b957d0d975c950389f88fe7253dd Mon Sep 17 00:00:00 2001 From: paclema Date: Wed, 15 Apr 2015 19:01:09 +0200 Subject: [PATCH 06/50] Removed unnecessary comments --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index bfde32aa3e..64d3d1f350 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2922,7 +2922,7 @@ inline void gcode_M42() { if (verbose_level > 0) SERIAL_PROTOCOLPGM("M48 Z-Probe Repeatability test\n"); - if (code_seen('P') || code_seen('p')) { // `n` for legacy support only - please use `P`! + if (code_seen('P') || code_seen('p')) { n_samples = code_value_short(); if (n_samples < 4 || n_samples > 50) { SERIAL_PROTOCOLPGM("?Sample size not plausible (4-50).\n"); From 53be0f3399e9d11c91ec35628f6a736b172dfb1c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 16 Apr 2015 04:16:36 -0700 Subject: [PATCH 07/50] Babystep delay 2us --- Marlin/stepper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index f11cc04301..a44ddbdab8 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -1140,7 +1140,7 @@ void quickStop() { uint8_t old_pin = AXIS ##_DIR_READ; \ AXIS ##_APPLY_DIR(INVERT_## AXIS ##_DIR^direction^INVERT, true); \ AXIS ##_APPLY_STEP(!INVERT_## AXIS ##_STEP_PIN, true); \ - _delay_us(1U); \ + delayMicroseconds(2); \ AXIS ##_APPLY_STEP(INVERT_## AXIS ##_STEP_PIN, true); \ AXIS ##_APPLY_DIR(old_pin, true); \ } @@ -1179,7 +1179,7 @@ void quickStop() { X_STEP_WRITE(!INVERT_X_STEP_PIN); Y_STEP_WRITE(!INVERT_Y_STEP_PIN); Z_STEP_WRITE(!INVERT_Z_STEP_PIN); - _delay_us(1U); + delayMicroseconds(2); X_STEP_WRITE(INVERT_X_STEP_PIN); Y_STEP_WRITE(INVERT_Y_STEP_PIN); Z_STEP_WRITE(INVERT_Z_STEP_PIN); From 63b98b828021796583691fade58de09d73b35f9a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 16 Apr 2015 07:24:33 -0700 Subject: [PATCH 08/50] Raise Z for M401 and M402 --- Marlin/Marlin_main.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 64d3d1f350..81ba32ab19 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4309,14 +4309,34 @@ inline void gcode_M400() { st_synchronize(); } #if defined(ENABLE_AUTO_BED_LEVELING) && (defined(SERVO_ENDSTOPS) || defined(Z_PROBE_ALLEN_KEY)) && not defined(Z_PROBE_SLED) + #ifdef SERVO_ENDSTOPS + void raise_z_for_servo() { + float zpos = current_position[Z_AXIS], z_dest = Z_RAISE_BEFORE_HOMING; + if (!axis_known_position[Z_AXIS]) z_dest += zpos; + if (zpos < z_dest) + do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_dest); // also updates current_position + } + #endif + /** * M401: Engage Z Servo endstop if available */ - inline void gcode_M401() { deploy_z_probe(); } + inline void gcode_M401() { + #ifdef SERVO_ENDSTOPS + raise_z_for_servo(); + #endif + deploy_z_probe(); + } + /** * M402: Retract Z Servo endstop if enabled */ - inline void gcode_M402() { stow_z_probe(); } + inline void gcode_M402() { + #ifdef SERVO_ENDSTOPS + raise_z_for_servo(); + #endif + stow_z_probe(); + } #endif From 58d128b7a9178490252f76045e7d5282430549e4 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 16 Apr 2015 07:41:19 -0700 Subject: [PATCH 09/50] Apply zprobe_zoffset in axis_is_at_home Ensure the probe offset will always be included when homing Z. --- Marlin/Marlin_main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 64d3d1f350..5a396bb932 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1033,6 +1033,10 @@ static void axis_is_at_home(int axis) { min_pos[axis] = base_min_pos(axis) + home_offset[axis]; max_pos[axis] = base_max_pos(axis) + home_offset[axis]; #endif + + #if defined(ENABLE_AUTO_BED_LEVELING) && Z_HOME_DIR < 0 + if (axis == Z_AXIS) current_position[Z_AXIS] += zprobe_zoffset; + #endif } /** @@ -2041,10 +2045,6 @@ inline void gcode_G28() { 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 || homeZ) current_position[Z_AXIS] += zprobe_zoffset; // Add Z_Probe offset (the distance is negative) - #endif - sync_plan_position(); #endif // else DELTA From e4595fa24a2051e95df8a4ed044d2c94cca18e63 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Thu, 16 Apr 2015 23:04:38 +0100 Subject: [PATCH 10/50] Fixed jump in speed when using high accelerations on axes with lots of steps. I.e., when acceleration * steps per mm > 2,000,000. This was done by changing MultiU24X24toH16 to take a 32b bit operand. Removed the claim that stepper.cpp uses the Leib algorithm. --- Marlin/stepper.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index a44ddbdab8..552d529476 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -206,7 +206,17 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; // uses: // r26 to store 0 // r27 to store the byte 1 of the 48bit result -#define MultiU24X24toH16(intRes, longIn1, longIn2) \ +// intRes = longIn1 * longIn2 >> 24 +// uses: +// r26 to store 0 +// r27 to store bits 16-23 of the 48bit result. The top bit is used to round the two byte result. +// note that the lower two bytes and the upper byte of the 48bit result are not calculated. +// this can cause the result to be out by one as the lower bytes may cause carries into the upper ones. +// B0 A0 are bits 24-39 and are the returned value +// C1 B1 A1 is longIn1 +// D2 C2 B2 A2 is longIn2 +// +#define MultiU24X32toH16(intRes, longIn1, longIn2) \ asm volatile ( \ "clr r26 \n\t" \ "mul %A1, %B2 \n\t" \ @@ -237,6 +247,11 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; "lsr r27 \n\t" \ "adc %A0, r26 \n\t" \ "adc %B0, r26 \n\t" \ + "mul %D2, %A1 \n\t" \ + "add %A0, r0 \n\t" \ + "adc %B0, r1 \n\t" \ + "mul %D2, %B1 \n\t" \ + "add %B0, r0 \n\t" \ "clr r1 \n\t" \ : \ "=&r" (intRes) \ @@ -313,7 +328,7 @@ void enable_endstops(bool check) { check_endstops = check; } // The trapezoid is the shape the speed curve over time. It starts at block->initial_rate, accelerates // first block->accelerate_until step_events_completed, then keeps going at constant speed until // step_events_completed reaches block->decelerate_after after which it decelerates until the trapezoid generator is reset. -// The slope of acceleration is calculated with the leib ramp alghorithm. +// The slope of acceleration is calculated using v = u + at where t is the accumulated timer values of the steps so far. void st_wake_up() { // TCNT1 = 0; @@ -714,7 +729,7 @@ ISR(TIMER1_COMPA_vect) { unsigned short step_rate; if (step_events_completed <= (unsigned long)current_block->accelerate_until) { - MultiU24X24toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate); + MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate); acc_step_rate += current_block->initial_rate; // upper limit @@ -737,7 +752,7 @@ ISR(TIMER1_COMPA_vect) { #endif } else if (step_events_completed > (unsigned long)current_block->decelerate_after) { - MultiU24X24toH16(step_rate, deceleration_time, current_block->acceleration_rate); + MultiU24X32toH16(step_rate, deceleration_time, current_block->acceleration_rate); if (step_rate > acc_step_rate) { // Check step_rate stays positive step_rate = current_block->final_rate; From cc6b7cf3ce66e832506ee782c5e7af3cdf41211e Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Fri, 17 Apr 2015 09:28:08 +0100 Subject: [PATCH 11/50] Fixed some comment spellings. --- Marlin/stepper.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 552d529476..7fe96f2687 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -54,7 +54,7 @@ static unsigned int cleaning_buffer_counter; locked_z2_motor = false; #endif -// Counter variables for the bresenham line tracer +// Counter variables for the Bresenham line tracer static long counter_x, counter_y, counter_z, counter_e; volatile static unsigned long step_events_completed; // The number of step events executed in the current block @@ -66,7 +66,7 @@ volatile static unsigned long step_events_completed; // The number of step event static long acceleration_time, deceleration_time; //static unsigned long accelerate_until, decelerate_after, acceleration_rate, initial_rate, final_rate, nominal_rate; -static unsigned short acc_step_rate; // needed for deccelaration start point +static unsigned short acc_step_rate; // needed for deceleration start point static char step_loops; static unsigned short OCR1A_nominal; static unsigned short step_loops_nominal; @@ -484,7 +484,7 @@ ISR(TIMER1_COMPA_vect) { 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) + if (TEST(out_bits, X_AXIS)) // stepping along -X axis (regular Cartesian bot) #endif { // -direction #ifdef DUAL_X_CARRIAGE From 483384aaa48a204780f6a4b3c6786fbde81a345d Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Fri, 17 Apr 2015 09:31:53 +0100 Subject: [PATCH 12/50] Fixed faulty comment merge --- Marlin/stepper.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 7fe96f2687..c8bcbbbf2b 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -202,10 +202,6 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; "r26" \ ) -// intRes = longIn1 * longIn2 >> 24 -// uses: -// r26 to store 0 -// r27 to store the byte 1 of the 48bit result // intRes = longIn1 * longIn2 >> 24 // uses: // r26 to store 0 From 581685a231064decaa721804bfad8dd7d76d94e9 Mon Sep 17 00:00:00 2001 From: paclema Date: Fri, 17 Apr 2015 11:15:09 +0200 Subject: [PATCH 13/50] Added new PID autotune info, to make easy copy & paste results to marlin --- Marlin/configurator/config/language.h | 2 +- Marlin/language.h | 2 +- Marlin/temperature.cpp | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Marlin/configurator/config/language.h b/Marlin/configurator/config/language.h index eb0ef8c0a1..718fe9499c 100644 --- a/Marlin/configurator/config/language.h +++ b/Marlin/configurator/config/language.h @@ -209,7 +209,7 @@ #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_AUTOTUNE_FINISHED MSG_PID_AUTOTUNE " finished! Put the last Kp, Ki and Kd constants from below into Configuration.h" #define MSG_PID_DEBUG " PID_DEBUG " #define MSG_PID_DEBUG_INPUT ": Input " #define MSG_PID_DEBUG_OUTPUT " Output " diff --git a/Marlin/language.h b/Marlin/language.h index ba5f3f700e..3bc7ce0161 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -209,7 +209,7 @@ #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_AUTOTUNE_FINISHED MSG_PID_AUTOTUNE " finished! Put the last Kp, Ki and Kd constants from below into Configuration.h" #define MSG_PID_DEBUG " PID_DEBUG " #define MSG_PID_DEBUG_INPUT ": Input " #define MSG_PID_DEBUG_OUTPUT " Output " diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 69a2877e70..fa17b6c4c2 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -341,6 +341,9 @@ void PID_autotune(float temp, int extruder, int ncycles) } if (cycles > ncycles) { SERIAL_PROTOCOLLNPGM(MSG_PID_AUTOTUNE_FINISHED); + SERIAL_PROTOCOLPGM("#define DEFAULT_Kp "); SERIAL_PROTOCOLLN(Kp); + SERIAL_PROTOCOLPGM("#define DEFAULT_Ki "); SERIAL_PROTOCOLLN(Ki); + SERIAL_PROTOCOLPGM("#define DEFAULT_Kd "); SERIAL_PROTOCOLLN(Kd); return; } lcd_update(); From 2d1e73021605ffd7d01a08f60d83ed0048a100eb Mon Sep 17 00:00:00 2001 From: Bo Herrmannsen Date: Fri, 17 Apr 2015 15:00:21 +0200 Subject: [PATCH 14/50] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eeb9091301..9b40193d25 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ The Marlin development is currently revived. There's a long list of reported iss ## Contact -__Google Hangout:__ Hangout +__Google Hangout:__ Hangout ## Credits From b99e63a7bf9820984e67ebcecaeacf515cc9823e Mon Sep 17 00:00:00 2001 From: Ivan Galvez Junquera Date: Fri, 17 Apr 2015 16:10:58 +0200 Subject: [PATCH 15/50] =?UTF-8?q?Fixed=20compilation=20error=20"error:=20s?= =?UTF-8?q?tray=20=E2=80=98\357=E2=80=99=20in=20program"=20in=20several=20?= =?UTF-8?q?configuration=20files.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduced in commit 697ee2dc and later spread to other files. --- Marlin/example_configurations/Felix/Configuration.h | 2 +- Marlin/example_configurations/Hephestos/Configuration.h | 2 +- Marlin/example_configurations/K8200/Configuration.h | 2 +- Marlin/example_configurations/SCARA/Configuration.h | 2 +- Marlin/example_configurations/WITBOX/Configuration.h | 2 +- Marlin/example_configurations/delta/generic/Configuration.h | 2 +- Marlin/example_configurations/delta/kossel_mini/Configuration.h | 2 +- Marlin/example_configurations/makibox/Configuration.h | 2 +- Marlin/example_configurations/tvrrug/Round2/Configuration.h | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 269b8b794e..d5f400bae0 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" diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index a83c6e911d..ce295054c6 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -1,4 +1,4 @@ -#ifndef CONFIGURATION_H +#ifndef CONFIGURATION_H #define CONFIGURATION_H #include "boards.h" diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index 1cde25fca3..4832e8cc7a 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -1,4 +1,4 @@ -#ifndef CONFIGURATION_H +#ifndef CONFIGURATION_H #define CONFIGURATION_H #include "boards.h" diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 1f180a53d2..02637f3e55 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -1,4 +1,4 @@ -#ifndef CONFIGURATION_H +#ifndef CONFIGURATION_H #define CONFIGURATION_H #include "boards.h" diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index dda21b7759..434a529cde 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -1,4 +1,4 @@ -#ifndef CONFIGURATION_H +#ifndef CONFIGURATION_H #define CONFIGURATION_H #include "boards.h" diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 2562010ea7..4d479047a4 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" diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 1c6313e938..c7c24a16c7 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" diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index a01bcb6684..83947b65f7 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -1,4 +1,4 @@ -#ifndef CONFIGURATION_H +#ifndef CONFIGURATION_H #define CONFIGURATION_H #include "boards.h" diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 423822a866..8b365019e8 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -1,4 +1,4 @@ -#ifndef CONFIGURATION_H +#ifndef CONFIGURATION_H #define CONFIGURATION_H #include "boards.h" From 47847765e217a6d37d7b3a1853d2941768fdab03 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 18 Apr 2015 23:07:48 -0700 Subject: [PATCH 16/50] Add M410 QuickStop command --- Marlin/Marlin_main.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 64d3d1f350..0b6fa211f3 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -184,6 +184,7 @@ * 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 + * M410 - Quickstop - Abort all the planned moves * 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. @@ -4376,6 +4377,14 @@ inline void gcode_M400() { st_synchronize(); } #endif // FILAMENT_SENSOR +/** + * M410: quickstop - Abort all planned moves + * + * This will stop the carriages mid-move, so most likely they + * will be out of sync with the stepper position after this. + */ +inline void gcode_M410() { quickStop(); } + /** * M500: Store settings in EEPROM */ @@ -5195,6 +5204,10 @@ void process_commands() { break; #endif // FILAMENT_SENSOR + case 410: // M410 quickstop - Abort all the planned moves. + gcode_M410(); + break; + case 500: // M500 Store settings in EEPROM gcode_M500(); break; From d931220a6594704c7392a9bc98ce6bc070fe3ba0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 18 Apr 2015 23:12:29 -0700 Subject: [PATCH 17/50] Tweak comments --- Marlin/Marlin_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 0b6fa211f3..8863b3db36 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -184,7 +184,7 @@ * 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 - * M410 - Quickstop - Abort all the planned moves + * M410 - Quickstop. Abort all the planned moves * 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. @@ -4378,7 +4378,7 @@ inline void gcode_M400() { st_synchronize(); } #endif // FILAMENT_SENSOR /** - * M410: quickstop - Abort all planned moves + * M410: Quickstop - Abort all planned moves * * This will stop the carriages mid-move, so most likely they * will be out of sync with the stepper position after this. From 671aaf2dc9ec19ba774371129acbb0fb2775f402 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Sun, 19 Apr 2015 13:25:20 +0200 Subject: [PATCH 18/50] Minor fix for M300 Corrected wrong order of parameters. --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 94c4c7bd84..4e3bb05be5 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3971,7 +3971,7 @@ inline void gcode_M226() { delay(beepP); noTone(BEEPER); #elif defined(ULTRALCD) - lcd_buzz(beepS, beepP); + lcd_buzz(beepP, beepS); #elif defined(LCD_USE_I2C_BUZZER) lcd_buzz(beepP, beepS); #endif From 064f2b37d03827440364c2dabcdb2468fbc57415 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Mon, 20 Apr 2015 11:11:13 +0200 Subject: [PATCH 19/50] More Beeper clean up. Centralised beep code to lcd_buzz(). From gcode_M300() and lcd_quick_feedback(). Enforced max. duration for M300 to 5 seconds. Corrected description in 'Configuration.h' LCD_FEEDBACK_FREQUENCY_HZ 0 gives now a silent delay of LCD_FEEDBACK_FREQUENCY_DURATION_MS. --- Marlin/Configuration.h | 7 ++-- Marlin/Marlin_main.cpp | 16 ++------- Marlin/configurator/config/Configuration.h | 4 +-- .../Felix/Configuration.h | 4 +-- .../Felix/Configuration_DUAL.h | 4 +-- .../Hephestos/Configuration.h | 4 +-- .../K8200/Configuration.h | 4 +-- .../SCARA/Configuration.h | 4 +-- .../WITBOX/Configuration.h | 4 +-- .../delta/generic/Configuration.h | 4 +-- .../delta/kossel_mini/Configuration.h | 4 +-- .../makibox/Configuration.h | 4 +-- .../tvrrug/Round2/Configuration.h | 4 +-- Marlin/ultralcd.cpp | 35 +++++++++++-------- 14 files changed, 48 insertions(+), 54 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index f48646ac7f..81392d96bb 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -661,10 +661,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. //#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 - +//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click + // 0 to disable buzzer feedback. Test with M300 S P // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne //#define PANEL_ONE @@ -681,7 +680,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // The RepRapDiscount Smart Controller (white PCB) // http://reprap.org/wiki/RepRapDiscount_Smart_Controller -//#define REPRAP_DISCOUNT_SMART_CONTROLLER +#define REPRAP_DISCOUNT_SMART_CONTROLLER // The GADGETS3D G3D LCD/SD Controller (blue PCB) // http://reprap.org/wiki/RAMPS_1.3/1.4_GADGETS3D_Shield_with_Panel diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 4e3bb05be5..b74cf66abe 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3965,20 +3965,8 @@ inline void gcode_M226() { inline void gcode_M300() { 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); - delay(beepP); - noTone(BEEPER); - #elif defined(ULTRALCD) - lcd_buzz(beepP, beepS); - #elif defined(LCD_USE_I2C_BUZZER) - lcd_buzz(beepP, beepS); - #endif - } - else { - delay(beepP); - } + if (beepP > 5000) beepP = 5000; // limit to 5 seconds + lcd_buzz(beepP, beepS); } #endif // BEEPER>0 || ULTRALCD || LCD_USE_I2C_BUZZER diff --git a/Marlin/configurator/config/Configuration.h b/Marlin/configurator/config/Configuration.h index 2b2175cc46..7210894182 100644 --- a/Marlin/configurator/config/Configuration.h +++ b/Marlin/configurator/config/Configuration.h @@ -660,9 +660,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. //#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 +//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click + // 0 to disable buzzer feedback. Test with M300 S P // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 269b8b794e..8536f4b2cb 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -594,9 +594,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. //#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 +//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click + // 0 to disable buzzer feedback. Test with M300 S P // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h index 49b9f5b0b7..edc1588101 100644 --- a/Marlin/example_configurations/Felix/Configuration_DUAL.h +++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h @@ -590,9 +590,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. //#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 +//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click + // 0 to disable buzzer feedback. Test with M300 S P // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index a83c6e911d..b6bafe8f74 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -614,9 +614,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. //#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 +//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click + // 0 to disable buzzer feedback. Test with M300 S P // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index df0614b507..9790eabaeb 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -622,9 +622,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. //#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 +//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click + // 0 to disable buzzer feedback. Test with M300 S P // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 1f180a53d2..b1ffea4563 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -645,9 +645,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. //#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 +//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click + // 0 to disable buzzer feedback. Test with M300 S P // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index dda21b7759..d9265da9bf 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -613,9 +613,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. //#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 +//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click + // 0 to disable buzzer feedback. Test with M300 S P // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 2562010ea7..926469e32d 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -662,9 +662,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. //#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 +//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click + // 0 to disable buzzer feedback. Test with M300 S P // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 1c6313e938..090811249a 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -666,9 +666,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. //#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 +//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click + // 0 to disable buzzer feedback. Test with M300 S P // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index a01bcb6684..16516deb27 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -613,9 +613,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. //#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 +//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click + // 0 to disable buzzer feedback. Test with M300 S P // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 423822a866..b4af63b959 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -619,9 +619,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. //#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 +//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click + // 0 to disable buzzer feedback. Test with M300 S P // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 293f819c92..2673f0f853 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1131,23 +1131,18 @@ void lcd_quick_feedback() { #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); + lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); + #else + #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS + #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2 + #endif + delay(LCD_FEEDBACK_FREQUENCY_DURATION_MS); #endif } @@ -1544,9 +1539,21 @@ bool lcd_detected(void) { } void lcd_buzz(long duration, uint16_t freq) { - #ifdef LCD_USE_I2C_BUZZER - lcd.buzz(duration,freq); - #endif + if (freq > 0) { + #if BEEPER > 0 + SET_OUTPUT(BEEPER); + tone(BEEPER, freq); + delay(duration); + noTone(BEEPER); + #elif defined(LCD_USE_I2C_BUZZER) + lcd.buzz(duration,freq); + #else + delay(duration); + #endif + } + else { + delay(duration); + } } bool lcd_clicked() { return LCD_CLICKED; } From 3a27a78f9ed5c89735ace99d8c4173991f3405a4 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Mon, 20 Apr 2015 15:01:43 +0200 Subject: [PATCH 20/50] Commented REPRAP_DISCOUNT_SMART_CONTROLLER again and removed some tabs. --- Marlin/Configuration.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 81392d96bb..4e39703ad4 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -680,7 +680,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // The RepRapDiscount Smart Controller (white PCB) // http://reprap.org/wiki/RepRapDiscount_Smart_Controller -#define REPRAP_DISCOUNT_SMART_CONTROLLER +//#define REPRAP_DISCOUNT_SMART_CONTROLLER // The GADGETS3D G3D LCD/SD Controller (blue PCB) // http://reprap.org/wiki/RAMPS_1.3/1.4_GADGETS3D_Shield_with_Panel @@ -791,13 +791,13 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // Uncomment below to enable //#define FILAMENT_SENSOR -#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2) -#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel +#define FILAMENT_SENSOR_EXTRUDER_NUM 0 //The number of the extruder that has the filament sensor (0,1,2) +#define MEASUREMENT_DELAY_CM 14 //measurement delay in cm. This is the distance from filament sensor to middle of barrel -#define DEFAULT_NOMINAL_FILAMENT_DIA 3.0 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation -#define MEASURED_UPPER_LIMIT 3.30 //upper limit factor used for sensor reading validation in mm -#define MEASURED_LOWER_LIMIT 1.90 //lower limit factor for sensor reading validation in mm -#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) +#define DEFAULT_NOMINAL_FILAMENT_DIA 3.0 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software. Used for sensor reading validation +#define MEASURED_UPPER_LIMIT 3.3 //upper limit factor used for sensor reading validation in mm +#define MEASURED_LOWER_LIMIT 1.9 //lower limit factor for sensor reading validation in mm +#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 From da0d91a79b1bf0fd1c4d4a568415073b70d17573 Mon Sep 17 00:00:00 2001 From: Wurstnase Date: Mon, 20 Apr 2015 23:28:46 +0200 Subject: [PATCH 21/50] max endstopp no user will home to 0 with a max endstopp --- Marlin/Marlin_main.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 64d3d1f350..22f037075d 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1947,12 +1947,18 @@ inline void gcode_G28() { if (home_all_axis || homeY) HOMEAXIS(Y); // 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[X_AXIS]) && code_has_value()) { + float v = code_value(); + if (X_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps + current_position[X_AXIS] = v; + } // Set the Y position, if included - if (code_seen(axis_codes[Y_AXIS]) && code_has_value()) - current_position[Y_AXIS] = code_value(); + if (code_seen(axis_codes[Y_AXIS]) && code_has_value()) { + float v = code_value(); + if (Y_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps + current_position[Y_AXIS] = code_value(); + } // Home Z last if homing towards the bed #if Z_HOME_DIR < 0 @@ -2038,8 +2044,11 @@ inline void gcode_G28() { #endif // Z_HOME_DIR < 0 // Set the Z position, if included - if (code_seen(axis_codes[Z_AXIS]) && code_has_value()) + if (code_seen(axis_codes[Z_AXIS]) && code_has_value()) { + float v = code_value(); + if (Z_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps current_position[Z_AXIS] = code_value(); + } #if defined(ENABLE_AUTO_BED_LEVELING) && (Z_HOME_DIR < 0) if (home_all_axis || homeZ) current_position[Z_AXIS] += zprobe_zoffset; // Add Z_Probe offset (the distance is negative) From 61ae43f35e8523ab9785a0d79a3c6f7e73407e4a Mon Sep 17 00:00:00 2001 From: Wurstnase Date: Mon, 20 Apr 2015 23:31:10 +0200 Subject: [PATCH 22/50] v <-> code_value --- Marlin/Marlin_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 22f037075d..4987aaf1e2 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1957,7 +1957,7 @@ inline void gcode_G28() { if (code_seen(axis_codes[Y_AXIS]) && code_has_value()) { float v = code_value(); if (Y_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps - current_position[Y_AXIS] = code_value(); + current_position[Y_AXIS] = v; } // Home Z last if homing towards the bed @@ -2047,7 +2047,7 @@ inline void gcode_G28() { if (code_seen(axis_codes[Z_AXIS]) && code_has_value()) { float v = code_value(); if (Z_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps - current_position[Z_AXIS] = code_value(); + current_position[Z_AXIS] = v; } #if defined(ENABLE_AUTO_BED_LEVELING) && (Z_HOME_DIR < 0) From b59e92ab99c64c280a1afc0b240b9217c2329eda Mon Sep 17 00:00:00 2001 From: AnHardt Date: Tue, 21 Apr 2015 13:50:28 +0200 Subject: [PATCH 23/50] Fix for #1946 Syntax error. --- Marlin/pins_AZTEEG_X3.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Marlin/pins_AZTEEG_X3.h b/Marlin/pins_AZTEEG_X3.h index ea98f95c59..7c5dca3397 100644 --- a/Marlin/pins_AZTEEG_X3.h +++ b/Marlin/pins_AZTEEG_X3.h @@ -28,9 +28,7 @@ #define STAT_LED_RED 64 #define STAT_LED_BLUE 63 #endif -#endif - -#elif define TEMP_STAT_LEDS +#elif defined(TEMP_STAT_LEDS) #define STAT_LED_RED 6 #define STAT_LED_BLUE 11 #endif From c5e0e29d23bebea6b9d900f2b9886f612e7e8901 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Tue, 21 Apr 2015 21:42:00 +0200 Subject: [PATCH 24/50] Add DISPLAY_CHARSET_HD44780_CYRILLIC as alternative in SanityCheck.h and add some documentation - how to integrate a new font. --- Marlin/SanityCheck.h | 4 ++-- Marlin/fonts/README.fonts | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 857976bc30..3bba4584cd 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -87,8 +87,8 @@ /** * Required LCD language */ - #if !defined(DOGLCD) && defined(ULTRA_LCD) && !defined(DISPLAY_CHARSET_HD44780_JAPAN) && !defined(DISPLAY_CHARSET_HD44780_WESTERN) - #error You must enable either DISPLAY_CHARSET_HD44780_JAPAN or DISPLAY_CHARSET_HD44780_WESTERN for your LCD controller. + #if !defined(DOGLCD) && defined(ULTRA_LCD) && !defined(DISPLAY_CHARSET_HD44780_JAPAN) && !defined(DISPLAY_CHARSET_HD44780_WESTERN)&& !defined(DISPLAY_CHARSET_HD44780_CYRILLIC) + #error You must enable either DISPLAY_CHARSET_HD44780_JAPAN or DISPLAY_CHARSET_HD44780_WESTERN or DISPLAY_CHARSET_HD44780_CYRILLIC for your LCD controller. #endif /** diff --git a/Marlin/fonts/README.fonts b/Marlin/fonts/README.fonts index f227c079ae..a33e6afcd0 100644 --- a/Marlin/fonts/README.fonts +++ b/Marlin/fonts/README.fonts @@ -3,4 +3,23 @@ In Fony export the fonts to bdf-format. Maybe another one can edit them with Fon 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. +How to integrate a new font: +Currently we are limited to 256 symbols per font. We use a menu system with 5 lines, on a display with 64 pixel height. That means we have 12 pixel for a line. To have some space in between the lines we can't use more then 10 pixel height for the symbols. +We use fixed width fonts. To fit 22 Symbols on the 128 pixel wide screen, the symbols can't be wider than 5 pixel. Maybe you can work with half symbols - two places in the charset will than build one wide symbol. + + * Get 'Fony.exe' + * Copy one of the existing *.fon files and work with this. + * Change the pixels. Don't change width or height. + * Export as *.bdf + * Use 'bdf2u8g.exe' to produce the *.h file. Examples for the existing fonts are in 'make_fonts.bat' + * Edit the produced .h file to match our needs. See hints in 'README.fonts' or the other 'dogm_font_data_.h' files. + * Make a new entry in the font list in 'dogm_lcd_implementation.h' before the '#else // fall back' + #elif defined( DISPLAY_CHARSET_NEWNAME ) + #include "dogm_font_data_yourfont.h" + #define FONT_MENU_NAME YOURFONTNAME + #else // fall-back + * Add your font to the list of permitted fonts in 'language_en.h' + ... || defined(DISPLAY_CHARSET_YOUR_NEW_FONT) ... ) + + +Especially the Kana font should be revised by someone who knows what he/she does. I am only a west-European with very little knowledge about this script. From f2c94b3298302dad7a8c24432fef08faf60b1987 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Wed, 22 Apr 2015 01:49:55 +0200 Subject: [PATCH 25/50] tone will end automaticly --- Marlin/ultralcd.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 2673f0f853..90ab351c88 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1542,9 +1542,7 @@ void lcd_buzz(long duration, uint16_t freq) { if (freq > 0) { #if BEEPER > 0 SET_OUTPUT(BEEPER); - tone(BEEPER, freq); - delay(duration); - noTone(BEEPER); + tone(BEEPER, freq, duration); #elif defined(LCD_USE_I2C_BUZZER) lcd.buzz(duration,freq); #else From c26d816839e556876522595e85c6aadd43c05844 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Apr 2015 12:09:57 +0200 Subject: [PATCH 26/50] filter any 0 --- Marlin/Marlin_main.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 4987aaf1e2..952aa2fb3e 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1948,16 +1948,14 @@ inline void gcode_G28() { // Set the X position, if included if (code_seen(axis_codes[X_AXIS]) && code_has_value()) { - float v = code_value(); - if (X_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps - current_position[X_AXIS] = v; + if (code_value_long() != 0) // filter 0 + current_position[X_AXIS] = code_value(); } // Set the Y position, if included if (code_seen(axis_codes[Y_AXIS]) && code_has_value()) { - float v = code_value(); - if (Y_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps - current_position[Y_AXIS] = v; + if (code_value_long() != 0) // filter 0 + current_position[X_AXIS] = code_value(); } // Home Z last if homing towards the bed @@ -2045,9 +2043,8 @@ inline void gcode_G28() { // Set the Z position, if included if (code_seen(axis_codes[Z_AXIS]) && code_has_value()) { - float v = code_value(); - if (Z_HOME_DIR == -1 || v != 0) // filter 0 with max-endstopps - current_position[Z_AXIS] = v; + if (code_value_long() != 0) // filter 0 + current_position[X_AXIS] = code_value(); } #if defined(ENABLE_AUTO_BED_LEVELING) && (Z_HOME_DIR < 0) From be9e4ceddcf02741c7042753d8c1276f9443bc67 Mon Sep 17 00:00:00 2001 From: Wurstnase Date: Thu, 23 Apr 2015 10:35:14 +0200 Subject: [PATCH 27/50] fix typo c'n'p ftw :/ --- Marlin/Marlin_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 952aa2fb3e..d99b63b0b6 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1955,7 +1955,7 @@ inline void gcode_G28() { // Set the Y position, if included if (code_seen(axis_codes[Y_AXIS]) && code_has_value()) { if (code_value_long() != 0) // filter 0 - current_position[X_AXIS] = code_value(); + current_position[Y_AXIS] = code_value(); } // Home Z last if homing towards the bed @@ -2044,7 +2044,7 @@ inline void gcode_G28() { // Set the Z position, if included if (code_seen(axis_codes[Z_AXIS]) && code_has_value()) { if (code_value_long() != 0) // filter 0 - current_position[X_AXIS] = code_value(); + current_position[Z_AXIS] = code_value(); } #if defined(ENABLE_AUTO_BED_LEVELING) && (Z_HOME_DIR < 0) From 8534bc376c55740e93ca21ac626d56c47da10b91 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 23 Apr 2015 17:56:37 -0700 Subject: [PATCH 28/50] Fix homing of YZ with DUAL_X_CARRIAGE --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index a51d483e8f..f3b83294ce 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1504,7 +1504,7 @@ static void homeaxis(AxisEnum axis) { int axis_home_dir; #ifdef DUAL_X_CARRIAGE - if (axis == X_AXIS) axis_home_dir = x_home_dir(active_extruder); + axis_home_dir = (axis == X_AXIS) ? x_home_dir(active_extruder) : home_dir(axis); #else axis_home_dir = home_dir(axis); #endif From 996d0a9185f12806d51e77b5d163086f21f144d8 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 23 Apr 2015 18:06:36 -0700 Subject: [PATCH 29/50] Squish the code down a little --- Marlin/Marlin_main.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index f3b83294ce..fb9739aade 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1501,13 +1501,11 @@ static void homeaxis(AxisEnum 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; - - #ifdef DUAL_X_CARRIAGE - axis_home_dir = (axis == X_AXIS) ? x_home_dir(active_extruder) : home_dir(axis); - #else - axis_home_dir = home_dir(axis); - #endif + int axis_home_dir = + #ifdef DUAL_X_CARRIAGE + (axis == X_AXIS) ? x_home_dir(active_extruder) : + #endif + home_dir(axis); // Set the axis position as setup for the move current_position[axis] = 0; From 64268f331263b0ff064274c3ee293f44b1bd144d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 23 Apr 2015 18:16:44 -0700 Subject: [PATCH 30/50] Fixup axis_is_at_home a little --- Marlin/Marlin_main.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index fb9739aade..cc76792428 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -990,10 +990,10 @@ static void axis_is_at_home(int axis) { #endif #ifdef SCARA - float homeposition[3]; - if (axis < 2) { + if (axis == X_AXIS || axis == Y_AXIS) { + float homeposition[3]; for (int i = 0; i < 3; i++) homeposition[i] = base_home_pos(i); // SERIAL_ECHOPGM("homeposition[x]= "); SERIAL_ECHO(homeposition[0]); @@ -1023,17 +1023,14 @@ static void axis_is_at_home(int axis) { // 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 + else + #endif + { 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 + } } /** From c3560e0288cc4c4ee9caeb70abb4f17cbed5d8d5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 23 Apr 2015 19:10:09 -0700 Subject: [PATCH 31/50] Include axis parameter to ultralcd's line_to_current --- Marlin/ultralcd.cpp | 46 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 341eb3c0d0..7ed146cb83 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -648,12 +648,12 @@ static void lcd_prepare_menu() { #endif // DELTA_CALIBRATION_MENU -inline void line_to_current() { +inline void line_to_current(AxisEnum axis) { #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); + 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[X_AXIS]/60, active_extruder); + 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 } @@ -667,7 +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; - line_to_current(); + line_to_current(axis); lcdDrawUpdate = 1; } if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis])); @@ -680,7 +680,7 @@ static void lcd_move_e() { if (encoderPosition != 0) { current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale; encoderPosition = 0; - line_to_current(); + line_to_current(E_AXIS); lcdDrawUpdate = 1; } if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS])); @@ -1803,7 +1803,7 @@ char *ftostr52(const float &x) { 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(); + line_to_current(Z_AXIS); lcdDrawUpdate = 2; } if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr43(current_position[Z_AXIS])); @@ -1811,48 +1811,44 @@ char *ftostr52(const float &x) { 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; - } + int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS, + iy = _lcd_level_bed_position / MESH_NUM_X_POINTS; + if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag 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(); + line_to_current(Z_AXIS); mbl.active = 1; enqueuecommands_P(PSTR("G28")); lcd_return_to_status(); - } else { + } + else { current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; - line_to_current(); + line_to_current(Z_AXIS); 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; - } + if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag current_position[X_AXIS] = mbl.get_x(ix); current_position[Y_AXIS] = mbl.get_y(iy); - line_to_current(); + line_to_current(X_AXIS); lcdDrawUpdate = 2; } } - } else { + } + else { debounce_click = false; } } 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]) { + 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(); + line_to_current(X_AXIS); _lcd_level_bed_position = 0; lcd_goto_menu(_lcd_level_bed); } @@ -1860,9 +1856,7 @@ char *ftostr52(const float &x) { } static void lcd_level_bed() { - axis_known_position[X_AXIS] = false; - axis_known_position[Y_AXIS] = false; - axis_known_position[Z_AXIS] = false; + axis_known_position[X_AXIS] = axis_known_position[Y_AXIS] = axis_known_position[Z_AXIS] = false; mbl.reset(); enqueuecommands_P(PSTR("G28")); lcdDrawUpdate = 2; From 31932912dd82178ac7010b52ab1694d903b5ee1e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 23 Apr 2015 19:32:37 -0700 Subject: [PATCH 32/50] Use AxisEnum instead of int for _lcd_move --- Marlin/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 7ed146cb83..aa24a7a8f5 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -660,7 +660,7 @@ inline void line_to_current(AxisEnum axis) { float move_menu_scale; static void lcd_move_menu_axis(); -static void _lcd_move(const char *name, int axis, int min, int max) { +static void _lcd_move(const char *name, AxisEnum axis, int min, int max) { if (encoderPosition != 0) { refresh_cmd_timeout(); current_position[axis] += float((int)encoderPosition) * move_menu_scale; From 2558c10c6c25bdcf524c118dac45a94a7c09ac8a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 23 Apr 2015 20:06:17 -0700 Subject: [PATCH 33/50] Use the slower feedrate for XY axes --- Marlin/Marlin_main.cpp | 12 ++++++------ Marlin/ultralcd.cpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index a51d483e8f..a27795eb5c 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3806,23 +3806,23 @@ inline void gcode_M206() { * M666: Set delta endstop adjustment */ inline void gcode_M666() { - for (int8_t i = 0; i < 3; i++) { + for (int8_t i = X_AXIS; i <= Z_AXIS; i++) { if (code_seen(axis_codes[i])) { endstop_adj[i] = code_value(); } } } -#elif defined(Z_DUAL_ENDSTOPS) +#elif defined(Z_DUAL_ENDSTOPS) // !DELTA && defined(Z_DUAL_ENDSTOPS) /** * M666: For Z Dual Endstop setup, set z axis offset to the z2 axis. */ inline void gcode_M666() { - if (code_seen('Z')) z_endstop_adj = code_value(); - SERIAL_ECHOPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj ); - SERIAL_EOL; + if (code_seen('Z')) z_endstop_adj = code_value(); + SERIAL_ECHOPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj); + SERIAL_EOL; } -#endif // DELTA +#endif // !DELTA && defined(Z_DUAL_ENDSTOPS) #ifdef FWRETRACT diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index aa24a7a8f5..c96f098994 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1831,7 +1831,7 @@ char *ftostr52(const float &x) { if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag current_position[X_AXIS] = mbl.get_x(ix); current_position[Y_AXIS] = mbl.get_y(iy); - line_to_current(X_AXIS); + line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS); lcdDrawUpdate = 2; } } @@ -1848,7 +1848,7 @@ char *ftostr52(const float &x) { 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(X_AXIS); + line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS); _lcd_level_bed_position = 0; lcd_goto_menu(_lcd_level_bed); } From 01655603330b67319fa5dc4be27819099857a006 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 16 Apr 2015 07:41:19 -0700 Subject: [PATCH 34/50] Apply zprobe_zoffset in axis_is_at_home Ensure the probe offset will always be included when homing Z. --- Marlin/Marlin_main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index a51d483e8f..5849fdd685 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1034,6 +1034,10 @@ static void axis_is_at_home(int axis) { min_pos[axis] = base_min_pos(axis) + home_offset[axis]; max_pos[axis] = base_max_pos(axis) + home_offset[axis]; #endif + + #if defined(ENABLE_AUTO_BED_LEVELING) && Z_HOME_DIR < 0 + if (axis == Z_AXIS) current_position[Z_AXIS] += zprobe_zoffset; + #endif } /** @@ -2042,10 +2046,6 @@ inline void gcode_G28() { 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 || homeZ) current_position[Z_AXIS] += zprobe_zoffset; // Add Z_Probe offset (the distance is negative) - #endif - sync_plan_position(); #endif // else DELTA From 79a44a9de37859b58a8de288341a54df42e26061 Mon Sep 17 00:00:00 2001 From: Wurstnase Date: Fri, 24 Apr 2015 08:03:17 +0200 Subject: [PATCH 35/50] stepper.cpp macros rework delete some tabs --- Marlin/stepper.cpp | 121 ++++++++++++++++++++++++++------------------- 1 file changed, 71 insertions(+), 50 deletions(-) diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index c8bcbbbf2b..ca17b3f9f2 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -46,7 +46,7 @@ block_t *current_block; // A pointer to the block currently being traced // Variables used by The Stepper Driver Interrupt static unsigned char out_bits; // The next stepping-bits to be output -static unsigned int cleaning_buffer_counter; +static unsigned int cleaning_buffer_counter; #ifdef Z_DUAL_ENDSTOPS static bool performing_homing = false, @@ -285,8 +285,8 @@ void checkHitEndstops() { } #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"); + SERIAL_ECHOPAIR(" Z_PROBE:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]); + LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP"); } #endif SERIAL_EOL; @@ -411,7 +411,7 @@ ISR(TIMER1_COMPA_vect) { OCR1A = 200; return; } - + // If there is no current block, attempt to pop one from the buffer if (!current_block) { // Anything in the buffer? @@ -463,14 +463,22 @@ ISR(TIMER1_COMPA_vect) { count_direction[Y_AXIS] = 1; } + #define _ENDSTOP(axis, minmax) axis ##_## minmax ##_endstop + #define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN + #define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING + #define _OLD_ENDSTOP(axis, minmax) old_## axis ##_## minmax ##_endstop + #define _AXIS(AXIS) AXIS ##_AXIS + #define _ENDSTOP_HIT(axis) endstop_## axis ##_hit + #define UPDATE_ENDSTOP(axis,AXIS,minmax,MINMAX) \ - bool axis ##_## minmax ##_endstop = (READ(AXIS ##_## MINMAX ##_PIN) != AXIS ##_## MINMAX ##_ENDSTOP_INVERTING); \ - if (axis ##_## minmax ##_endstop && old_## axis ##_## minmax ##_endstop && (current_block->steps[AXIS ##_AXIS] > 0)) { \ - endstops_trigsteps[AXIS ##_AXIS] = count_position[AXIS ##_AXIS]; \ - endstop_## axis ##_hit = true; \ + bool _ENDSTOP(axis, minmax) = (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)); \ + if (_ENDSTOP(axis, minmax) && _OLD_ENDSTOP(axis, minmax) && (current_block->steps[_AXIS(AXIS)] > 0)) { \ + endstops_trigsteps[_AXIS(AXIS)] = count_position[_AXIS(AXIS)]; \ + _ENDSTOP_HIT(axis) = true; \ step_events_completed = current_block->step_event_count; \ } \ - old_## axis ##_## minmax ##_endstop = axis ##_## minmax ##_endstop; + _OLD_ENDSTOP(axis, minmax) = _ENDSTOP(axis, minmax); + // Check X and Y endstops if (check_endstops) { @@ -486,7 +494,7 @@ ISR(TIMER1_COMPA_vect) { #ifdef DUAL_X_CARRIAGE // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) || (current_block->active_extruder != 0 && X2_HOME_DIR == -1)) - #endif + #endif { #if HAS_X_MIN UPDATE_ENDSTOP(x, X, min, MIN); @@ -572,14 +580,14 @@ ISR(TIMER1_COMPA_vect) { 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; + 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"); +// if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true"); } old_z_probe_endstop = z_probe_endstop; #endif - + } // check_endstops } @@ -625,15 +633,15 @@ ISR(TIMER1_COMPA_vect) { #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"); + 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 @@ -667,6 +675,11 @@ ISR(TIMER1_COMPA_vect) { } #endif //ADVANCE + #define _COUNTER(axis) counter_## axis + #define _WRITE_STEP(AXIS, HIGHLOW) AXIS ##_STEP_WRITE(HIGHLOW) + #define _APPLY_STEP(AXIS) AXIS ##_APPLY_STEP + #define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN + #ifdef CONFIG_STEPPERS_TOSHIBA /** * The Toshiba stepper controller require much longer pulses. @@ -675,8 +688,8 @@ ISR(TIMER1_COMPA_vect) { * lag to allow it work with without needing NOPs */ #define STEP_ADD(axis, AXIS) \ - counter_## axis += current_block->steps[AXIS ##_AXIS]; \ - if (counter_## axis > 0) { AXIS ##_STEP_WRITE(HIGH); } + _COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \ + if (_COUNTER(axis) > 0) { _WRITE_STEP(AXIS, HIGH); } STEP_ADD(x,X); STEP_ADD(y,Y); STEP_ADD(z,Z); @@ -685,10 +698,10 @@ ISR(TIMER1_COMPA_vect) { #endif #define STEP_IF_COUNTER(axis, AXIS) \ - if (counter_## axis > 0) { \ - counter_## axis -= current_block->step_event_count; \ - count_position[AXIS ##_AXIS] += count_direction[AXIS ##_AXIS]; \ - AXIS ##_STEP_WRITE(LOW); \ + if (_COUNTER(axis) > 0) { \ + _COUNTER(axis) -= current_block->step_event_count; \ + count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \ + _WRITE_STEP(AXIS, LOW); \ } STEP_IF_COUNTER(x, X); @@ -701,12 +714,12 @@ ISR(TIMER1_COMPA_vect) { #else // !CONFIG_STEPPERS_TOSHIBA #define APPLY_MOVEMENT(axis, AXIS) \ - counter_## axis += current_block->steps[AXIS ##_AXIS]; \ - if (counter_## axis > 0) { \ - AXIS ##_APPLY_STEP(!INVERT_## AXIS ##_STEP_PIN,0); \ - counter_## axis -= current_block->step_event_count; \ - count_position[AXIS ##_AXIS] += count_direction[AXIS ##_AXIS]; \ - AXIS ##_APPLY_STEP(INVERT_## AXIS ##_STEP_PIN,0); \ + _COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \ + if (_COUNTER(axis) > 0) { \ + _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); \ + _COUNTER(axis) -= current_block->step_event_count; \ + count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \ + _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \ } APPLY_MOVEMENT(x, X); @@ -874,7 +887,7 @@ void st_init() { #ifdef HAVE_L6470DRIVER L6470_init(); #endif - + // Initialize Dir Pins #if HAS_X_DIR X_DIR_INIT; @@ -920,11 +933,11 @@ void st_init() { #if HAS_Y_ENABLE Y_ENABLE_INIT; if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH); - - #if defined(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE - Y2_ENABLE_INIT; - if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH); - #endif + + #if defined(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE + Y2_ENABLE_INIT; + if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH); + #endif #endif #if HAS_Z_ENABLE Z_ENABLE_INIT; @@ -1001,8 +1014,8 @@ void st_init() { #ifdef ENDSTOPPULLUP_ZMAX WRITE(Z2_MAX_PIN,HIGH); #endif - #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 @@ -1010,10 +1023,13 @@ void st_init() { #endif #endif + #define _STEP_INIT(AXIS) AXIS ##_STEP_INIT + #define _DISABLE(axis) disable_## axis() + #define AXIS_INIT(axis, AXIS, PIN) \ - AXIS ##_STEP_INIT; \ - AXIS ##_STEP_WRITE(INVERT_## PIN ##_STEP_PIN); \ - disable_## axis() + _STEP_INIT(AXIS); \ + _WRITE_STEP(AXIS, _INVERT_STEP_PIN(PIN)); \ + _DISABLE(axis) #define E_AXIS_INIT(NUM) AXIS_INIT(e## NUM, E## NUM, E) @@ -1146,14 +1162,19 @@ void quickStop() { // No other ISR should ever interrupt this! void babystep(const uint8_t axis, const bool direction) { + #define _ENABLE(axis) enable_## axis() + #define _READ_DIR(AXIS) AXIS ##_DIR_READ + #define _INVERT_DIR(AXIS) INVERT_## AXIS ##_DIR + #define _APPLY_DIR(AXIS, INVERT) AXIS ##_APPLY_DIR(INVERT, true) + #define BABYSTEP_AXIS(axis, AXIS, INVERT) { \ - enable_## axis(); \ - uint8_t old_pin = AXIS ##_DIR_READ; \ - AXIS ##_APPLY_DIR(INVERT_## AXIS ##_DIR^direction^INVERT, true); \ - AXIS ##_APPLY_STEP(!INVERT_## AXIS ##_STEP_PIN, true); \ + _ENABLE(axis); \ + uint8_t old_pin = _READ_DIR(AXIS); \ + _APPLY_DIR(AXIS, _INVERT_DIR(AXIS)^direction^INVERT); \ + _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), true); \ delayMicroseconds(2); \ - AXIS ##_APPLY_STEP(INVERT_## AXIS ##_STEP_PIN, true); \ - AXIS ##_APPLY_DIR(old_pin, true); \ + _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS), true); \ + _APPLY_DIR(AXIS, old_pin); \ } switch(axis) { @@ -1165,7 +1186,7 @@ void quickStop() { case Y_AXIS: BABYSTEP_AXIS(y, Y, false); break; - + case Z_AXIS: { #ifndef DELTA @@ -1202,7 +1223,7 @@ void quickStop() { #endif } break; - + default: break; } } @@ -1266,7 +1287,7 @@ void microstep_init() { #if HAS_MICROSTEPS pinMode(X_MS1_PIN,OUTPUT); - pinMode(X_MS2_PIN,OUTPUT); + pinMode(X_MS2_PIN,OUTPUT); pinMode(Y_MS1_PIN,OUTPUT); pinMode(Y_MS2_PIN,OUTPUT); pinMode(Z_MS1_PIN,OUTPUT); From 0fed46360c7b43ecb49f0fc404a46fa48ad3a4cc Mon Sep 17 00:00:00 2001 From: AnHardt Date: Fri, 24 Apr 2015 16:43:19 +0200 Subject: [PATCH 36/50] Add variant for MAX6675 in M104 Else will throw error: @:0 B@:0 Error:No thermistors - no temperature [ERROR] Error:No thermistors - no temperature when no bed is defined --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index a06bf78d0c..52b79c7dee 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3152,7 +3152,7 @@ inline void gcode_M104() { inline void gcode_M105() { if (setTargetedHotend(105)) return; - #if HAS_TEMP_0 || HAS_TEMP_BED + #if HAS_TEMP_0 || HAS_TEMP_BED || defined(HEATER_0_USES_MAX6675) SERIAL_PROTOCOLPGM("ok"); #if HAS_TEMP_0 SERIAL_PROTOCOLPGM(" T:"); From 35e79d56a5e5af903f310f28d92298bfc5bb5548 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Apr 2015 19:23:12 -0700 Subject: [PATCH 37/50] Remove set-coordinate extension of G28 --- Marlin/Marlin_main.cpp | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 7d417bd228..a09ef49070 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1790,12 +1790,6 @@ inline void gcode_G4() { * 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() { @@ -1855,7 +1849,7 @@ inline void gcode_G28() { homeY = code_seen(axis_codes[Y_AXIS]), homeZ = code_seen(axis_codes[Z_AXIS]); - home_all_axis = !(homeX || homeY || homeZ) || (homeX && homeY && homeZ); + home_all_axis = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ); if (home_all_axis || homeZ) { @@ -1942,18 +1936,6 @@ inline void gcode_G28() { // Home Y if (home_all_axis || homeY) HOMEAXIS(Y); - // Set the X position, if included - if (code_seen(axis_codes[X_AXIS]) && code_has_value()) { - if (code_value_long() != 0) // filter 0 - current_position[X_AXIS] = code_value(); - } - - // Set the Y position, if included - if (code_seen(axis_codes[Y_AXIS]) && code_has_value()) { - if (code_value_long() != 0) // filter 0 - current_position[Y_AXIS] = code_value(); - } - // Home Z last if homing towards the bed #if Z_HOME_DIR < 0 @@ -2037,12 +2019,6 @@ inline void gcode_G28() { #endif // Z_HOME_DIR < 0 - // Set the Z position, if included - if (code_seen(axis_codes[Z_AXIS]) && code_has_value()) { - if (code_value_long() != 0) // filter 0 - current_position[Z_AXIS] = code_value(); - } - #if defined(ENABLE_AUTO_BED_LEVELING) && (Z_HOME_DIR < 0) if (home_all_axis || homeZ) current_position[Z_AXIS] += zprobe_zoffset; // Add Z_Probe offset (the distance is negative) #endif From ce142afddae60aad7ce6f7fb2d223613607b700d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Apr 2015 20:13:01 -0700 Subject: [PATCH 38/50] G4 shows status message only if no message is set already - Address issue raised in #1961 --- Marlin/Marlin_main.cpp | 5 +++-- Marlin/ultralcd.cpp | 2 ++ Marlin/ultralcd.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index a09ef49070..e1a9cd6e01 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1740,14 +1740,15 @@ inline void gcode_G2_G3(bool clockwise) { inline void gcode_G4() { millis_t codenum = 0; - LCD_MESSAGEPGM(MSG_DWELL); - if (code_seen('P')) codenum = code_value_long(); // milliseconds to wait if (code_seen('S')) codenum = code_value_long() * 1000; // seconds to wait st_synchronize(); refresh_cmd_timeout(); codenum += previous_cmd_ms; // keep track of when we started waiting + + if (!lcd_hasstatus()) LCD_MESSAGEPGM(MSG_DWELL); + while (millis() < codenum) { manage_heater(); manage_inactivity(); diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index c96f098994..03da2366b3 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1418,6 +1418,8 @@ void set_utf_strlen(char *s, uint8_t n) { s[i] = 0; } +bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); } + void lcd_setstatus(const char* message, bool persist) { if (lcd_status_message_level > 0) return; strncpy(lcd_status_message, message, 3*LCD_WIDTH); diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index b8d5cba8ad..97d939fa34 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -8,6 +8,7 @@ int lcd_strlen_P(const char *s); void lcd_update(); void lcd_init(); + bool lcd_hasstatus(); 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); From 56ff46eb8b34d3fa8db9ea6ddac22dab6f79878c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Apr 2015 20:43:16 -0700 Subject: [PATCH 39/50] Improve code_has_value test --- Marlin/Marlin_main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index e1a9cd6e01..27027c8332 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -890,8 +890,11 @@ void get_command() { } bool code_has_value() { - char c = strchr_pointer[1]; - return (c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.'; + int i = 1; + char c = strchr_pointer[i]; + if (c == '-' || c == '+') c = strchr_pointer[++i]; + if (c == '.') c = strchr_pointer[++i]; + return (c >= '0' && c <= '9'); } float code_value() { From 182f2cda350b284db5d71cc194ed7f3ea7872d4c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Apr 2015 21:26:36 -0700 Subject: [PATCH 40/50] Minor cleanup of M48 --- Marlin/Marlin_main.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 05a864e6a6..65290b3cb8 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1189,8 +1189,8 @@ inline void set_destination_to_current() { memcpy(destination, current_position, st_synchronize(); endstops_hit_on_purpose(); // clear endstop hit flags + // Get the current stepper position after bumping an endstop 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 @@ -2908,12 +2908,12 @@ inline void gcode_M42() { } } - 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), + double X_current = st_get_position_mm(X_AXIS), + Y_current = 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); + E_current = st_get_position_mm(E_AXIS), + X_probe_location = X_current, Y_probe_location = Y_current, + Z_start_location = Z_current + Z_RAISE_BEFORE_PROBING; bool deploy_probe_for_each_reading = code_seen('E') || code_seen('e'); @@ -2948,10 +2948,7 @@ inline void gcode_M42() { st_synchronize(); plan_bed_level_matrix.set_to_identity(); - plan_buffer_line(X_current, Y_current, Z_start_location, - ext_position, - homing_feedrate[Z_AXIS] / 60, - active_extruder); + plan_buffer_line(X_current, Y_current, Z_start_location, E_current, homing_feedrate[Z_AXIS] / 60, active_extruder); st_synchronize(); // @@ -2963,7 +2960,7 @@ inline void gcode_M42() { SERIAL_PROTOCOLPGM("Positioning the probe...\n"); plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location, - ext_position, + E_current, homing_feedrate[X_AXIS]/60, active_extruder); st_synchronize(); @@ -2971,7 +2968,7 @@ inline void gcode_M42() { current_position[X_AXIS] = X_current = st_get_position_mm(X_AXIS); current_position[Y_AXIS] = Y_current = st_get_position_mm(Y_AXIS); current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS); - current_position[E_AXIS] = ext_position = st_get_position_mm(E_AXIS); + current_position[E_AXIS] = E_current = st_get_position_mm(E_AXIS); // // OK, do the inital probe to get us close to the bed. @@ -2987,7 +2984,7 @@ inline void gcode_M42() { Z_start_location = st_get_position_mm(Z_AXIS) + Z_RAISE_BEFORE_PROBING; plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location, - ext_position, + E_current, homing_feedrate[X_AXIS]/60, active_extruder); st_synchronize(); @@ -3017,8 +3014,8 @@ inline void gcode_M42() { if (radius < 0.0) radius = -radius; X_current = X_probe_location + cos(theta) * radius; - Y_current = Y_probe_location + sin(theta) * radius; X_current = constrain(X_current, X_MIN_POS, X_MAX_POS); + Y_current = Y_probe_location + sin(theta) * radius; Y_current = constrain(Y_current, Y_MIN_POS, Y_MAX_POS); if (verbose_level > 3) { From 0d8c00d3f644e569489b61ba5bdb0ec22ba6fcf3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Apr 2015 21:36:04 -0700 Subject: [PATCH 41/50] Define lcd_hasstatus for no lcd also --- Marlin/ultralcd.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 97d939fa34..94ec168778 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -101,6 +101,7 @@ #else //no LCD FORCE_INLINE void lcd_update() {} FORCE_INLINE void lcd_init() {} + FORCE_INLINE bool lcd_hasstatus() { return false; }; 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() {} @@ -108,8 +109,8 @@ FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {} FORCE_INLINE bool lcd_detected(void) { return true; } - #define LCD_MESSAGEPGM(x) - #define LCD_ALERTMESSAGEPGM(x) + #define LCD_MESSAGEPGM(x) do{}while(0) + #define LCD_ALERTMESSAGEPGM(x) do{}while(0) #endif //ULTRA_LCD From 7295640f44636e779c1d8dec142c0b987c65fb59 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Apr 2015 21:37:27 -0700 Subject: [PATCH 42/50] Remove extraneous ; --- Marlin/ultralcd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 94ec168778..8f96f008ba 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -101,7 +101,7 @@ #else //no LCD FORCE_INLINE void lcd_update() {} FORCE_INLINE void lcd_init() {} - FORCE_INLINE bool lcd_hasstatus() { return false; }; + FORCE_INLINE bool lcd_hasstatus() { return false; } 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() {} From 97dfa0365d7d83303bbc2bea547d1815005c02f6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Apr 2015 21:51:10 -0700 Subject: [PATCH 43/50] Rename expireStatusMillis to expire_status_ms --- Marlin/ultralcd.cpp | 14 +++++++------- Marlin/ultralcd_implementation_hitachi_HD44780.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 03da2366b3..a310db6143 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -273,22 +273,22 @@ static void lcd_status_screen() { #endif #if PROGRESS_MSG_EXPIRE > 0 // Handle message expire - if (expireStatusMillis > 0) { + if (expire_status_ms > 0) { if (card.isFileOpen()) { // Expire the message when printing is active if (IS_SD_PRINTING) { // Expire the message when printing is active - if (ms >= expireStatusMillis) { + if (ms >= expire_status_ms) { lcd_status_message[0] = '\0'; - expireStatusMillis = 0; + expire_status_ms = 0; } } else { - expireStatusMillis += LCD_UPDATE_INTERVAL; + expire_status_ms += LCD_UPDATE_INTERVAL; } } else { - expireStatusMillis = 0; + expire_status_ms = 0; } } #endif @@ -1394,7 +1394,7 @@ void lcd_finishstatus(bool persist=false) { #ifdef LCD_PROGRESS_BAR progressBarTick = millis(); #if PROGRESS_MSG_EXPIRE > 0 - expireStatusMillis = persist ? 0 : progressBarTick + PROGRESS_MSG_EXPIRE; + expire_status_ms = persist ? 0 : progressBarTick + PROGRESS_MSG_EXPIRE; #endif #endif lcdDrawUpdate = 2; @@ -1405,7 +1405,7 @@ void lcd_finishstatus(bool persist=false) { } #if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 - void dontExpireStatus() { expireStatusMillis = 0; } + void dontExpireStatus() { expire_status_ms = 0; } #endif void set_utf_strlen(char *s, uint8_t n) { diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index f9ed56a7dc..50c6deb5e4 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -196,7 +196,7 @@ #ifdef LCD_PROGRESS_BAR static uint16_t progressBarTick = 0; #if PROGRESS_MSG_EXPIRE > 0 - static uint16_t expireStatusMillis = 0; + static uint16_t expire_status_ms = 0; #endif #define LCD_STR_PROGRESS "\x03\x04\x05" #endif From c92b59952a9eb517d92df58f428df8dbb03a1f05 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Apr 2015 22:16:09 -0700 Subject: [PATCH 44/50] Use millis_t for progress_bar_ms and expire_status_ms --- Marlin/ultralcd.cpp | 8 ++++---- Marlin/ultralcd_implementation_hitachi_HD44780.h | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index a310db6143..1d4e167287 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -267,8 +267,8 @@ static void lcd_status_screen() { #ifdef LCD_PROGRESS_BAR millis_t ms = millis(); #ifndef PROGRESS_MSG_ONCE - if (ms > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) { - progressBarTick = ms; + if (ms > progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) { + progress_bar_ms = ms; } #endif #if PROGRESS_MSG_EXPIRE > 0 @@ -1392,9 +1392,9 @@ void lcd_ignore_click(bool b) { void lcd_finishstatus(bool persist=false) { #ifdef LCD_PROGRESS_BAR - progressBarTick = millis(); + progress_bar_ms = millis(); #if PROGRESS_MSG_EXPIRE > 0 - expire_status_ms = persist ? 0 : progressBarTick + PROGRESS_MSG_EXPIRE; + expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE; #endif #endif lcdDrawUpdate = 2; diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 50c6deb5e4..eb1f525cc2 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -194,9 +194,9 @@ #include "utf_mapper.h" #ifdef LCD_PROGRESS_BAR - static uint16_t progressBarTick = 0; + static millis_t progress_bar_ms = 0; #if PROGRESS_MSG_EXPIRE > 0 - static uint16_t expire_status_ms = 0; + static millis_t expire_status_ms = 0; #endif #define LCD_STR_PROGRESS "\x03\x04\x05" #endif @@ -588,8 +588,9 @@ static void lcd_implementation_status_screen() { #ifdef LCD_PROGRESS_BAR if (card.isFileOpen()) { - if (millis() >= progressBarTick + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) { - // draw the progress bar + // Draw the progress bar if the message has shown long enough + // or if there is no message set. + if (millis() >= progress_bar_ms + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) { int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100, cel = tix / 3, rem = tix % 3, i = LCD_WIDTH; char msg[LCD_WIDTH+1], b = ' '; From 5c29fda16756d28b231444b1e54ed656650bc8ab Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Apr 2015 00:46:33 -0700 Subject: [PATCH 45/50] Add a warning for DISABLE_[XYZ] options --- Marlin/Configuration.h | 1 + Marlin/configurator/config/Configuration.h | 1 + Marlin/example_configurations/Felix/Configuration.h | 1 + Marlin/example_configurations/Felix/Configuration_DUAL.h | 1 + Marlin/example_configurations/Hephestos/Configuration.h | 1 + Marlin/example_configurations/K8200/Configuration.h | 1 + Marlin/example_configurations/SCARA/Configuration.h | 1 + Marlin/example_configurations/WITBOX/Configuration.h | 1 + Marlin/example_configurations/delta/generic/Configuration.h | 1 + Marlin/example_configurations/delta/kossel_mini/Configuration.h | 1 + Marlin/example_configurations/makibox/Configuration.h | 1 + Marlin/example_configurations/tvrrug/Round2/Configuration.h | 1 + 12 files changed, 12 insertions(+) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 4e39703ad4..e3d0c339a2 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -364,6 +364,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #define E_ENABLE_ON 0 // For all extruders // Disables axis when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z false diff --git a/Marlin/configurator/config/Configuration.h b/Marlin/configurator/config/Configuration.h index 7210894182..59d13ab64e 100644 --- a/Marlin/configurator/config/Configuration.h +++ b/Marlin/configurator/config/Configuration.h @@ -364,6 +364,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #define E_ENABLE_ON 0 // For all extruders // Disables axis when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z false diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 5b1bca2256..558ee3bb03 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -317,6 +317,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #define E_ENABLE_ON 0 // For all extruders // Disables axis when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z false diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h index edc1588101..2e5633b8c1 100644 --- a/Marlin/example_configurations/Felix/Configuration_DUAL.h +++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h @@ -317,6 +317,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #define E_ENABLE_ON 0 // For all extruders // Disables axis when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z false diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 0ebea087c6..69841816fd 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -338,6 +338,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic #define E_ENABLE_ON 0 // For all extruders // Disables axis when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z false diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index 68634b552a..2987552f6d 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -375,6 +375,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #define E_ENABLE_ON 0 // For all extruders // Disables axis when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z true diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 3718edbe7b..6d70fa244f 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -369,6 +369,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #define E_ENABLE_ON 0 // For all extruders // Disables axis when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z false diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index d4ff5b2aca..7022f78887 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -337,6 +337,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic #define E_ENABLE_ON 0 // For all extruders // Disables axis when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z true diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 1fa08d0cb4..ae094ccac5 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -367,6 +367,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic #define E_ENABLE_ON 0 // For all extruders // Disables axis when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z false diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 5557932838..f6b6a1e036 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -367,6 +367,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #define E_ENABLE_ON 0 // For all extruders // Disables axis when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z false diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index bc6cbb949f..500f47fe86 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -337,6 +337,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #define E_ENABLE_ON 0 // For all extruders // Disables axis when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z false diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index a785543ca7..314faf2d6a 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -339,6 +339,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the logic #define E_ENABLE_ON 1 // For all extruders // Disables axis when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z false From 9c5d14ea683099cbc70597894488281ab380c4f1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Apr 2015 03:12:49 -0700 Subject: [PATCH 46/50] Fix BEEPER duration --- Marlin/ultralcd.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 1d4e167287..433d0087b1 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1544,7 +1544,9 @@ void lcd_buzz(long duration, uint16_t freq) { if (freq > 0) { #if BEEPER > 0 SET_OUTPUT(BEEPER); - tone(BEEPER, freq, duration); + tone(BEEPER, freq); + delay(duration); + noTone(BEEPER); #elif defined(LCD_USE_I2C_BUZZER) lcd.buzz(duration,freq); #else From a932e7490fcfa01eb64c3675a0ce83d29c16045c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Apr 2015 03:25:30 -0700 Subject: [PATCH 47/50] No noTone needed, but delay is --- Marlin/ultralcd.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 433d0087b1..d2fb575ce0 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1544,11 +1544,10 @@ void lcd_buzz(long duration, uint16_t freq) { if (freq > 0) { #if BEEPER > 0 SET_OUTPUT(BEEPER); - tone(BEEPER, freq); + tone(BEEPER, freq, duration); delay(duration); - noTone(BEEPER); #elif defined(LCD_USE_I2C_BUZZER) - lcd.buzz(duration,freq); + lcd.buzz(duration, freq); #else delay(duration); #endif From a22a228bcc65e30c9c500dc17fbed51cc9718ef4 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Apr 2015 21:04:54 -0700 Subject: [PATCH 48/50] Rename files to move them in the IDE --- Marlin/BlinkM.cpp | 4 ++-- Marlin/BlinkM.h | 2 +- Marlin/Makefile | 4 ++-- Marlin/Marlin_main.cpp | 8 ++++---- Marlin/Servo.cpp | 4 ++-- Marlin/Servo.h | 6 +++--- .../{ConfigurationStore.cpp => configuration_store.cpp} | 4 ++-- Marlin/{ConfigurationStore.h => configuration_store.h} | 6 +++--- Marlin/{DOGMbitmaps.h => dogm_bitmaps.h} | 0 Marlin/dogm_lcd_implementation.h | 2 +- Marlin/pins_SAV_MKI.h | 2 +- Marlin/ultralcd.cpp | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) rename Marlin/{ConfigurationStore.cpp => configuration_store.cpp} (99%) rename Marlin/{ConfigurationStore.h => configuration_store.h} (83%) rename Marlin/{DOGMbitmaps.h => dogm_bitmaps.h} (100%) diff --git a/Marlin/BlinkM.cpp b/Marlin/BlinkM.cpp index b340f968c0..1ec5b656cc 100644 --- a/Marlin/BlinkM.cpp +++ b/Marlin/BlinkM.cpp @@ -1,11 +1,11 @@ /* - BlinkM.cpp - Library for controlling a BlinkM over i2c + blinkm.cpp - Library for controlling a BlinkM over i2c Created by Tim Koster, August 21 2013. */ #include "Marlin.h" #ifdef BLINKM -#include "BlinkM.h" +#include "blinkm.h" void SendColors(byte red, byte grn, byte blu) { Wire.begin(); diff --git a/Marlin/BlinkM.h b/Marlin/BlinkM.h index 5b802b718b..08169e589c 100644 --- a/Marlin/BlinkM.h +++ b/Marlin/BlinkM.h @@ -1,5 +1,5 @@ /* - BlinkM.h + blinkm.h Library header file for BlinkM library */ #if ARDUINO >= 100 diff --git a/Marlin/Makefile b/Marlin/Makefile index 56e5dda734..e23c2a19b4 100644 --- a/Marlin/Makefile +++ b/Marlin/Makefile @@ -267,8 +267,8 @@ endif CXXSRC = WMath.cpp WString.cpp Print.cpp Marlin_main.cpp \ MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp \ SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp \ - stepper.cpp temperature.cpp cardreader.cpp ConfigurationStore.cpp \ - watchdog.cpp SPI.cpp Servo.cpp Tone.cpp ultralcd.cpp digipot_mcp4451.cpp \ + stepper.cpp temperature.cpp cardreader.cpp configuration_store.cpp \ + watchdog.cpp SPI.cpp servo.cpp Tone.cpp ultralcd.cpp digipot_mcp4451.cpp \ vector_3.cpp qr_solve.cpp ifeq ($(LIQUID_TWI2), 0) CXXSRC += LiquidCrystal.cpp diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index e22fddb271..33432ac366 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -49,18 +49,18 @@ #include "motion_control.h" #include "cardreader.h" #include "watchdog.h" -#include "ConfigurationStore.h" +#include "configuration_store.h" #include "language.h" #include "pins_arduino.h" #include "math.h" #ifdef BLINKM - #include "BlinkM.h" + #include "blinkm.h" #include "Wire.h" #endif #if NUM_SERVOS > 0 - #include "Servo.h" + #include "servo.h" #endif #if HAS_DIGIPOTSS @@ -4417,7 +4417,7 @@ inline void gcode_M503() { if (code_seen('Z')) { value = code_value(); if (Z_PROBE_OFFSET_RANGE_MIN <= value && value <= Z_PROBE_OFFSET_RANGE_MAX) { - zprobe_zoffset = -value; // compare w/ line 278 of ConfigurationStore.cpp + zprobe_zoffset = -value; // compare w/ line 278 of configuration_store.cpp SERIAL_ECHO_START; SERIAL_ECHOLNPGM(MSG_ZPROBE_ZOFFSET " " MSG_OK); SERIAL_EOL; diff --git a/Marlin/Servo.cpp b/Marlin/Servo.cpp index 27a7d3cf3e..81d73ae870 100644 --- a/Marlin/Servo.cpp +++ b/Marlin/Servo.cpp @@ -1,5 +1,5 @@ /* - Servo.cpp - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 + servo.cpp - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 Copyright (c) 2009 Michael Margolis. All right reserved. This library is free software; you can redistribute it and/or @@ -48,7 +48,7 @@ #include #include -#include "Servo.h" +#include "servo.h" #define usToTicks(_us) (( clockCyclesPerMicrosecond()* _us) / 8) // converts microseconds to tick (assumes prescale of 8) // 12 Aug 2009 #define ticksToUs(_ticks) (( (unsigned)_ticks * 8)/ clockCyclesPerMicrosecond() ) // converts from ticks back to microseconds diff --git a/Marlin/Servo.h b/Marlin/Servo.h index 682a3b3798..4647561754 100644 --- a/Marlin/Servo.h +++ b/Marlin/Servo.h @@ -1,5 +1,5 @@ /* - Servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 + servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 Copyright (c) 2009 Michael Margolis. All right reserved. This library is free software; you can redistribute it and/or @@ -42,8 +42,8 @@ detach() - Stops an attached servos from pulsing its i/o pin. */ -#ifndef Servo_h -#define Servo_h +#ifndef servo_h +#define servo_h #include diff --git a/Marlin/ConfigurationStore.cpp b/Marlin/configuration_store.cpp similarity index 99% rename from Marlin/ConfigurationStore.cpp rename to Marlin/configuration_store.cpp index 0154691de0..9f91db0985 100644 --- a/Marlin/ConfigurationStore.cpp +++ b/Marlin/configuration_store.cpp @@ -1,5 +1,5 @@ /** - * ConfigurationStore.cpp + * configuration_store.cpp * * Configuration and EEPROM storage * @@ -93,7 +93,7 @@ #include "planner.h" #include "temperature.h" #include "ultralcd.h" -#include "ConfigurationStore.h" +#include "configuration_store.h" #ifdef MESH_BED_LEVELING #include "mesh_bed_leveling.h" diff --git a/Marlin/ConfigurationStore.h b/Marlin/configuration_store.h similarity index 83% rename from Marlin/ConfigurationStore.h rename to Marlin/configuration_store.h index 3dc4a92cfd..6f1a8fcbdc 100644 --- a/Marlin/ConfigurationStore.h +++ b/Marlin/configuration_store.h @@ -1,5 +1,5 @@ -#ifndef CONFIGURATIONSTORE_H -#define CONFIGURATIONSTORE_H +#ifndef CONFIGURATION_STORE_H +#define CONFIGURATION_STORE_H #include "Configuration.h" @@ -19,4 +19,4 @@ void Config_ResetDefault(); FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); } #endif -#endif //CONFIGURATIONSTORE_H +#endif //CONFIGURATION_STORE_H diff --git a/Marlin/DOGMbitmaps.h b/Marlin/dogm_bitmaps.h similarity index 100% rename from Marlin/DOGMbitmaps.h rename to Marlin/dogm_bitmaps.h diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index 3ab18af75c..0965b90972 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -29,7 +29,7 @@ #endif #include -#include "DOGMbitmaps.h" +#include "dogm_bitmaps.h" #include "ultralcd.h" #include "ultralcd_st7920_u8glib_rrd.h" diff --git a/Marlin/pins_SAV_MKI.h b/Marlin/pins_SAV_MKI.h index e898c9f285..e853b63b95 100644 --- a/Marlin/pins_SAV_MKI.h +++ b/Marlin/pins_SAV_MKI.h @@ -82,7 +82,7 @@ #define HOME_PIN -1 // A4 = marlin 44 - teensy = 42 #ifdef NUM_SERVOS - #define SERVO0_PIN 41 // In teensy's pin definition for pinMode (in Servo.cpp) + #define SERVO0_PIN 41 // In teensy's pin definition for pinMode (in servo.cpp) #endif #endif // SAV_3DLCD diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index d2fb575ce0..81844573ea 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -5,7 +5,7 @@ #include "cardreader.h" #include "temperature.h" #include "stepper.h" -#include "ConfigurationStore.h" +#include "configuration_store.h" int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */ From 0ec444720f32a25175b6aa6846d31e457d751bdf Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 25 Apr 2015 21:06:19 -0700 Subject: [PATCH 49/50] Rename blinkm files --- Marlin/{BlinkM.cpp => blinkm.cpp} | 0 Marlin/{BlinkM.h => blinkm.h} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename Marlin/{BlinkM.cpp => blinkm.cpp} (100%) rename Marlin/{BlinkM.h => blinkm.h} (100%) diff --git a/Marlin/BlinkM.cpp b/Marlin/blinkm.cpp similarity index 100% rename from Marlin/BlinkM.cpp rename to Marlin/blinkm.cpp diff --git a/Marlin/BlinkM.h b/Marlin/blinkm.h similarity index 100% rename from Marlin/BlinkM.h rename to Marlin/blinkm.h From d43cc2dd5f52c9b71b486e7778d7fb44ea67fad6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 26 Apr 2015 20:08:45 -0700 Subject: [PATCH 50/50] M111 - Debug Level - Add `M111` as a standard option to set the debug level - Implement `DEBUG_ECHO` in `process_commands` - Other debug levels (e.g., `DEBUG_DRYRUN`) need more work --- Marlin/Marlin.h | 12 ++++++ Marlin/Marlin_main.cpp | 59 ++++++++++++++++++--------- Marlin/configurator/config/language.h | 3 +- Marlin/language.h | 3 +- 4 files changed, 55 insertions(+), 22 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 0158a1d714..97978c45f7 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -223,6 +223,18 @@ void Stop(); void filrunout(); #endif +/** + * Debug flags - not yet widely applied + */ +enum DebugFlags { + DEBUG_ECHO = BIT(0), + DEBUG_INFO = BIT(1), + DEBUG_ERRORS = BIT(2), + DEBUG_DRYRUN = BIT(3), + DEBUG_COMMUNICATION = BIT(4) +}; +extern uint8_t marlin_debug_flags; + extern bool Running; inline bool IsRunning() { return Running; } inline bool IsStopped() { return !Running; } diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 33432ac366..ac86cb05b7 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -138,6 +138,7 @@ * 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 + * M111 - Set debug flags with S. See flag bits defined in Marlin.h. * M112 - Emergency stop * M114 - Output current position to serial port * M115 - Capabilities string @@ -218,6 +219,8 @@ bool Running = true; +uint8_t marlin_debug_flags = DEBUG_INFO|DEBUG_ERRORS; + static float feedrate = 1500.0, next_feedrate, saved_feedrate; float current_position[NUM_AXIS] = { 0.0 }; static float destination[NUM_AXIS] = { 0.0 }; @@ -749,9 +752,10 @@ void get_command() { gcode_N = (strtol(strchr_pointer + 1, NULL, 10)); 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); - //Serial.println(gcode_N); + SERIAL_ERRORPGM(MSG_ERR_LINE_NO1); + SERIAL_ERROR(gcode_LastN + 1); + SERIAL_ERRORPGM(MSG_ERR_LINE_NO2); + SERIAL_ERRORLN(gcode_N); FlushSerialRequestResend(); serial_count = 0; return; @@ -3337,12 +3341,17 @@ inline void gcode_M109() { #endif // HAS_TEMP_BED /** - * M112: Emergency Stop + * M111: Set the debug level */ -inline void gcode_M112() { - kill(); +inline void gcode_M111() { + marlin_debug_flags = code_seen('S') ? code_value_short() : DEBUG_INFO|DEBUG_ERRORS; } +/** + * M112: Emergency Stop + */ +inline void gcode_M112() { kill(); } + #ifdef BARICUDA #if HAS_HEATER_1 @@ -4781,6 +4790,12 @@ inline void gcode_T() { * This is called from the main loop() */ void process_commands() { + + if ((marlin_debug_flags & DEBUG_ECHO)) { + SERIAL_ECHO_START; + SERIAL_ECHOLN(command_queue[cmd_queue_index_r]); + } + if (code_seen('G')) { int gCode = code_value_short(); @@ -4919,34 +4934,38 @@ void process_commands() { gcode_M104(); break; - case 112: // M112 Emergency Stop + case 111: // M111: Set debug level + gcode_M111(); + break; + + case 112: // M112: Emergency Stop gcode_M112(); break; - case 140: // M140 Set bed temp + case 140: // M140: Set bed temp gcode_M140(); break; - case 105: // M105 Read current temperature + case 105: // M105: Read current temperature gcode_M105(); return; break; - case 109: // M109 Wait for temperature + case 109: // M109: Wait for temperature gcode_M109(); break; #if HAS_TEMP_BED - case 190: // M190 - Wait for bed heater to reach target. + case 190: // M190: Wait for bed heater to reach target gcode_M190(); break; #endif // HAS_TEMP_BED #if HAS_FAN - case 106: //M106 Fan On + case 106: // M106: Fan On gcode_M106(); break; - case 107: //M107 Fan Off + case 107: // M107: Fan Off gcode_M107(); break; #endif // HAS_FAN @@ -4954,20 +4973,20 @@ void process_commands() { #ifdef BARICUDA // PWM for HEATER_1_PIN #if HAS_HEATER_1 - case 126: // M126 valve open + case 126: // M126: valve open gcode_M126(); break; - case 127: // M127 valve closed + case 127: // M127: valve closed gcode_M127(); break; #endif // HAS_HEATER_1 // PWM for HEATER_2_PIN #if HAS_HEATER_2 - case 128: // M128 valve open + case 128: // M128: valve open gcode_M128(); break; - case 129: // M129 valve closed + case 129: // M129: valve closed gcode_M129(); break; #endif // HAS_HEATER_2 @@ -4975,13 +4994,13 @@ void process_commands() { #if HAS_POWER_SWITCH - case 80: // M80 - Turn on Power Supply + case 80: // M80: Turn on Power Supply gcode_M80(); break; #endif // HAS_POWER_SWITCH - case 81: // M81 - Turn off Power, including Power Supply, if possible + case 81: // M81: Turn off Power, including Power Supply, if possible gcode_M81(); break; @@ -4991,7 +5010,7 @@ void process_commands() { case 83: gcode_M83(); break; - case 18: //compatibility + case 18: // (for compatibility) case 84: // M84 gcode_M18_M84(); break; diff --git a/Marlin/configurator/config/language.h b/Marlin/configurator/config/language.h index 718fe9499c..2576bec42b 100644 --- a/Marlin/configurator/config/language.h +++ b/Marlin/configurator/config/language.h @@ -122,7 +122,8 @@ #define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: " #define MSG_OK "ok" #define MSG_FILE_SAVED "Done saving file." -#define MSG_ERR_LINE_NO "Line Number is not Last Line Number+1, Last Line: " +#define MSG_ERR_LINE_NO1 "Line Number out of sequence. Expected: " +#define MSG_ERR_LINE_NO2 " Got: " #define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line: " #define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line: " #define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line: " diff --git a/Marlin/language.h b/Marlin/language.h index 3bc7ce0161..c9ddfeee41 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -122,7 +122,8 @@ #define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: " #define MSG_OK "ok" #define MSG_FILE_SAVED "Done saving file." -#define MSG_ERR_LINE_NO "Line Number is not Last Line Number+1, Last Line: " +#define MSG_ERR_LINE_NO1 "Line Number out of sequence. Expected: " +#define MSG_ERR_LINE_NO2 " Got: " #define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line: " #define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line: " #define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line: "