Commit 22f2ce3f authored by MagoKimbra's avatar MagoKimbra

Update

parent edcc4c13
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
* 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. * 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.
* M49 - Z probe repetability test * M49 - Z probe repetability test
* M80 - Turn on Power Supply * M80 - Turn on Power Supply
* M81 - Turn off Power Supply * M81 - Turn off Power, including Power Supply, if possible
* M82 - Set E codes absolute (default) * M82 - Set E codes absolute (default)
* M83 - Set E codes relative while in Absolute Coordinates (G90) mode * M83 - Set E codes relative while in Absolute Coordinates (G90) mode
* M84 - Disable steppers until next move, or use S[seconds] to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout. * M84 - Disable steppers until next move, or use S[seconds] to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout.
......
...@@ -159,6 +159,31 @@ ...@@ -159,6 +159,31 @@
#define CONDITIONALS_H #define CONDITIONALS_H
#ifndef AT90USB
#define HardwareSerial_h // trick to disable the standard HWserial
#endif
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "pins.h"
/**
* ENDSTOPPULLUPS
*/
#ifdef ENDSTOPPULLUPS
#define ENDSTOPPULLUP_XMAX
#define ENDSTOPPULLUP_YMAX
#define ENDSTOPPULLUP_ZMAX
#define ENDSTOPPULLUP_XMIN
#define ENDSTOPPULLUP_YMIN
#define ENDSTOPPULLUP_ZMIN
#define ENDSTOPPULLUP_EMIN
#endif
/** /**
* Firmware Test * Firmware Test
*/ */
...@@ -184,18 +209,6 @@ ...@@ -184,18 +209,6 @@
#define DRIVER_EXTRUDERS EXTRUDERS // This defines the number of Driver extruder #define DRIVER_EXTRUDERS EXTRUDERS // This defines the number of Driver extruder
#endif #endif
#ifndef AT90USB
#define HardwareSerial_h // trick to disable the standard HWserial
#endif
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "pins.h"
/** /**
* Axis lengths * Axis lengths
*/ */
...@@ -286,16 +299,14 @@ ...@@ -286,16 +299,14 @@
#ifndef POWER_SUPPLY #ifndef POWER_SUPPLY
#define POWER_SUPPLY 0 #define POWER_SUPPLY 0
#endif #endif
// 0 = Normal - 1 = ATX #if (POWER_SUPPLY == 1) // 1 = ATX
#if (POWER_SUPPLY <= 1)
#define PS_ON_AWAKE LOW #define PS_ON_AWAKE LOW
#define PS_ON_ASLEEP HIGH #define PS_ON_ASLEEP HIGH
#endif #elif (POWER_SUPPLY == 2) // 2 = X-Box 360 203W
// 2 = X-Box 360 203W
#if (POWER_SUPPLY == 2)
#define PS_ON_AWAKE HIGH #define PS_ON_AWAKE HIGH
#define PS_ON_ASLEEP LOW #define PS_ON_ASLEEP LOW
#endif #endif
#define HAS_POWER_SWITCH (POWER_SUPPLY > 0 && defined(PS_ON_PIN) && PS_ON_PIN >= 0)
/** /**
* Temp Sensor defines * Temp Sensor defines
......
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
// 10 is 100k RS thermistor 198-961 (4.7k pullup) // 10 is 100k RS thermistor 198-961 (4.7k pullup)
// 11 is 100k beta 3950 1% thermistor (4.7k pullup) // 11 is 100k beta 3950 1% thermistor (4.7k pullup)
// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" // 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
// 20 is the PT100 circuit found in the Ultimainboard V2.x // 20 is the PT100 circuit found in the Ultimainboard V2.x
// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
// //
...@@ -296,15 +296,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua ...@@ -296,15 +296,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua
The system will turn the heater on forever, burning up the filament and anything The system will turn the heater on forever, burning up the filament and anything
else around. else around.
After the temperature reaches the target for the first time, this feature will After the temperature reaches the target for the first time, this feature will
start measuring for how long the current temperature stays below the target start measuring for how long the current temperature stays below the target
minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS). minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS).
If it stays longer than _PERIOD, it means the thermistor temperature If it stays longer than _PERIOD, it means the thermistor temperature
cannot catch up with the target, so something *may be* wrong. Then, to be on the cannot catch up with the target, so something *may be* wrong. Then, to be on the
safe side, the system will he halt. safe side, the system will he halt.
Bear in mind the count down will just start AFTER the first time the Bear in mind the count down will just start AFTER the first time the
thermistor temperature is over the target, so you will have no problem if thermistor temperature is over the target, so you will have no problem if
your extruder heater takes 2 minutes to hit the target on heating. your extruder heater takes 2 minutes to hit the target on heating.
...@@ -582,7 +582,7 @@ your extruder heater takes 2 minutes to hit the target on heating. ...@@ -582,7 +582,7 @@ your extruder heater takes 2 minutes to hit the target on heating.
// Support for BlinkM/CyzRgb // Support for BlinkM/CyzRgb
//#define BLINKM //#define BLINKM
// Support for STEPPERS TOSHIBA // Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA //#define CONFIG_STEPPERS_TOSHIBA
// Setting firmware for filament end switch // Setting firmware for filament end switch
......
...@@ -274,7 +274,7 @@ void Config_RetrieveSettings() ...@@ -274,7 +274,7 @@ void Config_RetrieveSettings()
void Config_ResetDefault() void Config_ResetDefault()
{ {
//Setting default baudrate for serial //Setting default baudrate for serial
baudrate=BAUDRATE; baudrate = BAUDRATE;
float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT; float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT;
float tmp2[] = DEFAULT_MAX_FEEDRATE; float tmp2[] = DEFAULT_MAX_FEEDRATE;
...@@ -286,9 +286,9 @@ void Config_ResetDefault() ...@@ -286,9 +286,9 @@ void Config_ResetDefault()
float tmp7[] = DEFAULT_Kd; float tmp7[] = DEFAULT_Kd;
#endif // PIDTEMP #endif // PIDTEMP
#if defined(EXTRUDER_OFFSET_X) && defined(EXTRUDER_OFFSET_Y) #if defined(HOTEND_OFFSET_X) && defined(HOTEND_OFFSET_Y)
float tmp8[] = EXTRUDER_OFFSET_X; float tmp8[] = HOTEND_OFFSET_X;
float tmp9[] = EXTRUDER_OFFSET_Y; float tmp9[] = HOTEND_OFFSET_Y;
#else #else
float tmp8[] = {0,0,0,0}; float tmp8[] = {0,0,0,0};
float tmp9[] = {0,0,0,0}; float tmp9[] = {0,0,0,0};
...@@ -303,8 +303,8 @@ void Config_ResetDefault() ...@@ -303,8 +303,8 @@ void Config_ResetDefault()
for (int i = 0; i < EXTRUDERS; i++) { for (int i = 0; i < EXTRUDERS; i++) {
max_retraction_feedrate[i] = tmp3[i]; max_retraction_feedrate[i] = tmp3[i];
#if HOTENDS > 1 #if HOTENDS > 1
hotend_offset[i][X_AXIS] = tmp8[i]; hotend_offset[X_AXIS][i] = tmp8[i];
hotend_offset[i][Y_AXIS] = tmp9[i]; hotend_offset[Y_AXIS][i] = tmp9[i];
#endif #endif
#ifdef SCARA #ifdef SCARA
if (i < sizeof(axis_scaling) / sizeof(*axis_scaling)) if (i < sizeof(axis_scaling) / sizeof(*axis_scaling))
......
...@@ -19,17 +19,7 @@ ...@@ -19,17 +19,7 @@
// #define ENDSTOPPULLUP_EMIN // #define ENDSTOPPULLUP_EMIN
#endif #endif
#ifdef ENDSTOPPULLUPS // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
#define ENDSTOPPULLUP_XMAX
#define ENDSTOPPULLUP_YMAX
#define ENDSTOPPULLUP_ZMAX
#define ENDSTOPPULLUP_XMIN
#define ENDSTOPPULLUP_YMIN
#define ENDSTOPPULLUP_ZMIN
#define ENDSTOPPULLUP_EMIN
#endif
// The pullups are needed if you directly connect a mechanical end switch between the signal and ground pins.
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
...@@ -62,7 +52,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the log ...@@ -62,7 +52,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the log
#define DISABLE_E false // For all extruder #define DISABLE_E false // For all extruder
#define DISABLE_INACTIVE_EXTRUDER false //disable only inactive extruder and keep active extruder enabled #define DISABLE_INACTIVE_EXTRUDER false //disable only inactive extruder and keep active extruder enabled
// If you motor turns to wrong direction, you can invert it here: // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
#define INVERT_X_DIR false #define INVERT_X_DIR false
#define INVERT_Y_DIR false #define INVERT_Y_DIR false
#define INVERT_Z_DIR false #define INVERT_Z_DIR false
...@@ -71,7 +61,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the log ...@@ -71,7 +61,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the log
#define INVERT_E2_DIR false #define INVERT_E2_DIR false
#define INVERT_E3_DIR false #define INVERT_E3_DIR false
// Travel limits after homing // Travel limits after homing (units are in mm)
#define X_MAX_POS 200 #define X_MAX_POS 200
#define X_MIN_POS 0 #define X_MIN_POS 0
#define Y_MAX_POS 200 #define Y_MAX_POS 200
...@@ -143,8 +133,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the log ...@@ -143,8 +133,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the log
// Offsets to the probe relative to the extruder tip (Hotend - Probe) // Offsets to the probe relative to the extruder tip (Hotend - Probe)
// X and Y offsets MUST be INTEGERS // X and Y offsets MUST be INTEGERS
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // -left +right #define X_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // -front +behind #define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -front +behind
#define Z_PROBE_OFFSET_FROM_EXTRUDER -1 // -below (always!) #define Z_PROBE_OFFSET_FROM_EXTRUDER -1 // -below (always!)
#define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance. #define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance.
...@@ -152,6 +142,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the log ...@@ -152,6 +142,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the log
#define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before travelling to the first probing point. #define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before travelling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when travelling from between next probing points #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when travelling from between next probing points
#define Z_RAISE_AFTER_PROBING 5 //How much the extruder will be raised after the last probing point.
//#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell
//#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pick up the sled. 0 should be fine but you can push it further if you'd like. //#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pick up the sled. 0 should be fine but you can push it further if you'd like.
...@@ -170,9 +161,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the log ...@@ -170,9 +161,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the log
//#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)
//Manual homing switch locations: //Manual homing switch locations:
#define MANUAL_X_HOME_POS 0 #ifdef MANUAL_HOME_POSITIONS
#define MANUAL_Y_HOME_POS 0 #define MANUAL_X_HOME_POS 0
#define MANUAL_Z_HOME_POS 0 #define MANUAL_Y_HOME_POS 0
#define MANUAL_Z_HOME_POS 0
#endif
// MOVEMENT SETTINGS // MOVEMENT SETTINGS
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
...@@ -207,6 +200,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the log ...@@ -207,6 +200,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the log
//#define CUSTOM_M_CODES //#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES #ifdef CUSTOM_M_CODES
#define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851
#define Z_PROBE_OFFSET_RANGE_MIN -15 #define Z_PROBE_OFFSET_RANGE_MIN -20
#define Z_PROBE_OFFSET_RANGE_MAX -5 #define Z_PROBE_OFFSET_RANGE_MAX 20
#endif #endif
...@@ -19,24 +19,14 @@ ...@@ -19,24 +19,14 @@
// #define ENDSTOPPULLUP_EMIN // #define ENDSTOPPULLUP_EMIN
#endif #endif
#ifdef ENDSTOPPULLUPS // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
#define ENDSTOPPULLUP_XMAX const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
#define ENDSTOPPULLUP_YMAX const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
#define ENDSTOPPULLUP_ZMAX const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
#define ENDSTOPPULLUP_XMIN const bool E_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
#define ENDSTOPPULLUP_YMIN const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
#define ENDSTOPPULLUP_ZMIN const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
#define ENDSTOPPULLUP_EMIN const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
#endif
// The pullups are needed if you directly connect a mechanical end switch between the signal and ground pins.
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool E_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
// ENDSTOP SETTINGS: // ENDSTOP SETTINGS:
// Sets direction of endstop when homing; 1=MAX, -1=MIN // Sets direction of endstop when homing; 1=MAX, -1=MIN
...@@ -45,7 +35,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo ...@@ -45,7 +35,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define Z_HOME_DIR -1 #define Z_HOME_DIR -1
#define E_HOME_DIR -1 #define E_HOME_DIR -1
#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS. #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. #define max_software_endstops true // If true, axis won't move to coordinates greater than the defined lengths below.
...@@ -62,7 +52,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo ...@@ -62,7 +52,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define DISABLE_E false // For all extruder #define DISABLE_E false // For all extruder
#define DISABLE_INACTIVE_EXTRUDER false //disable only inactive extruder and keep active extruder enabled #define DISABLE_INACTIVE_EXTRUDER false //disable only inactive extruder and keep active extruder enabled
// If you motor turns to wrong direction, you can invert it here: // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
#define INVERT_X_DIR false #define INVERT_X_DIR false
#define INVERT_Y_DIR false #define INVERT_Y_DIR false
#define INVERT_Z_DIR false #define INVERT_Z_DIR false
...@@ -71,7 +61,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo ...@@ -71,7 +61,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define INVERT_E2_DIR false #define INVERT_E2_DIR false
#define INVERT_E3_DIR false #define INVERT_E3_DIR false
// Travel limits after homing // Travel limits after homing (units are in mm)
#define X_MAX_POS 200 #define X_MAX_POS 200
#define X_MIN_POS 0 #define X_MIN_POS 0
#define Y_MAX_POS 200 #define Y_MAX_POS 200
...@@ -80,10 +70,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo ...@@ -80,10 +70,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define Z_MIN_POS 0 #define Z_MIN_POS 0
#define E_MIN_POS 0 #define E_MIN_POS 0
#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
//===================================================================================== //=====================================================================================
//============================= Bed Manual or Auto Leveling =========================== //============================= Bed Manual or Auto Leveling ===========================
//===================================================================================== //=====================================================================================
...@@ -147,15 +133,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo ...@@ -147,15 +133,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
// Offsets to the probe relative to the extruder tip (Hotend - Probe) // Offsets to the probe relative to the extruder tip (Hotend - Probe)
// X and Y offsets must be integers // X and Y offsets must be integers
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // -left +right #define X_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // -front +behind #define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -front +behind
#define Z_PROBE_OFFSET_FROM_EXTRUDER -1 // -below (always!) #define Z_PROBE_OFFSET_FROM_EXTRUDER -1 // -below (always!)
#define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance. #define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance.
// Be sure you have this distance over your Z_MAX_POS in case // Be sure you have this distance over your Z_MAX_POS in case
#define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before travelling to the first probing point. #define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before travelling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when travelling from between next probing points #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when travelling from between next probing points
#define Z_RAISE_AFTER_PROBING 5 //How much the extruder will be raised after the last probing point.
//#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell
//#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pick up the sled. 0 should be fine but you can push it further if you'd like. //#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pick up the sled. 0 should be fine but you can push it further if you'd like.
...@@ -174,9 +161,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo ...@@ -174,9 +161,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
//#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0) //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)
//Manual homing switch locations: //Manual homing switch locations:
#define MANUAL_X_HOME_POS 0 #ifdef MANUAL_HOME_POSITIONS
#define MANUAL_Y_HOME_POS 0 #define MANUAL_X_HOME_POS 0
#define MANUAL_Z_HOME_POS 0 #define MANUAL_Y_HOME_POS 0
#define MANUAL_Z_HOME_POS 0
#endif
// MOVEMENT SETTINGS // MOVEMENT SETTINGS
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
...@@ -211,6 +200,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo ...@@ -211,6 +200,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
//#define CUSTOM_M_CODES //#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES #ifdef CUSTOM_M_CODES
#define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851
#define Z_PROBE_OFFSET_RANGE_MIN -15 #define Z_PROBE_OFFSET_RANGE_MIN -20
#define Z_PROBE_OFFSET_RANGE_MAX -5 #define Z_PROBE_OFFSET_RANGE_MAX 20
#endif #endif
...@@ -43,17 +43,7 @@ ...@@ -43,17 +43,7 @@
// #define ENDSTOPPULLUP_ZMIN // #define ENDSTOPPULLUP_ZMIN
#endif #endif
#ifdef ENDSTOPPULLUPS // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
#define ENDSTOPPULLUP_XMAX
#define ENDSTOPPULLUP_YMAX
#define ENDSTOPPULLUP_ZMAX
#define ENDSTOPPULLUP_XMIN
#define ENDSTOPPULLUP_YMIN
#define ENDSTOPPULLUP_ZMIN
#define ENDSTOPPULLUP_EMIN
#endif
// The pullups are needed if you directly connect a mechanical end switch between the signal and ground pins.
const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
...@@ -86,7 +76,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the log ...@@ -86,7 +76,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the log
#define DISABLE_E false // For all extruder #define DISABLE_E false // For all extruder
#define DISABLE_INACTIVE_EXTRUDER false //disable only inactive extruder and keep active extruder enabled #define DISABLE_INACTIVE_EXTRUDER false //disable only inactive extruder and keep active extruder enabled
// If you motor turns to wrong direction, you can invert it here: // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
#define INVERT_X_DIR false #define INVERT_X_DIR false
#define INVERT_Y_DIR false #define INVERT_Y_DIR false
#define INVERT_Z_DIR true #define INVERT_Z_DIR true
...@@ -95,7 +85,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the log ...@@ -95,7 +85,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the log
#define INVERT_E2_DIR false #define INVERT_E2_DIR false
#define INVERT_E3_DIR false #define INVERT_E3_DIR false
// Travel limits after homing // Travel limits after homing (units are in mm)
#define X_MAX_POS 200 #define X_MAX_POS 200
#define X_MIN_POS 0 #define X_MIN_POS 0
#define Y_MAX_POS 200 #define Y_MAX_POS 200
...@@ -104,10 +94,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the log ...@@ -104,10 +94,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the log
#define Z_MIN_POS MANUAL_Z_HOME_POS #define Z_MIN_POS MANUAL_Z_HOME_POS
#define E_MIN_POS 0 #define E_MIN_POS 0
#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
//===================================================================================== //=====================================================================================
//============================= Bed Manual or Auto Leveling =========================== //============================= Bed Manual or Auto Leveling ===========================
//===================================================================================== //=====================================================================================
...@@ -118,7 +104,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the log ...@@ -118,7 +104,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the log
#define FRONT_PROBE_BED_POSITION 20 #define FRONT_PROBE_BED_POSITION 20
#define BACK_PROBE_BED_POSITION 180 #define BACK_PROBE_BED_POSITION 180
#define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min #define XY_TRAVEL_SPEED 10000 // X and Y axis travel speed between probes, in mm/min
//If you have enabled the Auto Bed Levelling and are using the same Z Probe for Z Homing, //If you have enabled the Auto Bed Levelling and are using the same Z Probe for Z Homing,
//it is highly recommended you let this Z_SAFE_HOMING enabled!!! //it is highly recommended you let this Z_SAFE_HOMING enabled!!!
...@@ -171,15 +157,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the log ...@@ -171,15 +157,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the log
// Offsets to the probe relative to the extruder tip (Hotend - Probe) // Offsets to the probe relative to the extruder tip (Hotend - Probe)
// X and Y offsets must be integers // X and Y offsets must be integers
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // -left +right #define X_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // -front +behind #define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -front +behind
#define Z_PROBE_OFFSET_FROM_EXTRUDER -1 // -below (always!) #define Z_PROBE_OFFSET_FROM_EXTRUDER -1 // -below (always!)
#define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance. #define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance.
// Be sure you have this distance over your Z_MAX_POS in case // Be sure you have this distance over your Z_MAX_POS in case
#define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before travelling to the first probing point. #define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before travelling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when travelling from between next probing points #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when travelling from between next probing points
#define Z_RAISE_AFTER_PROBING 5 //How much the extruder will be raised after the last probing point.
//#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell
//#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pick up the sled. 0 should be fine but you can push it further if you'd like. //#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pick up the sled. 0 should be fine but you can push it further if you'd like.
...@@ -194,14 +181,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the log ...@@ -194,14 +181,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the log
// The position of the homing switches // The position of the homing switches
//#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used #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) //#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)
//Manual homing switch locations: //Manual homing switch locations:
// For SCARA: Offset between HomingPosition and Bed X=0 / Y=0 // For SCARA: Offset between HomingPosition and Bed X=0 / Y=0
#ifdef MANUAL_HOME_POSITIONS
#define MANUAL_X_HOME_POS -22 #define MANUAL_X_HOME_POS -22
#define MANUAL_Y_HOME_POS -52 #define MANUAL_Y_HOME_POS -52
#define MANUAL_Z_HOME_POS 0.1 // Distance between nozzle and print surface after homing. #define MANUAL_Z_HOME_POS 0.1 // Distance between nozzle and print surface after homing.
#endif
// MOVEMENT SETTINGS // MOVEMENT SETTINGS
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
...@@ -236,6 +225,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the log ...@@ -236,6 +225,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the log
//#define CUSTOM_M_CODES //#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES #ifdef CUSTOM_M_CODES
#define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851
#define Z_PROBE_OFFSET_RANGE_MIN -15 #define Z_PROBE_OFFSET_RANGE_MIN -20
#define Z_PROBE_OFFSET_RANGE_MAX -5 #define Z_PROBE_OFFSET_RANGE_MAX 20
#endif #endif
...@@ -115,28 +115,27 @@ ...@@ -115,28 +115,27 @@
#ifdef Z_DUAL_STEPPER_DRIVERS #ifdef Z_DUAL_STEPPER_DRIVERS
// Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper. // Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper.
// That way the machine is capable to align the bed during home, since both Z steppers are homed. // That way the machine is capable to align the bed during home, since both Z steppers are homed.
// There is also an implementation of M666 (software endstops adjustment) to this feature. // There is also an implementation of M666 (software endstops adjustment) to this feature.
// After Z homing, this adjustment is applied to just one of the steppers in order to align the bed. // After Z homing, this adjustment is applied to just one of the steppers in order to align the bed.
// One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2. // One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2.
// If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive. // If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive.
// Play a little bit with small adjustments (0.5mm) and check the behaviour. // Play a little bit with small adjustments (0.5mm) and check the behaviour.
// The M119 (endstops report) will start reporting the Z2 Endstop as well. // The M119 (endstops report) will start reporting the Z2 Endstop as well.
#define Z_DUAL_ENDSTOPS #define Z_DUAL_ENDSTOPS
#ifdef Z_DUAL_ENDSTOPS #ifdef Z_DUAL_ENDSTOPS
#define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis. #define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis.
#define Z2_DIR_PIN E2_DIR_PIN #define Z2_DIR_PIN E2_DIR_PIN
#define Z2_ENABLE_PIN E2_ENABLE_PIN #define Z2_ENABLE_PIN E2_ENABLE_PIN
#define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36)
const bool Z2_MAX_ENDSTOP_INVERTING = false; const bool Z2_MAX_ENDSTOP_INVERTING = false;
#define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis.
#endif #endif
#endif // Z_DUAL_STEPPER_DRIVERS
#endif
// Same again but for Y Axis. // Same again but for Y Axis.
//#define Y_DUAL_STEPPER_DRIVERS //#define Y_DUAL_STEPPER_DRIVERS
...@@ -248,34 +247,44 @@ ...@@ -248,34 +247,44 @@
//=========================================================================== //===========================================================================
#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly #define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly
#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiple the steps moved by ten to quickly advance the value #define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value
#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiple the steps moved by 100 to really quickly advance the value #define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value
//#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value
//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers? #ifdef SDSUPPORT
#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted
#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT
// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. // in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should
// using: // be commented out otherwise
//#define MENU_ADDAUTOSTART #define SDCARDDETECTINVERTED
//========================= LCD PROGRESS BAR ====================== #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers?
// Show a progress bar on HD44780 LCDs for SD printing #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
//#define LCD_PROGRESS_BAR
#ifdef LCD_PROGRESS_BAR #define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order.
// Amount of time (ms) to show the bar // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that.
#define PROGRESS_BAR_BAR_TIME 2000 // using:
// Amount of time (ms) to show the status message //#define MENU_ADDAUTOSTART
#define PROGRESS_BAR_MSG_TIME 3000
// Amount of time (ms) to retain the status message (0=forever) // Show a progress bar on HD44780 LCDs for SD printing
#define PROGRESS_MSG_EXPIRE 0 //#define LCD_PROGRESS_BAR
// Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE #ifdef LCD_PROGRESS_BAR
#endif // Amount of time (ms) to show the bar
#define PROGRESS_BAR_BAR_TIME 5000
// Amount of time (ms) to show the status message
#define PROGRESS_BAR_MSG_TIME 1500
// Amount of time (ms) to retain the status message (0=forever)
#define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE
#endif
#endif // SDSUPPORT
// The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation. // The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
//#define USE_WATCHDOG //#define USE_WATCHDOG
...@@ -321,12 +330,6 @@ ...@@ -321,12 +330,6 @@
const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted
// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT
// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should
// be commented out otherwise
#define SDCARDDETECTINVERTED
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.
//#define HEATERS_PARALLEL //#define HEATERS_PARALLEL
......
...@@ -257,7 +257,7 @@ extern float home_offset[3]; ...@@ -257,7 +257,7 @@ extern float home_offset[3];
#else #else
#define NUM_HOTEND_OFFSETS 3 // supports offsets in XYZ plane #define NUM_HOTEND_OFFSETS 3 // supports offsets in XYZ plane
#endif #endif
extern float hotend_offset[HOTENDS][NUM_HOTEND_OFFSETS]; extern float hotend_offset[NUM_HOTEND_OFFSETS][HOTENDS];
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#ifdef NPR2 #ifdef NPR2
......
...@@ -110,7 +110,7 @@ M32 - Select file and start SD print (Can be used _while_ printing from SD card ...@@ -110,7 +110,7 @@ M32 - Select file and start SD print (Can be used _while_ printing from SD card
M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used. 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.
M49 - Z probe repetability test M49 - Z probe repetability test
M80 - Turn on Power Supply M80 - Turn on Power Supply
M81 - Turn off Power Supply M81 - Turn off Power, including Power Supply, if possible
M82 - Set E codes absolute (default) M82 - Set E codes absolute (default)
M83 - Set E codes relative while in Absolute Coordinates (G90) mode M83 - Set E codes relative while in Absolute Coordinates (G90) mode
M84 - Disable steppers until next move, M84 - Disable steppers until next move,
...@@ -172,7 +172,7 @@ M406 - Turn off Filament Sensor extrusion control ...@@ -172,7 +172,7 @@ M406 - Turn off Filament Sensor extrusion control
M407 - Displays measured filament diameter M407 - Displays measured filament diameter
M500 - Store parameters in EEPROM M500 - Store parameters in EEPROM
M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily). 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. M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
M503 - Print the current settings (from memory not from EEPROM). Use S0 to leave off headings. M503 - Print the current settings (from memory not from EEPROM). Use S0 to leave off headings.
M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
...@@ -264,21 +264,14 @@ float zprobe_zoffset; ...@@ -264,21 +264,14 @@ float zprobe_zoffset;
float lastpos[4]; float lastpos[4];
// Hotend offset // Hotend offset
#if HOTENDS > 1 #if HOTENDS > 1
#ifndef HOTEND_OFFSET_X
#define HOTEND_OFFSET_X 0
#endif
#ifndef HOTEND_OFFSET_Y
#define HOTEND_OFFSET_Y 0
#endif
#ifndef DUAL_X_CARRIAGE #ifndef DUAL_X_CARRIAGE
#define NUM_HOTENDS_OFFSETS 2 // only in XY plane #define NUM_HOTEND_OFFSETS 2 // only in XY plane
#else #else
#define NUM_HOTENDS_OFFSETS 3 // supports offsets in XYZ plane #define NUM_HOTEND_OFFSETS 3 // supports offsets in XYZ plane
#endif #endif
#define _EXY { HOTEND_OFFSET_X, HOTEND_OFFSET_Y } float hotend_offset[NUM_HOTEND_OFFSETS][HOTENDS];
float hotend_offset[HOTENDS][NUM_HOTENDS_OFFSETS] = ARRAY_BY_EXTRUDERS(_EXY, _EXY, _EXY, _EXY); #endif // HOTENDS > 1
#endif //HOTENDS > 1
uint8_t active_extruder = 0; uint8_t active_extruder = 0;
uint8_t active_driver = 0; uint8_t active_driver = 0;
...@@ -321,13 +314,13 @@ uint8_t debugLevel = 0; ...@@ -321,13 +314,13 @@ uint8_t debugLevel = 0;
float retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE; float retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
#endif //FWRETRACT #endif //FWRETRACT
#ifdef ULTIPANEL #if defined(ULTIPANEL) && HAS_POWER_SWITCH
#ifdef PS_DEFAULT_OFF #ifdef PS_DEFAULT_OFF
bool powersupply = false; bool powersupply = false;
#else #else
bool powersupply = true; bool powersupply = true;
#endif #endif
#endif //ULTIPANEL #endif //ULTIPANEL && HAS_POWER_SWITCH
#ifdef SCARA #ifdef SCARA
float axis_scaling[3] = { 1, 1, 1 }; // Build size scaling, default to 1 float axis_scaling[3] = { 1, 1, 1 }; // Build size scaling, default to 1
...@@ -623,7 +616,7 @@ void setup_powerhold() ...@@ -623,7 +616,7 @@ void setup_powerhold()
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1 #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
OUT_WRITE(SUICIDE_PIN, HIGH); OUT_WRITE(SUICIDE_PIN, HIGH);
#endif #endif
#if defined(PS_ON_PIN) && PS_ON_PIN > -1 #if HAS_POWER_SWITCH
#if defined(PS_DEFAULT_OFF) #if defined(PS_DEFAULT_OFF)
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP); OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#else #else
...@@ -940,10 +933,10 @@ void get_command() ...@@ -940,10 +933,10 @@ void get_command()
int hours, minutes; int hours, minutes;
minutes=(t/60)%60; minutes=(t/60)%60;
hours=t/60/60; hours=t/60/60;
sprintf_P(time, PSTR("%i hours %i minutes"),hours, minutes); sprintf_P(time, PSTR("%i "MSG_END_HOUR" %i "MSG_END_MINUTE),hours, minutes);
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLN(time); SERIAL_ECHOLN(time);
lcd_setstatus(time); lcd_setstatus(time, true);
card.printingHasFinished(); card.printingHasFinished();
card.checkautostart(true); card.checkautostart(true);
...@@ -1034,7 +1027,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR); ...@@ -1034,7 +1027,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
// second X-carriage offset when homed - otherwise X2_HOME_POS is used. // second X-carriage offset when homed - otherwise X2_HOME_POS is used.
// This allow soft recalibration of the second extruder offset position without firmware reflash // This allow soft recalibration of the second extruder offset position without firmware reflash
// (through the M218 command). // (through the M218 command).
return (hotend_offset[1][X_AXIS] > 0) ? hotend_offset[1][X_AXIS] : X2_HOME_POS; return (hotend_offset[X_AXIS][1] > 0) ? hotend_offset[X_AXIS][1] : X2_HOME_POS;
} }
static int x_home_dir(int extruder) { static int x_home_dir(int extruder) {
...@@ -1051,26 +1044,36 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR); ...@@ -1051,26 +1044,36 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
#endif //DUAL_X_CARRIAGE #endif //DUAL_X_CARRIAGE
// Shorthand to tell the planner our current position (in mm). // Some planner shorthand inline functions
inline void line_to_current_position() {
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder, active_driver);
}
inline void line_to_z(float zPosition) {
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder, active_driver);
}
inline void line_to_destination() {
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver);
}
inline void sync_plan_position() { inline void sync_plan_position() {
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
} }
#if defined(CARTESIAN) || defined(COREXY) || defined(SCARA) #if defined(CARTESIAN) || defined(COREXY) || defined(SCARA)
static void axis_is_at_home(int axis) { static void axis_is_at_home(int axis) {
#ifdef DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE
if (axis == X_AXIS) { if (axis == X_AXIS) {
if (active_extruder != 0) { if (active_extruder != 0) {
current_position[X_AXIS] = x_home_pos(active_extruder); current_position[X_AXIS] = x_home_pos(active_extruder);
min_pos[X_AXIS] = X2_MIN_POS; min_pos[X_AXIS] = X2_MIN_POS;
max_pos[X_AXIS] = max(hotend_offset[1][X_AXIS], X2_MAX_POS); max_pos[X_AXIS] = max(hotend_offset[X_AXIS][1], X2_MAX_POS);
return; return;
} }
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) { else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
current_position[X_AXIS] = base_home_pos(X_AXIS) + home_offset[X_AXIS]; float xoff = home_offset[X_AXIS];
min_pos[X_AXIS] = base_min_pos(X_AXIS) + home_offset[X_AXIS]; current_position[X_AXIS] = base_home_pos(X_AXIS) + xoff;
max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + home_offset[X_AXIS], min_pos[X_AXIS] = base_min_pos(X_AXIS) + xoff;
max(hotend_offset[1][X_AXIS], X2_MAX_POS) - duplicate_extruder_x_offset); max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + xoff, max(hotend_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
return; return;
} }
} }
...@@ -1127,14 +1130,14 @@ inline void sync_plan_position() { ...@@ -1127,14 +1130,14 @@ inline void sync_plan_position() {
feedrate = homing_feedrate[Z_AXIS]; feedrate = homing_feedrate[Z_AXIS];
current_position[Z_AXIS] = z; current_position[Z_AXIS] = z;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_current_position();
st_synchronize(); st_synchronize();
feedrate = xy_travel_speed; feedrate = xy_travel_speed;
current_position[X_AXIS] = x; current_position[X_AXIS] = x;
current_position[Y_AXIS] = y; current_position[Y_AXIS] = y;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_current_position();
st_synchronize(); st_synchronize();
feedrate = oldFeedRate; feedrate = oldFeedRate;
...@@ -1156,12 +1159,13 @@ inline void sync_plan_position() { ...@@ -1156,12 +1159,13 @@ inline void sync_plan_position() {
//corrected_position.debug("position after"); //corrected_position.debug("position after");
current_position[X_AXIS] = corrected_position.x; current_position[X_AXIS] = corrected_position.x;
current_position[Y_AXIS] = corrected_position.y; current_position[Y_AXIS] = corrected_position.y;
current_position[Z_AXIS] = zprobe_zoffset; // was: corrected_position.z current_position[Z_AXIS] = corrected_position.z;
sync_plan_position(); sync_plan_position();
} }
#else // not AUTO_BED_LEVELING_GRID #else // not AUTO_BED_LEVELING_GRID
static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) { static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) {
plan_bed_level_matrix.set_to_identity(); plan_bed_level_matrix.set_to_identity();
vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1); vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1);
...@@ -1180,7 +1184,7 @@ inline void sync_plan_position() { ...@@ -1180,7 +1184,7 @@ inline void sync_plan_position() {
vector_3 corrected_position = plan_get_position(); vector_3 corrected_position = plan_get_position();
current_position[X_AXIS] = corrected_position.x; current_position[X_AXIS] = corrected_position.x;
current_position[Y_AXIS] = corrected_position.y; current_position[Y_AXIS] = corrected_position.y;
current_position[Z_AXIS] = zprobe_zoffset; // was: corrected_position.z current_position[Z_AXIS] = corrected_position.z;
sync_plan_position(); sync_plan_position();
} }
...@@ -1188,12 +1192,13 @@ inline void sync_plan_position() { ...@@ -1188,12 +1192,13 @@ inline void sync_plan_position() {
#endif // AUTO_BED_LEVELING_GRID #endif // AUTO_BED_LEVELING_GRID
static void run_z_probe() { static void run_z_probe() {
plan_bed_level_matrix.set_to_identity(); plan_bed_level_matrix.set_to_identity();
feedrate = homing_feedrate[Z_AXIS]; feedrate = homing_feedrate[Z_AXIS];
// move down until you find the bed // move down until you find the bed
float zPosition = -10; float zPosition = -10;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_z(zPosition);
st_synchronize(); st_synchronize();
// we have to let the planner know where we are right now as it is not where we said to go. // we have to let the planner know where we are right now as it is not where we said to go.
...@@ -1202,7 +1207,7 @@ inline void sync_plan_position() { ...@@ -1202,7 +1207,7 @@ inline void sync_plan_position() {
// move up the retract distance // move up the retract distance
zPosition += home_retract_mm(Z_AXIS); zPosition += home_retract_mm(Z_AXIS);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_z(zPosition);
st_synchronize(); st_synchronize();
endstops_hit_on_purpose(); endstops_hit_on_purpose();
...@@ -1216,7 +1221,7 @@ inline void sync_plan_position() { ...@@ -1216,7 +1221,7 @@ inline void sync_plan_position() {
} }
zPosition -= home_retract_mm(Z_AXIS) * 2; zPosition -= home_retract_mm(Z_AXIS) * 2;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_z(zPosition);
st_synchronize(); st_synchronize();
endstops_hit_on_purpose(); endstops_hit_on_purpose();
...@@ -1247,13 +1252,16 @@ inline void sync_plan_position() { ...@@ -1247,13 +1252,16 @@ inline void sync_plan_position() {
} }
static void engage_z_probe() { static void engage_z_probe() {
// Engage Z Servo endstop if enabled
#if NUM_SERVOS > 0 #if NUM_SERVOS > 0
if (servo_endstops[Z_AXIS] > -1) { // Engage Z Servo endstop if enabled
if (servo_endstops[Z_AXIS] >= 0) {
#if SERVO_LEVELING #if SERVO_LEVELING
servos[servo_endstops[Z_AXIS]].attach(0); servos[servo_endstops[Z_AXIS]].attach(0);
#endif #endif
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2]); servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2]);
#if SERVO_LEVELING #if SERVO_LEVELING
delay(PROBE_SERVO_DEACTIVATION_DELAY); delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach(); servos[servo_endstops[Z_AXIS]].detach();
...@@ -1263,13 +1271,21 @@ inline void sync_plan_position() { ...@@ -1263,13 +1271,21 @@ inline void sync_plan_position() {
} }
static void retract_z_probe() { static void retract_z_probe() {
// Retract Z Servo endstop if enabled
#if NUM_SERVOS > 0 #if NUM_SERVOS > 0
if (servo_endstops[Z_AXIS] > -1) { // Retract Z Servo endstop if enabled
if (servo_endstops[Z_AXIS] >= 0) {
#if Z_RAISE_AFTER_PROBING > 0
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_AFTER_PROBING);
st_synchronize();
#endif
#if SERVO_LEVELING #if SERVO_LEVELING
servos[servo_endstops[Z_AXIS]].attach(0); servos[servo_endstops[Z_AXIS]].attach(0);
#endif #endif
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]); servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]);
#if SERVO_LEVELING #if SERVO_LEVELING
delay(PROBE_SERVO_DEACTIVATION_DELAY); delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach(); servos[servo_endstops[Z_AXIS]].detach();
...@@ -1298,18 +1314,25 @@ inline void sync_plan_position() { ...@@ -1298,18 +1314,25 @@ inline void sync_plan_position() {
run_z_probe(); run_z_probe();
float measured_z = current_position[Z_AXIS]; float measured_z = current_position[Z_AXIS];
#if Z_RAISE_BETWEEN_PROBINGS > 0
if (retract_action == ProbeStay) {
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_BETWEEN_PROBINGS);
st_synchronize();
}
#endif
#ifndef Z_PROBE_SLED #ifndef Z_PROBE_SLED
if (retract_action & ProbeRetract) retract_z_probe(); if (retract_action & ProbeRetract) retract_z_probe();
#endif // Z_PROBE_SLED #endif
if (verbose_level > 2) { if (verbose_level > 2) {
SERIAL_PROTOCOLPGM(MSG_BED); SERIAL_PROTOCOLPGM(MSG_BED);
SERIAL_PROTOCOLPGM(" X: "); SERIAL_PROTOCOLPGM(" X: ");
SERIAL_PROTOCOL(x + 0.0001); SERIAL_PROTOCOL_F(x, 3);
SERIAL_PROTOCOLPGM(" Y: "); SERIAL_PROTOCOLPGM(" Y: ");
SERIAL_PROTOCOL(y + 0.0001); SERIAL_PROTOCOL_F(y, 3);
SERIAL_PROTOCOLPGM(" Z: "); SERIAL_PROTOCOLPGM(" Z: ");
SERIAL_PROTOCOL(measured_z + 0.0001); SERIAL_PROTOCOL_F(measured_z, 3);
SERIAL_EOL; SERIAL_EOL;
} }
return measured_z; return measured_z;
...@@ -1351,13 +1374,13 @@ inline void sync_plan_position() { ...@@ -1351,13 +1374,13 @@ inline void sync_plan_position() {
#endif #endif
destination[axis] = 1.5 * max_length(axis) * axis_home_dir; destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
feedrate = homing_feedrate[axis]; feedrate = homing_feedrate[axis];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_destination();
st_synchronize(); st_synchronize();
current_position[axis] = 0; current_position[axis] = 0;
sync_plan_position(); sync_plan_position();
destination[axis] = -home_retract_mm(axis) * axis_home_dir; destination[axis] = -home_retract_mm(axis) * axis_home_dir;
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_destination();
st_synchronize(); st_synchronize();
destination[axis] = 2*home_retract_mm(axis) * axis_home_dir; destination[axis] = 2*home_retract_mm(axis) * axis_home_dir;
...@@ -1370,7 +1393,7 @@ inline void sync_plan_position() { ...@@ -1370,7 +1393,7 @@ inline void sync_plan_position() {
SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less then 1"); SERIAL_ECHOLN("Warning: The Homing Bump Feedrate Divisor cannot be less then 1");
} }
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_destination();
st_synchronize(); st_synchronize();
#ifdef Z_DUAL_ENDSTOPS #ifdef Z_DUAL_ENDSTOPS
if (axis==Z_AXIS) { if (axis==Z_AXIS) {
...@@ -1383,7 +1406,7 @@ inline void sync_plan_position() { ...@@ -1383,7 +1406,7 @@ inline void sync_plan_position() {
destination[axis] = fabs(z_endstop_adj); destination[axis] = fabs(z_endstop_adj);
if (z_endstop_adj < 0) Lock_z_motor(true); else Lock_z2_motor(true); if (z_endstop_adj < 0) Lock_z_motor(true); else Lock_z2_motor(true);
} }
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_destination();
st_synchronize(); st_synchronize();
Lock_z_motor(false); Lock_z_motor(false);
Lock_z2_motor(false); Lock_z2_motor(false);
...@@ -1435,20 +1458,20 @@ inline void sync_plan_position() { ...@@ -1435,20 +1458,20 @@ inline void sync_plan_position() {
sync_plan_position(); sync_plan_position();
destination[axis] = 1.5 * max_length[axis] * axis_home_dir; destination[axis] = 1.5 * max_length[axis] * axis_home_dir;
feedrate = homing_feedrate[axis]; feedrate = homing_feedrate[axis];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_destination();
st_synchronize(); st_synchronize();
enable_endstops(false); // Ignore Z probe while moving away from the top microswitch. enable_endstops(false); // Ignore Z probe while moving away from the top microswitch.
current_position[axis] = 0; current_position[axis] = 0;
sync_plan_position(); sync_plan_position();
destination[axis] = -home_retract_mm(axis) * axis_home_dir; destination[axis] = -home_retract_mm(axis) * axis_home_dir;
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_destination();
st_synchronize(); st_synchronize();
enable_endstops(true); // Stop ignoring Z probe while moving up to the top microswitch again. enable_endstops(true); // Stop ignoring Z probe while moving up to the top microswitch again.
destination[axis] = 2 * home_retract_mm(axis) * axis_home_dir; destination[axis] = 2 * home_retract_mm(axis) * axis_home_dir;
feedrate = homing_feedrate[axis]/10 ; feedrate = homing_feedrate[axis]/10 ;
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_destination();
st_synchronize(); st_synchronize();
// retrace by the amount specified in endstop_adj // retrace by the amount specified in endstop_adj
...@@ -1457,7 +1480,7 @@ inline void sync_plan_position() { ...@@ -1457,7 +1480,7 @@ inline void sync_plan_position() {
enable_endstops(false); // Ignore Z probe while moving away from the top microswitch. enable_endstops(false); // Ignore Z probe while moving away from the top microswitch.
sync_plan_position(); sync_plan_position();
destination[axis] = endstop_adj[axis]; destination[axis] = endstop_adj[axis];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_destination();
st_synchronize(); st_synchronize();
enable_endstops(true); // Stop ignoring Z probe while moving up to the top microswitch again. enable_endstops(true); // Stop ignoring Z probe while moving up to the top microswitch again.
} }
...@@ -1817,7 +1840,7 @@ inline void sync_plan_position() { ...@@ -1817,7 +1840,7 @@ inline void sync_plan_position() {
destination[Y_AXIS] = 3 * max_length[Z_AXIS]; destination[Y_AXIS] = 3 * max_length[Z_AXIS];
destination[Z_AXIS] = 3 * max_length[Z_AXIS]; destination[Z_AXIS] = 3 * max_length[Z_AXIS];
feedrate = 1.732 * homing_feedrate[X_AXIS]; feedrate = 1.732 * homing_feedrate[X_AXIS];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_destination();
st_synchronize(); st_synchronize();
endstops_hit_on_purpose(); endstops_hit_on_purpose();
...@@ -2279,7 +2302,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) { ...@@ -2279,7 +2302,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
for (int i = X_AXIS; i <= Z_AXIS; i++) destination[i] = 3 * Z_MAX_LENGTH; for (int i = X_AXIS; i <= Z_AXIS; i++) destination[i] = 3 * Z_MAX_LENGTH;
feedrate = 1.732 * homing_feedrate[X_AXIS]; feedrate = 1.732 * homing_feedrate[X_AXIS];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_destination();
st_synchronize(); st_synchronize();
endstops_hit_on_purpose(); endstops_hit_on_purpose();
...@@ -2329,7 +2352,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) { ...@@ -2329,7 +2352,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
else { else {
feedrate *= sqrt(pow(max_length(X_AXIS) / max_length(Y_AXIS), 2) + 1); feedrate *= sqrt(pow(max_length(X_AXIS) / max_length(Y_AXIS), 2) + 1);
} }
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_destination();
st_synchronize(); st_synchronize();
axis_is_at_home(X_AXIS); axis_is_at_home(X_AXIS);
...@@ -2337,7 +2360,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) { ...@@ -2337,7 +2360,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
sync_plan_position(); sync_plan_position();
destination[X_AXIS] = current_position[X_AXIS]; destination[X_AXIS] = current_position[X_AXIS];
destination[Y_AXIS] = current_position[Y_AXIS]; destination[Y_AXIS] = current_position[Y_AXIS];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_destination();
feedrate = 0.0; feedrate = 0.0;
st_synchronize(); st_synchronize();
endstops_hit_on_purpose(); endstops_hit_on_purpose();
...@@ -2596,6 +2619,15 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) { ...@@ -2596,6 +2619,15 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
#ifdef ENABLE_AUTO_BED_LEVELING #ifdef ENABLE_AUTO_BED_LEVELING
// Check for known positions in X and Y
inline bool can_run_bed_leveling() {
if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) return true;
LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN);
return false;
}
/** /**
* G29: Detailed Z-Probe, probes the bed at 3 or more points. * G29: Detailed Z-Probe, probes the bed at 3 or more points.
* Will fail if the printer has not been homed with G28. * Will fail if the printer has not been homed with G28.
...@@ -2634,13 +2666,8 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) { ...@@ -2634,13 +2666,8 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
*/ */
inline void gcode_G29() { inline void gcode_G29() {
// Prevent user from running a G29 without first homing in X and Y // Prevent leveling without first homing in X and Y
if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) { if (!can_run_bed_leveling()) return;
LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN);
return;
}
int verbose_level = 1; int verbose_level = 1;
...@@ -2715,10 +2742,11 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) { ...@@ -2715,10 +2742,11 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
st_synchronize(); st_synchronize();
if (!dryrun) { if (!dryrun) {
// make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly // make sure the bed_level_rotation_matrix is identity or the planner will get it wrong
plan_bed_level_matrix.set_to_identity();
//vector_3 corrected_position = plan_get_position_mm(); //vector_3 corrected_position = plan_get_position_mm();
//corrected_position.debug("position before G29"); //corrected_position.debug("position before G29");
plan_bed_level_matrix.set_to_identity();
vector_3 uncorrected_position = plan_get_position(); vector_3 uncorrected_position = plan_get_position();
// uncorrected_position.debug("position during G29"); // uncorrected_position.debug("position during G29");
...@@ -2778,7 +2806,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) { ...@@ -2778,7 +2806,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
// raise extruder // raise extruder
float measured_z, float measured_z,
z_before = probePointCounter == 0 ? Z_RAISE_BEFORE_PROBING : current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS; z_before = Z_RAISE_BETWEEN_PROBINGS + (probePointCounter ? current_position[Z_AXIS] : 0);
// Enhanced G29 - Do not retract servo between probes // Enhanced G29 - Do not retract servo between probes
ProbeAction act; ProbeAction act;
...@@ -2801,6 +2829,11 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) { ...@@ -2801,6 +2829,11 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
eqnAMatrix[probePointCounter + 2 * abl2] = 1; eqnAMatrix[probePointCounter + 2 * abl2] = 1;
probePointCounter++; probePointCounter++;
manage_heater();
manage_inactivity();
lcd_update();
} //xProbe } //xProbe
} //yProbe } //yProbe
...@@ -3484,9 +3517,13 @@ inline void gcode_G92() { ...@@ -3484,9 +3517,13 @@ inline void gcode_G92() {
if (starpos != NULL) *(starpos) = '\0'; if (starpos != NULL) *(starpos) = '\0';
while (*src == ' ') ++src; while (*src == ' ') ++src;
if (!hasP && !hasS && *src != '\0') if (!hasP && !hasS && *src != '\0')
lcd_setstatus(src); lcd_setstatus(src, true);
else else {
LCD_MESSAGEPGM(MSG_USERWAIT); LCD_MESSAGEPGM(MSG_USERWAIT);
#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
dontExpireStatus();
#endif
}
lcd_ignore_click(); lcd_ignore_click();
st_synchronize(); st_synchronize();
...@@ -3776,7 +3813,7 @@ inline void gcode_M42() { ...@@ -3776,7 +3813,7 @@ inline void gcode_M42() {
Y_current = Y_probe_location = st_get_position_mm(Y_AXIS); Y_current = Y_probe_location = st_get_position_mm(Y_AXIS);
Z_current = st_get_position_mm(Z_AXIS); Z_current = st_get_position_mm(Z_AXIS);
Z_start_location = st_get_position_mm(Z_AXIS) + Z_RAISE_BEFORE_PROBING; Z_start_location = st_get_position_mm(Z_AXIS) + Z_RAISE_BEFORE_PROBING;
ext_position = st_get_position_mm(E_AXIS); ext_position = st_get_position_mm(E_AXIS);
if (code_seen('E') || code_seen('e')) if (code_seen('E') || code_seen('e'))
engage_probe_for_each_reading++; engage_probe_for_each_reading++;
...@@ -3864,7 +3901,7 @@ inline void gcode_M42() { ...@@ -3864,7 +3901,7 @@ inline void gcode_M42() {
//SERIAL_ECHOPAIR("starting radius: ",radius); //SERIAL_ECHOPAIR("starting radius: ",radius);
//SERIAL_ECHOPAIR(" theta: ",theta); //SERIAL_ECHOPAIR(" theta: ",theta);
//SERIAL_ECHOPAIR(" direction: ",rotational_direction); //SERIAL_ECHOPAIR(" direction: ",rotational_direction);
//SERIAL_PROTOCOLLNPGM(""); //SERIAL_EOL;
float dir = rotational_direction ? 1 : -1; float dir = rotational_direction ? 1 : -1;
for (l = 0; l < n_legs - 1; l++) { for (l = 0; l < n_legs - 1; l++) {
...@@ -3883,7 +3920,7 @@ inline void gcode_M42() { ...@@ -3883,7 +3920,7 @@ inline void gcode_M42() {
if (verbose_level > 3) { if (verbose_level > 3) {
SERIAL_ECHOPAIR("x: ", X_current); SERIAL_ECHOPAIR("x: ", X_current);
SERIAL_ECHOPAIR("y: ", Y_current); SERIAL_ECHOPAIR("y: ", Y_current);
SERIAL_PROTOCOLLNPGM(""); SERIAL_EOL;
} }
do_blocking_move_to( X_current, Y_current, Z_current ); do_blocking_move_to( X_current, Y_current, Z_current );
...@@ -3959,7 +3996,7 @@ inline void gcode_M42() { ...@@ -3959,7 +3996,7 @@ inline void gcode_M42() {
} }
#endif // ENABLE_AUTO_BED_LEVELING && Z_PROBE_REPEATABILITY_TEST #endif // ENABLE_AUTO_BED_LEVELING && Z_PROBE_REPEATABILITY_TEST
#if defined(POWER_SUPPLY) && POWER_SUPPLY > 0 && defined(PS_ON_PIN) && PS_ON_PIN > -1 #if HAS_POWER_SWITCH
// M80: Turn on Power Supply // M80: Turn on Power Supply
inline void gcode_M80() { inline void gcode_M80() {
OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE); //GND OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE); //GND
...@@ -3977,9 +4014,13 @@ inline void gcode_M42() { ...@@ -3977,9 +4014,13 @@ inline void gcode_M42() {
lcd_update(); lcd_update();
#endif #endif
} }
#endif #endif // HAS_POWER_SWITCH
// M81: Turn off Power Supply /**
* M81: Turn off Power, including Power Supply, if there is one.
*
* This code should ALWAYS be available for EMERGENCY SHUTDOWN!
*/
inline void gcode_M81() { inline void gcode_M81() {
disable_heater(); disable_heater();
st_synchronize(); st_synchronize();
...@@ -3993,11 +4034,13 @@ inline void gcode_M81() { ...@@ -3993,11 +4034,13 @@ inline void gcode_M81() {
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1 #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
st_synchronize(); st_synchronize();
suicide(); suicide();
#elif defined(PS_ON_PIN) && PS_ON_PIN > -1 #elif HAS_POWER_SWITCH
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP); OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#endif #endif
#ifdef ULTIPANEL #ifdef ULTIPANEL
powersupply = false; #if HAS_POWER_SWITCH
powersupply = false;
#endif
LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF "."); LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF ".");
lcd_update(); lcd_update();
#endif #endif
...@@ -4512,23 +4555,23 @@ inline void gcode_M206() { ...@@ -4512,23 +4555,23 @@ inline void gcode_M206() {
inline void gcode_M218() { inline void gcode_M218() {
if (setTargetedHotend(218)) return; if (setTargetedHotend(218)) return;
if (code_seen('X')) hotend_offset[tmp_extruder][X_AXIS] = code_value(); if (code_seen('X')) hotend_offset[X_AXIS][tmp_extruder] = code_value();
if (code_seen('Y')) hotend_offset[tmp_extruder][Y_AXIS] = code_value(); if (code_seen('Y')) hotend_offset[Y_AXIS][tmp_extruder] = code_value();
#ifdef DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE
if (code_seen('Z')) hotend_offset[tmp_extruder][Z_AXIS] = code_value(); if (code_seen('Z')) hotend_offset[Z_AXIS][tmp_extruder] = code_value();
#endif #endif
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET); SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
for (tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++) { for (tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++) {
SERIAL_ECHO(" "); SERIAL_ECHO(" ");
SERIAL_ECHO(hotend_offset[tmp_extruder][X_AXIS]); SERIAL_ECHO(hotend_offset[X_AXIS][tmp_extruder]);
SERIAL_ECHO(","); SERIAL_ECHO(",");
SERIAL_ECHO(hotend_offset[tmp_extruder][Y_AXIS]); SERIAL_ECHO(hotend_offset[Y_AXIS][tmp_extruder]);
#ifdef DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE
SERIAL_ECHO(","); SERIAL_ECHO(",");
SERIAL_ECHO(hotend_offset[tmp_extruder][Z_AXIS]); SERIAL_ECHO(hotend_offset[Z_AXIS][tmp_extruder]);
#endif #endif
} }
SERIAL_EOL; SERIAL_EOL;
...@@ -5155,13 +5198,13 @@ inline void gcode_M503() { ...@@ -5155,13 +5198,13 @@ inline void gcode_M503() {
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET); SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
SERIAL_ECHO(" "); SERIAL_ECHO(" ");
SERIAL_ECHO(extruder_offset[0][X_AXIS]); SERIAL_ECHO(hotend_offset[X_AXIS][0]);
SERIAL_ECHO(","); SERIAL_ECHO(",");
SERIAL_ECHO(extruder_offset[0][Y_AXIS]); SERIAL_ECHO(hotend_offset[Y_AXIS][0]);
SERIAL_ECHO(" "); SERIAL_ECHO(" ");
SERIAL_ECHO(duplicate_extruder_x_offset); SERIAL_ECHO(duplicate_extruder_x_offset);
SERIAL_ECHO(","); SERIAL_ECHO(",");
SERIAL_ECHOLN(extruder_offset[1][Y_AXIS]); SERIAL_ECHOLN(hotend_offset[Y_AXIS][1]);
break; break;
case DXC_FULL_CONTROL_MODE: case DXC_FULL_CONTROL_MODE:
case DXC_AUTO_PARK_MODE: case DXC_AUTO_PARK_MODE:
...@@ -5405,11 +5448,11 @@ inline void gcode_T() { ...@@ -5405,11 +5448,11 @@ inline void gcode_T() {
// apply Y & Z extruder offset (x offset is already used in determining home pos) // apply Y & Z extruder offset (x offset is already used in determining home pos)
current_position[Y_AXIS] = current_position[Y_AXIS] - current_position[Y_AXIS] = current_position[Y_AXIS] -
hotend_offset[active_extruder][Y_AXIS] + hotend_offset[Y_AXIS][active_extruder] +
hotend_offset[tmp_extruder][Y_AXIS]; hotend_offset[Y_AXIS][tmp_extruder];
current_position[Z_AXIS] = current_position[Z_AXIS] - current_position[Z_AXIS] = current_position[Z_AXIS] -
hotend_offset[active_extruder][Z_AXIS] + hotend_offset[Z_AXIS][active_extruder] +
hotend_offset[tmp_extruder][Z_AXIS]; hotend_offset[Z_AXIS][tmp_extruder];
active_extruder = tmp_extruder; active_extruder = tmp_extruder;
...@@ -5440,7 +5483,7 @@ inline void gcode_T() { ...@@ -5440,7 +5483,7 @@ inline void gcode_T() {
// Offset hotend (only by XY) // Offset hotend (only by XY)
#if HOTENDS > 1 #if HOTENDS > 1
for (int i=X_AXIS; i<=Y_AXIS; i++) for (int i=X_AXIS; i<=Y_AXIS; i++)
current_position[i] += hotend_offset[tmp_extruder][i] - hotend_offset[active_extruder][i]; current_position[i] += hotend_offset[i][tmp_extruder] - hotend_offset[i][active_extruder];
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#if defined(MKR4) && (EXTRUDERS > 1) #if defined(MKR4) && (EXTRUDERS > 1)
...@@ -5705,12 +5748,12 @@ void process_commands() { ...@@ -5705,12 +5748,12 @@ void process_commands() {
gcode_M49(); break; gcode_M49(); break;
#endif //defined(ENABLE_AUTO_BED_LEVELING) && defined(Z_PROBE_REPEATABILITY_TEST) #endif //defined(ENABLE_AUTO_BED_LEVELING) && defined(Z_PROBE_REPEATABILITY_TEST)
#if defined(POWER_SUPPLY) && POWER_SUPPLY > 0 && defined(PS_ON_PIN) && PS_ON_PIN > -1 #if HAS_POWER_SWITCH
case 80: //M80 - Turn on Power Supply case 80: //M80 - Turn on Power Supply
gcode_M80(); break; gcode_M80(); break;
#endif //POWER_SUPPLY #endif //HAS_POWER_SWITCH
case 81: // M81 - Turn off Power Supply case 81: // M81 - Turn off Power, including Power Supply, if possible
gcode_M81(); break; gcode_M81(); break;
case 82: case 82:
gcode_M82(); break; gcode_M82(); break;
...@@ -6180,7 +6223,7 @@ void prepare_move() ...@@ -6180,7 +6223,7 @@ void prepare_move()
#if ! (defined DELTA || defined SCARA) #if ! (defined DELTA || defined SCARA)
// Do not use feedmultiply for E or Z only moves // Do not use feedmultiply for E or Z only moves
if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) { if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) {
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver); line_to_destination();
} }
else { else {
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder, active_driver); plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder, active_driver);
......
...@@ -17,8 +17,11 @@ ...@@ -17,8 +17,11 @@
* Progress Bar * Progress Bar
*/ */
#ifdef LCD_PROGRESS_BAR #ifdef LCD_PROGRESS_BAR
#ifndef SDSUPPORT
#error LCD_PROGRESS_BAR requires SDSUPPORT.
#endif
#ifdef DOGLCD #ifdef DOGLCD
#warning LCD_PROGRESS_BAR does not apply to graphical displays. #error LCD_PROGRESS_BAR does not apply to graphical displays.
#endif #endif
#ifdef FILAMENT_LCD_DISPLAY #ifdef FILAMENT_LCD_DISPLAY
#error LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both. #error LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both.
......
...@@ -358,12 +358,12 @@ static void lcd_implementation_status_screen() { ...@@ -358,12 +358,12 @@ static void lcd_implementation_status_screen() {
#else #else
u8g.setPrintPos(0,63); u8g.setPrintPos(0,63);
#endif #endif
#if HAS_FILAMENT_SENSOR #if HAS_FILAMENT_SENSOR || HAS_POWER_CONSUMPTION_SENSOR
if (millis() < message_millis + 5000) { //Display both Status message line and Filament display on the last line if (millis() < message_millis + 5000) { //Display both Status message line and Filament display on the last line
lcd_print(lcd_status_message); lcd_print(lcd_status_message);
} }
#if (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY) #if HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY)
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) #if HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)
else if (millis() < message_millis + 10000) else if (millis() < message_millis + 10000)
#else #else
else else
...@@ -376,7 +376,7 @@ static void lcd_implementation_status_screen() { ...@@ -376,7 +376,7 @@ static void lcd_implementation_status_screen() {
lcd_printPGM(PSTR("Wh")); lcd_printPGM(PSTR("Wh"));
} }
#endif #endif
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) #if HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)
else { else {
lcd_printPGM(PSTR("D:")); lcd_printPGM(PSTR("D:"));
lcd_print(ftostr12ns(filament_width_meas)); lcd_print(ftostr12ns(filament_width_meas));
......
...@@ -150,6 +150,9 @@ ...@@ -150,6 +150,9 @@
#define MSG_ERR_MINTEMP "Err: MINTEMP" #define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED" #define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#define MSG_END_HOUR "hours"
#define MSG_END_MINUTE "minutes"
#ifdef DELTA #ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration" #define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE_X "Calibrate X" #define MSG_DELTA_CALIBRATE_X "Calibrate X"
......
...@@ -146,6 +146,9 @@ ...@@ -146,6 +146,9 @@
#define MSG_ERR_MINTEMP "Err: MINTEMP" #define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED" #define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#define MSG_END_HOUR "ore"
#define MSG_END_MINUTE "minuti"
#ifdef DELTA #ifdef DELTA
#define MSG_DELTA_CALIBRATE "Calibraz. Delta" #define MSG_DELTA_CALIBRATE "Calibraz. Delta"
#define MSG_DELTA_CALIBRATE_X "Calibra X" #define MSG_DELTA_CALIBRATE_X "Calibra X"
......
...@@ -441,7 +441,9 @@ ISR(TIMER1_COMPA_vect) { ...@@ -441,7 +441,9 @@ ISR(TIMER1_COMPA_vect) {
{ {
current_block = NULL; current_block = NULL;
plan_discard_current_block(); plan_discard_current_block();
if ((cleaning_buffer_counter == 1) && (SD_FINISHED_STEPPERRELEASE)) enquecommands_P(PSTR(SD_FINISHED_RELEASECOMMAND)); #ifdef SD_FINISHED_RELEASECOMMAND
if ((cleaning_buffer_counter == 1) && (SD_FINISHED_STEPPERRELEASE)) enquecommands_P(PSTR(SD_FINISHED_RELEASECOMMAND));
#endif
cleaning_buffer_counter--; cleaning_buffer_counter--;
OCR1A = 200; OCR1A = 200;
return; return;
...@@ -564,74 +566,98 @@ ISR(TIMER1_COMPA_vect) { ...@@ -564,74 +566,98 @@ ISR(TIMER1_COMPA_vect) {
} }
if (TEST(out_bits, Z_AXIS)) { // -direction if (TEST(out_bits, Z_AXIS)) { // -direction
Z_APPLY_DIR(INVERT_Z_DIR,0); Z_APPLY_DIR(INVERT_Z_DIR,0);
count_direction[Z_AXIS] = -1; count_direction[Z_AXIS] = -1;
if (check_endstops)
{ if (check_endstops) {
#if defined(Z_MIN_PIN) && Z_MIN_PIN > -1
#ifndef Z_DUAL_ENDSTOPS #if defined(Z_MIN_PIN) && Z_MIN_PIN >= 0
UPDATE_ENDSTOP(z, Z, min, MIN);
#else #ifdef Z_DUAL_ENDSTOPS
bool z_min_endstop=(READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
#if defined(Z2_MIN_PIN) && Z2_MIN_PIN > -1 bool z_min_endstop = READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING,
bool z2_min_endstop=(READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING); z2_min_endstop =
#else #if defined(Z2_MIN_PIN) && Z2_MIN_PIN >= 0
bool z2_min_endstop=z_min_endstop; READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING
#endif #else
if(((z_min_endstop && old_z_min_endstop) || (z2_min_endstop && old_z2_min_endstop)) && (current_block->steps[Z_AXIS] > 0)) z_min_endstop
{ #endif
;
bool z_min_both = z_min_endstop && old_z_min_endstop,
z2_min_both = z2_min_endstop && old_z2_min_endstop;
if ((z_min_both || z2_min_both) && current_block->steps[Z_AXIS] > 0) {
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS]; endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_z_hit=true; endstop_z_hit = true;
if (!(performing_homing) || ((performing_homing)&&(z_min_endstop && old_z_min_endstop)&&(z2_min_endstop && old_z2_min_endstop))) //if not performing home or if both endstops were trigged during homing... if (!performing_homing || (performing_homing && z_min_both && z2_min_both)) //if not performing home or if both endstops were trigged during homing...
{
step_events_completed = current_block->step_event_count; step_events_completed = current_block->step_event_count;
}
} }
old_z_min_endstop = z_min_endstop; old_z_min_endstop = z_min_endstop;
old_z2_min_endstop = z2_min_endstop; old_z2_min_endstop = z2_min_endstop;
#endif
#endif #else // !Z_DUAL_ENDSTOPS
}
UPDATE_ENDSTOP(z, Z, min, MIN);
#endif // !Z_DUAL_ENDSTOPS
#endif // Z_MIN_PIN
} // check_endstops
} }
else { // +direction else { // +direction
Z_APPLY_DIR(!INVERT_Z_DIR,0); Z_APPLY_DIR(!INVERT_Z_DIR,0);
count_direction[Z_AXIS] = 1; count_direction[Z_AXIS] = 1;
if (check_endstops) { if (check_endstops) {
#if defined(Z_MAX_PIN) && Z_MAX_PIN >= 0 #if defined(Z_MAX_PIN) && Z_MAX_PIN >= 0
#ifndef Z_DUAL_ENDSTOPS
UPDATE_ENDSTOP(z, Z, max, MAX); #ifdef Z_DUAL_ENDSTOPS
#else
bool z_max_endstop=(READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING); bool z_max_endstop = READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING,
#if defined(Z2_MAX_PIN) && Z2_MAX_PIN > -1 z2_max_endstop =
bool z2_max_endstop=(READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING); #if defined(Z2_MAX_PIN) && Z2_MAX_PIN >= 0
#else READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING
bool z2_max_endstop=z_max_endstop; #else
#endif z_max_endstop
if(((z_max_endstop && old_z_max_endstop) || (z2_max_endstop && old_z2_max_endstop)) && (current_block->steps[Z_AXIS] > 0)) #endif
{ ;
bool z_max_both = z_max_endstop && old_z_max_endstop,
z2_max_both = z2_max_endstop && old_z2_max_endstop;
if ((z_max_both || z2_max_both) && current_block->steps[Z_AXIS] > 0) {
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS]; endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_z_hit=true; endstop_z_hit = true;
// if (z_max_endstop && old_z_max_endstop) SERIAL_ECHOLN("z_max_endstop = true"); // if (z_max_both) SERIAL_ECHOLN("z_max_endstop = true");
// if (z2_max_endstop && old_z2_max_endstop) SERIAL_ECHOLN("z2_max_endstop = true"); // if (z2_max_both) SERIAL_ECHOLN("z2_max_endstop = true");
if (!performing_homing || (performing_homing && z_max_both && z2_max_both)) //if not performing home or if both endstops were trigged during homing...
if (!(performing_homing) || ((performing_homing)&&(z_max_endstop && old_z_max_endstop)&&(z2_max_endstop && old_z2_max_endstop))) //if not performing home or if both endstops were trigged during homing...
{
step_events_completed = current_block->step_event_count; step_events_completed = current_block->step_event_count;
}
} }
old_z_max_endstop = z_max_endstop; old_z_max_endstop = z_max_endstop;
old_z2_max_endstop = z2_max_endstop; old_z2_max_endstop = z2_max_endstop;
#endif
#endif #else // !Z_DUAL_ENDSTOPS
}
} UPDATE_ENDSTOP(z, Z, max, MAX);
#endif // !Z_DUAL_ENDSTOPS
#endif // Z_MAX_PIN
} // check_endstops
} // +direction
#ifndef ADVANCE #ifndef ADVANCE
if (TEST(out_bits, E_AXIS)) { // -direction if (TEST(out_bits, E_AXIS)) { // -direction
REV_E_DIR(); REV_E_DIR();
count_direction[E_AXIS]=-1; count_direction[E_AXIS] = -1;
#ifdef NPR2 #ifdef NPR2
if (check_endstops) { if (check_endstops) {
#if defined(E_MIN_PIN) && E_MIN_PIN > -1 #if defined(E_MIN_PIN) && E_MIN_PIN > -1
...@@ -648,12 +674,12 @@ ISR(TIMER1_COMPA_vect) { ...@@ -648,12 +674,12 @@ ISR(TIMER1_COMPA_vect) {
} }
else { // +direction else { // +direction
NORM_E_DIR(); NORM_E_DIR();
count_direction[E_AXIS]=1; count_direction[E_AXIS] = 1;
} }
#endif //!ADVANCE #endif //!ADVANCE
// Take multiple steps per interrupt (For high speed moves) // Take multiple steps per interrupt (For high speed moves)
for (int8_t i=0; i < step_loops; i++) { for (int8_t i = 0; i < step_loops; i++) {
#ifndef AT90USB #ifndef AT90USB
MSerial.checkRx(); // Check for serial chars. MSerial.checkRx(); // Check for serial chars.
#endif #endif
...@@ -811,51 +837,52 @@ ISR(TIMER1_COMPA_vect) { ...@@ -811,51 +837,52 @@ ISR(TIMER1_COMPA_vect) {
E0_STEP_WRITE(!INVERT_E_STEP_PIN); E0_STEP_WRITE(!INVERT_E_STEP_PIN);
} }
} }
#if DRIVER_EXTRUDERS > 1 #if DRIVER_EXTRUDERS > 1
if (e_steps[1] != 0) { if (e_steps[1] != 0) {
E1_STEP_WRITE(INVERT_E_STEP_PIN); E1_STEP_WRITE(INVERT_E_STEP_PIN);
if (e_steps[1] < 0) { if (e_steps[1] < 0) {
E1_DIR_WRITE(INVERT_E1_DIR); E1_DIR_WRITE(INVERT_E1_DIR);
e_steps[1]++; e_steps[1]++;
E1_STEP_WRITE(!INVERT_E_STEP_PIN); E1_STEP_WRITE(!INVERT_E_STEP_PIN);
}
else if (e_steps[1] > 0) {
E1_DIR_WRITE(!INVERT_E1_DIR);
e_steps[1]--;
E1_STEP_WRITE(!INVERT_E_STEP_PIN);
}
} }
#endif else if (e_steps[1] > 0) {
#if DRIVER_EXTRUDERS > 2 E1_DIR_WRITE(!INVERT_E1_DIR);
if (e_steps[2] != 0) { e_steps[1]--;
E2_STEP_WRITE(INVERT_E_STEP_PIN); E1_STEP_WRITE(!INVERT_E_STEP_PIN);
if (e_steps[2] < 0) {
E2_DIR_WRITE(INVERT_E2_DIR);
e_steps[2]++;
E2_STEP_WRITE(!INVERT_E_STEP_PIN);
}
else if (e_steps[2] > 0) {
E2_DIR_WRITE(!INVERT_E2_DIR);
e_steps[2]--;
E2_STEP_WRITE(!INVERT_E_STEP_PIN);
}
} }
#endif }
#if DRIVER_EXTRUDERS > 3 #endif
if (e_steps[3] != 0) { #if DRIVER_EXTRUDERS > 2
E3_STEP_WRITE(INVERT_E_STEP_PIN); if (e_steps[2] != 0) {
if (e_steps[3] < 0) { E2_STEP_WRITE(INVERT_E_STEP_PIN);
E3_DIR_WRITE(INVERT_E3_DIR); if (e_steps[2] < 0) {
e_steps[3]++; E2_DIR_WRITE(INVERT_E2_DIR);
E3_STEP_WRITE(!INVERT_E_STEP_PIN); e_steps[2]++;
} E2_STEP_WRITE(!INVERT_E_STEP_PIN);
else if (e_steps[3] > 0) {
E3_DIR_WRITE(!INVERT_E3_DIR);
e_steps[3]--;
E3_STEP_WRITE(!INVERT_E_STEP_PIN);
}
} }
#endif else if (e_steps[2] > 0) {
E2_DIR_WRITE(!INVERT_E2_DIR);
e_steps[2]--;
E2_STEP_WRITE(!INVERT_E_STEP_PIN);
}
}
#endif
#if DRIVER_EXTRUDERS > 3
if (e_steps[3] != 0) {
E3_STEP_WRITE(INVERT_E_STEP_PIN);
if (e_steps[3] < 0) {
E3_DIR_WRITE(INVERT_E3_DIR);
e_steps[3]++;
E3_STEP_WRITE(!INVERT_E_STEP_PIN);
}
else if (e_steps[3] > 0) {
E3_DIR_WRITE(!INVERT_E3_DIR);
e_steps[3]--;
E3_STEP_WRITE(!INVERT_E_STEP_PIN);
}
}
#endif
} }
} }
#endif // ADVANCE #endif // ADVANCE
......
...@@ -33,7 +33,7 @@ int gumPreheatFanSpeed; ...@@ -33,7 +33,7 @@ int gumPreheatFanSpeed;
const long baudrates[] = {9600,14400,19200,28800,38400,56000,115200,250000}; const long baudrates[] = {9600,14400,19200,28800,38400,56000,115200,250000};
int baudrate_position = -1; int baudrate_position = -1;
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) || (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY) #if (HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)) || (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY))
unsigned long message_millis = 0; unsigned long message_millis = 0;
#endif #endif
...@@ -58,7 +58,9 @@ static void lcd_status_screen(); ...@@ -58,7 +58,9 @@ static void lcd_status_screen();
#ifdef ULTIPANEL #ifdef ULTIPANEL
extern bool powersupply; #if HAS_POWER_SWITCH
extern bool powersupply;
#endif
static float manual_feedrate[] = MANUAL_FEEDRATE; static float manual_feedrate[] = MANUAL_FEEDRATE;
static void lcd_main_menu(); static void lcd_main_menu();
static void lcd_tune_menu(); static void lcd_tune_menu();
...@@ -143,7 +145,6 @@ static void lcd_status_screen(); ...@@ -143,7 +145,6 @@ static void lcd_status_screen();
if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \ if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \
uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \ uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
bool wasClicked = LCD_CLICKED, itemSelected; \ bool wasClicked = LCD_CLICKED, itemSelected; \
if (wasClicked) lcd_quick_feedback(); \
for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \ for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
_menuItemNr = 0; _menuItemNr = 0;
...@@ -174,6 +175,7 @@ static void lcd_status_screen(); ...@@ -174,6 +175,7 @@ static void lcd_status_screen();
if (lcdDrawUpdate) \ if (lcdDrawUpdate) \
lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \ lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \
if (wasClicked && itemSelected) { \ if (wasClicked && itemSelected) { \
lcd_quick_feedback(); \
menu_action_ ## type(args); \ menu_action_ ## type(args); \
return; \ return; \
} \ } \
...@@ -261,7 +263,7 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool ...@@ -261,7 +263,7 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool
if (feedback) lcd_quick_feedback(); if (feedback) lcd_quick_feedback();
// For LCD_PROGRESS_BAR re-initialize the custom characters // For LCD_PROGRESS_BAR re-initialize the custom characters
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD) #ifdef LCD_PROGRESS_BAR
lcd_set_custom_characters(menu == lcd_status_screen); lcd_set_custom_characters(menu == lcd_status_screen);
#endif #endif
} }
...@@ -271,29 +273,32 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool ...@@ -271,29 +273,32 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool
static void lcd_status_screen() static void lcd_status_screen()
{ {
encoderRateMultiplierEnabled = false; encoderRateMultiplierEnabled = false;
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD)
uint16_t mil = millis(); #ifdef LCD_PROGRESS_BAR
unsigned long ms = millis();
#ifndef PROGRESS_MSG_ONCE #ifndef PROGRESS_MSG_ONCE
if (mil > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) { if (ms > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
progressBarTick = mil; progressBarTick = ms;
} }
#endif #endif
#if PROGRESS_MSG_EXPIRE > 0 #if PROGRESS_MSG_EXPIRE > 0
// keep the message alive if paused, count down otherwise // Handle message expire
if (messageTick > 0) { if (expireStatusMillis > 0) {
if (card.isFileOpen()) { if (card.isFileOpen()) {
// Expire the message when printing is active
if (IS_SD_PRINTING) { if (IS_SD_PRINTING) {
if ((mil-messageTick) >= PROGRESS_MSG_EXPIRE) { // Expire the message when printing is active
if (ms >= expireStatusMillis) {
lcd_status_message[0] = '\0'; lcd_status_message[0] = '\0';
messageTick = 0; expireStatusMillis = 0;
} }
} }
else { else {
messageTick += LCD_UPDATE_INTERVAL; expireStatusMillis += LCD_UPDATE_INTERVAL;
} }
} }
else { else {
messageTick = 0; expireStatusMillis = 0;
} }
} }
#endif #endif
...@@ -333,12 +338,12 @@ static void lcd_status_screen() ...@@ -333,12 +338,12 @@ static void lcd_status_screen()
{ {
lcd_goto_menu(lcd_main_menu); lcd_goto_menu(lcd_main_menu);
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD) #ifdef LCD_PROGRESS_BAR
currentMenu == lcd_status_screen currentMenu == lcd_status_screen
#endif #endif
); );
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) || (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY) #if (HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)) || (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY))
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) && (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY) #if (HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)) && (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY))
if (millis() > message_millis + 15000) if (millis() > message_millis + 15000)
#else #else
if (millis() > message_millis + 10000) if (millis() > message_millis + 10000)
...@@ -396,7 +401,7 @@ static void lcd_sdcard_stop() { ...@@ -396,7 +401,7 @@ static void lcd_sdcard_stop() {
card.closefile(); card.closefile();
autotempShutdown(); autotempShutdown();
cancel_heatup = true; cancel_heatup = true;
lcd_setstatus(MSG_PRINT_ABORTED); lcd_setstatus(MSG_PRINT_ABORTED, true);
} }
/* Menu implementation */ /* Menu implementation */
...@@ -560,6 +565,8 @@ void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTem ...@@ -560,6 +565,8 @@ void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTem
void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
void lcd_preheat_gum0() { _lcd_preheat(0, gumPreheatHotendTemp, gumPreheatHPBTemp, gumPreheatFanSpeed); } void lcd_preheat_gum0() { _lcd_preheat(0, gumPreheatHotendTemp, gumPreheatHPBTemp, gumPreheatFanSpeed); }
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0 //more than one extruder present
#if TEMP_SENSOR_1 != 0 //2nd extruder preheat #if TEMP_SENSOR_1 != 0 //2nd extruder preheat
void lcd_preheat_pla1() { _lcd_preheat(1, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } void lcd_preheat_pla1() { _lcd_preheat(1, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
void lcd_preheat_abs1() { _lcd_preheat(1, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } void lcd_preheat_abs1() { _lcd_preheat(1, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
...@@ -578,7 +585,6 @@ void lcd_preheat_gum0() { _lcd_preheat(0, gumPreheatHotendTemp, gumPreheatHPBTem ...@@ -578,7 +585,6 @@ void lcd_preheat_gum0() { _lcd_preheat(0, gumPreheatHotendTemp, gumPreheatHPBTem
void lcd_preheat_gum3() { _lcd_preheat(3, gumPreheatHotendTemp, gumPreheatHPBTemp, gumPreheatFanSpeed); } void lcd_preheat_gum3() { _lcd_preheat(3, gumPreheatHotendTemp, gumPreheatHPBTemp, gumPreheatFanSpeed); }
#endif //4 extruder preheat #endif //4 extruder preheat
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //more than one extruder present
void lcd_preheat_pla0123() { void lcd_preheat_pla0123() {
setTargetHotend0(plaPreheatHotendTemp); setTargetHotend0(plaPreheatHotendTemp);
setTargetHotend1(plaPreheatHotendTemp); setTargetHotend1(plaPreheatHotendTemp);
...@@ -799,14 +805,13 @@ static void lcd_prepare_menu() { ...@@ -799,14 +805,13 @@ static void lcd_prepare_menu() {
MENU_ITEM(function, MSG_PURGE_XMM, lcd_purge); MENU_ITEM(function, MSG_PURGE_XMM, lcd_purge);
MENU_ITEM(function, MSG_RETRACT_XMM, lcd_retract); MENU_ITEM(function, MSG_RETRACT_XMM, lcd_retract);
#endif // EASY_LOAD #endif // EASY_LOAD
#if defined(POWER_SUPPLY) && POWER_SUPPLY > 0 && defined(PS_ON_PIN) && PS_ON_PIN > -1 #if HAS_POWER_SWITCH
if (powersupply) { if (powersupply)
MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81")); MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81"));
} else
else {
MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80")); MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80"));
}
#endif #endif
MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu); MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
END_MENU(); END_MENU();
} }
...@@ -1362,10 +1367,10 @@ static void lcd_quick_feedback() { ...@@ -1362,10 +1367,10 @@ static void lcd_quick_feedback() {
#elif defined(BEEPER) && BEEPER > -1 #elif defined(BEEPER) && BEEPER > -1
SET_OUTPUT(BEEPER); SET_OUTPUT(BEEPER);
#ifndef LCD_FEEDBACK_FREQUENCY_HZ #ifndef LCD_FEEDBACK_FREQUENCY_HZ
#define LCD_FEEDBACK_FREQUENCY_HZ 500 #define LCD_FEEDBACK_FREQUENCY_HZ 5000
#endif #endif
#ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 50 #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
#endif #endif
const unsigned int delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2; const unsigned int delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2;
int i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000; int i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000;
...@@ -1489,7 +1494,7 @@ void lcd_update() { ...@@ -1489,7 +1494,7 @@ void lcd_update() {
lcdDrawUpdate = 2; lcdDrawUpdate = 2;
lcd_oldcardstatus = IS_SD_INSERTED; lcd_oldcardstatus = IS_SD_INSERTED;
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD) #ifdef LCD_PROGRESS_BAR
currentMenu == lcd_status_screen currentMenu == lcd_status_screen
#endif #endif
); );
...@@ -1552,7 +1557,7 @@ void lcd_update() { ...@@ -1552,7 +1557,7 @@ void lcd_update() {
} }
lastEncoderMovementMillis = ms; lastEncoderMovementMillis = ms;
} } // encoderRateMultiplierEnabled
#endif //ENCODER_RATE_MULTIPLIER #endif //ENCODER_RATE_MULTIPLIER
lcdDrawUpdate = 1; lcdDrawUpdate = 1;
...@@ -1602,7 +1607,7 @@ void lcd_ignore_click(bool b) { ...@@ -1602,7 +1607,7 @@ void lcd_ignore_click(bool b) {
wait_for_unclick = false; wait_for_unclick = false;
} }
void lcd_finishstatus() { void lcd_finishstatus(bool persist=false) {
int len = lcd_strlen(lcd_status_message); int len = lcd_strlen(lcd_status_message);
if (len > 0) { if (len > 0) {
while (len < LCD_WIDTH) { while (len < LCD_WIDTH) {
...@@ -1610,30 +1615,39 @@ void lcd_finishstatus() { ...@@ -1610,30 +1615,39 @@ void lcd_finishstatus() {
} }
} }
lcd_status_message[LCD_WIDTH] = '\0'; lcd_status_message[LCD_WIDTH] = '\0';
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD) #ifdef LCD_PROGRESS_BAR
progressBarTick = millis();
#if PROGRESS_MSG_EXPIRE > 0 #if PROGRESS_MSG_EXPIRE > 0
messageTick = expireStatusMillis = persist ? 0 : progressBarTick + PROGRESS_MSG_EXPIRE;
#endif #endif
progressBarTick = millis();
#endif #endif
lcdDrawUpdate = 2; lcdDrawUpdate = 2;
#ifdef FILAMENT_LCD_DISPLAY
message_millis = millis(); //get status message to show up for a while
#endif
} }
void lcd_setstatus(const char* message) { #if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
void dontExpireStatus() { expireStatusMillis = 0; }
#endif
void lcd_setstatus(const char* message, bool persist) {
if (lcd_status_message_level > 0) return; if (lcd_status_message_level > 0) return;
strncpy(lcd_status_message, message, LCD_WIDTH); strncpy(lcd_status_message, message, LCD_WIDTH);
lcd_finishstatus(); lcd_finishstatus(persist);
} }
void lcd_setstatuspgm(const char* message) { void lcd_setstatuspgm(const char* message, uint8_t level) {
if (lcd_status_message_level > 0) return; if (level >= lcd_status_message_level) {
strncpy_P(lcd_status_message, message, LCD_WIDTH); strncpy_P(lcd_status_message, message, LCD_WIDTH);
lcd_finishstatus(); lcd_status_message_level = level;
lcd_finishstatus(level > 0);
}
} }
void lcd_setalertstatuspgm(const char* message) { void lcd_setalertstatuspgm(const char* message) {
lcd_setstatuspgm(message); lcd_setstatuspgm(message, 1);
lcd_status_message_level = 1;
#ifdef ULTIPANEL #ifdef ULTIPANEL
lcd_return_to_status(); lcd_return_to_status();
#endif #endif
...@@ -1750,70 +1764,62 @@ bool lcd_clicked() { return LCD_CLICKED; } ...@@ -1750,70 +1764,62 @@ bool lcd_clicked() { return LCD_CLICKED; }
#endif //ULTIPANEL #endif //ULTIPANEL
/********************************/ /*********************************/
/** Float conversion utilities **/ /** Number to string conversion **/
/********************************/ /*********************************/
// convert float to string with +123.4 format
char conv[8]; char conv[8];
char *ftostr3(const float &x)
{ // Convert float to string with +123.4 format
char *ftostr3(const float &x) {
return itostr3((int)x); return itostr3((int)x);
} }
char *itostr2(const uint8_t &x) // Convert int to string with 12 format
{ char *itostr2(const uint8_t &x) {
//sprintf(conv,"%5.1f",x); //sprintf(conv,"%5.1f",x);
int xx=x; int xx = x;
conv[0]=(xx/10)%10+'0'; conv[0] = (xx / 10) % 10 + '0';
conv[1]=(xx)%10+'0'; conv[1] = xx % 10 + '0';
conv[2]=0; conv[2] = 0;
return conv; return conv;
} }
// Convert float to string with 123.4 format, dropping sign // Convert float to string with +123.4 format
char *ftostr31(const float &x) char *ftostr31(const float &x) {
{ int xx = abs(x * 10);
int xx=x*10; conv[0] = (x >= 0) ? '+' : '-';
conv[0]=(xx>=0)?'+':'-'; conv[1] = (xx / 1000) % 10 + '0';
xx=abs(xx); conv[2] = (xx / 100) % 10 + '0';
conv[1]=(xx/1000)%10+'0'; conv[3] = (xx / 10) % 10 + '0';
conv[2]=(xx/100)%10+'0'; conv[4] = '.';
conv[3]=(xx/10)%10+'0'; conv[5] = xx % 10 + '0';
conv[4]='.'; conv[6] = 0;
conv[5]=(xx)%10+'0';
conv[6]=0;
return conv; return conv;
} }
// Convert float to string with 123.4 format // Convert float to string with 123.4 format, dropping sign
char *ftostr31ns(const float &x) char *ftostr31ns(const float &x) {
{ int xx = abs(x * 10);
int xx=x*10; conv[0] = (xx / 1000) % 10 + '0';
//conv[0]=(xx>=0)?'+':'-'; conv[1] = (xx / 100) % 10 + '0';
xx=abs(xx); conv[2] = (xx / 10) % 10 + '0';
conv[0]=(xx/1000)%10+'0'; conv[3] = '.';
conv[1]=(xx/100)%10+'0'; conv[4] = xx % 10 + '0';
conv[2]=(xx/10)%10+'0'; conv[5] = 0;
conv[3]='.';
conv[4]=(xx)%10+'0';
conv[5]=0;
return conv; return conv;
} }
char *ftostr32(const float &x) // Convert float to string with 123.4 format
{ char *ftostr32(const float &x) {
long xx=x*100; long xx = abs(x * 100);
if (xx >= 0) conv[0] = x >= 0 ? (xx / 10000) % 10 + '0' : '-';
conv[0]=(xx/10000)%10+'0'; conv[1] = (xx / 1000) % 10 + '0';
else conv[2] = (xx / 100) % 10 + '0';
conv[0]='-'; conv[3] = '.';
xx=abs(xx); conv[4] = (xx / 10) % 10 + '0';
conv[1]=(xx/1000)%10+'0'; conv[5] = xx % 10 + '0';
conv[2]=(xx/100)%10+'0'; conv[6] = 0;
conv[3]='.';
conv[4]=(xx/10)%10+'0';
conv[5]=(xx)%10+'0';
conv[6]=0;
return conv; return conv;
} }
...@@ -1834,7 +1840,7 @@ char *ftostr43(const float &x) ...@@ -1834,7 +1840,7 @@ char *ftostr43(const float &x)
return conv; return conv;
} }
//Float to string with 1.23 format // Convert float to string with 1.23 format
char *ftostr12ns(const float &x) char *ftostr12ns(const float &x)
{ {
long xx=x*100; long xx=x*100;
...@@ -1848,7 +1854,7 @@ char *ftostr12ns(const float &x) ...@@ -1848,7 +1854,7 @@ char *ftostr12ns(const float &x)
return conv; return conv;
} }
// convert float to space-padded string with -_23.4_ format // Convert float to space-padded string with -_23.4_ format
char *ftostr32sp(const float &x) { char *ftostr32sp(const float &x) {
long xx = abs(x * 100); long xx = abs(x * 100);
uint8_t dig; uint8_t dig;
...@@ -1894,58 +1900,51 @@ char *ftostr32sp(const float &x) { ...@@ -1894,58 +1900,51 @@ char *ftostr32sp(const float &x) {
return conv; return conv;
} }
char *itostr31(const int &xx) // Convert int to lj string with +123.0 format
{ char *itostr31(const int &x) {
conv[0]=(xx>=0)?'+':'-'; conv[0] = x >= 0 ? '+' : '-';
conv[1]=(xx/1000)%10+'0'; int xx = abs(x);
conv[2]=(xx/100)%10+'0'; conv[1] = (xx / 100) % 10 + '0';
conv[3]=(xx/10)%10+'0'; conv[2] = (xx / 10) % 10 + '0';
conv[4]='.'; conv[3] = xx % 10 + '0';
conv[5]=(xx)%10+'0'; conv[4] = '.';
conv[6]=0; conv[5] = '0';
conv[6] = 0;
return conv; return conv;
} }
// Convert int to rj string with 123 or -12 format // Convert int to rj string with 123 or -12 format
char *itostr3(const int &x) char *itostr3(const int &x) {
{
int xx = x; int xx = x;
if (xx < 0) { if (xx < 0) {
conv[0]='-'; conv[0] = '-';
xx = -xx; xx = -xx;
} else if (xx >= 100) }
conv[0]=(xx/100)%10+'0';
else
conv[0]=' ';
if (xx >= 10)
conv[1]=(xx/10)%10+'0';
else else
conv[1]=' '; conv[0] = xx >= 100 ? (xx / 100) % 10 + '0' : ' ';
conv[2]=(xx)%10+'0';
conv[3]=0; conv[1] = xx >= 10 ? (xx / 10) % 10 + '0' : ' ';
conv[2] = xx % 10 + '0';
conv[3] = 0;
return conv; return conv;
} }
// Convert int to lj string with 123 format // Convert int to lj string with 123 format
char *itostr3left(const int &xx) char *itostr3left(const int &xx) {
{ if (xx >= 100) {
if (xx >= 100) conv[0] = (xx / 100) % 10 + '0';
{ conv[1] = (xx / 10) % 10 + '0';
conv[0]=(xx/100)%10+'0'; conv[2] = xx % 10 + '0';
conv[1]=(xx/10)%10+'0'; conv[3] = 0;
conv[2]=(xx)%10+'0';
conv[3]=0;
} }
else if (xx >= 10) else if (xx >= 10) {
{ conv[0] = (xx / 10) % 10 + '0';
conv[0]=(xx/10)%10+'0'; conv[1] = xx % 10 + '0';
conv[1]=(xx)%10+'0'; conv[2] = 0;
conv[2]=0;
} }
else else {
{ conv[0] = xx % 10 + '0';
conv[0]=(xx)%10+'0'; conv[1] = 0;
conv[1]=0;
} }
return conv; return conv;
} }
...@@ -1960,8 +1959,7 @@ char *itostr4(const int &xx) { ...@@ -1960,8 +1959,7 @@ char *itostr4(const int &xx) {
return conv; return conv;
} }
char *ltostr7(const long &xx) char *ltostr7(const long &xx) {
{
if (xx >= 1000000) if (xx >= 1000000)
conv[0]=(xx/1000000)%10+'0'; conv[0]=(xx/1000000)%10+'0';
else else
...@@ -1992,8 +1990,7 @@ char *ltostr7(const long &xx) ...@@ -1992,8 +1990,7 @@ char *ltostr7(const long &xx)
} }
// convert float to string with +123 format // convert float to string with +123 format
char *ftostr30(const float &x) char *ftostr30(const float &x) {
{
int xx=x; int xx=x;
conv[0]=(xx>=0)?'+':'-'; conv[0]=(xx>=0)?'+':'-';
xx=abs(xx); xx=abs(xx);
...@@ -2017,35 +2014,32 @@ char *ftostr5(const float &x) { ...@@ -2017,35 +2014,32 @@ char *ftostr5(const float &x) {
} }
// Convert float to string with +1234.5 format // Convert float to string with +1234.5 format
char *ftostr51(const float &x) char *ftostr51(const float &x) {
{ long xx = abs(x * 10);
long xx=x*10; conv[0] = (x >= 0) ? '+' : '-';
conv[0]=(xx>=0)?'+':'-'; conv[1] = (xx / 10000) % 10 + '0';
xx=abs(xx); conv[2] = (xx / 1000) % 10 + '0';
conv[1]=(xx/10000)%10+'0'; conv[3] = (xx / 100) % 10 + '0';
conv[2]=(xx/1000)%10+'0'; conv[4] = (xx / 10) % 10 + '0';
conv[3]=(xx/100)%10+'0'; conv[5] = '.';
conv[4]=(xx/10)%10+'0'; conv[6] = xx % 10 + '0';
conv[5]='.'; conv[7] = 0;
conv[6]=(xx)%10+'0';
conv[7]=0;
return conv; return conv;
} }
// Convert float to string with +123.45 format // Convert float to string with +123.45 format
char *ftostr52(const float &x) char *ftostr52(const float &x) {
{ conv[0] = (x >= 0) ? '+' : '-';
long xx=x*100; long xx = abs(x * 100);
conv[0]=(xx>=0)?'+':'-'; conv[1] = (xx / 10000) % 10 + '0';
xx=abs(xx); conv[2] = (xx / 1000) % 10 + '0';
conv[1]=(xx/10000)%10+'0'; conv[3] = (xx / 100) % 10 + '0';
conv[2]=(xx/1000)%10+'0'; conv[4] = '.';
conv[3]=(xx/100)%10+'0'; conv[5] = (xx / 10) % 10 + '0';
conv[4]='.'; conv[6] = xx % 10 + '0';
conv[5]=(xx/10)%10+'0'; conv[7] = 0;
conv[6]=(xx)%10+'0';
conv[7]=0;
return conv; return conv;
} }
#endif //ULTRA_LCD #endif //ULTRA_LCD
...@@ -8,16 +8,20 @@ ...@@ -8,16 +8,20 @@
int lcd_strlen_P(const char *s); int lcd_strlen_P(const char *s);
void lcd_update(); void lcd_update();
void lcd_init(); void lcd_init();
void lcd_setstatus(const char* message); void lcd_setstatus(const char* message, const bool persist=false);
void lcd_setstatuspgm(const char* message); void lcd_setstatuspgm(const char* message, const uint8_t level=0);
void lcd_setalertstatuspgm(const char* message); void lcd_setalertstatuspgm(const char* message);
void lcd_reset_alert_level(); void lcd_reset_alert_level();
bool lcd_detected(void); bool lcd_detected(void);
#if defined(DOGLCD) && LCD_CONTRAST >= 0 #if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
extern int lcd_contrast; void dontExpireStatus();
void lcd_setcontrast(uint8_t value); #endif
#endif
#if defined(DOGLCD) && LCD_CONTRAST >= 0
extern int lcd_contrast;
void lcd_setcontrast(uint8_t value);
#endif
void set_pageShowInfo(int value); void set_pageShowInfo(int value);
void set_ChangeScreen(boolean state); void set_ChangeScreen(boolean state);
...@@ -54,7 +58,7 @@ ...@@ -54,7 +58,7 @@
extern bool cancel_heatup; extern bool cancel_heatup;
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) || (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY) #if (HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)) || (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY))
extern unsigned long message_millis; extern unsigned long message_millis;
#endif #endif
......
...@@ -193,10 +193,10 @@ ...@@ -193,10 +193,10 @@
#include "utf_mapper.h" #include "utf_mapper.h"
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) #ifdef LCD_PROGRESS_BAR
static uint16_t progressBarTick = 0; static uint16_t progressBarTick = 0;
#if PROGRESS_MSG_EXPIRE > 0 #if PROGRESS_MSG_EXPIRE > 0
static uint16_t messageTick = 0; static uint16_t expireStatusMillis = 0;
#endif #endif
#define LCD_STR_PROGRESS "\x03\x04\x05" #define LCD_STR_PROGRESS "\x03\x04\x05"
#endif #endif
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
#define LCD_STR_ARROW_RIGHT ">" /* from the default character set */ #define LCD_STR_ARROW_RIGHT ">" /* from the default character set */
static void lcd_set_custom_characters( static void lcd_set_custom_characters(
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) #ifdef LCD_PROGRESS_BAR
bool progress_bar_set=true bool progress_bar_set=true
#endif #endif
) { ) {
...@@ -316,7 +316,7 @@ static void lcd_set_custom_characters( ...@@ -316,7 +316,7 @@ static void lcd_set_custom_characters(
B00000 B00000
}; //thanks Sonny Mounicou }; //thanks Sonny Mounicou
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) #ifdef LCD_PROGRESS_BAR
static bool char_mode = false; static bool char_mode = false;
byte progress[3][8] = { { byte progress[3][8] = { {
B00000, B00000,
...@@ -376,9 +376,9 @@ static void lcd_set_custom_characters( ...@@ -376,9 +376,9 @@ static void lcd_set_custom_characters(
#endif #endif
} }
static void lcd_implementation_init ( static void lcd_implementation_init(
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) #ifdef LCD_PROGRESS_BAR
bool progress_bar_set = true bool progress_bar_set=true
#endif #endif
) { ) {
...@@ -404,7 +404,7 @@ static void lcd_implementation_init ( ...@@ -404,7 +404,7 @@ static void lcd_implementation_init (
#endif #endif
lcd_set_custom_characters( lcd_set_custom_characters(
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) #ifdef LCD_PROGRESS_BAR
progress_bar_set progress_bar_set
#endif #endif
); );
...@@ -594,8 +594,7 @@ static void lcd_implementation_status_screen() ...@@ -594,8 +594,7 @@ static void lcd_implementation_status_screen()
lcd.print(':'); lcd.print(':');
lcd.print(itostr2(time%60)); lcd.print(itostr2(time%60));
} }
else else {
{
lcd_printPGM(PSTR("--:--")); lcd_printPGM(PSTR("--:--"));
} }
#endif #endif
...@@ -603,7 +602,8 @@ static void lcd_implementation_status_screen() ...@@ -603,7 +602,8 @@ static void lcd_implementation_status_screen()
// Status message line at the bottom // Status message line at the bottom
lcd.setCursor(0, LCD_HEIGHT - 1); lcd.setCursor(0, LCD_HEIGHT - 1);
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) #ifdef LCD_PROGRESS_BAR
if (card.isFileOpen()) { if (card.isFileOpen()) {
uint16_t mil = millis(), diff = mil - progressBarTick; uint16_t mil = millis(), diff = mil - progressBarTick;
if (diff >= PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) { if (diff >= PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
...@@ -627,12 +627,12 @@ static void lcd_implementation_status_screen() ...@@ -627,12 +627,12 @@ static void lcd_implementation_status_screen()
#endif //LCD_PROGRESS_BAR #endif //LCD_PROGRESS_BAR
//Display both Status message line and Filament display on the last line //Display both Status message line and Filament display on the last line
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) || (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY) #if (HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)) || (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY))
if (millis() < message_millis + 5000) { //Display both Status message line and Filament display on the last line if (millis() < message_millis + 5000) { //Display both Status message line and Filament display on the last line
lcd_print(lcd_status_message); lcd_print(lcd_status_message);
} }
#if defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && (POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY) #if HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY)
#if defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && (FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) #if HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)
else if (millis() < message_millis + 10000) else if (millis() < message_millis + 10000)
#else #else
else else
...@@ -645,7 +645,7 @@ static void lcd_implementation_status_screen() ...@@ -645,7 +645,7 @@ static void lcd_implementation_status_screen()
lcd_printPGM(PSTR("Wh")); lcd_printPGM(PSTR("Wh"));
} }
#endif #endif
#if defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && (FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY) #if HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)
else { else {
lcd_printPGM(PSTR("D:")); lcd_printPGM(PSTR("D:"));
lcd.print(ftostr12ns(filament_width_meas)); lcd.print(ftostr12ns(filament_width_meas));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment