Commit 22f2ce3f authored by MagoKimbra's avatar MagoKimbra

Update

parent edcc4c13
......@@ -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.
* M49 - Z probe repetability test
* 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)
* 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.
......
......@@ -159,6 +159,31 @@
#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
*/
......@@ -184,18 +209,6 @@
#define DRIVER_EXTRUDERS EXTRUDERS // This defines the number of Driver extruder
#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
*/
......@@ -286,16 +299,14 @@
#ifndef POWER_SUPPLY
#define POWER_SUPPLY 0
#endif
// 0 = Normal - 1 = ATX
#if (POWER_SUPPLY <= 1)
#if (POWER_SUPPLY == 1) // 1 = ATX
#define PS_ON_AWAKE LOW
#define PS_ON_ASLEEP HIGH
#endif
// 2 = X-Box 360 203W
#if (POWER_SUPPLY == 2)
#elif (POWER_SUPPLY == 2) // 2 = X-Box 360 203W
#define PS_ON_AWAKE HIGH
#define PS_ON_ASLEEP LOW
#endif
#define HAS_POWER_SWITCH (POWER_SUPPLY > 0 && defined(PS_ON_PIN) && PS_ON_PIN >= 0)
/**
* Temp Sensor defines
......
......@@ -147,7 +147,7 @@
// 10 is 100k RS thermistor 198-961 (4.7k pullup)
// 11 is 100k beta 3950 1% thermistor (4.7k pullup)
// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
// 20 is the PT100 circuit found in the Ultimainboard V2.x
// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
//
......@@ -582,7 +582,7 @@ your extruder heater takes 2 minutes to hit the target on heating.
// Support for BlinkM/CyzRgb
//#define BLINKM
// Support for STEPPERS TOSHIBA
// Enable this option for Toshiba steppers
//#define CONFIG_STEPPERS_TOSHIBA
// Setting firmware for filament end switch
......
......@@ -274,7 +274,7 @@ void Config_RetrieveSettings()
void Config_ResetDefault()
{
//Setting default baudrate for serial
baudrate=BAUDRATE;
baudrate = BAUDRATE;
float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT;
float tmp2[] = DEFAULT_MAX_FEEDRATE;
......@@ -286,9 +286,9 @@ void Config_ResetDefault()
float tmp7[] = DEFAULT_Kd;
#endif // PIDTEMP
#if defined(EXTRUDER_OFFSET_X) && defined(EXTRUDER_OFFSET_Y)
float tmp8[] = EXTRUDER_OFFSET_X;
float tmp9[] = EXTRUDER_OFFSET_Y;
#if defined(HOTEND_OFFSET_X) && defined(HOTEND_OFFSET_Y)
float tmp8[] = HOTEND_OFFSET_X;
float tmp9[] = HOTEND_OFFSET_Y;
#else
float tmp8[] = {0,0,0,0};
float tmp9[] = {0,0,0,0};
......@@ -303,8 +303,8 @@ void Config_ResetDefault()
for (int i = 0; i < EXTRUDERS; i++) {
max_retraction_feedrate[i] = tmp3[i];
#if HOTENDS > 1
hotend_offset[i][X_AXIS] = tmp8[i];
hotend_offset[i][Y_AXIS] = tmp9[i];
hotend_offset[X_AXIS][i] = tmp8[i];
hotend_offset[Y_AXIS][i] = tmp9[i];
#endif
#ifdef SCARA
if (i < sizeof(axis_scaling) / sizeof(*axis_scaling))
......
......@@ -19,17 +19,7 @@
// #define ENDSTOPPULLUP_EMIN
#endif
#ifdef ENDSTOPPULLUPS
#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.
// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
......@@ -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_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_Y_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
#define INVERT_E2_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_MIN_POS 0
#define Y_MAX_POS 200
......@@ -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)
// X and Y offsets MUST be INTEGERS
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // -front +behind
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -front +behind
#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.
......@@ -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_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 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
//#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)
//Manual homing switch locations:
#define MANUAL_X_HOME_POS 0
#define MANUAL_Y_HOME_POS 0
#define MANUAL_Z_HOME_POS 0
#ifdef MANUAL_HOME_POSITIONS
#define MANUAL_X_HOME_POS 0
#define MANUAL_Y_HOME_POS 0
#define MANUAL_Z_HOME_POS 0
#endif
// MOVEMENT SETTINGS
#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
//#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES
#define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851
#define Z_PROBE_OFFSET_RANGE_MIN -15
#define Z_PROBE_OFFSET_RANGE_MAX -5
#define Z_PROBE_OFFSET_RANGE_MIN -20
#define Z_PROBE_OFFSET_RANGE_MAX 20
#endif
......@@ -19,17 +19,7 @@
// #define ENDSTOPPULLUP_EMIN
#endif
#ifdef ENDSTOPPULLUPS
#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.
// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
......@@ -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_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_Y_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
#define INVERT_E2_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_MIN_POS 0
#define Y_MAX_POS 200
......@@ -80,10 +70,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define Z_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 ===========================
//=====================================================================================
......@@ -147,8 +133,8 @@ 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)
// X and Y offsets must be integers
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // -front +behind
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -front +behind
#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.
......@@ -156,6 +142,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#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_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 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
//#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)
//Manual homing switch locations:
#define MANUAL_X_HOME_POS 0
#define MANUAL_Y_HOME_POS 0
#define MANUAL_Z_HOME_POS 0
#ifdef MANUAL_HOME_POSITIONS
#define MANUAL_X_HOME_POS 0
#define MANUAL_Y_HOME_POS 0
#define MANUAL_Z_HOME_POS 0
#endif
// MOVEMENT SETTINGS
#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
//#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES
#define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851
#define Z_PROBE_OFFSET_RANGE_MIN -15
#define Z_PROBE_OFFSET_RANGE_MAX -5
#define Z_PROBE_OFFSET_RANGE_MIN -20
#define Z_PROBE_OFFSET_RANGE_MAX 20
#endif
......@@ -43,17 +43,7 @@
// #define ENDSTOPPULLUP_ZMIN
#endif
#ifdef ENDSTOPPULLUPS
#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.
// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
......@@ -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_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_Y_DIR false
#define INVERT_Z_DIR true
......@@ -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_E3_DIR false
// Travel limits after homing
// Travel limits after homing (units are in mm)
#define X_MAX_POS 200
#define X_MIN_POS 0
#define Y_MAX_POS 200
......@@ -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 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 ===========================
//=====================================================================================
......@@ -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 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,
//it is highly recommended you let this Z_SAFE_HOMING enabled!!!
......@@ -171,8 +157,8 @@ 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)
// X and Y offsets must be integers
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // -front +behind
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -front +behind
#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.
......@@ -180,6 +166,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // 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_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 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
// 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)
//Manual homing switch locations:
// For SCARA: Offset between HomingPosition and Bed X=0 / Y=0
#ifdef MANUAL_HOME_POSITIONS
#define MANUAL_X_HOME_POS -22
#define MANUAL_Y_HOME_POS -52
#define MANUAL_Z_HOME_POS 0.1 // Distance between nozzle and print surface after homing.
#endif
// MOVEMENT SETTINGS
#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
//#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES
#define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851
#define Z_PROBE_OFFSET_RANGE_MIN -15
#define Z_PROBE_OFFSET_RANGE_MAX -5
#define Z_PROBE_OFFSET_RANGE_MIN -20
#define Z_PROBE_OFFSET_RANGE_MAX 20
#endif
......@@ -115,28 +115,27 @@
#ifdef Z_DUAL_STEPPER_DRIVERS
// Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper.
// That way the machine is capable to align the bed during home, since both Z steppers are homed.
// There is also an implementation of M666 (software endstops adjustment) to this feature.
// After Z homing, this adjustment is applied to just one of the steppers in order to align the bed.
// One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2.
// If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive.
// Play a little bit with small adjustments (0.5mm) and check the behaviour.
// The M119 (endstops report) will start reporting the Z2 Endstop as well.
#define Z_DUAL_ENDSTOPS
#ifdef Z_DUAL_ENDSTOPS
// Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper.
// That way the machine is capable to align the bed during home, since both Z steppers are homed.
// There is also an implementation of M666 (software endstops adjustment) to this feature.
// After Z homing, this adjustment is applied to just one of the steppers in order to align the bed.
// One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2.
// If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive.
// Play a little bit with small adjustments (0.5mm) and check the behaviour.
// The M119 (endstops report) will start reporting the Z2 Endstop as well.
#define Z_DUAL_ENDSTOPS
#ifdef Z_DUAL_ENDSTOPS
#define Z2_STEP_PIN E2_STEP_PIN // Stepper to be used to Z2 axis.
#define Z2_DIR_PIN E2_DIR_PIN
#define Z2_ENABLE_PIN E2_ENABLE_PIN
#define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36)
const bool Z2_MAX_ENDSTOP_INVERTING = false;
#define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis.
#endif
#endif
#endif
#endif // Z_DUAL_STEPPER_DRIVERS
// Same again but for Y Axis.
//#define Y_DUAL_STEPPER_DRIVERS
......@@ -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_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_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_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value
#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value
//#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value
//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers?
#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
#ifdef SDSUPPORT
// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted
// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT
// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should
// be commented out otherwise
#define SDCARDDETECTINVERTED
#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order.
// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that.
// using:
//#define MENU_ADDAUTOSTART
#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers?
#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
//========================= LCD PROGRESS BAR ======================
// Show a progress bar on HD44780 LCDs for SD printing
//#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.
// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that.
// using:
//#define MENU_ADDAUTOSTART
// Show a progress bar on HD44780 LCDs for SD printing
//#define LCD_PROGRESS_BAR
#ifdef LCD_PROGRESS_BAR
// Amount of time (ms) to show the bar
#define PROGRESS_BAR_BAR_TIME 2000
#define PROGRESS_BAR_BAR_TIME 5000
// Amount of time (ms) to show the status message
#define PROGRESS_BAR_MSG_TIME 3000
#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
#endif // SDSUPPORT
// 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
......@@ -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
// 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.
//#define HEATERS_PARALLEL
......
......@@ -257,7 +257,7 @@ extern float home_offset[3];
#else
#define NUM_HOTEND_OFFSETS 3 // supports offsets in XYZ plane
#endif
extern float hotend_offset[HOTENDS][NUM_HOTEND_OFFSETS];
extern float hotend_offset[NUM_HOTEND_OFFSETS][HOTENDS];
#endif // HOTENDS > 1
#ifdef NPR2
......
......@@ -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.
M49 - Z probe repetability test
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)
M83 - Set E codes relative while in Absolute Coordinates (G90) mode
M84 - Disable steppers until next move,
......@@ -265,20 +265,13 @@ float lastpos[4];
// Hotend offset
#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
#define NUM_HOTENDS_OFFSETS 2 // only in XY plane
#define NUM_HOTEND_OFFSETS 2 // only in XY plane
#else
#define NUM_HOTENDS_OFFSETS 3 // supports offsets in XYZ plane
#define NUM_HOTEND_OFFSETS 3 // supports offsets in XYZ plane
#endif
#define _EXY { HOTEND_OFFSET_X, HOTEND_OFFSET_Y }
float hotend_offset[HOTENDS][NUM_HOTENDS_OFFSETS] = ARRAY_BY_EXTRUDERS(_EXY, _EXY, _EXY, _EXY);
#endif //HOTENDS > 1
float hotend_offset[NUM_HOTEND_OFFSETS][HOTENDS];
#endif // HOTENDS > 1
uint8_t active_extruder = 0;
uint8_t active_driver = 0;
......@@ -321,13 +314,13 @@ uint8_t debugLevel = 0;
float retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
#endif //FWRETRACT
#ifdef ULTIPANEL
#if defined(ULTIPANEL) && HAS_POWER_SWITCH
#ifdef PS_DEFAULT_OFF
bool powersupply = false;
#else
bool powersupply = true;
#endif
#endif //ULTIPANEL
#endif //ULTIPANEL && HAS_POWER_SWITCH
#ifdef SCARA
float axis_scaling[3] = { 1, 1, 1 }; // Build size scaling, default to 1
......@@ -623,7 +616,7 @@ void setup_powerhold()
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
OUT_WRITE(SUICIDE_PIN, HIGH);
#endif
#if defined(PS_ON_PIN) && PS_ON_PIN > -1
#if HAS_POWER_SWITCH
#if defined(PS_DEFAULT_OFF)
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#else
......@@ -940,10 +933,10 @@ void get_command()
int hours, minutes;
minutes=(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_ECHOLN(time);
lcd_setstatus(time);
lcd_setstatus(time, true);
card.printingHasFinished();
card.checkautostart(true);
......@@ -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.
// This allow soft recalibration of the second extruder offset position without firmware reflash
// (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) {
......@@ -1051,26 +1044,36 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
#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() {
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)
static void axis_is_at_home(int axis) {
#ifdef DUAL_X_CARRIAGE
if (axis == X_AXIS) {
if (active_extruder != 0) {
current_position[X_AXIS] = x_home_pos(active_extruder);
min_pos[X_AXIS] = X2_MIN_POS;
max_pos[X_AXIS] = max(hotend_offset[1][X_AXIS], X2_MAX_POS);
max_pos[X_AXIS] = max(hotend_offset[X_AXIS][1], X2_MAX_POS);
return;
}
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
current_position[X_AXIS] = base_home_pos(X_AXIS) + home_offset[X_AXIS];
min_pos[X_AXIS] = base_min_pos(X_AXIS) + home_offset[X_AXIS];
max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + home_offset[X_AXIS],
max(hotend_offset[1][X_AXIS], X2_MAX_POS) - duplicate_extruder_x_offset);
float xoff = home_offset[X_AXIS];
current_position[X_AXIS] = base_home_pos(X_AXIS) + xoff;
min_pos[X_AXIS] = base_min_pos(X_AXIS) + xoff;
max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + xoff, max(hotend_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
return;
}
}
......@@ -1127,14 +1130,14 @@ inline void sync_plan_position() {
feedrate = homing_feedrate[Z_AXIS];
current_position[Z_AXIS] = z;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder, active_driver);
line_to_current_position();
st_synchronize();
feedrate = xy_travel_speed;
current_position[X_AXIS] = x;
current_position[Y_AXIS] = y;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder, active_driver);
line_to_current_position();
st_synchronize();
feedrate = oldFeedRate;
......@@ -1156,12 +1159,13 @@ inline void sync_plan_position() {
//corrected_position.debug("position after");
current_position[X_AXIS] = corrected_position.x;
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();
}
#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) {
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);
......@@ -1180,7 +1184,7 @@ inline void sync_plan_position() {
vector_3 corrected_position = plan_get_position();
current_position[X_AXIS] = corrected_position.x;
current_position[Y_AXIS] = corrected_position.y;
current_position[Z_AXIS] = zprobe_zoffset; // was: corrected_position.z
current_position[Z_AXIS] = corrected_position.z;
sync_plan_position();
}
......@@ -1188,12 +1192,13 @@ inline void sync_plan_position() {
#endif // AUTO_BED_LEVELING_GRID
static void run_z_probe() {
plan_bed_level_matrix.set_to_identity();
feedrate = homing_feedrate[Z_AXIS];
// move down until you find the bed
float zPosition = -10;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder, active_driver);
line_to_z(zPosition);
st_synchronize();
// we have to let the planner know where we are right now as it is not where we said to go.
......@@ -1202,7 +1207,7 @@ inline void sync_plan_position() {
// move up the retract distance
zPosition += home_retract_mm(Z_AXIS);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder, active_driver);
line_to_z(zPosition);
st_synchronize();
endstops_hit_on_purpose();
......@@ -1216,7 +1221,7 @@ inline void sync_plan_position() {
}
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();
endstops_hit_on_purpose();
......@@ -1247,13 +1252,16 @@ inline void sync_plan_position() {
}
static void engage_z_probe() {
// Engage Z Servo endstop if enabled
#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
servos[servo_endstops[Z_AXIS]].attach(0);
#endif
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2]);
#if SERVO_LEVELING
delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach();
......@@ -1263,13 +1271,21 @@ inline void sync_plan_position() {
}
static void retract_z_probe() {
// Retract Z Servo endstop if enabled
#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
servos[servo_endstops[Z_AXIS]].attach(0);
#endif
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]);
#if SERVO_LEVELING
delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach();
......@@ -1298,18 +1314,25 @@ inline void sync_plan_position() {
run_z_probe();
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
if (retract_action & ProbeRetract) retract_z_probe();
#endif // Z_PROBE_SLED
#endif
if (verbose_level > 2) {
SERIAL_PROTOCOLPGM(MSG_BED);
SERIAL_PROTOCOLPGM(" X: ");
SERIAL_PROTOCOL(x + 0.0001);
SERIAL_PROTOCOL_F(x, 3);
SERIAL_PROTOCOLPGM(" Y: ");
SERIAL_PROTOCOL(y + 0.0001);
SERIAL_PROTOCOL_F(y, 3);
SERIAL_PROTOCOLPGM(" Z: ");
SERIAL_PROTOCOL(measured_z + 0.0001);
SERIAL_PROTOCOL_F(measured_z, 3);
SERIAL_EOL;
}
return measured_z;
......@@ -1351,13 +1374,13 @@ inline void sync_plan_position() {
#endif
destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
feedrate = homing_feedrate[axis];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver);
line_to_destination();
st_synchronize();
current_position[axis] = 0;
sync_plan_position();
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();
destination[axis] = 2*home_retract_mm(axis) * axis_home_dir;
......@@ -1370,7 +1393,7 @@ inline void sync_plan_position() {
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();
#ifdef Z_DUAL_ENDSTOPS
if (axis==Z_AXIS) {
......@@ -1383,7 +1406,7 @@ inline void sync_plan_position() {
destination[axis] = fabs(z_endstop_adj);
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();
Lock_z_motor(false);
Lock_z2_motor(false);
......@@ -1435,20 +1458,20 @@ inline void sync_plan_position() {
sync_plan_position();
destination[axis] = 1.5 * max_length[axis] * axis_home_dir;
feedrate = homing_feedrate[axis];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver);
line_to_destination();
st_synchronize();
enable_endstops(false); // Ignore Z probe while moving away from the top microswitch.
current_position[axis] = 0;
sync_plan_position();
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();
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;
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();
// retrace by the amount specified in endstop_adj
......@@ -1457,7 +1480,7 @@ inline void sync_plan_position() {
enable_endstops(false); // Ignore Z probe while moving away from the top microswitch.
sync_plan_position();
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();
enable_endstops(true); // Stop ignoring Z probe while moving up to the top microswitch again.
}
......@@ -1817,7 +1840,7 @@ inline void sync_plan_position() {
destination[Y_AXIS] = 3 * max_length[Z_AXIS];
destination[Z_AXIS] = 3 * max_length[Z_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();
endstops_hit_on_purpose();
......@@ -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;
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();
endstops_hit_on_purpose();
......@@ -2329,7 +2352,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
else {
feedrate *= sqrt(pow(max_length(X_AXIS) / max_length(Y_AXIS), 2) + 1);
}
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver);
line_to_destination();
st_synchronize();
axis_is_at_home(X_AXIS);
......@@ -2337,7 +2360,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
sync_plan_position();
destination[X_AXIS] = current_position[X_AXIS];
destination[Y_AXIS] = current_position[Y_AXIS];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver);
line_to_destination();
feedrate = 0.0;
st_synchronize();
endstops_hit_on_purpose();
......@@ -2596,6 +2619,15 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
#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.
* 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) {
*/
inline void gcode_G29() {
// Prevent user from running a G29 without first homing in X and Y
if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) {
LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN);
return;
}
// Prevent leveling without first homing in X and Y
if (!can_run_bed_leveling()) return;
int verbose_level = 1;
......@@ -2715,10 +2742,11 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
st_synchronize();
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();
//corrected_position.debug("position before G29");
plan_bed_level_matrix.set_to_identity();
vector_3 uncorrected_position = plan_get_position();
// uncorrected_position.debug("position during G29");
......@@ -2778,7 +2806,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
// raise extruder
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
ProbeAction act;
......@@ -2801,6 +2829,11 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
eqnAMatrix[probePointCounter + 2 * abl2] = 1;
probePointCounter++;
manage_heater();
manage_inactivity();
lcd_update();
} //xProbe
} //yProbe
......@@ -3484,9 +3517,13 @@ inline void gcode_G92() {
if (starpos != NULL) *(starpos) = '\0';
while (*src == ' ') ++src;
if (!hasP && !hasS && *src != '\0')
lcd_setstatus(src);
else
lcd_setstatus(src, true);
else {
LCD_MESSAGEPGM(MSG_USERWAIT);
#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
dontExpireStatus();
#endif
}
lcd_ignore_click();
st_synchronize();
......@@ -3864,7 +3901,7 @@ inline void gcode_M42() {
//SERIAL_ECHOPAIR("starting radius: ",radius);
//SERIAL_ECHOPAIR(" theta: ",theta);
//SERIAL_ECHOPAIR(" direction: ",rotational_direction);
//SERIAL_PROTOCOLLNPGM("");
//SERIAL_EOL;
float dir = rotational_direction ? 1 : -1;
for (l = 0; l < n_legs - 1; l++) {
......@@ -3883,7 +3920,7 @@ inline void gcode_M42() {
if (verbose_level > 3) {
SERIAL_ECHOPAIR("x: ", X_current);
SERIAL_ECHOPAIR("y: ", Y_current);
SERIAL_PROTOCOLLNPGM("");
SERIAL_EOL;
}
do_blocking_move_to( X_current, Y_current, Z_current );
......@@ -3959,7 +3996,7 @@ inline void gcode_M42() {
}
#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
inline void gcode_M80() {
OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE); //GND
......@@ -3977,9 +4014,13 @@ inline void gcode_M42() {
lcd_update();
#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() {
disable_heater();
st_synchronize();
......@@ -3993,11 +4034,13 @@ inline void gcode_M81() {
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
st_synchronize();
suicide();
#elif defined(PS_ON_PIN) && PS_ON_PIN > -1
#elif HAS_POWER_SWITCH
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#endif
#ifdef ULTIPANEL
#if HAS_POWER_SWITCH
powersupply = false;
#endif
LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF ".");
lcd_update();
#endif
......@@ -4512,23 +4555,23 @@ inline void gcode_M206() {
inline void gcode_M218() {
if (setTargetedHotend(218)) return;
if (code_seen('X')) hotend_offset[tmp_extruder][X_AXIS] = code_value();
if (code_seen('Y')) hotend_offset[tmp_extruder][Y_AXIS] = code_value();
if (code_seen('X')) hotend_offset[X_AXIS][tmp_extruder] = code_value();
if (code_seen('Y')) hotend_offset[Y_AXIS][tmp_extruder] = code_value();
#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
SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
for (tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++) {
SERIAL_ECHO(" ");
SERIAL_ECHO(hotend_offset[tmp_extruder][X_AXIS]);
SERIAL_ECHO(hotend_offset[X_AXIS][tmp_extruder]);
SERIAL_ECHO(",");
SERIAL_ECHO(hotend_offset[tmp_extruder][Y_AXIS]);
SERIAL_ECHO(hotend_offset[Y_AXIS][tmp_extruder]);
#ifdef DUAL_X_CARRIAGE
SERIAL_ECHO(",");
SERIAL_ECHO(hotend_offset[tmp_extruder][Z_AXIS]);
SERIAL_ECHO(hotend_offset[Z_AXIS][tmp_extruder]);
#endif
}
SERIAL_EOL;
......@@ -5155,13 +5198,13 @@ inline void gcode_M503() {
SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
SERIAL_ECHO(" ");
SERIAL_ECHO(extruder_offset[0][X_AXIS]);
SERIAL_ECHO(hotend_offset[X_AXIS][0]);
SERIAL_ECHO(",");
SERIAL_ECHO(extruder_offset[0][Y_AXIS]);
SERIAL_ECHO(hotend_offset[Y_AXIS][0]);
SERIAL_ECHO(" ");
SERIAL_ECHO(duplicate_extruder_x_offset);
SERIAL_ECHO(",");
SERIAL_ECHOLN(extruder_offset[1][Y_AXIS]);
SERIAL_ECHOLN(hotend_offset[Y_AXIS][1]);
break;
case DXC_FULL_CONTROL_MODE:
case DXC_AUTO_PARK_MODE:
......@@ -5405,11 +5448,11 @@ inline void gcode_T() {
// apply Y & Z extruder offset (x offset is already used in determining home pos)
current_position[Y_AXIS] = current_position[Y_AXIS] -
hotend_offset[active_extruder][Y_AXIS] +
hotend_offset[tmp_extruder][Y_AXIS];
hotend_offset[Y_AXIS][active_extruder] +
hotend_offset[Y_AXIS][tmp_extruder];
current_position[Z_AXIS] = current_position[Z_AXIS] -
hotend_offset[active_extruder][Z_AXIS] +
hotend_offset[tmp_extruder][Z_AXIS];
hotend_offset[Z_AXIS][active_extruder] +
hotend_offset[Z_AXIS][tmp_extruder];
active_extruder = tmp_extruder;
......@@ -5440,7 +5483,7 @@ inline void gcode_T() {
// Offset hotend (only by XY)
#if HOTENDS > 1
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
#if defined(MKR4) && (EXTRUDERS > 1)
......@@ -5705,12 +5748,12 @@ void process_commands() {
gcode_M49(); break;
#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
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;
case 82:
gcode_M82(); break;
......@@ -6180,7 +6223,7 @@ void prepare_move()
#if ! (defined DELTA || defined SCARA)
// Do not use feedmultiply for E or Z only moves
if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) {
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver);
line_to_destination();
}
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);
......
......@@ -17,8 +17,11 @@
* Progress Bar
*/
#ifdef LCD_PROGRESS_BAR
#ifndef SDSUPPORT
#error LCD_PROGRESS_BAR requires SDSUPPORT.
#endif
#ifdef DOGLCD
#warning LCD_PROGRESS_BAR does not apply to graphical displays.
#error LCD_PROGRESS_BAR does not apply to graphical displays.
#endif
#ifdef FILAMENT_LCD_DISPLAY
#error LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both.
......
......@@ -358,12 +358,12 @@ static void lcd_implementation_status_screen() {
#else
u8g.setPrintPos(0,63);
#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
lcd_print(lcd_status_message);
}
#if (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY)
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY)
#if HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY)
#if HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)
else if (millis() < message_millis + 10000)
#else
else
......@@ -376,7 +376,7 @@ static void lcd_implementation_status_screen() {
lcd_printPGM(PSTR("Wh"));
}
#endif
#if (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY)
#if HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)
else {
lcd_printPGM(PSTR("D:"));
lcd_print(ftostr12ns(filament_width_meas));
......
......@@ -150,6 +150,9 @@
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#define MSG_END_HOUR "hours"
#define MSG_END_MINUTE "minutes"
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
......
......@@ -146,6 +146,9 @@
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#define MSG_END_HOUR "ore"
#define MSG_END_MINUTE "minuti"
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Calibraz. Delta"
#define MSG_DELTA_CALIBRATE_X "Calibra X"
......
......@@ -441,7 +441,9 @@ ISR(TIMER1_COMPA_vect) {
{
current_block = NULL;
plan_discard_current_block();
#ifdef SD_FINISHED_RELEASECOMMAND
if ((cleaning_buffer_counter == 1) && (SD_FINISHED_STEPPERRELEASE)) enquecommands_P(PSTR(SD_FINISHED_RELEASECOMMAND));
#endif
cleaning_buffer_counter--;
OCR1A = 200;
return;
......@@ -564,74 +566,98 @@ ISR(TIMER1_COMPA_vect) {
}
if (TEST(out_bits, Z_AXIS)) { // -direction
Z_APPLY_DIR(INVERT_Z_DIR,0);
count_direction[Z_AXIS] = -1;
if (check_endstops)
{
#if defined(Z_MIN_PIN) && Z_MIN_PIN > -1
#ifndef Z_DUAL_ENDSTOPS
UPDATE_ENDSTOP(z, Z, min, MIN);
#else
bool z_min_endstop=(READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
#if defined(Z2_MIN_PIN) && Z2_MIN_PIN > -1
bool z2_min_endstop=(READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING);
if (check_endstops) {
#if defined(Z_MIN_PIN) && Z_MIN_PIN >= 0
#ifdef Z_DUAL_ENDSTOPS
bool z_min_endstop = READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING,
z2_min_endstop =
#if defined(Z2_MIN_PIN) && Z2_MIN_PIN >= 0
READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING
#else
bool z2_min_endstop=z_min_endstop;
z_min_endstop
#endif
if(((z_min_endstop && old_z_min_endstop) || (z2_min_endstop && old_z2_min_endstop)) && (current_block->steps[Z_AXIS] > 0))
{
;
bool z_min_both = z_min_endstop && old_z_min_endstop,
z2_min_both = z2_min_endstop && old_z2_min_endstop;
if ((z_min_both || z2_min_both) && current_block->steps[Z_AXIS] > 0) {
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_z_hit=true;
if (!(performing_homing) || ((performing_homing)&&(z_min_endstop && old_z_min_endstop)&&(z2_min_endstop && old_z2_min_endstop))) //if not performing home or if both endstops were trigged during homing...
{
endstop_z_hit = true;
if (!performing_homing || (performing_homing && z_min_both && z2_min_both)) //if not performing home or if both endstops were trigged during homing...
step_events_completed = current_block->step_event_count;
}
}
old_z_min_endstop = z_min_endstop;
old_z2_min_endstop = z2_min_endstop;
#endif
#endif
}
#else // !Z_DUAL_ENDSTOPS
UPDATE_ENDSTOP(z, Z, min, MIN);
#endif // !Z_DUAL_ENDSTOPS
#endif // Z_MIN_PIN
} // check_endstops
}
else { // +direction
Z_APPLY_DIR(!INVERT_Z_DIR,0);
count_direction[Z_AXIS] = 1;
if (check_endstops) {
#if defined(Z_MAX_PIN) && Z_MAX_PIN >= 0
#ifndef Z_DUAL_ENDSTOPS
UPDATE_ENDSTOP(z, Z, max, MAX);
#else
bool z_max_endstop=(READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING);
#if defined(Z2_MAX_PIN) && Z2_MAX_PIN > -1
bool z2_max_endstop=(READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING);
#ifdef Z_DUAL_ENDSTOPS
bool z_max_endstop = READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING,
z2_max_endstop =
#if defined(Z2_MAX_PIN) && Z2_MAX_PIN >= 0
READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING
#else
bool z2_max_endstop=z_max_endstop;
z_max_endstop
#endif
if(((z_max_endstop && old_z_max_endstop) || (z2_max_endstop && old_z2_max_endstop)) && (current_block->steps[Z_AXIS] > 0))
{
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_z_hit=true;
;
// if (z_max_endstop && old_z_max_endstop) SERIAL_ECHOLN("z_max_endstop = true");
// if (z2_max_endstop && old_z2_max_endstop) SERIAL_ECHOLN("z2_max_endstop = true");
bool z_max_both = z_max_endstop && old_z_max_endstop,
z2_max_both = z2_max_endstop && old_z2_max_endstop;
if ((z_max_both || z2_max_both) && current_block->steps[Z_AXIS] > 0) {
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_z_hit = true;
// if (z_max_both) SERIAL_ECHOLN("z_max_endstop = true");
// if (z2_max_both) SERIAL_ECHOLN("z2_max_endstop = true");
if (!(performing_homing) || ((performing_homing)&&(z_max_endstop && old_z_max_endstop)&&(z2_max_endstop && old_z2_max_endstop))) //if not performing home or if both endstops were trigged during homing...
{
if (!performing_homing || (performing_homing && z_max_both && z2_max_both)) //if not performing home or if both endstops were trigged during homing...
step_events_completed = current_block->step_event_count;
}
}
old_z_max_endstop = z_max_endstop;
old_z2_max_endstop = z2_max_endstop;
#endif
#endif
}
}
#else // !Z_DUAL_ENDSTOPS
UPDATE_ENDSTOP(z, Z, max, MAX);
#endif // !Z_DUAL_ENDSTOPS
#endif // Z_MAX_PIN
} // check_endstops
} // +direction
#ifndef ADVANCE
if (TEST(out_bits, E_AXIS)) { // -direction
REV_E_DIR();
count_direction[E_AXIS]=-1;
count_direction[E_AXIS] = -1;
#ifdef NPR2
if (check_endstops) {
#if defined(E_MIN_PIN) && E_MIN_PIN > -1
......@@ -648,12 +674,12 @@ ISR(TIMER1_COMPA_vect) {
}
else { // +direction
NORM_E_DIR();
count_direction[E_AXIS]=1;
count_direction[E_AXIS] = 1;
}
#endif //!ADVANCE
// Take multiple steps per interrupt (For high speed moves)
for (int8_t i=0; i < step_loops; i++) {
for (int8_t i = 0; i < step_loops; i++) {
#ifndef AT90USB
MSerial.checkRx(); // Check for serial chars.
#endif
......@@ -856,6 +882,7 @@ ISR(TIMER1_COMPA_vect) {
}
}
#endif
}
}
#endif // ADVANCE
......
......@@ -33,7 +33,7 @@ int gumPreheatFanSpeed;
const long baudrates[] = {9600,14400,19200,28800,38400,56000,115200,250000};
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;
#endif
......@@ -58,7 +58,9 @@ static void lcd_status_screen();
#ifdef ULTIPANEL
#if HAS_POWER_SWITCH
extern bool powersupply;
#endif
static float manual_feedrate[] = MANUAL_FEEDRATE;
static void lcd_main_menu();
static void lcd_tune_menu();
......@@ -143,7 +145,6 @@ static void lcd_status_screen();
if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \
uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
bool wasClicked = LCD_CLICKED, itemSelected; \
if (wasClicked) lcd_quick_feedback(); \
for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
_menuItemNr = 0;
......@@ -174,6 +175,7 @@ static void lcd_status_screen();
if (lcdDrawUpdate) \
lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \
if (wasClicked && itemSelected) { \
lcd_quick_feedback(); \
menu_action_ ## type(args); \
return; \
} \
......@@ -261,7 +263,7 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool
if (feedback) lcd_quick_feedback();
// For LCD_PROGRESS_BAR re-initialize the custom characters
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD)
#ifdef LCD_PROGRESS_BAR
lcd_set_custom_characters(menu == lcd_status_screen);
#endif
}
......@@ -271,29 +273,32 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool
static void lcd_status_screen()
{
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
if (mil > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
progressBarTick = mil;
if (ms > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
progressBarTick = ms;
}
#endif
#if PROGRESS_MSG_EXPIRE > 0
// keep the message alive if paused, count down otherwise
if (messageTick > 0) {
// Handle message expire
if (expireStatusMillis > 0) {
if (card.isFileOpen()) {
// Expire the message when printing is active
if (IS_SD_PRINTING) {
if ((mil-messageTick) >= PROGRESS_MSG_EXPIRE) {
// Expire the message when printing is active
if (ms >= expireStatusMillis) {
lcd_status_message[0] = '\0';
messageTick = 0;
expireStatusMillis = 0;
}
}
else {
messageTick += LCD_UPDATE_INTERVAL;
expireStatusMillis += LCD_UPDATE_INTERVAL;
}
}
else {
messageTick = 0;
expireStatusMillis = 0;
}
}
#endif
......@@ -333,12 +338,12 @@ static void lcd_status_screen()
{
lcd_goto_menu(lcd_main_menu);
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD)
#ifdef LCD_PROGRESS_BAR
currentMenu == lcd_status_screen
#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 (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 (HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)) && (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY))
if (millis() > message_millis + 15000)
#else
if (millis() > message_millis + 10000)
......@@ -396,7 +401,7 @@ static void lcd_sdcard_stop() {
card.closefile();
autotempShutdown();
cancel_heatup = true;
lcd_setstatus(MSG_PRINT_ABORTED);
lcd_setstatus(MSG_PRINT_ABORTED, true);
}
/* Menu implementation */
......@@ -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_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
void lcd_preheat_pla1() { _lcd_preheat(1, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
void lcd_preheat_abs1() { _lcd_preheat(1, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
......@@ -578,7 +585,6 @@ void lcd_preheat_gum0() { _lcd_preheat(0, gumPreheatHotendTemp, gumPreheatHPBTem
void lcd_preheat_gum3() { _lcd_preheat(3, gumPreheatHotendTemp, gumPreheatHPBTemp, gumPreheatFanSpeed); }
#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() {
setTargetHotend0(plaPreheatHotendTemp);
setTargetHotend1(plaPreheatHotendTemp);
......@@ -799,14 +805,13 @@ static void lcd_prepare_menu() {
MENU_ITEM(function, MSG_PURGE_XMM, lcd_purge);
MENU_ITEM(function, MSG_RETRACT_XMM, lcd_retract);
#endif // EASY_LOAD
#if defined(POWER_SUPPLY) && POWER_SUPPLY > 0 && defined(PS_ON_PIN) && PS_ON_PIN > -1
if (powersupply) {
#if HAS_POWER_SWITCH
if (powersupply)
MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81"));
}
else {
else
MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80"));
}
#endif
MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
END_MENU();
}
......@@ -1362,10 +1367,10 @@ static void lcd_quick_feedback() {
#elif defined(BEEPER) && BEEPER > -1
SET_OUTPUT(BEEPER);
#ifndef LCD_FEEDBACK_FREQUENCY_HZ
#define LCD_FEEDBACK_FREQUENCY_HZ 500
#define LCD_FEEDBACK_FREQUENCY_HZ 5000
#endif
#ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 50
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
#endif
const unsigned int delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2;
int i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000;
......@@ -1489,7 +1494,7 @@ void lcd_update() {
lcdDrawUpdate = 2;
lcd_oldcardstatus = IS_SD_INSERTED;
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD)
#ifdef LCD_PROGRESS_BAR
currentMenu == lcd_status_screen
#endif
);
......@@ -1552,7 +1557,7 @@ void lcd_update() {
}
lastEncoderMovementMillis = ms;
}
} // encoderRateMultiplierEnabled
#endif //ENCODER_RATE_MULTIPLIER
lcdDrawUpdate = 1;
......@@ -1602,7 +1607,7 @@ void lcd_ignore_click(bool b) {
wait_for_unclick = false;
}
void lcd_finishstatus() {
void lcd_finishstatus(bool persist=false) {
int len = lcd_strlen(lcd_status_message);
if (len > 0) {
while (len < LCD_WIDTH) {
......@@ -1610,30 +1615,39 @@ void lcd_finishstatus() {
}
}
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
messageTick =
expireStatusMillis = persist ? 0 : progressBarTick + PROGRESS_MSG_EXPIRE;
#endif
progressBarTick = millis();
#endif
lcdDrawUpdate = 2;
#ifdef FILAMENT_LCD_DISPLAY
message_millis = millis(); //get status message to show up for a while
#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;
strncpy(lcd_status_message, message, LCD_WIDTH);
lcd_finishstatus();
lcd_finishstatus(persist);
}
void lcd_setstatuspgm(const char* message) {
if (lcd_status_message_level > 0) return;
void lcd_setstatuspgm(const char* message, uint8_t level) {
if (level >= lcd_status_message_level) {
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) {
lcd_setstatuspgm(message);
lcd_status_message_level = 1;
lcd_setstatuspgm(message, 1);
#ifdef ULTIPANEL
lcd_return_to_status();
#endif
......@@ -1750,70 +1764,62 @@ bool lcd_clicked() { return LCD_CLICKED; }
#endif //ULTIPANEL
/********************************/
/** Float conversion utilities **/
/********************************/
// convert float to string with +123.4 format
/*********************************/
/** Number to string conversion **/
/*********************************/
char conv[8];
char *ftostr3(const float &x)
{
// Convert float to string with +123.4 format
char *ftostr3(const float &x) {
return itostr3((int)x);
}
char *itostr2(const uint8_t &x)
{
// Convert int to string with 12 format
char *itostr2(const uint8_t &x) {
//sprintf(conv,"%5.1f",x);
int xx=x;
conv[0]=(xx/10)%10+'0';
conv[1]=(xx)%10+'0';
conv[2]=0;
int xx = x;
conv[0] = (xx / 10) % 10 + '0';
conv[1] = xx % 10 + '0';
conv[2] = 0;
return conv;
}
// Convert float to string with 123.4 format, dropping sign
char *ftostr31(const float &x)
{
int xx=x*10;
conv[0]=(xx>=0)?'+':'-';
xx=abs(xx);
conv[1]=(xx/1000)%10+'0';
conv[2]=(xx/100)%10+'0';
conv[3]=(xx/10)%10+'0';
conv[4]='.';
conv[5]=(xx)%10+'0';
conv[6]=0;
// Convert float to string with +123.4 format
char *ftostr31(const float &x) {
int xx = abs(x * 10);
conv[0] = (x >= 0) ? '+' : '-';
conv[1] = (xx / 1000) % 10 + '0';
conv[2] = (xx / 100) % 10 + '0';
conv[3] = (xx / 10) % 10 + '0';
conv[4] = '.';
conv[5] = xx % 10 + '0';
conv[6] = 0;
return conv;
}
// Convert float to string with 123.4 format
char *ftostr31ns(const float &x)
{
int xx=x*10;
//conv[0]=(xx>=0)?'+':'-';
xx=abs(xx);
conv[0]=(xx/1000)%10+'0';
conv[1]=(xx/100)%10+'0';
conv[2]=(xx/10)%10+'0';
conv[3]='.';
conv[4]=(xx)%10+'0';
conv[5]=0;
// Convert float to string with 123.4 format, dropping sign
char *ftostr31ns(const float &x) {
int xx = abs(x * 10);
conv[0] = (xx / 1000) % 10 + '0';
conv[1] = (xx / 100) % 10 + '0';
conv[2] = (xx / 10) % 10 + '0';
conv[3] = '.';
conv[4] = xx % 10 + '0';
conv[5] = 0;
return conv;
}
char *ftostr32(const float &x)
{
long xx=x*100;
if (xx >= 0)
conv[0]=(xx/10000)%10+'0';
else
conv[0]='-';
xx=abs(xx);
conv[1]=(xx/1000)%10+'0';
conv[2]=(xx/100)%10+'0';
conv[3]='.';
conv[4]=(xx/10)%10+'0';
conv[5]=(xx)%10+'0';
conv[6]=0;
// Convert float to string with 123.4 format
char *ftostr32(const float &x) {
long xx = abs(x * 100);
conv[0] = x >= 0 ? (xx / 10000) % 10 + '0' : '-';
conv[1] = (xx / 1000) % 10 + '0';
conv[2] = (xx / 100) % 10 + '0';
conv[3] = '.';
conv[4] = (xx / 10) % 10 + '0';
conv[5] = xx % 10 + '0';
conv[6] = 0;
return conv;
}
......@@ -1834,7 +1840,7 @@ char *ftostr43(const float &x)
return conv;
}
//Float to string with 1.23 format
// Convert float to string with 1.23 format
char *ftostr12ns(const float &x)
{
long xx=x*100;
......@@ -1848,7 +1854,7 @@ char *ftostr12ns(const float &x)
return conv;
}
// convert float to space-padded string with -_23.4_ format
// Convert float to space-padded string with -_23.4_ format
char *ftostr32sp(const float &x) {
long xx = abs(x * 100);
uint8_t dig;
......@@ -1894,58 +1900,51 @@ char *ftostr32sp(const float &x) {
return conv;
}
char *itostr31(const int &xx)
{
conv[0]=(xx>=0)?'+':'-';
conv[1]=(xx/1000)%10+'0';
conv[2]=(xx/100)%10+'0';
conv[3]=(xx/10)%10+'0';
conv[4]='.';
conv[5]=(xx)%10+'0';
conv[6]=0;
// Convert int to lj string with +123.0 format
char *itostr31(const int &x) {
conv[0] = x >= 0 ? '+' : '-';
int xx = abs(x);
conv[1] = (xx / 100) % 10 + '0';
conv[2] = (xx / 10) % 10 + '0';
conv[3] = xx % 10 + '0';
conv[4] = '.';
conv[5] = '0';
conv[6] = 0;
return conv;
}
// Convert int to rj string with 123 or -12 format
char *itostr3(const int &x)
{
char *itostr3(const int &x) {
int xx = x;
if (xx < 0) {
conv[0]='-';
conv[0] = '-';
xx = -xx;
} else if (xx >= 100)
conv[0]=(xx/100)%10+'0';
else
conv[0]=' ';
if (xx >= 10)
conv[1]=(xx/10)%10+'0';
}
else
conv[1]=' ';
conv[2]=(xx)%10+'0';
conv[3]=0;
conv[0] = xx >= 100 ? (xx / 100) % 10 + '0' : ' ';
conv[1] = xx >= 10 ? (xx / 10) % 10 + '0' : ' ';
conv[2] = xx % 10 + '0';
conv[3] = 0;
return conv;
}
// Convert int to lj string with 123 format
char *itostr3left(const int &xx)
{
if (xx >= 100)
{
conv[0]=(xx/100)%10+'0';
conv[1]=(xx/10)%10+'0';
conv[2]=(xx)%10+'0';
conv[3]=0;
char *itostr3left(const int &xx) {
if (xx >= 100) {
conv[0] = (xx / 100) % 10 + '0';
conv[1] = (xx / 10) % 10 + '0';
conv[2] = xx % 10 + '0';
conv[3] = 0;
}
else if (xx >= 10) {
conv[0] = (xx / 10) % 10 + '0';
conv[1] = xx % 10 + '0';
conv[2] = 0;
}
else if (xx >= 10)
{
conv[0]=(xx/10)%10+'0';
conv[1]=(xx)%10+'0';
conv[2]=0;
}
else
{
conv[0]=(xx)%10+'0';
conv[1]=0;
else {
conv[0] = xx % 10 + '0';
conv[1] = 0;
}
return conv;
}
......@@ -1960,8 +1959,7 @@ char *itostr4(const int &xx) {
return conv;
}
char *ltostr7(const long &xx)
{
char *ltostr7(const long &xx) {
if (xx >= 1000000)
conv[0]=(xx/1000000)%10+'0';
else
......@@ -1992,8 +1990,7 @@ char *ltostr7(const long &xx)
}
// convert float to string with +123 format
char *ftostr30(const float &x)
{
char *ftostr30(const float &x) {
int xx=x;
conv[0]=(xx>=0)?'+':'-';
xx=abs(xx);
......@@ -2017,35 +2014,32 @@ char *ftostr5(const float &x) {
}
// Convert float to string with +1234.5 format
char *ftostr51(const float &x)
{
long xx=x*10;
conv[0]=(xx>=0)?'+':'-';
xx=abs(xx);
conv[1]=(xx/10000)%10+'0';
conv[2]=(xx/1000)%10+'0';
conv[3]=(xx/100)%10+'0';
conv[4]=(xx/10)%10+'0';
conv[5]='.';
conv[6]=(xx)%10+'0';
conv[7]=0;
char *ftostr51(const float &x) {
long xx = abs(x * 10);
conv[0] = (x >= 0) ? '+' : '-';
conv[1] = (xx / 10000) % 10 + '0';
conv[2] = (xx / 1000) % 10 + '0';
conv[3] = (xx / 100) % 10 + '0';
conv[4] = (xx / 10) % 10 + '0';
conv[5] = '.';
conv[6] = xx % 10 + '0';
conv[7] = 0;
return conv;
}
// Convert float to string with +123.45 format
char *ftostr52(const float &x)
{
long xx=x*100;
conv[0]=(xx>=0)?'+':'-';
xx=abs(xx);
conv[1]=(xx/10000)%10+'0';
conv[2]=(xx/1000)%10+'0';
conv[3]=(xx/100)%10+'0';
conv[4]='.';
conv[5]=(xx/10)%10+'0';
conv[6]=(xx)%10+'0';
conv[7]=0;
char *ftostr52(const float &x) {
conv[0] = (x >= 0) ? '+' : '-';
long xx = abs(x * 100);
conv[1] = (xx / 10000) % 10 + '0';
conv[2] = (xx / 1000) % 10 + '0';
conv[3] = (xx / 100) % 10 + '0';
conv[4] = '.';
conv[5] = (xx / 10) % 10 + '0';
conv[6] = xx % 10 + '0';
conv[7] = 0;
return conv;
}
#endif //ULTRA_LCD
......@@ -8,16 +8,20 @@
int lcd_strlen_P(const char *s);
void lcd_update();
void lcd_init();
void lcd_setstatus(const char* message);
void lcd_setstatuspgm(const char* message);
void lcd_setstatus(const char* message, const bool persist=false);
void lcd_setstatuspgm(const char* message, const uint8_t level=0);
void lcd_setalertstatuspgm(const char* message);
void lcd_reset_alert_level();
bool lcd_detected(void);
#if defined(DOGLCD) && LCD_CONTRAST >= 0
#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
void dontExpireStatus();
#endif
#if defined(DOGLCD) && LCD_CONTRAST >= 0
extern int lcd_contrast;
void lcd_setcontrast(uint8_t value);
#endif
#endif
void set_pageShowInfo(int value);
void set_ChangeScreen(boolean state);
......@@ -54,7 +58,7 @@
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;
#endif
......
......@@ -193,10 +193,10 @@
#include "utf_mapper.h"
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
#ifdef LCD_PROGRESS_BAR
static uint16_t progressBarTick = 0;
#if PROGRESS_MSG_EXPIRE > 0
static uint16_t messageTick = 0;
static uint16_t expireStatusMillis = 0;
#endif
#define LCD_STR_PROGRESS "\x03\x04\x05"
#endif
......@@ -214,7 +214,7 @@
#define LCD_STR_ARROW_RIGHT ">" /* from the default character set */
static void lcd_set_custom_characters(
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
#ifdef LCD_PROGRESS_BAR
bool progress_bar_set=true
#endif
) {
......@@ -316,7 +316,7 @@ static void lcd_set_custom_characters(
B00000
}; //thanks Sonny Mounicou
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
#ifdef LCD_PROGRESS_BAR
static bool char_mode = false;
byte progress[3][8] = { {
B00000,
......@@ -376,9 +376,9 @@ static void lcd_set_custom_characters(
#endif
}
static void lcd_implementation_init (
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
bool progress_bar_set = true
static void lcd_implementation_init(
#ifdef LCD_PROGRESS_BAR
bool progress_bar_set=true
#endif
) {
......@@ -404,7 +404,7 @@ static void lcd_implementation_init (
#endif
lcd_set_custom_characters(
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
#ifdef LCD_PROGRESS_BAR
progress_bar_set
#endif
);
......@@ -594,8 +594,7 @@ static void lcd_implementation_status_screen()
lcd.print(':');
lcd.print(itostr2(time%60));
}
else
{
else {
lcd_printPGM(PSTR("--:--"));
}
#endif
......@@ -603,7 +602,8 @@ static void lcd_implementation_status_screen()
// Status message line at the bottom
lcd.setCursor(0, LCD_HEIGHT - 1);
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
#ifdef LCD_PROGRESS_BAR
if (card.isFileOpen()) {
uint16_t mil = millis(), diff = mil - progressBarTick;
if (diff >= PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
......@@ -627,12 +627,12 @@ static void lcd_implementation_status_screen()
#endif //LCD_PROGRESS_BAR
//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
lcd_print(lcd_status_message);
}
#if defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && (POWER_CONSUMPTION_PIN >= 0) && defined(POWER_CONSUMPTION_LCD_DISPLAY)
#if defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && (FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY)
#if HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY)
#if HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)
else if (millis() < message_millis + 10000)
#else
else
......@@ -645,7 +645,7 @@ static void lcd_implementation_status_screen()
lcd_printPGM(PSTR("Wh"));
}
#endif
#if defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && (FILWIDTH_PIN >= 0) && defined(FILAMENT_LCD_DISPLAY)
#if HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)
else {
lcd_printPGM(PSTR("D:"));
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