Commit 768a1272 authored by MagoKimbra's avatar MagoKimbra

Update

parent 7bd1de66
#ifndef CONFIGURATION_H #ifndef CONFIGURATION_H
#define CONFIGURATION_H #define CONFIGURATION_H
// This configuration file contains basic settings. Select your: #include "boards.h"
// - board type #include "macros.h"
// - Mechanism type (cartesian-corexy-delta-scara)
// - temperature sensor type
//
// Mechanisms-settings can be found in configuration_xxxxxx.h
// Advanced settings can be found in Configuration_adv.h
//===========================================================================
//============================= Getting Started =============================
//===========================================================================
#include "boards.h" /*
// Choose your board type. * This configuration file contains basic settings. Select your:
// Either an numeric ID or name defined in boards.h is valid. * - board type
// See: https://github.com/MagoKimbra/MarlinKimbra/blob/master/Documentation/Hardware.md * - Mechanism type (cartesian-corexy-delta-scara)
* - temperature sensor type
*
* Mechanisms-settings can be found in configuration_xxxxxx.h
* Advanced settings can be found in Configuration_adv.h
*/
/*
* Choose your board type.
* Either an numeric ID or name defined in boards.h is valid.
* See: https://github.com/MagoKimbra/MarlinKimbra/blob/master/Documentation/Hardware.md
*/
#define MOTHERBOARD BOARD_RAMPS_13_EFB #define MOTHERBOARD BOARD_RAMPS_13_EFB
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during
...@@ -57,13 +65,13 @@ ...@@ -57,13 +65,13 @@
/***********************************************************************\ /***********************************************************************\
********************** Do not touch this section ********************** ********************** Do not touch this section **********************
***********************************************************************/ ***********************************************************************/
#if defined(CARTESIAN) #if ENABLED(CARTESIAN)
#include "Configuration_Cartesian.h" #include "Configuration_Cartesian.h"
#elif defined(COREXY) #elif ENABLED(COREXY)
#include "Configuration_Corexy.h" #include "Configuration_Corexy.h"
#elif defined(DELTA) #elif ENABLED(DELTA)
#include "Configuration_Delta.h" #include "Configuration_Delta.h"
#elif defined(SCARA) #elif ENABLED(SCARA)
#include "Configuration_Scara.h" #include "Configuration_Scara.h"
#endif #endif
/***********************************************************************/ /***********************************************************************/
...@@ -594,7 +602,7 @@ ...@@ -594,7 +602,7 @@
//#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament //#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
// It is assumed that when logic high = filament available // It is assumed that when logic high = filament available
// when logic low = filament run out // when logic low = filament run out
#ifdef FILAMENT_RUNOUT_SENSOR #if ENABLED(FILAMENT_RUNOUT_SENSOR)
const bool FILRUNOUT_PIN_INVERTING = true; // Should be uncommented and true or false should assigned const bool FILRUNOUT_PIN_INVERTING = true; // Should be uncommented and true or false should assigned
#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined. #define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
#define FILAMENT_RUNOUT_SCRIPT "M600" // Script execute when filament run out #define FILAMENT_RUNOUT_SCRIPT "M600" // Script execute when filament run out
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// coarse Endstop Settings // coarse Endstop Settings
#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
#ifndef ENDSTOPPULLUPS #if DISABLED(ENDSTOPPULLUPS)
// fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
// #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_XMAX
// #define ENDSTOPPULLUP_YMAX // #define ENDSTOPPULLUP_YMAX
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
//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!!!
//#define Z_SAFE_HOMING //#define Z_SAFE_HOMING
#ifdef Z_SAFE_HOMING #if ENABLED(Z_SAFE_HOMING)
#define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2) // X point for Z homing when homing all axis (G28) or homing Z #define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2) // X point for Z homing when homing all axis (G28) or homing Z
#define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28) or homing Z #define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28) or homing Z
#endif #endif
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (ABL) //#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (ABL)
//#define Z_PROBE_REPEATABILITY_TEST // Delete the comment to enable //#define Z_PROBE_REPEATABILITY_TEST // Delete the comment to enable
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
// There are 2 different ways to specify probing locations // There are 2 different ways to specify probing locations
// //
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
// Note: this feature generates 10KB extra code size // Note: this feature generates 10KB extra code size
#define AUTO_BED_LEVELING_GRID #define AUTO_BED_LEVELING_GRID
#ifdef AUTO_BED_LEVELING_GRID #if ENABLED(AUTO_BED_LEVELING_GRID)
#define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
//#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:
#ifdef MANUAL_HOME_POSITIONS #if ENABLED(MANUAL_HOME_POSITIONS)
#define MANUAL_X_HOME_POS 0 #define MANUAL_X_HOME_POS 0
#define MANUAL_Y_HOME_POS 0 #define MANUAL_Y_HOME_POS 0
#define MANUAL_Z_HOME_POS 0 #define MANUAL_Z_HOME_POS 0
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
// Custom M code points // Custom M code points
//#define CUSTOM_M_CODES //#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES #if ENABLED(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 -20 #define Z_PROBE_OFFSET_RANGE_MIN -20
#define Z_PROBE_OFFSET_RANGE_MAX 20 #define Z_PROBE_OFFSET_RANGE_MAX 20
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// coarse Endstop Settings // coarse Endstop Settings
#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
#ifndef ENDSTOPPULLUPS #if DISABLED(ENDSTOPPULLUPS)
// fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
// #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_XMAX
// #define ENDSTOPPULLUP_YMAX // #define ENDSTOPPULLUP_YMAX
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
//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!!!
//#define Z_SAFE_HOMING //#define Z_SAFE_HOMING
#ifdef Z_SAFE_HOMING #if ENABLED(Z_SAFE_HOMING)
#define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2) // X point for Z homing when homing all axis (G28) or homing Z #define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2) // X point for Z homing when homing all axis (G28) or homing Z
#define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28) or homing Z #define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28) or homing Z
#endif #endif
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (ABL) //#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (ABL)
//#define Z_PROBE_REPEATABILITY_TEST // Delete the comment to enable //#define Z_PROBE_REPEATABILITY_TEST // Delete the comment to enable
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
// There are 2 different ways to specify probing locations // There are 2 different ways to specify probing locations
// //
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
// Note: this feature generates 10KB extra code size // Note: this feature generates 10KB extra code size
#define AUTO_BED_LEVELING_GRID #define AUTO_BED_LEVELING_GRID
#ifdef AUTO_BED_LEVELING_GRID #if ENABLED(AUTO_BED_LEVELING_GRID)
#define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
//#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:
#ifdef MANUAL_HOME_POSITIONS #if ENABLED(MANUAL_HOME_POSITIONS)
#define MANUAL_X_HOME_POS 0 #define MANUAL_X_HOME_POS 0
#define MANUAL_Y_HOME_POS 0 #define MANUAL_Y_HOME_POS 0
#define MANUAL_Z_HOME_POS 0 #define MANUAL_Z_HOME_POS 0
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
// Custom M code points // Custom M code points
//#define CUSTOM_M_CODES //#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES #if ENABLED(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 -20 #define Z_PROBE_OFFSET_RANGE_MIN -20
#define Z_PROBE_OFFSET_RANGE_MAX 20 #define Z_PROBE_OFFSET_RANGE_MAX 20
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
// coarse Endstop Settings // coarse Endstop Settings
#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
#ifndef ENDSTOPPULLUPS #if DISABLED(ENDSTOPPULLUPS)
// fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
// #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_XMAX
// #define ENDSTOPPULLUP_YMAX // #define ENDSTOPPULLUP_YMAX
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
//=============================Thermal Settings ============================ //=============================Thermal Settings ============================
//=========================================================================== //===========================================================================
#ifdef BED_LIMIT_SWITCHING #if ENABLED(BED_LIMIT_SWITCHING)
#define BED_HYSTERESIS 2 //only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS #define BED_HYSTERESIS 2 //only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
#endif #endif
#define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
/** /**
* Thermal Protection parameters * Thermal Protection parameters
*/ */
#ifdef THERMAL_PROTECTION_HOTENDS #if ENABLED(THERMAL_PROTECTION_HOTENDS)
#define THERMAL_PROTECTION_PERIOD 40 // Seconds #define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#define WATCH_TEMP_INCREASE 4 // Degrees Celsius #define WATCH_TEMP_INCREASE 4 // Degrees Celsius
#endif #endif
#ifdef THERMAL_PROTECTION_BED #if ENABLED(THERMAL_PROTECTION_BED)
#define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
#endif #endif
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
* On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
*/ */
#define AUTOTEMP #define AUTOTEMP
#ifdef AUTOTEMP #if ENABLED(AUTOTEMP)
#define AUTOTEMP_OLDWEIGHT 0.98 #define AUTOTEMP_OLDWEIGHT 0.98
#endif #endif
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
//#define Z_DUAL_STEPPER_DRIVERS //#define Z_DUAL_STEPPER_DRIVERS
#ifdef Z_DUAL_STEPPER_DRIVERS #if ENABLED(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.
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
#define Z_DUAL_ENDSTOPS #define Z_DUAL_ENDSTOPS
#ifdef Z_DUAL_ENDSTOPS #if ENABLED(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
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
// prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
// allowing faster printing speeds. // allowing faster printing speeds.
//#define DUAL_X_CARRIAGE //#define DUAL_X_CARRIAGE
#ifdef DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE)
// Configuration for second X-carriage // Configuration for second X-carriage
// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop;
// the second x-carriage always homes to the maximum endstop. // the second x-carriage always homes to the maximum endstop.
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate
#define DEFAULT_MINTRAVELFEEDRATE 0.0 #define DEFAULT_MINTRAVELFEEDRATE 0.0
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
#define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel
#define ULTIPANEL_FEEDMULTIPLY // Comment to disable setting feedrate multiplier via encoder #define ULTIPANEL_FEEDMULTIPLY // Comment to disable setting feedrate multiplier via encoder
#endif #endif
...@@ -294,11 +294,8 @@ ...@@ -294,11 +294,8 @@
// be commented out otherwise // be commented out otherwise
#define SDCARDDETECTINVERTED #define SDCARDDETECTINVERTED
// Disable steppers when the file is done printing #define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers?
#define SD_FINISHED_STEPPERRELEASE true #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
// Command to send. You may want to keep Z enabled so your bed stays in place.
#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E"
#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order. #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. // 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.
...@@ -308,7 +305,7 @@ ...@@ -308,7 +305,7 @@
// Show a progress bar on HD44780 LCDs for SD printing // Show a progress bar on HD44780 LCDs for SD printing
//#define LCD_PROGRESS_BAR //#define LCD_PROGRESS_BAR
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
// Amount of time (ms) to show the bar // Amount of time (ms) to show the bar
#define PROGRESS_BAR_BAR_TIME 5000 #define PROGRESS_BAR_BAR_TIME 5000
// Amount of time (ms) to show the status message // Amount of time (ms) to show the status message
...@@ -325,7 +322,7 @@ ...@@ -325,7 +322,7 @@
#endif // SDSUPPORT #endif // SDSUPPORT
// for dogm lcd displays you can choose some additional fonts: // for dogm lcd displays you can choose some additional fonts:
#ifdef DOGLCD #if ENABLED(DOGLCD)
// save 3120 bytes of PROGMEM by commenting out #define USE_BIG_EDIT_FONT // save 3120 bytes of PROGMEM by commenting out #define USE_BIG_EDIT_FONT
// we don't have a big font for Cyrillic, Kana // we don't have a big font for Cyrillic, Kana
//#define USE_BIG_EDIT_FONT //#define USE_BIG_EDIT_FONT
...@@ -338,7 +335,7 @@ ...@@ -338,7 +335,7 @@
// 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
#ifdef USE_WATCHDOG #if ENABLED(USE_WATCHDOG)
// If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on. // If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on.
// The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset. // The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset.
// However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled. // However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
...@@ -352,7 +349,7 @@ ...@@ -352,7 +349,7 @@
// it can e.g. be used to change z-positions in the print startup phase in real-time // it can e.g. be used to change z-positions in the print startup phase in real-time
// does not respect endstops! // does not respect endstops!
//#define BABYSTEPPING //#define BABYSTEPPING
#ifdef BABYSTEPPING #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z #define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
...@@ -367,7 +364,7 @@ ...@@ -367,7 +364,7 @@
// so: v ^ 2 is proportional to number of steps we advance the extruder // so: v ^ 2 is proportional to number of steps we advance the extruder
//#define ADVANCE //#define ADVANCE
#ifdef ADVANCE #if ENABLED(ADVANCE)
#define EXTRUDER_ADVANCE_K .0 #define EXTRUDER_ADVANCE_K .0
#define D_FILAMENT 2.85 #define D_FILAMENT 2.85
#define STEPS_MM_E 836 #define STEPS_MM_E 836
...@@ -388,7 +385,7 @@ const unsigned int dropsegments = 5; // everything with less than this number of ...@@ -388,7 +385,7 @@ const unsigned int dropsegments = 5; // everything with less than this number of
// The number of linear motions that can be in the plan at any give time. // The number of linear motions that can be in the plan at any give time.
// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. // THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering.
#ifdef SDSUPPORT #if ENABLED(SDSUPPORT)
#define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller #define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller
#else #else
#define BLOCK_BUFFER_SIZE 16 // maximize block buffer #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
...@@ -400,9 +397,10 @@ const unsigned int dropsegments = 5; // everything with less than this number of ...@@ -400,9 +397,10 @@ const unsigned int dropsegments = 5; // everything with less than this number of
#define BUFSIZE 4 #define BUFSIZE 4
// Bad Serial-connections can miss a received command by sending an 'ok' // Bad Serial-connections can miss a received command by sending an 'ok'
// Therefore some clients go after 30 seconds in a timeout. Some other clients start sending commands while receiving a 'wait'. // Therefore some clients abort after 30 seconds in a timeout.
// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value. // Some other clients start sending commands while receiving a 'wait'.
#define NO_TIMEOUTS 1000 // This "wait" is only sent when the buffer is empty. 1 second is a good value here.
#define NO_TIMEOUTS 1000 // Milliseconds
// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. // Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
#define ADVANCED_OK #define ADVANCED_OK
...@@ -414,7 +412,7 @@ const unsigned int dropsegments = 5; // everything with less than this number of ...@@ -414,7 +412,7 @@ const unsigned int dropsegments = 5; // everything with less than this number of
// the moves are than replaced by the firmware controlled ones. // the moves are than replaced by the firmware controlled ones.
//#define FWRETRACT //ONLY PARTIALLY TESTED //#define FWRETRACT //ONLY PARTIALLY TESTED
#ifdef FWRETRACT #if ENABLED(FWRETRACT)
#define MIN_RETRACT 0.1 //minimum extruded mm to accept a automatic gcode retraction attempt #define MIN_RETRACT 0.1 //minimum extruded mm to accept a automatic gcode retraction attempt
#define RETRACT_LENGTH 3 //default retract length (positive mm) #define RETRACT_LENGTH 3 //default retract length (positive mm)
#define RETRACT_LENGTH_SWAP 13 //default swap retract length (positive mm), for extruder change #define RETRACT_LENGTH_SWAP 13 //default swap retract length (positive mm), for extruder change
...@@ -425,10 +423,10 @@ const unsigned int dropsegments = 5; // everything with less than this number of ...@@ -425,10 +423,10 @@ const unsigned int dropsegments = 5; // everything with less than this number of
#define RETRACT_RECOVER_FEEDRATE 8 //default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE 8 //default feedrate for recovering from retraction (mm/s)
#endif #endif
// Add support for experimental filament exchange support M600; requires display // Add support for filament exchange support M600; requires display
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
#define FILAMENTCHANGEENABLE #define FILAMENTCHANGEENABLE
#ifdef FILAMENTCHANGEENABLE #if ENABLED(FILAMENTCHANGEENABLE)
#define FILAMENTCHANGE_XPOS 3 #define FILAMENTCHANGE_XPOS 3
#define FILAMENTCHANGE_YPOS 3 #define FILAMENTCHANGE_YPOS 3
#define FILAMENTCHANGE_ZADD 10 #define FILAMENTCHANGE_ZADD 10
...@@ -444,7 +442,7 @@ const unsigned int dropsegments = 5; // everything with less than this number of ...@@ -444,7 +442,7 @@ const unsigned int dropsegments = 5; // everything with less than this number of
******************************************************************************/ ******************************************************************************/
//#define HAVE_TMCDRIVER //#define HAVE_TMCDRIVER
#ifdef HAVE_TMCDRIVER #if ENABLED(HAVE_TMCDRIVER)
// #define X_IS_TMC // #define X_IS_TMC
#define X_MAX_CURRENT 1000 //in mA #define X_MAX_CURRENT 1000 //in mA
...@@ -504,7 +502,7 @@ const unsigned int dropsegments = 5; // everything with less than this number of ...@@ -504,7 +502,7 @@ const unsigned int dropsegments = 5; // everything with less than this number of
******************************************************************************/ ******************************************************************************/
//#define HAVE_L6470DRIVER //#define HAVE_L6470DRIVER
#ifdef HAVE_L6470DRIVER #if ENABLED(HAVE_L6470DRIVER)
// #define X_IS_L6470 // #define X_IS_L6470
#define X_MICROSTEPS 16 //number of microsteps #define X_MICROSTEPS 16 //number of microsteps
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include "Configuration.h" #include "Configuration.h"
#include "pins.h"
#ifndef SANITYCHECK_H #ifndef SANITYCHECK_H
#error Your Configuration.h and Configuration_adv.h files are outdated! #error Your Configuration.h and Configuration_adv.h files are outdated!
...@@ -34,14 +35,6 @@ ...@@ -34,14 +35,6 @@
#include "WProgram.h" #include "WProgram.h"
#endif #endif
#define BIT(b) (1<<(b))
#define TEST(n,b) (((n)&BIT(b))!=0)
#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (BIT(b))
#define RADIANS(d) ((d)*M_PI/180.0)
#define DEGREES(r) ((d)*180.0/M_PI)
#define NOLESS(v,n) do{ if (v < n) v = n; }while(0)
#define NOMORE(v,n) do{ if (v > n) v = n; }while(0)
typedef unsigned long millis_t; typedef unsigned long millis_t;
// Arduino < 1.0.0 does not define this, so we need to do it ourselves // Arduino < 1.0.0 does not define this, so we need to do it ourselves
...@@ -53,9 +46,11 @@ typedef unsigned long millis_t; ...@@ -53,9 +46,11 @@ typedef unsigned long millis_t;
void get_command(); void get_command();
void idle(bool ignore_stepper_queue = false);
void manage_inactivity(bool ignore_stepper_queue=false); void manage_inactivity(bool ignore_stepper_queue=false);
#if defined(DUAL_X_CARRIAGE) && HAS_X_ENABLE && HAS_X2_ENABLE #if ENABLED(DUAL_X_CARRIAGE) && HAS_X_ENABLE && HAS_X2_ENABLE
#define enable_x() do { X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); } while (0) #define enable_x() do { X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); } while (0)
#define disable_x() do { X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } while (0) #define disable_x() do { X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } while (0)
#elif HAS_X_ENABLE #elif HAS_X_ENABLE
...@@ -67,7 +62,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); ...@@ -67,7 +62,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#endif #endif
#if HAS_Y_ENABLE #if HAS_Y_ENABLE
#ifdef Y_DUAL_STEPPER_DRIVERS #if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#define enable_y() { Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); } #define enable_y() { Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }
#define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; } #define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#else #else
...@@ -80,7 +75,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); ...@@ -80,7 +75,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#endif #endif
#if HAS_Z_ENABLE #if HAS_Z_ENABLE
#ifdef Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS)
#define enable_z() { Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); } #define enable_z() { Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }
#define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; } #define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#else #else
...@@ -147,7 +142,7 @@ void disable_all_steppers(); ...@@ -147,7 +142,7 @@ void disable_all_steppers();
void FlushSerialRequestResend(); void FlushSerialRequestResend();
void ok_to_send(); void ok_to_send();
#ifdef DELTA #if ENABLED(DELTA)
float probe_bed(float x, float y); float probe_bed(float x, float y);
void set_delta_constants(); void set_delta_constants();
void home_delta_axis(); void home_delta_axis();
...@@ -165,7 +160,7 @@ extern float delta_tower1_x, delta_tower1_y; ...@@ -165,7 +160,7 @@ extern float delta_tower1_x, delta_tower1_y;
extern float delta_tower2_x, delta_tower2_y; extern float delta_tower2_x, delta_tower2_y;
extern float delta_tower3_x, delta_tower3_y; extern float delta_tower3_x, delta_tower3_y;
#endif #endif
#ifdef SCARA #if ENABLED(SCARA)
void calculate_delta(float cartesian[3]); void calculate_delta(float cartesian[3]);
void calculate_SCARA_forward_Transform(float f_scara[3]); void calculate_SCARA_forward_Transform(float f_scara[3]);
#endif #endif
...@@ -173,7 +168,7 @@ void prepare_move(); ...@@ -173,7 +168,7 @@ void prepare_move();
void kill(const char *); void kill(const char *);
void Stop(); void Stop();
#ifdef FILAMENT_RUNOUT_SENSOR #if ENABLED(FILAMENT_RUNOUT_SENSOR)
void filrunout(); void filrunout();
#endif #endif
...@@ -202,7 +197,7 @@ void clamp_to_software_endstops(float target[3]); ...@@ -202,7 +197,7 @@ void clamp_to_software_endstops(float target[3]);
extern millis_t previous_cmd_ms; extern millis_t previous_cmd_ms;
inline void refresh_cmd_timeout() { previous_cmd_ms = millis(); } inline void refresh_cmd_timeout() { previous_cmd_ms = millis(); }
#ifdef FAST_PWM_FAN #if ENABLED(FAST_PWM_FAN)
void setPwmFrequency(uint8_t pin, int val); void setPwmFrequency(uint8_t pin, int val);
#endif #endif
...@@ -224,7 +219,7 @@ extern float home_offset[3]; ...@@ -224,7 +219,7 @@ extern float home_offset[3];
// Hotend offset // Hotend offset
#if HOTENDS > 1 #if HOTENDS > 1
#ifndef DUAL_X_CARRIAGE #if DISABLED(DUAL_X_CARRIAGE)
#define NUM_HOTEND_OFFSETS 2 // only in XY plane #define NUM_HOTEND_OFFSETS 2 // only in XY plane
#else #else
#define NUM_HOTEND_OFFSETS 3 // supports offsets in XYZ plane #define NUM_HOTEND_OFFSETS 3 // supports offsets in XYZ plane
...@@ -232,22 +227,22 @@ extern float home_offset[3]; ...@@ -232,22 +227,22 @@ extern float home_offset[3];
extern float hotend_offset[NUM_HOTEND_OFFSETS][HOTENDS]; extern float hotend_offset[NUM_HOTEND_OFFSETS][HOTENDS];
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#ifdef NPR2 #if ENABLED(NPR2)
extern int old_color; // old color for system NPR2 extern int old_color; // old color for system NPR2
#endif #endif
#ifdef DELTA #if ENABLED(DELTA)
extern float z_probe_offset[3]; extern float z_probe_offset[3];
extern float endstop_adj[3]; extern float endstop_adj[3];
extern float tower_adj[6]; extern float tower_adj[6];
extern float delta_radius; extern float delta_radius;
extern float delta_diagonal_rod; extern float delta_diagonal_rod;
extern float delta_segments_per_second; extern float delta_segments_per_second;
#elif defined(Z_DUAL_ENDSTOPS) #elif ENABLED(Z_DUAL_ENDSTOPS)
extern float z_endstop_adj; extern float z_endstop_adj;
#endif #endif
#ifdef SCARA #if ENABLED(SCARA)
extern float axis_scaling[3]; // Build size scaling extern float axis_scaling[3]; // Build size scaling
#endif #endif
...@@ -260,18 +255,18 @@ extern float zprobe_zoffset; ...@@ -260,18 +255,18 @@ extern float zprobe_zoffset;
// Lifetime stats // Lifetime stats
extern unsigned long printer_usage_seconds; //this can old about 136 year before go overflow. If you belive that you can live more than this please contact me. extern unsigned long printer_usage_seconds; //this can old about 136 year before go overflow. If you belive that you can live more than this please contact me.
#ifdef PREVENT_DANGEROUS_EXTRUDE #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
extern float extrude_min_temp; extern float extrude_min_temp;
#endif #endif
extern int fanSpeed; extern int fanSpeed;
#ifdef BARICUDA #if ENABLED(BARICUDA)
extern int ValvePressure; extern int ValvePressure;
extern int EtoPPressure; extern int EtoPPressure;
#endif #endif
#ifdef FAN_SOFT_PWM #if ENABLED(FAN_SOFT_PWM)
extern unsigned char fanSpeedSoftPwm; extern unsigned char fanSpeedSoftPwm;
#endif #endif
...@@ -292,26 +287,26 @@ extern int fanSpeed; ...@@ -292,26 +287,26 @@ extern int fanSpeed;
extern unsigned long stoppower; extern unsigned long stoppower;
#endif #endif
#ifdef IDLE_OOZING_PREVENT #if ENABLED(IDLE_OOZING_PREVENT)
extern bool idleoozing_enabled; extern bool idleoozing_enabled;
#endif #endif
#ifdef FWRETRACT #if ENABLED(FWRETRACT)
extern bool autoretract_enabled; extern bool autoretract_enabled;
extern bool retracted[EXTRUDERS]; extern bool retracted[EXTRUDERS];
extern float retract_length, retract_length_swap, retract_feedrate, retract_zlift; extern float retract_length, retract_length_swap, retract_feedrate, retract_zlift;
extern float retract_recover_length, retract_recover_length_swap, retract_recover_feedrate; extern float retract_recover_length, retract_recover_length_swap, retract_recover_feedrate;
#endif #endif
#ifdef EASY_LOAD #if ENABLED(EASY_LOAD)
extern bool allow_lengthy_extrude_once; // for load/unload extern bool allow_lengthy_extrude_once; // for load/unload
#endif #endif
#ifdef LASERBEAM #if ENABLED(LASERBEAM)
extern int laser_ttl_modulation; extern int laser_ttl_modulation;
#endif #endif
#if defined(SDSUPPORT) && defined(SD_SETTINGS) #if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS)
extern millis_t config_last_update; extern millis_t config_last_update;
extern bool config_readed; extern bool config_readed;
#endif #endif
...@@ -323,12 +318,12 @@ extern millis_t print_job_stop_ms; ...@@ -323,12 +318,12 @@ extern millis_t print_job_stop_ms;
extern uint8_t active_extruder; extern uint8_t active_extruder;
extern uint8_t active_driver; extern uint8_t active_driver;
#ifdef DIGIPOT_I2C #if ENABLED(DIGIPOT_I2C)
extern void digipot_i2c_set_current( int channel, float current ); extern void digipot_i2c_set_current( int channel, float current );
extern void digipot_i2c_init(); extern void digipot_i2c_init();
#endif #endif
#ifdef FIRMWARE_TEST #if ENABLED(FIRMWARE_TEST)
void FirmwareTest(); void FirmwareTest();
#endif #endif
......
...@@ -287,6 +287,6 @@ MarlinSerial MSerial; ...@@ -287,6 +287,6 @@ MarlinSerial MSerial;
#endif // !AT90USB #endif // !AT90USB
// For AT90USB targets use the UART for BT interfacing // For AT90USB targets use the UART for BT interfacing
#if defined(AT90USB) && defined(BTENABLED) #if defined(AT90USB) && ENABLED(BTENABLED)
HardwareSerial bt; HardwareSerial bt;
#endif #endif
...@@ -153,7 +153,7 @@ extern MarlinSerial MSerial; ...@@ -153,7 +153,7 @@ extern MarlinSerial MSerial;
#endif // !AT90USB #endif // !AT90USB
// Use the UART for BT in AT90USB configurations // Use the UART for BT in AT90USB configurations
#if defined(AT90USB) && defined(BTENABLED) #if defined(AT90USB) && ENABLED(BTENABLED)
extern HardwareSerial bt; extern HardwareSerial bt;
#endif #endif
......
...@@ -285,12 +285,12 @@ bool target_direction; ...@@ -285,12 +285,12 @@ bool target_direction;
unsigned long printer_usage_seconds; unsigned long printer_usage_seconds;
#ifndef DELTA #if DISABLED(DELTA)
int xy_travel_speed = XY_TRAVEL_SPEED; int xy_travel_speed = XY_TRAVEL_SPEED;
float zprobe_zoffset = 0; float zprobe_zoffset = 0;
#endif #endif
#if defined(Z_DUAL_ENDSTOPS) && !defined(DELTA) #if ENABLED(Z_DUAL_ENDSTOPS) && DISABLED(DELTA)
float z_endstop_adj = 0; float z_endstop_adj = 0;
#endif #endif
...@@ -304,7 +304,7 @@ unsigned long printer_usage_seconds; ...@@ -304,7 +304,7 @@ unsigned long printer_usage_seconds;
float hotend_offset[NUM_HOTEND_OFFSETS][HOTENDS]; float hotend_offset[NUM_HOTEND_OFFSETS][HOTENDS];
#endif #endif
#ifdef NPR2 #if ENABLED(NPR2)
int old_color = 99; int old_color = 99;
#endif #endif
...@@ -313,13 +313,12 @@ unsigned long printer_usage_seconds; ...@@ -313,13 +313,12 @@ unsigned long printer_usage_seconds;
int servo_endstop_angles[] = SERVO_ENDSTOP_ANGLES; int servo_endstop_angles[] = SERVO_ENDSTOP_ANGLES;
#endif #endif
#ifdef BARICUDA #if ENABLED(BARICUDA)
int ValvePressure = 0; int ValvePressure = 0;
int EtoPPressure = 0; int EtoPPressure = 0;
#endif #endif
#ifdef FWRETRACT #if ENABLED(FWRETRACT)
bool autoretract_enabled = false; bool autoretract_enabled = false;
bool retracted[EXTRUDERS] = { false }; bool retracted[EXTRUDERS] = { false };
bool retracted_swap[EXTRUDERS] = { false }; bool retracted_swap[EXTRUDERS] = { false };
...@@ -331,10 +330,9 @@ unsigned long printer_usage_seconds; ...@@ -331,10 +330,9 @@ unsigned long printer_usage_seconds;
float retract_recover_length = RETRACT_RECOVER_LENGTH; float retract_recover_length = RETRACT_RECOVER_LENGTH;
float retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP; float retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP;
float retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE; float retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
#endif // FWRETRACT #endif // FWRETRACT
#if defined(ULTIPANEL) && HAS_POWER_SWITCH #if ENABLED(ULTIPANEL) && HAS_POWER_SWITCH
bool powersupply = bool powersupply =
#ifdef PS_DEFAULT_OFF #ifdef PS_DEFAULT_OFF
false false
...@@ -344,7 +342,7 @@ unsigned long printer_usage_seconds; ...@@ -344,7 +342,7 @@ unsigned long printer_usage_seconds;
; ;
#endif #endif
#ifdef DELTA #if ENABLED(DELTA)
float delta[3] = { 0.0 }; float delta[3] = { 0.0 };
float tower_adj[6] = { 0, 0, 0, 0, 0, 0 }; float tower_adj[6] = { 0, 0, 0, 0, 0, 0 };
float delta_radius; // = DEFAULT_delta_radius; float delta_radius; // = DEFAULT_delta_radius;
...@@ -377,8 +375,6 @@ unsigned long printer_usage_seconds; ...@@ -377,8 +375,6 @@ unsigned long printer_usage_seconds;
float z_probe_deploy_end_location[] = Z_PROBE_DEPLOY_END_LOCATION; float z_probe_deploy_end_location[] = Z_PROBE_DEPLOY_END_LOCATION;
float z_probe_retract_start_location[] = Z_PROBE_RETRACT_START_LOCATION; float z_probe_retract_start_location[] = Z_PROBE_RETRACT_START_LOCATION;
float z_probe_retract_end_location[] = Z_PROBE_RETRACT_END_LOCATION; float z_probe_retract_end_location[] = Z_PROBE_RETRACT_END_LOCATION;
#define SIN_60 0.8660254037844386
#define COS_60 0.5
float endstop_adj[3] = { 0 }; float endstop_adj[3] = { 0 };
static float bed_level[7][7] = { static float bed_level[7][7] = {
{ 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 },
...@@ -399,7 +395,7 @@ unsigned long printer_usage_seconds; ...@@ -399,7 +395,7 @@ unsigned long printer_usage_seconds;
static bool home_all_axis = true; static bool home_all_axis = true;
#endif // DELTA #endif // DELTA
#ifdef SCARA #if ENABLED(SCARA)
float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND; float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND;
static float delta[3] = { 0 }; static float delta[3] = { 0 };
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
...@@ -422,7 +418,7 @@ unsigned long printer_usage_seconds; ...@@ -422,7 +418,7 @@ unsigned long printer_usage_seconds;
bool printing = false; bool printing = false;
#endif #endif
#ifdef SDSUPPORT #if ENABLED(SDSUPPORT)
static bool fromsd[BUFSIZE]; static bool fromsd[BUFSIZE];
#ifdef SD_SETTINGS #ifdef SD_SETTINGS
millis_t config_last_update = 0; millis_t config_last_update = 0;
...@@ -430,16 +426,16 @@ unsigned long printer_usage_seconds; ...@@ -430,16 +426,16 @@ unsigned long printer_usage_seconds;
#endif #endif
#endif #endif
#ifdef FILAMENTCHANGEENABLE #if ENABLED(FILAMENTCHANGEENABLE)
bool filament_changing = false; bool filament_changing = false;
#endif #endif
#if defined(IDLE_OOZING_PREVENT) || defined(EXTRUDER_RUNOUT_PREVENT) #if ENABLED(IDLE_OOZING_PREVENT) || ENABLED(EXTRUDER_RUNOUT_PREVENT)
unsigned long axis_last_activity = 0; unsigned long axis_last_activity = 0;
bool axis_is_moving = false; bool axis_is_moving = false;
#endif #endif
#ifdef IDLE_OOZING_PREVENT #if ENABLED(IDLE_OOZING_PREVENT)
bool idleoozing_enabled = true; bool idleoozing_enabled = true;
bool IDLE_OOZING_retracted[EXTRUDERS] = ARRAY_BY_EXTRUDERS(false, false, false, false); bool IDLE_OOZING_retracted[EXTRUDERS] = ARRAY_BY_EXTRUDERS(false, false, false, false);
#endif #endif
...@@ -451,16 +447,16 @@ unsigned long printer_usage_seconds; ...@@ -451,16 +447,16 @@ unsigned long printer_usage_seconds;
unsigned long stoppower = 0; unsigned long stoppower = 0;
#endif #endif
#ifdef LASERBEAM #if ENABLED(LASERBEAM)
int laser_ttl_modulation = 0; int laser_ttl_modulation = 0;
#endif #endif
#ifdef NPR2 #if ENABLED(NPR2)
static float color_position[] = COLOR_STEP; //variabile per la scelta del colore static float color_position[] = COLOR_STEP;
static float color_step_moltiplicator = (DRIVER_MICROSTEP / MOTOR_ANGLE) * CARTER_MOLTIPLICATOR; static float color_step_moltiplicator = (DRIVER_MICROSTEP / MOTOR_ANGLE) * CARTER_MOLTIPLICATOR;
#endif // NPR2 #endif // NPR2
#ifdef EASY_LOAD #if ENABLED(EASY_LOAD)
bool allow_lengthy_extrude_once; // for load/unload bool allow_lengthy_extrude_once; // for load/unload
#endif #endif
...@@ -481,7 +477,7 @@ void process_next_command(); ...@@ -481,7 +477,7 @@ void process_next_command();
bool setTargetedHotend(int code); bool setTargetedHotend(int code);
#ifdef PREVENT_DANGEROUS_EXTRUDE #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
float extrude_min_temp = EXTRUDE_MINTEMP; float extrude_min_temp = EXTRUDE_MINTEMP;
#endif #endif
...@@ -709,7 +705,7 @@ void setup() { ...@@ -709,7 +705,7 @@ void setup() {
ECHO_SMV(DB, MSG_FREE_MEMORY, freeMemory()); ECHO_SMV(DB, MSG_FREE_MEMORY, freeMemory());
ECHO_EMV(MSG_PLANNER_BUFFER_BYTES, (int)sizeof(block_t)*BLOCK_BUFFER_SIZE); ECHO_EMV(MSG_PLANNER_BUFFER_BYTES, (int)sizeof(block_t)*BLOCK_BUFFER_SIZE);
#ifdef SDSUPPORT #if ENABLED(SDSUPPORT)
for (int8_t i = 0; i < BUFSIZE; i++) fromsd[i] = false; for (int8_t i = 0; i < BUFSIZE; i++) fromsd[i] = false;
#endif #endif
...@@ -719,6 +715,9 @@ void setup() { ...@@ -719,6 +715,9 @@ void setup() {
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate) // loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
Config_RetrieveSettings(); Config_RetrieveSettings();
lcd_init();
_delay_ms(SPLASH_SCREEN_DURATION); // wait to display the splash screen
tp_init(); // Initialize temperature loop tp_init(); // Initialize temperature loop
plan_init(); // Initialize planner; plan_init(); // Initialize planner;
watchdog_init(); watchdog_init();
...@@ -727,9 +726,6 @@ void setup() { ...@@ -727,9 +726,6 @@ void setup() {
setup_laserbeampin(); // Initialize Laserbeam pin setup_laserbeampin(); // Initialize Laserbeam pin
servo_init(); servo_init();
lcd_init();
_delay_ms(SPLASH_SCREEN_DURATION); // wait to display the splash screen
#if HAS_CONTROLLERFAN #if HAS_CONTROLLERFAN
SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
#endif #endif
...@@ -738,7 +734,7 @@ void setup() { ...@@ -738,7 +734,7 @@ void setup() {
digipot_i2c_init(); digipot_i2c_init();
#endif #endif
#ifdef Z_PROBE_SLED #if ENABLED(Z_PROBE_SLED)
OUT_WRITE(SERVO0_PIN, LOW); // turn it off OUT_WRITE(SERVO0_PIN, LOW); // turn it off
#endif // Z_PROBE_SLED #endif // Z_PROBE_SLED
...@@ -754,7 +750,7 @@ void setup() { ...@@ -754,7 +750,7 @@ void setup() {
digitalWrite(STAT_LED_BLUE, LOW); // turn it off digitalWrite(STAT_LED_BLUE, LOW); // turn it off
#endif #endif
#ifdef FIRMWARE_TEST #if ENABLED(FIRMWARE_TEST)
FirmwareTest(); FirmwareTest();
#endif // FIRMWARE_TEST #endif // FIRMWARE_TEST
} }
...@@ -772,13 +768,13 @@ void setup() { ...@@ -772,13 +768,13 @@ void setup() {
void loop() { void loop() {
if (commands_in_queue < BUFSIZE - 1) get_command(); if (commands_in_queue < BUFSIZE - 1) get_command();
#ifdef SDSUPPORT #if ENABLED(SDSUPPORT)
card.checkautostart(false); card.checkautostart(false);
#endif #endif
if (commands_in_queue) { if (commands_in_queue) {
#ifdef SDSUPPORT #if ENABLED(SDSUPPORT)
if (card.saving) { if (card.saving) {
char *command = command_queue[cmd_queue_index_r]; char *command = command_queue[cmd_queue_index_r];
...@@ -808,11 +804,8 @@ void loop() { ...@@ -808,11 +804,8 @@ void loop() {
commands_in_queue--; commands_in_queue--;
cmd_queue_index_r = (cmd_queue_index_r + 1) % BUFSIZE; cmd_queue_index_r = (cmd_queue_index_r + 1) % BUFSIZE;
} }
// Check heater every n milliseconds
manage_heater();
manage_inactivity();
checkHitEndstops(); checkHitEndstops();
lcd_update(); idle();
} }
void gcode_line_error(const char *err, bool doFlush = true) { void gcode_line_error(const char *err, bool doFlush = true) {
...@@ -834,7 +827,7 @@ void get_command() { ...@@ -834,7 +827,7 @@ void get_command() {
if (drain_queued_commands_P()) return; // priority is given to non-serial commands if (drain_queued_commands_P()) return; // priority is given to non-serial commands
#ifdef NO_TIMEOUTS #if ENABLED(NO_TIMEOUTS)
static millis_t last_command_time = 0; static millis_t last_command_time = 0;
millis_t ms = millis(); millis_t ms = millis();
...@@ -849,7 +842,7 @@ void get_command() { ...@@ -849,7 +842,7 @@ void get_command() {
// //
while (MYSERIAL.available() > 0 && commands_in_queue < BUFSIZE) { while (MYSERIAL.available() > 0 && commands_in_queue < BUFSIZE) {
#ifdef NO_TIMEOUTS #if ENABLED(NO_TIMEOUTS)
last_command_time = ms; last_command_time = ms;
#endif #endif
...@@ -869,7 +862,7 @@ void get_command() { ...@@ -869,7 +862,7 @@ void get_command() {
command[serial_count] = 0; // terminate string command[serial_count] = 0; // terminate string
// this item in the queue is not from sd // this item in the queue is not from sd
#ifdef SDSUPPORT #if ENABLED(SDSUPPORT)
fromsd[cmd_queue_index_w] = false; fromsd[cmd_queue_index_w] = false;
#endif #endif
...@@ -928,6 +921,10 @@ void get_command() { ...@@ -928,6 +921,10 @@ void get_command() {
// If command was e-stop process now // If command was e-stop process now
if (strcmp(command, "M112") == 0) kill(PSTR(MSG_KILLED)); if (strcmp(command, "M112") == 0) kill(PSTR(MSG_KILLED));
#if ENABLED(FILAMENTCHANGEENABLE)
if (strcmp(command, "M601") == 0) filament_changing = false;
#endif //FILAMENTCHANGEENABL
cmd_queue_index_w = (cmd_queue_index_w + 1) % BUFSIZE; cmd_queue_index_w = (cmd_queue_index_w + 1) % BUFSIZE;
commands_in_queue += 1; commands_in_queue += 1;
...@@ -1053,7 +1050,7 @@ XYZ_CONSTS_FROM_CONFIG(float, base_min_pos, MIN_POS); ...@@ -1053,7 +1050,7 @@ XYZ_CONSTS_FROM_CONFIG(float, base_min_pos, MIN_POS);
XYZ_CONSTS_FROM_CONFIG(float, home_bump_mm, HOME_BUMP_MM); XYZ_CONSTS_FROM_CONFIG(float, home_bump_mm, HOME_BUMP_MM);
XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR); XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
#ifdef DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE)
#define DXC_FULL_CONTROL_MODE 0 #define DXC_FULL_CONTROL_MODE 0
#define DXC_AUTO_PARK_MODE 1 #define DXC_AUTO_PARK_MODE 1
...@@ -1198,7 +1195,7 @@ inline void line_to_destination() { ...@@ -1198,7 +1195,7 @@ inline void line_to_destination() {
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(DELTA) || defined(SCARA) #if ENABLED(DELTA) || ENABLED(SCARA)
inline void sync_plan_position_delta() { inline void sync_plan_position_delta() {
calculate_delta(current_position); calculate_delta(current_position);
plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]); plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
...@@ -1215,7 +1212,7 @@ static void setup_for_endstop_move() { ...@@ -1215,7 +1212,7 @@ static void setup_for_endstop_move() {
enable_endstops(true); enable_endstops(true);
} }
#if defined(CARTESIAN) || defined(COREXY) || defined(SCARA) #if ENABLED(CARTESIAN) || ENABLED(COREXY) || ENABLED(SCARA)
static void do_blocking_move_to(float x, float y, float z) { static void do_blocking_move_to(float x, float y, float z) {
float oldFeedRate = feedrate; float oldFeedRate = feedrate;
...@@ -1538,7 +1535,7 @@ static void setup_for_endstop_move() { ...@@ -1538,7 +1535,7 @@ static void setup_for_endstop_move() {
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS) #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
#endif // Cartesian || CoreXY || Scara #endif // Cartesian || CoreXY || Scara
#ifdef DELTA #if ENABLED(DELTA)
static void homeaxis(AxisEnum axis) { static void homeaxis(AxisEnum axis) {
#define HOMEAXIS_DO(LETTER) \ #define HOMEAXIS_DO(LETTER) \
...@@ -2395,7 +2392,7 @@ static void setup_for_endstop_move() { ...@@ -2395,7 +2392,7 @@ static void setup_for_endstop_move() {
} }
#endif //DELTA #endif //DELTA
#ifdef IDLE_OOZING_PREVENT #if ENABLED(IDLE_OOZING_PREVENT)
void IDLE_OOZING_retract(bool retracting) { void IDLE_OOZING_retract(bool retracting) {
if (retracting && !IDLE_OOZING_retracted[active_extruder]) { if (retracting && !IDLE_OOZING_retracted[active_extruder]) {
set_destination_to_current(); set_destination_to_current();
...@@ -2420,7 +2417,7 @@ static void setup_for_endstop_move() { ...@@ -2420,7 +2417,7 @@ static void setup_for_endstop_move() {
} }
#endif #endif
#ifdef FWRETRACT #if ENABLED(FWRETRACT)
void retract(bool retracting, bool swapping = false) { void retract(bool retracting, bool swapping = false) {
if (retracting == retracted[active_extruder]) return; if (retracting == retracted[active_extruder]) return;
...@@ -2471,7 +2468,7 @@ static void setup_for_endstop_move() { ...@@ -2471,7 +2468,7 @@ static void setup_for_endstop_move() {
} // retract() } // retract()
#endif //FWRETRACT #endif //FWRETRACT
#ifdef Z_PROBE_SLED #if ENABLED(Z_PROBE_SLED)
#ifndef SLED_DOCKING_OFFSET #ifndef SLED_DOCKING_OFFSET
#define SLED_DOCKING_OFFSET 0 #define SLED_DOCKING_OFFSET 0
...@@ -2504,10 +2501,6 @@ static void setup_for_endstop_move() { ...@@ -2504,10 +2501,6 @@ static void setup_for_endstop_move() {
inline void wait_heater() { inline void wait_heater() {
#ifdef THERMAL_PROTECTION_HOTENDS
start_watching_heater(target_extruder);
#endif
millis_t temp_ms = millis(); millis_t temp_ms = millis();
/* See if we are heating up or cooling down */ /* See if we are heating up or cooling down */
...@@ -2527,8 +2520,8 @@ inline void wait_heater() { ...@@ -2527,8 +2520,8 @@ inline void wait_heater() {
{ // while loop { // while loop
if (millis() > temp_ms + 1000UL) { //Print temp & remaining time every 1s while waiting if (millis() > temp_ms + 1000UL) { //Print temp & remaining time every 1s while waiting
ECHO_MV("T:", degHotend(target_extruder),1); ECHO_MV("T:", degHotend(target_extruder), 1);
ECHO_MV(" E:", target_extruder); ECHO_MV(" E:", (int)target_extruder);
#ifdef TEMP_RESIDENCY_TIME #ifdef TEMP_RESIDENCY_TIME
ECHO_M(" W:"); ECHO_M(" W:");
if (residency_start_ms > -1) { if (residency_start_ms > -1) {
...@@ -2543,9 +2536,9 @@ inline void wait_heater() { ...@@ -2543,9 +2536,9 @@ inline void wait_heater() {
#endif #endif
temp_ms = millis(); temp_ms = millis();
} }
manage_heater();
manage_inactivity(); idle();
lcd_update();
#ifdef TEMP_RESIDENCY_TIME #ifdef TEMP_RESIDENCY_TIME
// start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time // start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
// or when current temp falls outside the hysteresis after target temp was reached // or when current temp falls outside the hysteresis after target temp was reached
...@@ -2586,6 +2579,10 @@ inline void wait_bed() { ...@@ -2586,6 +2579,10 @@ inline void wait_bed() {
refresh_cmd_timeout(); refresh_cmd_timeout();
} }
void error_invalid_extruder(int code, int e) {
ECHO_SMV(DB, "M", code);
ECHO_EMV(MSG_INVALID_EXTRUDER, e);
}
/****************************************************************************** /******************************************************************************
***************************** G-Code Functions ******************************** ***************************** G-Code Functions ********************************
...@@ -2815,11 +2812,7 @@ inline void gcode_G4() { ...@@ -2815,11 +2812,7 @@ inline void gcode_G4() {
if (!lcd_hasstatus()) LCD_MESSAGEPGM(MSG_DWELL); if (!lcd_hasstatus()) LCD_MESSAGEPGM(MSG_DWELL);
while (millis() < codenum) { while (millis() < codenum) idle();
manage_heater();
manage_inactivity();
lcd_update();
}
} }
#ifdef FWRETRACT #ifdef FWRETRACT
...@@ -3431,9 +3424,7 @@ inline void gcode_G28(boolean home_XY = false) { ...@@ -3431,9 +3424,7 @@ inline void gcode_G28(boolean home_XY = false) {
probePointCounter++; probePointCounter++;
manage_heater(); idle();
manage_inactivity();
lcd_update();
} //xProbe } //xProbe
} //yProbe } //yProbe
...@@ -3517,6 +3508,8 @@ inline void gcode_G28(boolean home_XY = false) { ...@@ -3517,6 +3508,8 @@ inline void gcode_G28(boolean home_XY = false) {
#ifdef Z_PROBE_SLED #ifdef Z_PROBE_SLED
dock_sled(true, -SLED_DOCKING_OFFSET); // dock the probe, correcting for over-travel dock_sled(true, -SLED_DOCKING_OFFSET); // dock the probe, correcting for over-travel
#endif #endif
FlushSerialRequestResend();
} }
#ifndef Z_PROBE_SLED #ifndef Z_PROBE_SLED
...@@ -3537,8 +3530,8 @@ inline void gcode_G28(boolean home_XY = false) { ...@@ -3537,8 +3530,8 @@ inline void gcode_G28(boolean home_XY = false) {
clean_up_after_endstop_move(); clean_up_after_endstop_move();
stow_z_probe(); // Retract Z Servo endstop if available stow_z_probe(); // Retract Z Servo endstop if available
} }
#endif //Z_PROBE_SLED #endif // !Z_PROBE_SLED
#endif //ENABLE_AUTO_BED_LEVELING #endif // ENABLE_AUTO_BED_LEVELING
#if defined(DELTA) && defined(Z_PROBE_ENDSTOP) #if defined(DELTA) && defined(Z_PROBE_ENDSTOP)
...@@ -3571,6 +3564,7 @@ inline void gcode_G28(boolean home_XY = false) { ...@@ -3571,6 +3564,7 @@ inline void gcode_G28(boolean home_XY = false) {
feedrate_multiplier = saved_feedrate_multiplier; feedrate_multiplier = saved_feedrate_multiplier;
refresh_cmd_timeout(); refresh_cmd_timeout();
endstops_hit_on_purpose(); // clear endstop hit flags endstops_hit_on_purpose(); // clear endstop hit flags
FlushSerialRequestResend();
} }
// G30: Delta AutoCalibration // G30: Delta AutoCalibration
...@@ -3637,6 +3631,8 @@ inline void gcode_G28(boolean home_XY = false) { ...@@ -3637,6 +3631,8 @@ inline void gcode_G28(boolean home_XY = false) {
//Restore saved variables //Restore saved variables
feedrate = saved_feedrate; feedrate = saved_feedrate;
feedrate_multiplier = saved_feedrate_multiplier; feedrate_multiplier = saved_feedrate_multiplier;
FlushSerialRequestResend();
} }
#endif // DELTA && Z_PROBE_ENDSTOP #endif // DELTA && Z_PROBE_ENDSTOP
...@@ -3705,7 +3701,7 @@ inline void gcode_G92() { ...@@ -3705,7 +3701,7 @@ inline void gcode_G92() {
* M1: // M1 - Conditional stop - Wait for user button press on LCD * M1: // M1 - Conditional stop - Wait for user button press on LCD
*/ */
inline void gcode_M0_M1() { inline void gcode_M0_M1() {
char *src = seen_pointer + 2; char *args = current_command_args;
millis_t codenum = 0; millis_t codenum = 0;
bool hasP = false, hasS = false; bool hasP = false, hasS = false;
...@@ -3714,14 +3710,12 @@ inline void gcode_G92() { ...@@ -3714,14 +3710,12 @@ inline void gcode_G92() {
hasP = codenum > 0; hasP = codenum > 0;
} }
if (code_seen('S')) { if (code_seen('S')) {
codenum = code_value_short() * 1000UL; // seconds to wait codenum = code_value() * 1000; // seconds to wait
hasS = codenum > 0; hasS = codenum > 0;
} }
char* starpos = strchr(src, '*');
if (starpos != NULL) *(starpos) = '\0'; if (!hasP && !hasS && *args != '\0')
while (*src == ' ') ++src; lcd_setstatus(args, true);
if (!hasP && !hasS && *src != '\0')
lcd_setstatus(src, true);
else { else {
LCD_MESSAGEPGM(MSG_USERWAIT); LCD_MESSAGEPGM(MSG_USERWAIT);
#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 #if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
...@@ -3734,20 +3728,12 @@ inline void gcode_G92() { ...@@ -3734,20 +3728,12 @@ inline void gcode_G92() {
refresh_cmd_timeout(); refresh_cmd_timeout();
if (codenum > 0) { if (codenum > 0) {
codenum += previous_cmd_ms; // keep track of when we started waiting codenum += previous_cmd_ms; // keep track of when we started waiting
while(millis() < codenum && !lcd_clicked()) { while(millis() < codenum && !lcd_clicked()) idle();
manage_heater();
manage_inactivity();
lcd_update();
}
lcd_ignore_click(false); lcd_ignore_click(false);
} }
else { else {
if (!lcd_detected()) return; if (!lcd_detected()) return;
while (!lcd_clicked()) { while (!lcd_clicked()) idle();
manage_heater();
manage_inactivity();
lcd_update();
}
} }
if (IS_SD_PRINTING) if (IS_SD_PRINTING)
LCD_MESSAGEPGM(MSG_RESUMING); LCD_MESSAGEPGM(MSG_RESUMING);
...@@ -3960,8 +3946,7 @@ inline void gcode_M31() { ...@@ -3960,8 +3946,7 @@ inline void gcode_M31() {
} }
} }
#ifdef LONG_FILENAME_HOST_SUPPORT #if ENABLED(LONG_FILENAME_HOST_SUPPORT)
/** /**
* M33: Get the long full path of a file or folder * M33: Get the long full path of a file or folder
* *
...@@ -3975,12 +3960,8 @@ inline void gcode_M31() { ...@@ -3975,12 +3960,8 @@ inline void gcode_M31() {
* /Miscellaneous/Armchair/Armchair.gcode * /Miscellaneous/Armchair/Armchair.gcode
*/ */
inline void gcode_M33() { inline void gcode_M33() {
char *args = seen_pointer + 4; card.printLongPath(current_command_args);
while (*args == ' ') ++args;
//clear_asterisk(args);
card.printLongPath(args);
} }
#endif #endif
/** /**
...@@ -4245,13 +4226,11 @@ inline void gcode_M42() { ...@@ -4245,13 +4226,11 @@ inline void gcode_M42() {
clean_up_after_endstop_move(); clean_up_after_endstop_move();
// enable_endstops(true); if (verbose_level > 0) ECHO_EMV("Mean: ", mean, 6);
if (verbose_level > 0) {
ECHO_EMV("Mean: ",mean, 6);
}
ECHO_EMV("Standard Deviation: ", sigma, 6); ECHO_EMV("Standard Deviation: ", sigma, 6);
FlushSerialRequestResend();
} }
#endif // ENABLE_AUTO_BED_LEVELING && Z_PROBE_REPEATABILITY_TEST #endif // ENABLE_AUTO_BED_LEVELING && Z_PROBE_REPEATABILITY_TEST
...@@ -4778,7 +4757,7 @@ inline void gcode_M200() { ...@@ -4778,7 +4757,7 @@ inline void gcode_M200() {
if (code_seen('T')) { if (code_seen('T')) {
tmp_extruder = code_value_short(); tmp_extruder = code_value_short();
if (tmp_extruder >= EXTRUDERS) { if (tmp_extruder >= EXTRUDERS) {
ECHO_LM(ER, MSG_M200_INVALID_EXTRUDER); error_invalid_extruder(200, tmp_extruder);
return; return;
} }
} }
...@@ -5036,11 +5015,7 @@ inline void gcode_M226() { ...@@ -5036,11 +5015,7 @@ inline void gcode_M226() {
break; break;
} }
while(digitalRead(pin_number) != target) { while(digitalRead(pin_number) != target) idle();
manage_heater();
manage_inactivity();
lcd_update();
}
} // pin_number > -1 } // pin_number > -1
} // pin_state -1 0 1 } // pin_state -1 0 1
...@@ -5550,7 +5525,7 @@ inline void gcode_M503() { ...@@ -5550,7 +5525,7 @@ inline void gcode_M503() {
inline void gcode_M600() { inline void gcode_M600() {
float target[NUM_AXIS], fr60 = feedrate / 60; float target[NUM_AXIS], fr60 = feedrate / 60;
filament_changing = true; filament_changing = true;
for (int i=0; i < NUM_AXIS; i++) for (int i = 0; i < NUM_AXIS; i++)
target[i] = lastpos[i] = current_position[i]; target[i] = lastpos[i] = current_position[i];
#ifdef DELTA #ifdef DELTA
...@@ -5604,11 +5579,10 @@ inline void gcode_M503() { ...@@ -5604,11 +5579,10 @@ inline void gcode_M503() {
delay(100); delay(100);
boolean beep = true; boolean beep = true;
boolean sleep = false; boolean sleep = false;
int cnt = 0; uint8_t cnt = 0;
int old_target_temperature[HOTENDS] = { 0 }; int old_target_temperature[HOTENDS] = { 0 };
for (int8_t e = 0; e < HOTENDS; e++) for (int8_t e = 0; e < HOTENDS; e++) {
{
old_target_temperature[e] = target_temperature[e]; old_target_temperature[e] = target_temperature[e];
} }
int old_target_temperature_bed = target_temperature_bed; int old_target_temperature_bed = target_temperature_bed;
...@@ -5617,9 +5591,7 @@ inline void gcode_M503() { ...@@ -5617,9 +5591,7 @@ inline void gcode_M503() {
PRESSBUTTON: PRESSBUTTON:
LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE); LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE);
while (!lcd_clicked()) { while (!lcd_clicked()) {
manage_heater(); idle(true);
manage_inactivity(true);
lcd_update();
if ((millis() - last_set > 60000) && cnt <= FILAMENTCHANGE_PRINTEROFF) beep = true; if ((millis() - last_set > 60000) && cnt <= FILAMENTCHANGE_PRINTEROFF) beep = true;
if (cnt >= FILAMENTCHANGE_PRINTEROFF && !sleep) { if (cnt >= FILAMENTCHANGE_PRINTEROFF && !sleep) {
disable_all_heaters(); disable_all_heaters();
...@@ -5629,17 +5601,15 @@ inline void gcode_M503() { ...@@ -5629,17 +5601,15 @@ inline void gcode_M503() {
LCD_ALERTMESSAGEPGM("Zzzz Zzzz Zzzz"); LCD_ALERTMESSAGEPGM("Zzzz Zzzz Zzzz");
} }
if (beep) { if (beep) {
for(int8_t i = 0; i < 3; i++) lcd_buzz(100, 1000);
last_set = millis(); last_set = millis();
for(int8_t i = 0; i < 3; i++) {
lcd_buzz(100, 1000);
}
beep = false; beep = false;
cnt += 1; ++cnt;
} }
} } // while(!lcd_clicked)
//reset LCD alert message lcd_quick_feedback(); // click sound feedback
lcd_reset_alert_level(); lcd_reset_alert_level(); //reset LCD alert message
if (sleep) { if (sleep) {
enable_all_steppers(); // Enable all stepper enable_all_steppers(); // Enable all stepper
...@@ -5687,6 +5657,12 @@ inline void gcode_M503() { ...@@ -5687,6 +5657,12 @@ inline void gcode_M503() {
filrunoutEnqueued = false; filrunoutEnqueued = false;
#endif #endif
} }
/**
* M601: Resume the print from filament change
*/
inline void gcode_M601() { filament_changing = false; }
#endif //FILAMENTCHANGEENABLE #endif //FILAMENTCHANGEENABLE
#ifdef DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE
...@@ -6283,27 +6259,29 @@ void process_next_command() { ...@@ -6283,27 +6259,29 @@ void process_next_command() {
gcode_M20(); break; gcode_M20(); break;
case 21: // M21 - init SD card case 21: // M21 - init SD card
gcode_M21(); break; gcode_M21(); break;
case 22: //M22 - release SD card case 22: // M22 - release SD card
gcode_M22(); break; gcode_M22(); break;
case 23: //M23 - Select file case 23: // M23 - Select file
gcode_M23(); break; gcode_M23(); break;
case 24: //M24 - Start SD print case 24: // M24 - Start SD print
gcode_M24(); break; gcode_M24(); break;
case 25: //M25 - Pause SD print case 25: // M25 - Pause SD print
gcode_M25(); break; gcode_M25(); break;
case 26: //M26 - Set SD index case 26: // M26 - Set SD index
gcode_M26(); break; gcode_M26(); break;
case 27: //M27 - Get SD status case 27: // M27 - Get SD status
gcode_M27(); break; gcode_M27(); break;
case 28: //M28 - Start SD write case 28: // M28 - Start SD write
gcode_M28(); break; gcode_M28(); break;
case 29: //M29 - Stop SD write case 29: // M29 - Stop SD write
gcode_M29(); break; gcode_M29(); break;
case 30: //M30 <filename> Delete File case 30: // M30 <filename> Delete File
gcode_M30(); break; gcode_M30(); break;
case 32: //M32 - Select file and start SD print case 32: // M32 - Select file and start SD print
gcode_M32(); break; gcode_M32(); break;
case 928: //M928 - Start SD write case 33: // M33 - Long path
gcode_M33(); break;
case 928: // M928 - Start SD write
gcode_M928(); break; gcode_M928(); break;
#endif //SDSUPPORT #endif //SDSUPPORT
...@@ -6550,7 +6528,7 @@ void process_next_command() { ...@@ -6550,7 +6528,7 @@ void process_next_command() {
#endif #endif
#ifdef FILAMENTCHANGEENABLE #ifdef FILAMENTCHANGEENABLE
case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] case 600: // M600 Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
gcode_M600(); break; gcode_M600(); break;
#endif // FILAMENTCHANGEENABLE #endif // FILAMENTCHANGEENABLE
...@@ -6950,6 +6928,15 @@ void disable_all_steppers() { ...@@ -6950,6 +6928,15 @@ void disable_all_steppers() {
disable_e3(); disable_e3();
} }
/**
* Standard idle routine keeps the machine alive
*/
void idle(bool ignore_stepper_queue/*=false*/) {
manage_heater();
manage_inactivity(ignore_stepper_queue);
lcd_update();
}
/** /**
* Manage several activities: * Manage several activities:
* - Check for Filament Runout * - Check for Filament Runout
...@@ -7254,25 +7241,15 @@ bool setTargetedHotend(int code) { ...@@ -7254,25 +7241,15 @@ bool setTargetedHotend(int code) {
if (code_seen('T')) { if (code_seen('T')) {
target_extruder = code_value_short(); target_extruder = code_value_short();
if (target_extruder >= EXTRUDERS) { if (target_extruder >= EXTRUDERS) {
ECHO_S(ER);
switch(code) { switch(code) {
case 104: case 104:
ECHO_M(MSG_M104_INVALID_EXTRUDER);
break;
case 105: case 105:
ECHO_M(MSG_M105_INVALID_EXTRUDER);
break;
case 109: case 109:
ECHO_M(MSG_M109_INVALID_EXTRUDER);
break;
case 218: case 218:
ECHO_M(MSG_M218_INVALID_EXTRUDER);
break;
case 221: case 221:
ECHO_M(MSG_M221_INVALID_EXTRUDER); error_invalid_extruder(code, target_extruder);
break; break;
} }
ECHO_EV(target_extruder);
return true; return true;
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
Created by Tim Koster, August 21 2013. Created by Tim Koster, August 21 2013.
*/ */
#include "Marlin.h" #include "Marlin.h"
#ifdef BLINKM #if ENABLED(BLINKM)
#include "blinkm.h" #include "blinkm.h"
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "temperature.h" #include "temperature.h"
#include "language.h" #include "language.h"
#ifdef SDSUPPORT #if ENABLED(SDSUPPORT)
CardReader::CardReader() { CardReader::CardReader() {
filesize = 0; filesize = 0;
...@@ -20,6 +20,7 @@ CardReader::CardReader() { ...@@ -20,6 +20,7 @@ CardReader::CardReader() {
autostart_stilltocheck = true; //the SD start is delayed, because otherwise the serial cannot answer fast enough to make contact with the host software. autostart_stilltocheck = true; //the SD start is delayed, because otherwise the serial cannot answer fast enough to make contact with the host software.
autostart_index = 0; autostart_index = 0;
//power to SD reader //power to SD reader
#if SDPOWER > -1 #if SDPOWER > -1
OUT_WRITE(SDPOWER, HIGH); OUT_WRITE(SDPOWER, HIGH);
...@@ -125,7 +126,7 @@ void CardReader::ls() { ...@@ -125,7 +126,7 @@ void CardReader::ls() {
lsDive("", root); lsDive("", root);
} }
#ifdef LONG_FILENAME_HOST_SUPPORT #if ENABLED(LONG_FILENAME_HOST_SUPPORT)
/** /**
* Get a long pretty path based on a DOS 8.3 path * Get a long pretty path based on a DOS 8.3 path
...@@ -190,7 +191,7 @@ void CardReader::initsd() { ...@@ -190,7 +191,7 @@ void CardReader::initsd() {
cardOK = false; cardOK = false;
if (root.isOpen()) root.close(); if (root.isOpen()) root.close();
#ifdef SDSLOW #if ENABLED(SDSLOW)
#define SPI_SPEED SPI_HALF_SPEED #define SPI_SPEED SPI_HALF_SPEED
#else #else
#define SPI_SPEED SPI_FULL_SPEED #define SPI_SPEED SPI_FULL_SPEED
...@@ -448,7 +449,7 @@ void CardReader::checkautostart(bool force) { ...@@ -448,7 +449,7 @@ void CardReader::checkautostart(bool force) {
if (!cardOK) return; // fail if (!cardOK) return; // fail
} }
char autoname[30]; char autoname[10];
sprintf_P(autoname, PSTR("auto%i.g"), autostart_index); sprintf_P(autoname, PSTR("auto%i.g"), autostart_index);
for (int8_t i = 0; i < (int8_t)strlen(autoname); i++) autoname[i] = tolower(autoname[i]); for (int8_t i = 0; i < (int8_t)strlen(autoname); i++) autoname[i] = tolower(autoname[i]);
...@@ -460,7 +461,7 @@ void CardReader::checkautostart(bool force) { ...@@ -460,7 +461,7 @@ void CardReader::checkautostart(bool force) {
while (root.readDir(p, NULL) > 0) { while (root.readDir(p, NULL) > 0) {
for (int8_t i = 0; i < (int8_t)strlen((char*)p.name); i++) p.name[i] = tolower(p.name[i]); for (int8_t i = 0; i < (int8_t)strlen((char*)p.name); i++) p.name[i] = tolower(p.name[i]);
if (p.name[9] != '~' && strncmp((char*)p.name, autoname, 5) == 0) { if (p.name[9] != '~' && strncmp((char*)p.name, autoname, 5) == 0) {
char cmd[30]; char cmd[4 + (FILENAME_LENGTH + 1) * MAX_DIR_DEPTH + 2];
sprintf_P(cmd, PSTR("M23 %s"), autoname); sprintf_P(cmd, PSTR("M23 %s"), autoname);
enqueuecommand(cmd); enqueuecommand(cmd);
enqueuecommands_P(PSTR("M24")); enqueuecommands_P(PSTR("M24"));
...@@ -607,22 +608,22 @@ void CardReader::chdir(const char * relpath) { ...@@ -607,22 +608,22 @@ void CardReader::chdir(const char * relpath) {
if (workDir.isOpen()) parent = &workDir; if (workDir.isOpen()) parent = &workDir;
if (newfile.open(*parent, relpath, O_READ)) { if (!newfile.open(*parent, relpath, O_READ)) {
ECHO_LMV(ER, MSG_SD_CANT_ENTER_SUBDIR, relpath);
}
else {
if (workDirDepth < MAX_DIR_DEPTH) { if (workDirDepth < MAX_DIR_DEPTH) {
workDirDepth++; ++workDirDepth;
for (int d = workDirDepth; d--;) workDirParents[d + 1] = workDirParents[d]; for (int d = workDirDepth; d--;) workDirParents[d + 1] = workDirParents[d];
workDirParents[0] = *parent; workDirParents[0] = *parent;
} }
workDir = newfile; workDir = newfile;
} }
else {
ECHO_LMV(ER, MSG_SD_CANT_ENTER_SUBDIR, relpath);
}
} }
void CardReader::updir() { void CardReader::updir() {
if (workDirDepth > 0) { if (workDirDepth > 0) {
workDirDepth--; --workDirDepth;
workDir = workDirParents[0]; workDir = workDirParents[0];
for (uint16_t d = 0; d < workDirDepth; d++) for (uint16_t d = 0; d < workDirDepth; d++)
workDirParents[d] = workDirParents[d+1]; workDirParents[d] = workDirParents[d+1];
......
#ifndef CARDREADER_H #ifndef CARDREADER_H
#define CARDREADER_H #define CARDREADER_H
#ifdef SDSUPPORT #if ENABLED(SDSUPPORT)
#define MAX_DIR_DEPTH 10 // Maximum folder depth #define MAX_DIR_DEPTH 10 // Maximum folder depth
...@@ -84,7 +84,7 @@ extern CardReader card; ...@@ -84,7 +84,7 @@ extern CardReader card;
#define IS_SD_PRINTING (card.sdprinting) #define IS_SD_PRINTING (card.sdprinting)
#if (SDCARDDETECT > -1) #if (SDCARDDETECT > -1)
#ifdef SDCARDDETECTINVERTED #if ENABLED(SDCARDDETECTINVERTED)
#define IS_SD_INSERTED (READ(SDCARDDETECT) != 0) #define IS_SD_INSERTED (READ(SDCARDDETECT) != 0)
#else #else
#define IS_SD_INSERTED (READ(SDCARDDETECT) == 0) #define IS_SD_INSERTED (READ(SDCARDDETECT) == 0)
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#define OK "ok" //ok answer for host #define OK "ok" //ok answer for host
#define ER "Error: " //error for host #define ER "Error: " //error for host
#define WT "wait" //wait for host #define WT "wait" //wait for host
#define DB "MK4: " //message for user #define DB "echo: " //message for user
#define RS "Resend: " //resend for host #define RS "Resend: " //resend for host
#define PAUSE "//action:pause" //command for host that support action #define PAUSE "//action:pause" //command for host that support action
#define RESUME "//action:resume" //command for host that support action #define RESUME "//action:resume" //command for host that support action
......
...@@ -4,638 +4,541 @@ ...@@ -4,638 +4,541 @@
*/ */
#ifndef CONDITIONALS_H #ifndef CONDITIONALS_H
#ifndef M_PI #ifndef CONFIGURATION_LCD // Get the LCD defines which are needed first
#define M_PI 3.1415926536 #define CONFIGURATION_LCD
#endif
#if ENABLED(MAKRPANEL)
#ifndef CONFIGURATION_LCD // Get the LCD defines which are needed first #define DOGLCD
#define SDSUPPORT
#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0) #define DEFAULT_LCD_CONTRAST 17
#define ULTIPANEL
#define CONFIGURATION_LCD #define NEWPANEL
#endif
#if defined(MAKRPANEL)
#define DOGLCD #if ENABLED(miniVIKI) || ENABLED(VIKI2) || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
#define SDSUPPORT #define ULTRA_LCD //general LCD support, also 16x2
#define DEFAULT_LCD_CONTRAST 17 #define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
#define ULTIPANEL #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
#define NEWPANEL
#endif #if ENABLED(miniVIKI)
#define DEFAULT_LCD_CONTRAST 95
#if defined(miniVIKI) || defined(VIKI2) || defined(ELB_FULL_GRAPHIC_CONTROLLER) #elif ENABLED(VIKI2)
#define ULTRA_LCD //general LCD support, also 16x2 #define DEFAULT_LCD_CONTRAST 40
#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. #define DEFAULT_LCD_CONTRAST 110
#define SDCARDDETECTINVERTED
#ifdef miniVIKI #define SDSLOW
#define DEFAULT_LCD_CONTRAST 95 #define U8GLIB_LM6059_AF
#elif defined(VIKI2) #endif
#define DEFAULT_LCD_CONTRAST 40
#elif defined(ELB_FULL_GRAPHIC_CONTROLLER)
#define DEFAULT_LCD_CONTRAST 110
#define SDCARDDETECTINVERTED
#define SDSLOW
#define U8GLIB_LM6059_AF
#endif
#define ENCODER_PULSES_PER_STEP 4
#define ENCODER_STEPS_PER_MENU_ITEM 1
#endif
#ifdef PANEL_ONE
#define SDSUPPORT
#define ULTIMAKERCONTROLLER
#endif
#ifdef REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
#define DOGLCD
#define U8GLIB_ST7920
#define REPRAP_DISCOUNT_SMART_CONTROLLER
#endif
#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
#define ULTIPANEL
#define NEWPANEL
#endif
#if defined(RADDS_DISPLAY)
#define ENCODER_PULSES_PER_STEP 2
#define ENCODER_STEPS_PER_MENU_ITEM 1
#define ULTIPANEL
#define NEWPANEL
#endif
#ifdef REPRAPWORLD_KEYPAD
#define ULTIPANEL
#define NEWPANEL
#endif
#ifdef RA_CONTROL_PANEL
#define LCD_I2C_TYPE_PCA8574
#define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
#define ULTIPANEL
#define NEWPANEL
#endif
/**
* I2C PANELS
*/
#ifdef LCD_I2C_SAINSMART_YWROBOT
// This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
// Make sure it is placed in the Arduino libraries directory.
#define LCD_I2C_TYPE_PCF8575
#define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
#define ULTIPANEL
#define NEWPANEL
#endif
// PANELOLU2 LCD with status LEDs, separate encoder and click inputs
#ifdef LCD_I2C_PANELOLU2
// This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
// Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
// (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
// Note: The PANELOLU2 encoder click input can either be directly connected to a pin
// (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
#define LCD_I2C_TYPE_MCP23017
#define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
#define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
#ifndef ENCODER_PULSES_PER_STEP
#define ENCODER_PULSES_PER_STEP 4 #define ENCODER_PULSES_PER_STEP 4
#define ENCODER_STEPS_PER_MENU_ITEM 1
#endif
#if ENABLED(PANEL_ONE)
#define SDSUPPORT
#define ULTIMAKERCONTROLLER
#endif #endif
#ifndef ENCODER_STEPS_PER_MENU_ITEM #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
#define DOGLCD
#define U8GLIB_ST7920
#define REPRAP_DISCOUNT_SMART_CONTROLLER
#endif
#if ENABLED(ULTIMAKERCONTROLLER) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL)
#define ULTIPANEL
#define NEWPANEL
#endif
#if ENABLED(RADDS_DISPLAY)
#define ENCODER_PULSES_PER_STEP 2
#define ENCODER_STEPS_PER_MENU_ITEM 1 #define ENCODER_STEPS_PER_MENU_ITEM 1
#define ULTIPANEL
#define NEWPANEL
#endif #endif
#ifdef LCD_USE_I2C_BUZZER #if ENABLED(REPRAPWORLD_KEYPAD)
#define LCD_FEEDBACK_FREQUENCY_HZ 1000 #define ULTIPANEL
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 #define NEWPANEL
#endif #endif
#define ULTIPANEL #if ENABLED(RA_CONTROL_PANEL)
#define NEWPANEL #define LCD_I2C_TYPE_PCA8574
#endif #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
#define ULTIPANEL
// Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs #define NEWPANEL
#ifdef LCD_I2C_VIKI #endif
// This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
// Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory. /**
// Note: The pause/stop/resume LCD button pin should be connected to the Arduino * I2C PANELS
// BTN_ENC pin (or set BTN_ENC to -1 if not used) */
#define LCD_I2C_TYPE_MCP23017
#define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander #if ENABLED(LCD_I2C_SAINSMART_YWROBOT)
#define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later) // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
#define ULTIPANEL // Make sure it is placed in the Arduino libraries directory.
#define NEWPANEL #define LCD_I2C_TYPE_PCF8575
#endif #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
#define ULTIPANEL
// Shift register panels #define NEWPANEL
// --------------------- #endif
// 2 wire Non-latching LCD SR from:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
#if ENABLED(LCD_I2C_PANELOLU2)
#ifdef SAV_3DLCD // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
#define SR_LCD_2W_NL // Non latching 2 wire shiftregister // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
#define ULTIPANEL // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
#define NEWPANEL // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
#endif // (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
#define LCD_I2C_TYPE_MCP23017
#ifdef ULTIPANEL #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
#define NEWPANEL //enable this if you have a click-encoder panel #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
#define SDSUPPORT
#define ULTRA_LCD #if DISABLED(ENCODER_PULSES_PER_STEP)
#ifdef DOGLCD // Change number of lines to match the DOG graphic display #define ENCODER_PULSES_PER_STEP 4
#define LCD_WIDTH 22 #endif
#define LCD_HEIGHT 5
#else #if DISABLED(ENCODER_STEPS_PER_MENU_ITEM)
#define LCD_WIDTH 20 #define ENCODER_STEPS_PER_MENU_ITEM 1
#define LCD_HEIGHT 4 #endif
#if ENABLED(LCD_USE_I2C_BUZZER)
#define LCD_FEEDBACK_FREQUENCY_HZ 1000
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
#endif
#define ULTIPANEL
#define NEWPANEL
#endif
// Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
#if ENABLED(LCD_I2C_VIKI)
// This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
// Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
// Note: The pause/stop/resume LCD button pin should be connected to the Arduino
// BTN_ENC pin (or set BTN_ENC to -1 if not used)
#define LCD_I2C_TYPE_MCP23017
#define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
#define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
#define ULTIPANEL
#define NEWPANEL
#endif #endif
#else //no panel but just LCD
#ifdef ULTRA_LCD // Shift register panels
#ifdef DOGLCD // Change number of lines to match the 128x64 graphics display // ---------------------
// 2 wire Non-latching LCD SR from:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
#if ENABLED(SAV_3DLCD)
#define SR_LCD_2W_NL // Non latching 2 wire shiftregister
#define ULTIPANEL
#define NEWPANEL
#endif
#if ENABLED(ULTIPANEL)
#define NEWPANEL //enable this if you have a click-encoder panel
#define SDSUPPORT
#define ULTRA_LCD
#if ENABLED(DOGLCD) // Change number of lines to match the DOG graphic display
#define LCD_WIDTH 22 #define LCD_WIDTH 22
#define LCD_HEIGHT 5 #define LCD_HEIGHT 5
#else #else
#define LCD_WIDTH 16 #define LCD_WIDTH 20
#define LCD_HEIGHT 2 #define LCD_HEIGHT 4
#endif
#else //no panel but just LCD
#if ENABLED(ULTRA_LCD)
#if ENABLED(DOGLCD) // Change number of lines to match the 128x64 graphics display
#define LCD_WIDTH 22
#define LCD_HEIGHT 5
#else
#define LCD_WIDTH 16
#define LCD_HEIGHT 2
#endif
#endif
#endif
#if ENABLED(DOGLCD)
/* Custom characters defined in font font_6x10_marlin_symbols */
// \x00 intentionally skipped to avoid problems in strings
#define LCD_STR_REFRESH "\x01"
#define LCD_STR_FOLDER "\x02"
#define LCD_STR_ARROW_RIGHT "\x03"
#define LCD_STR_UPLEVEL "\x04"
#define LCD_STR_CLOCK "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_BEDTEMP "\x07"
#define LCD_STR_THERMOMETER "\x08"
#define LCD_STR_DEGREE "\x09"
#define LCD_STR_SPECIAL_MAX '\x09'
// Maximum here is 0x1f because 0x20 is ' ' (space) and the normal charsets begin.
// Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here.
#else
/* Custom characters defined in the first 8 characters of the LCD */
#define LCD_STR_BEDTEMP "\x00" // this will have 'unexpected' results when used in a string!
#define LCD_STR_DEGREE "\x01"
#define LCD_STR_THERMOMETER "\x02"
#define LCD_STR_UPLEVEL "\x03"
#define LCD_STR_REFRESH "\x04"
#define LCD_STR_FOLDER "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_CLOCK "\x07"
#define LCD_STR_ARROW_RIGHT ">" /* from the default character set */
#endif
/**
* Default LCD contrast for dogm-like LCD displays
*/
#if ENABLED(DOGLCD) && DISABLED(DEFAULT_LCD_CONTRAST)
#define DEFAULT_LCD_CONTRAST 32
#endif
#if ENABLED(DOGLCD)
#define HAS_LCD_CONTRAST
#if ENABLED(U8GLIB_ST7920)
#undef HAS_LCD_CONTRAST
#endif #endif
#endif #endif
#endif
/**
#ifdef DOGLCD * LCD BUZZ
/* Custom characters defined in font font_6x10_marlin_symbols */ */
// \x00 intentionally skipped to avoid problems in strings #define HAS_LCD_BUZZ (ENABLED(ULTRALCD) || (ENABLED(BEEPER) && BEEPER >= 0) || ENABLED(LCD_USE_I2C_BUZZER))
#define LCD_STR_REFRESH "\x01"
#define LCD_STR_FOLDER "\x02"
#define LCD_STR_ARROW_RIGHT "\x03"
#define LCD_STR_UPLEVEL "\x04"
#define LCD_STR_CLOCK "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_BEDTEMP "\x07"
#define LCD_STR_THERMOMETER "\x08"
#define LCD_STR_DEGREE "\x09"
#define LCD_STR_SPECIAL_MAX '\x09'
// Maximum here is 0x1f because 0x20 is ' ' (space) and the normal charsets begin.
// Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here.
#else
/* Custom characters defined in the first 8 characters of the LCD */
#define LCD_STR_BEDTEMP "\x00" // this will have 'unexpected' results when used in a string!
#define LCD_STR_DEGREE "\x01"
#define LCD_STR_THERMOMETER "\x02"
#define LCD_STR_UPLEVEL "\x03"
#define LCD_STR_REFRESH "\x04"
#define LCD_STR_FOLDER "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_CLOCK "\x07"
#define LCD_STR_ARROW_RIGHT ">" /* from the default character set */
#endif
/**
* Default LCD contrast for dogm-like LCD displays
*/
#if defined(DOGLCD) && !defined(DEFAULT_LCD_CONTRAST)
#define DEFAULT_LCD_CONTRAST 32
#endif
#ifdef DOGLCD
#define HAS_LCD_CONTRAST
#ifdef U8GLIB_ST7920
#undef HAS_LCD_CONTRAST
#endif
#endif
/**
* LCD BUZZ
*/
#define HAS_LCD_BUZZ (defined(ULTRALCD) || (defined(BEEPER) && BEEPER >= 0) || defined(LCD_USE_I2C_BUZZER))
/**
* SPLASH_SCREEN_DURATION for no DOGLCD display
*/
#ifndef DOGLCD
#undef SPLASH_SCREEN_DURATION
#define SPLASH_SCREEN_DURATION 500
#endif
#else // CONFIGURATION_LCD
#define CONDITIONALS_H
/**
* SINGLENOZZLE
*/
#ifdef SINGLENOZZLE
#define HOTENDS 1
#undef TEMP_SENSOR_1_AS_REDUNDANT
#else
#define HOTENDS EXTRUDERS
#endif
/**
* DRIVER_EXTRUDERS
*/
#if !defined(MKR4) && !defined(NPR2)
#define DRIVER_EXTRUDERS EXTRUDERS // This defines the number of Driver extruder
#endif
#ifndef __SAM3X8E__
#ifndef AT90USB
#define HardwareSerial_h // trick to disable the standard HWserial
#endif
#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
#define ENDSTOPPULLUP_ZPROBE
#endif
/**
* ENDSTOP LOGICAL
*/
#if MB(ALLIGATOR)
#define X_MIN_ENDSTOP_INVERTING !X_MIN_ENDSTOP_LOGIC
#define Y_MIN_ENDSTOP_INVERTING !Y_MIN_ENDSTOP_LOGIC
#define Z_MIN_ENDSTOP_INVERTING !Z_MIN_ENDSTOP_LOGIC
#define Z2_MIN_ENDSTOP_INVERTING !Z2_MIN_ENDSTOP_LOGIC
#define E_MIN_ENDSTOP_INVERTING !E_MIN_ENDSTOP_LOGIC
#define X_MAX_ENDSTOP_INVERTING !X_MAX_ENDSTOP_LOGIC
#define Y_MAX_ENDSTOP_INVERTING !Y_MAX_ENDSTOP_LOGIC
#define Z_MAX_ENDSTOP_INVERTING !Z_MAX_ENDSTOP_LOGIC
#define Z2_MAX_ENDSTOP_INVERTING !Z2_MAX_ENDSTOP_LOGIC
#define Z_PROBE_ENDSTOP_INVERTING !Z_PROBE_ENDSTOP_LOGIC
#else
#define X_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_LOGIC
#define Y_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_LOGIC
#define Z_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_LOGIC
#define Z2_MIN_ENDSTOP_INVERTING Z2_MIN_ENDSTOP_LOGIC
#define E_MIN_ENDSTOP_INVERTING E_MIN_ENDSTOP_LOGIC
#define X_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_LOGIC
#define Y_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_LOGIC
#define Z_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_LOGIC
#define Z2_MAX_ENDSTOP_INVERTING Z2_MAX_ENDSTOP_LOGIC
#define Z_PROBE_ENDSTOP_INVERTING Z_PROBE_ENDSTOP_LOGIC
#endif
/**
* Firmware Test
*/
#ifdef FIRMWARE_TEST
#undef BAUDRATE
#define BAUDRATE 115200 // Baudrate setting to 115200 because serial monitor arduino function at max 115200 baudrate.
#endif
/**
* Axis lengths
*/
#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)
/**
* SCARA
*/
#ifdef SCARA
#undef SLOWDOWN
#define QUICK_HOME //SCARA needs Quickhome
#endif
/**
* DELTA
*/
#ifdef DELTA
#undef SLOWDOWN //DELTA not needs SLOWDOWN
// DELTA must have same valour for 3 axis endstop hits
#undef Y_HOME_BUMP_MM
#undef Z_HOME_BUMP_MM
#define Y_HOME_BUMP_MM X_HOME_BUMP_MM
#define Z_HOME_BUMP_MM X_HOME_BUMP_MM
#endif
/** /**
* AUTOSET LOCATIONS OF LIMIT SWITCHES * SPLASH_SCREEN_DURATION for no DOGLCD display
* Added by ZetaPhoenix 09-15-2012 */
*/ #if DISABLED(DOGLCD)
#ifdef MANUAL_HOME_POSITIONS // Use manual limit switch locations #undef SPLASH_SCREEN_DURATION
#define X_HOME_POS MANUAL_X_HOME_POS #define SPLASH_SCREEN_DURATION 500
#define Y_HOME_POS MANUAL_Y_HOME_POS #endif
#define Z_HOME_POS MANUAL_Z_HOME_POS
#else //!MANUAL_HOME_POSITIONS – Use home switch positions based on homing direction and travel limits #else // CONFIGURATION_LCD
#ifdef BED_CENTER_AT_0_0 #define CONDITIONALS_H
#define X_HOME_POS X_MAX_LENGTH * X_HOME_DIR * 0.5
#define Y_HOME_POS Y_MAX_LENGTH * Y_HOME_DIR * 0.5 /**
* SINGLENOZZLE
*/
#if ENABLED(SINGLENOZZLE)
#define HOTENDS 1
#undef TEMP_SENSOR_1_AS_REDUNDANT
#else #else
#define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS) #define HOTENDS EXTRUDERS
#define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS) #endif
#endif
#define Z_HOME_POS (Z_HOME_DIR < 0 ? Z_MIN_POS : Z_MAX_POS) /**
#endif //!MANUAL_HOME_POSITIONS * DRIVER_EXTRUDERS
*/
/** #if DISABLED(MKR4) && DISABLED(NPR2)
* Auto Bed Leveling #define DRIVER_EXTRUDERS EXTRUDERS // This defines the number of Driver extruder
*/ #endif
#ifdef ENABLE_AUTO_BED_LEVELING
// Boundaries for probing based on set limits #ifndef __SAM3X8E__
#define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER)) #ifndef AT90USB
#define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER)) #define HardwareSerial_h // trick to disable the standard HWserial
#define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER)) #endif
#define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER)) #endif
#endif
#if (ARDUINO >= 100)
/** #include "Arduino.h"
* Sled Options
*/
#ifdef Z_PROBE_SLED
#define Z_SAFE_HOMING
#endif
/**
* Servo Leveling
*/
#define SERVO_LEVELING (NUM_SERVOS > 0 && defined(ENABLE_AUTO_BED_LEVELING))
#define SERVO_LEVELING_DELAY (SERVO_LEVELING && PROBE_SERVO_DEACTIVATION_DELAY > 0)
/**
* MAX_STEP_FREQUENCY differs for TOSHIBA OR ARDUINO DUE OR ARDUINO MEGA
*/
#ifdef __SAM3X8E__
#ifdef CONFIG_STEPPERS_TOSHIBA
#define MAX_STEP_FREQUENCY 120000 // Max step frequency for Toshiba Stepper Controllers
#define DOUBLE_STEP_FREQUENCY MAX_STEP_FREQUENCY
#else #else
#define MAX_STEP_FREQUENCY 500000 // Max step frequency for the Due is approx. 330kHz #include "WProgram.h"
#define DOUBLE_STEP_FREQUENCY 120000 //96kHz is close to maximum for an Arduino Due
#endif #endif
#else
#ifdef CONFIG_STEPPERS_TOSHIBA #include "pins.h"
#define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers
#define DOUBLE_STEP_FREQUENCY MAX_STEP_FREQUENCY /**
* ENDSTOPPULLUPS
*/
#if ENABLED(ENDSTOPPULLUPS)
#define ENDSTOPPULLUP_XMAX
#define ENDSTOPPULLUP_YMAX
#define ENDSTOPPULLUP_ZMAX
#define ENDSTOPPULLUP_XMIN
#define ENDSTOPPULLUP_YMIN
#define ENDSTOPPULLUP_ZMIN
#define ENDSTOPPULLUP_EMIN
#define ENDSTOPPULLUP_ZPROBE
#endif
/**
* ENDSTOP LOGICAL
*/
#if MB(ALLIGATOR)
#define X_MIN_ENDSTOP_INVERTING !X_MIN_ENDSTOP_LOGIC
#define Y_MIN_ENDSTOP_INVERTING !Y_MIN_ENDSTOP_LOGIC
#define Z_MIN_ENDSTOP_INVERTING !Z_MIN_ENDSTOP_LOGIC
#define Z2_MIN_ENDSTOP_INVERTING !Z2_MIN_ENDSTOP_LOGIC
#define E_MIN_ENDSTOP_INVERTING !E_MIN_ENDSTOP_LOGIC
#define X_MAX_ENDSTOP_INVERTING !X_MAX_ENDSTOP_LOGIC
#define Y_MAX_ENDSTOP_INVERTING !Y_MAX_ENDSTOP_LOGIC
#define Z_MAX_ENDSTOP_INVERTING !Z_MAX_ENDSTOP_LOGIC
#define Z2_MAX_ENDSTOP_INVERTING !Z2_MAX_ENDSTOP_LOGIC
#define Z_PROBE_ENDSTOP_INVERTING !Z_PROBE_ENDSTOP_LOGIC
#else #else
#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Arduino mega #define X_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_LOGIC
#endif #define Y_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_LOGIC
#endif #define Z_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_LOGIC
#define Z2_MIN_ENDSTOP_INVERTING Z2_MIN_ENDSTOP_LOGIC
// MS1 MS2 Stepper Driver Microstepping mode table #define E_MIN_ENDSTOP_INVERTING E_MIN_ENDSTOP_LOGIC
#define MICROSTEP1 LOW,LOW #define X_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_LOGIC
#define MICROSTEP2 HIGH,LOW #define Y_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_LOGIC
#define MICROSTEP4 LOW,HIGH #define Z_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_LOGIC
#define MICROSTEP8 HIGH,HIGH #define Z2_MAX_ENDSTOP_INVERTING Z2_MAX_ENDSTOP_LOGIC
#if MB(ALLIGATOR) #define Z_PROBE_ENDSTOP_INVERTING Z_PROBE_ENDSTOP_LOGIC
#define MICROSTEP16 LOW,LOW #endif
#define MICROSTEP32 HIGH,HIGH
#else /**
#define MICROSTEP16 HIGH,HIGH * Firmware Test
#endif */
#if ENABLED(FIRMWARE_TEST)
/** #undef BAUDRATE
* Advance calculated values #define BAUDRATE 115200 // Baudrate setting to 115200 because serial monitor arduino function at max 115200 baudrate.
*/ #endif
#ifdef ADVANCE
#define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * M_PI) /**
#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS] / EXTRUSION_AREA) * Axis lengths
#endif */
#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
#ifdef ULTIPANEL #define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
#undef SDCARDDETECTINVERTED #define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
#endif
/**
// Power Signal Control Definitions * SCARA
// By default use Normal definition */
#ifndef POWER_SUPPLY #if ENABLED(SCARA)
#define POWER_SUPPLY 0 #undef SLOWDOWN
#endif #define QUICK_HOME //SCARA needs Quickhome
#if (POWER_SUPPLY == 1) // 1 = ATX #endif
#define PS_ON_AWAKE LOW
#define PS_ON_ASLEEP HIGH /**
#elif (POWER_SUPPLY == 2) // 2 = X-Box 360 203W * DELTA
#define PS_ON_AWAKE HIGH */
#define PS_ON_ASLEEP LOW #if ENABLED(DELTA)
#endif #undef SLOWDOWN //DELTA not needs SLOWDOWN
#define HAS_POWER_SWITCH (POWER_SUPPLY > 0 && PIN_EXISTS(PS_ON)) // DELTA must have same valour for 3 axis endstop hits
#undef Y_HOME_BUMP_MM
/** #undef Z_HOME_BUMP_MM
* Temp Sensor defines #define Y_HOME_BUMP_MM X_HOME_BUMP_MM
*/ #define Z_HOME_BUMP_MM X_HOME_BUMP_MM
#if TEMP_SENSOR_0 == -2 #endif
#define HEATER_0_USES_MAX6675
#elif TEMP_SENSOR_0 == -1 /**
#define HEATER_0_USES_AD595 * AUTOSET LOCATIONS OF LIMIT SWITCHES
#elif TEMP_SENSOR_0 == 0 * Added by ZetaPhoenix 09-15-2012
#undef HEATER_0_MINTEMP */
#undef HEATER_0_MAXTEMP #if ENABLED(MANUAL_HOME_POSITIONS) // Use manual limit switch locations
#elif TEMP_SENSOR_0 > 0 #define X_HOME_POS MANUAL_X_HOME_POS
#define THERMISTORHEATER_0 TEMP_SENSOR_0 #define Y_HOME_POS MANUAL_Y_HOME_POS
#define HEATER_0_USES_THERMISTOR #define Z_HOME_POS MANUAL_Z_HOME_POS
#endif #else //!MANUAL_HOME_POSITIONS – Use home switch positions based on homing direction and travel limits
#if ENABLED(BED_CENTER_AT_0_0)
#if TEMP_SENSOR_1 == -1 #define X_HOME_POS X_MAX_LENGTH * X_HOME_DIR * 0.5
#define HEATER_1_USES_AD595 #define Y_HOME_POS Y_MAX_LENGTH * Y_HOME_DIR * 0.5
#elif TEMP_SENSOR_1 == 0 #else
#undef HEATER_1_MINTEMP #define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS)
#undef HEATER_1_MAXTEMP #define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS)
#elif TEMP_SENSOR_1 > 0 #endif
#define THERMISTORHEATER_1 TEMP_SENSOR_1 #define Z_HOME_POS (Z_HOME_DIR < 0 ? Z_MIN_POS : Z_MAX_POS)
#define HEATER_1_USES_THERMISTOR #endif //!MANUAL_HOME_POSITIONS
#endif
/**
#if TEMP_SENSOR_2 == -1 * Auto Bed Leveling
#define HEATER_2_USES_AD595 */
#elif TEMP_SENSOR_2 == 0 #if ENABLED(ENABLE_AUTO_BED_LEVELING)
#undef HEATER_2_MINTEMP // Boundaries for probing based on set limits
#undef HEATER_2_MAXTEMP #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#elif TEMP_SENSOR_2 > 0 #define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define THERMISTORHEATER_2 TEMP_SENSOR_2 #define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#define HEATER_2_USES_THERMISTOR #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#endif #endif
#if TEMP_SENSOR_3 == -1 /**
#define HEATER_3_USES_AD595 * Sled Options
#elif TEMP_SENSOR_3 == 0 */
#undef HEATER_3_MINTEMP #if ENABLED(Z_PROBE_SLED)
#undef HEATER_3_MAXTEMP #define Z_SAFE_HOMING
#elif TEMP_SENSOR_3 > 0 #endif
#define THERMISTORHEATER_3 TEMP_SENSOR_3
#define HEATER_3_USES_THERMISTOR /**
#endif * Servo Leveling
*/
#if TEMP_SENSOR_BED == -1 #define SERVO_LEVELING (NUM_SERVOS > 0 && defined(ENABLE_AUTO_BED_LEVELING))
#define BED_USES_AD595 #define SERVO_LEVELING_DELAY (SERVO_LEVELING && PROBE_SERVO_DEACTIVATION_DELAY > 0)
#elif TEMP_SENSOR_BED == 0
#undef BED_MINTEMP /**
#undef BED_MAXTEMP * MAX_STEP_FREQUENCY differs for TOSHIBA OR ARDUINO DUE OR ARDUINO MEGA
#elif TEMP_SENSOR_BED > 0 */
#define THERMISTORBED TEMP_SENSOR_BED #ifdef __SAM3X8E__
#define BED_USES_THERMISTOR #if ENABLED(CONFIG_STEPPERS_TOSHIBA)
#endif #define MAX_STEP_FREQUENCY 120000 // Max step frequency for Toshiba Stepper Controllers
#define DOUBLE_STEP_FREQUENCY MAX_STEP_FREQUENCY
/** #else
* ARRAY_BY_EXTRUDERS based on EXTRUDERS #define MAX_STEP_FREQUENCY 500000 // Max step frequency for the Due is approx. 330kHz
*/ #define DOUBLE_STEP_FREQUENCY 120000 //96kHz is close to maximum for an Arduino Due
#if EXTRUDERS > 3
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3, v4 }
#elif EXTRUDERS > 2
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3 }
#elif EXTRUDERS > 1
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2 }
#else
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1 }
#endif
/**
* ARRAY_BY_HOTENDS based on HOTENDS
*/
#if HOTENDS > 3
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2, v3, v4 }
#elif HOTENDS > 2
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2, v3 }
#elif HOTENDS > 1
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2 }
#else
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1 }
#endif
/**
* Shorthand for pin tests, used wherever needed
*/
#define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 != -2)
#define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0)
#define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0)
#define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0)
#define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0)
#define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
#define HAS_HEATER_1 (PIN_EXISTS(HEATER_1))
#define HAS_HEATER_2 (PIN_EXISTS(HEATER_2))
#define HAS_HEATER_3 (PIN_EXISTS(HEATER_3))
#define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
#define HAS_AUTO_FAN_0 (PIN_EXISTS(EXTRUDER_0_AUTO_FAN))
#define HAS_AUTO_FAN_1 (PIN_EXISTS(EXTRUDER_1_AUTO_FAN))
#define HAS_AUTO_FAN_2 (PIN_EXISTS(EXTRUDER_2_AUTO_FAN))
#define HAS_AUTO_FAN_3 (PIN_EXISTS(EXTRUDER_3_AUTO_FAN))
#define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3)
#define HAS_FAN (PIN_EXISTS(FAN))
#define HAS_CONTROLLERFAN (PIN_EXISTS(CONTROLLERFAN))
#define HAS_SERVO_0 (PIN_EXISTS(SERVO0))
#define HAS_SERVO_1 (PIN_EXISTS(SERVO1))
#define HAS_SERVO_2 (PIN_EXISTS(SERVO2))
#define HAS_SERVO_3 (PIN_EXISTS(SERVO3))
#define HAS_FILAMENT_SENSOR (defined(FILAMENT_SENSOR) && PIN_EXISTS(FILWIDTH))
#define HAS_POWER_CONSUMPTION_SENSOR (defined(POWER_CONSUMPTION) && PIN_EXISTS(POWER_CONSUMPTION))
#define HAS_FILRUNOUT (defined(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FILRUNOUT))
#define HAS_HOME (PIN_EXISTS(HOME))
#define HAS_KILL (PIN_EXISTS(KILL))
#define HAS_SUICIDE (PIN_EXISTS(SUICIDE))
#define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH))
#define HAS_X_MIN (PIN_EXISTS(X_MIN))
#define HAS_X_MAX (PIN_EXISTS(X_MAX))
#define HAS_Y_MIN (PIN_EXISTS(Y_MIN))
#define HAS_Y_MAX (PIN_EXISTS(Y_MAX))
#define HAS_Z_MIN (PIN_EXISTS(Z_MIN))
#define HAS_Z_MAX (PIN_EXISTS(Z_MAX))
#define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
#define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
#define HAS_Z_PROBE (PIN_EXISTS(Z_PROBE))
#define HAS_E_MIN (PIN_EXISTS(E_MIN))
#define HAS_SOLENOID_1 (PIN_EXISTS(SOL1))
#define HAS_SOLENOID_2 (PIN_EXISTS(SOL2))
#define HAS_SOLENOID_3 (PIN_EXISTS(SOL3))
#define HAS_MICROSTEPS (PIN_EXISTS(X_MS1))
#define HAS_MICROSTEPS_E0 (PIN_EXISTS(E0_MS1))
#define HAS_MICROSTEPS_E1 (PIN_EXISTS(E1_MS1))
#define HAS_MICROSTEPS_E2 (PIN_EXISTS(E2_MS1))
#define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE))
#define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE))
#define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE))
#define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE))
#define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE))
#define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE))
#define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE))
#define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE))
#define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE))
#define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE))
#define HAS_X_DIR (PIN_EXISTS(X_DIR))
#define HAS_X2_DIR (PIN_EXISTS(X2_DIR))
#define HAS_Y_DIR (PIN_EXISTS(Y_DIR))
#define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR))
#define HAS_Z_DIR (PIN_EXISTS(Z_DIR))
#define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR))
#define HAS_E0_DIR (PIN_EXISTS(E0_DIR))
#define HAS_E1_DIR (PIN_EXISTS(E1_DIR))
#define HAS_E2_DIR (PIN_EXISTS(E2_DIR))
#define HAS_E3_DIR (PIN_EXISTS(E3_DIR))
#define HAS_X_STEP (PIN_EXISTS(X_STEP))
#define HAS_X2_STEP (PIN_EXISTS(X2_STEP))
#define HAS_Y_STEP (PIN_EXISTS(Y_STEP))
#define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP))
#define HAS_Z_STEP (PIN_EXISTS(Z_STEP))
#define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP))
#define HAS_E0_STEP (PIN_EXISTS(E0_STEP))
#define HAS_E1_STEP (PIN_EXISTS(E1_STEP))
#define HAS_E2_STEP (PIN_EXISTS(E2_STEP))
#define HAS_E3_STEP (PIN_EXISTS(E3_STEP))
#define HAS_E0E1 (PIN_EXISTS(E0E1_CHOICE))
#define HAS_E0E2 (PIN_EXISTS(E0E2_CHOICE))
#define HAS_E0E3 (PIN_EXISTS(E0E3_CHOICE))
#define HAS_E0E4 (PIN_EXISTS(E0E4_CHOICE))
#define HAS_E1E3 (PIN_EXISTS(E1E3_CHOICE))
#define HAS_BTN_BACK (PIN_EXISTS(BTN_BACK))
/**
* Helper Macros for heaters and extruder fan
*/
#ifdef INVERTED_HEATER_PINS
#define WRITE_HEATER(pin,value) WRITE(pin,!value)
#else
#define WRITE_HEATER(pin,value) WRITE(pin,value)
#endif
#define WRITE_HEATER_0P(v) WRITE_HEATER(HEATER_0_PIN, v)
#if HOTENDS > 1 || defined(HEATERS_PARALLEL)
#define WRITE_HEATER_1(v) WRITE_HEATER(HEATER_1_PIN, v)
#if HOTENDS > 2
#define WRITE_HEATER_2(v) WRITE_HEATER(HEATER_2_PIN, v)
#if HOTENDS > 3
#define WRITE_HEATER_3(v) WRITE_HEATER(HEATER_3_PIN, v)
#endif #endif
#else
#if ENABLED(CONFIG_STEPPERS_TOSHIBA)
#define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers
#define DOUBLE_STEP_FREQUENCY MAX_STEP_FREQUENCY
#else
#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Arduino mega
#endif
#endif
// MS1 MS2 Stepper Driver Microstepping mode table
#define MICROSTEP1 LOW,LOW
#define MICROSTEP2 HIGH,LOW
#define MICROSTEP4 LOW,HIGH
#define MICROSTEP8 HIGH,HIGH
#if MB(ALLIGATOR)
#define MICROSTEP16 LOW,LOW
#define MICROSTEP32 HIGH,HIGH
#else
#define MICROSTEP16 HIGH,HIGH
#endif
/**
* Advance calculated values
*/
#if ENABLED(ADVANCE)
#define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * M_PI)
#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS] / EXTRUSION_AREA)
#endif
#if ENABLED(ULTIPANEL)
#undef SDCARDDETECTINVERTED
#endif
// Power Signal Control Definitions
// By default use Normal definition
#ifndef POWER_SUPPLY
#define POWER_SUPPLY 0
#endif
#if (POWER_SUPPLY == 1) // 1 = ATX
#define PS_ON_AWAKE LOW
#define PS_ON_ASLEEP HIGH
#elif (POWER_SUPPLY == 2) // 2 = X-Box 360 203W
#define PS_ON_AWAKE HIGH
#define PS_ON_ASLEEP LOW
#endif #endif
#endif #define HAS_POWER_SWITCH (POWER_SUPPLY > 0 && PIN_EXISTS(PS_ON))
#ifdef HEATERS_PARALLEL
#define WRITE_HEATER_0(v) { WRITE_HEATER_0P(v); WRITE_HEATER_1(v); } /**
#else * Temp Sensor defines
#define WRITE_HEATER_0(v) WRITE_HEATER_0P(v) */
#endif #if TEMP_SENSOR_0 == -2
#if HAS_HEATER_BED #define HEATER_0_USES_MAX6675
#define WRITE_HEATER_BED(v) WRITE_HEATER(HEATER_BED_PIN, v) #elif TEMP_SENSOR_0 == -1
#endif #define HEATER_0_USES_AD595
#if HAS_FAN #elif TEMP_SENSOR_0 == 0
#define WRITE_FAN(v) WRITE(FAN_PIN, v) #undef HEATER_0_MINTEMP
#endif #undef HEATER_0_MAXTEMP
#elif TEMP_SENSOR_0 > 0
/** #define THERMISTORHEATER_0 TEMP_SENSOR_0
* Shorthand for filament sensor and power sensor for ultralcd.cpp, dogm_lcd_implementation.h, ultralcd_implementation_hitachi_HD44780.h #define HEATER_0_USES_THERMISTOR
*/ #endif
#define HAS_LCD_FILAMENT_SENSOR (HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY))
#define HAS_LCD_POWER_SENSOR (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY)) #if TEMP_SENSOR_1 == -1
#define HEATER_1_USES_AD595
#endif //CONFIGURATION_LCD #elif TEMP_SENSOR_1 == 0
#undef HEATER_1_MINTEMP
#undef HEATER_1_MAXTEMP
#elif TEMP_SENSOR_1 > 0
#define THERMISTORHEATER_1 TEMP_SENSOR_1
#define HEATER_1_USES_THERMISTOR
#endif
#if TEMP_SENSOR_2 == -1
#define HEATER_2_USES_AD595
#elif TEMP_SENSOR_2 == 0
#undef HEATER_2_MINTEMP
#undef HEATER_2_MAXTEMP
#elif TEMP_SENSOR_2 > 0
#define THERMISTORHEATER_2 TEMP_SENSOR_2
#define HEATER_2_USES_THERMISTOR
#endif
#if TEMP_SENSOR_3 == -1
#define HEATER_3_USES_AD595
#elif TEMP_SENSOR_3 == 0
#undef HEATER_3_MINTEMP
#undef HEATER_3_MAXTEMP
#elif TEMP_SENSOR_3 > 0
#define THERMISTORHEATER_3 TEMP_SENSOR_3
#define HEATER_3_USES_THERMISTOR
#endif
#if TEMP_SENSOR_BED == -1
#define BED_USES_AD595
#elif TEMP_SENSOR_BED == 0
#undef BED_MINTEMP
#undef BED_MAXTEMP
#undef THERMAL_PROTECTION_BED
#undef THERMAL_PROTECTION_BED_PERIOD
#elif TEMP_SENSOR_BED > 0
#define THERMISTORBED TEMP_SENSOR_BED
#define BED_USES_THERMISTOR
#endif
/**
* ARRAY_BY_EXTRUDERS based on EXTRUDERS
*/
#if EXTRUDERS > 3
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3, v4 }
#elif EXTRUDERS > 2
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3 }
#elif EXTRUDERS > 1
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2 }
#else
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1 }
#endif
/**
* ARRAY_BY_HOTENDS based on HOTENDS
*/
#if HOTENDS > 3
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2, v3, v4 }
#elif HOTENDS > 2
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2, v3 }
#elif HOTENDS > 1
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2 }
#else
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1 }
#endif
/**
* Helper Macros for heaters and extruder fan
*/
#if ENABLED(INVERTED_HEATER_PINS)
#define WRITE_HEATER(pin,value) WRITE(pin,!value)
#else
#define WRITE_HEATER(pin,value) WRITE(pin,value)
#endif
#define WRITE_HEATER_0P(v) WRITE_HEATER(HEATER_0_PIN, v)
#if HOTENDS > 1 || defined(HEATERS_PARALLEL)
#define WRITE_HEATER_1(v) WRITE_HEATER(HEATER_1_PIN, v)
#if HOTENDS > 2
#define WRITE_HEATER_2(v) WRITE_HEATER(HEATER_2_PIN, v)
#if HOTENDS > 3
#define WRITE_HEATER_3(v) WRITE_HEATER(HEATER_3_PIN, v)
#endif
#endif
#endif
#if ENABLED(HEATERS_PARALLEL)
#define WRITE_HEATER_0(v) { WRITE_HEATER_0P(v); WRITE_HEATER_1(v); }
#else
#define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
#endif
#if HAS_HEATER_BED
#define WRITE_HEATER_BED(v) WRITE_HEATER(HEATER_BED_PIN, v)
#endif
#if HAS_FAN
#define WRITE_FAN(v) WRITE(FAN_PIN, v)
#endif
#endif //CONFIGURATION_LCD
#endif //CONDITIONALS_H #endif //CONDITIONALS_H
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
#include "ultralcd.h" #include "ultralcd.h"
#include "configuration_store.h" #include "configuration_store.h"
#ifdef SDSUPPORT #if ENABLED(SDSUPPORT)
#include "cardreader.h" #include "cardreader.h"
#endif #endif
...@@ -138,7 +138,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) { ...@@ -138,7 +138,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) {
#define EEPROM_OFFSET 100 #define EEPROM_OFFSET 100
#ifdef EEPROM_SETTINGS #if ENABLED(EEPROM_SETTINGS)
void Config_StoreSettings() { void Config_StoreSettings() {
float dummy = 0.0f; float dummy = 0.0f;
...@@ -159,7 +159,7 @@ void Config_StoreSettings() { ...@@ -159,7 +159,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, max_e_jerk); EEPROM_WRITE_VAR(i, max_e_jerk);
EEPROM_WRITE_VAR(i, home_offset); EEPROM_WRITE_VAR(i, home_offset);
#ifndef DELTA #if DISABLED(DELTA)
EEPROM_WRITE_VAR(i, zprobe_zoffset); EEPROM_WRITE_VAR(i, zprobe_zoffset);
#endif #endif
...@@ -167,21 +167,21 @@ void Config_StoreSettings() { ...@@ -167,21 +167,21 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, hotend_offset); EEPROM_WRITE_VAR(i, hotend_offset);
#endif #endif
#ifdef DELTA #if ENABLED(DELTA)
EEPROM_WRITE_VAR(i, endstop_adj); EEPROM_WRITE_VAR(i, endstop_adj);
EEPROM_WRITE_VAR(i, delta_radius); EEPROM_WRITE_VAR(i, delta_radius);
EEPROM_WRITE_VAR(i, delta_diagonal_rod); EEPROM_WRITE_VAR(i, delta_diagonal_rod);
EEPROM_WRITE_VAR(i, max_pos); EEPROM_WRITE_VAR(i, max_pos);
EEPROM_WRITE_VAR(i, tower_adj); EEPROM_WRITE_VAR(i, tower_adj);
EEPROM_WRITE_VAR(i, z_probe_offset); EEPROM_WRITE_VAR(i, z_probe_offset);
#elif defined(Z_DUAL_ENDSTOPS) #elif ENABLED(Z_DUAL_ENDSTOPS)
EEPROM_WRITE_VAR(i, z_endstop_adj); // 1 floats EEPROM_WRITE_VAR(i, z_endstop_adj); // 1 floats
#endif #endif
#ifndef ULTIPANEL #if DISABLED(ULTIPANEL)
int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED; int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED,
int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED; absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED,
int gumPreheatHotendTemp = GUM_PREHEAT_HOTEND_TEMP, gumPreheatHPBTemp = GUM_PREHEAT_HPB_TEMP, gumPreheatFanSpeed = GUM_PREHEAT_FAN_SPEED; gumPreheatHotendTemp = GUM_PREHEAT_HOTEND_TEMP, gumPreheatHPBTemp = GUM_PREHEAT_HPB_TEMP, gumPreheatFanSpeed = GUM_PREHEAT_FAN_SPEED;
#endif #endif
EEPROM_WRITE_VAR(i, plaPreheatHotendTemp); EEPROM_WRITE_VAR(i, plaPreheatHotendTemp);
...@@ -195,7 +195,7 @@ void Config_StoreSettings() { ...@@ -195,7 +195,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, gumPreheatFanSpeed); EEPROM_WRITE_VAR(i, gumPreheatFanSpeed);
for (int e = 0; e < 4; e++) { for (int e = 0; e < 4; e++) {
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
if (e < HOTENDS) { if (e < HOTENDS) {
EEPROM_WRITE_VAR(i, PID_PARAM(Kp, e)); EEPROM_WRITE_VAR(i, PID_PARAM(Kp, e));
EEPROM_WRITE_VAR(i, PID_PARAM(Ki, e)); EEPROM_WRITE_VAR(i, PID_PARAM(Ki, e));
...@@ -212,7 +212,7 @@ void Config_StoreSettings() { ...@@ -212,7 +212,7 @@ void Config_StoreSettings() {
} // Extruders Loop } // Extruders Loop
#ifndef PIDTEMPBED #if DISABLED(PIDTEMPBED)
float bedKp = DUMMY_PID_VALUE, bedKi = DUMMY_PID_VALUE, bedKd = DUMMY_PID_VALUE; float bedKp = DUMMY_PID_VALUE, bedKi = DUMMY_PID_VALUE, bedKd = DUMMY_PID_VALUE;
#endif #endif
...@@ -220,19 +220,19 @@ void Config_StoreSettings() { ...@@ -220,19 +220,19 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, bedKi); EEPROM_WRITE_VAR(i, bedKi);
EEPROM_WRITE_VAR(i, bedKd); EEPROM_WRITE_VAR(i, bedKd);
#if !defined(DOGLCD) || LCD_CONTRAST < 0 #if DISABLED(DOGLCD) || LCD_CONTRAST < 0
int lcd_contrast = 32; const int lcd_contrast = 32;
#endif #endif
EEPROM_WRITE_VAR(i, lcd_contrast); EEPROM_WRITE_VAR(i, lcd_contrast);
#ifdef SCARA #if ENABLED(SCARA)
EEPROM_WRITE_VAR(i, axis_scaling); // 3 floats EEPROM_WRITE_VAR(i, axis_scaling); // 3 floats
#else #else
dummy = 1.0f; dummy = 1.0f;
EEPROM_WRITE_VAR(i, dummy); EEPROM_WRITE_VAR(i, dummy);
#endif #endif
#ifdef FWRETRACT #if ENABLED(FWRETRACT)
EEPROM_WRITE_VAR(i, autoretract_enabled); EEPROM_WRITE_VAR(i, autoretract_enabled);
EEPROM_WRITE_VAR(i, retract_length); EEPROM_WRITE_VAR(i, retract_length);
#if EXTRUDERS > 1 #if EXTRUDERS > 1
...@@ -261,7 +261,7 @@ void Config_StoreSettings() { ...@@ -261,7 +261,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, dummy); EEPROM_WRITE_VAR(i, dummy);
} }
#ifdef IDLE_OOZING_PREVENT #if ENABLED(IDLE_OOZING_PREVENT)
EEPROM_WRITE_VAR(i, idleoozing_enabled); EEPROM_WRITE_VAR(i, idleoozing_enabled);
#endif #endif
...@@ -310,7 +310,7 @@ void Config_RetrieveSettings() { ...@@ -310,7 +310,7 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, max_e_jerk); EEPROM_READ_VAR(i, max_e_jerk);
EEPROM_READ_VAR(i, home_offset); EEPROM_READ_VAR(i, home_offset);
#ifndef DELTA #if DISABLED(DELTA)
EEPROM_READ_VAR(i, zprobe_zoffset); EEPROM_READ_VAR(i, zprobe_zoffset);
#endif #endif
...@@ -318,7 +318,7 @@ void Config_RetrieveSettings() { ...@@ -318,7 +318,7 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, hotend_offset); EEPROM_READ_VAR(i, hotend_offset);
#endif #endif
#ifdef DELTA #if ENABLED(DELTA)
EEPROM_READ_VAR(i, endstop_adj); EEPROM_READ_VAR(i, endstop_adj);
EEPROM_READ_VAR(i, delta_radius); EEPROM_READ_VAR(i, delta_radius);
EEPROM_READ_VAR(i, delta_diagonal_rod); EEPROM_READ_VAR(i, delta_diagonal_rod);
...@@ -329,7 +329,7 @@ void Config_RetrieveSettings() { ...@@ -329,7 +329,7 @@ void Config_RetrieveSettings() {
set_delta_constants(); set_delta_constants();
#endif //DELTA #endif //DELTA
#ifndef ULTIPANEL #if DISABLED(ULTIPANEL)
int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed, int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed,
absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed,
gumPreheatHotendTemp, gumPreheatHPBTemp, gumPreheatFanSpeed; gumPreheatHotendTemp, gumPreheatHPBTemp, gumPreheatFanSpeed;
...@@ -345,7 +345,7 @@ void Config_RetrieveSettings() { ...@@ -345,7 +345,7 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, gumPreheatHPBTemp); EEPROM_READ_VAR(i, gumPreheatHPBTemp);
EEPROM_READ_VAR(i, gumPreheatFanSpeed); EEPROM_READ_VAR(i, gumPreheatFanSpeed);
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
for (int e = 0; e < 4; e++) { // 4 = max hotend currently supported for (int e = 0; e < 4; e++) { // 4 = max hotend currently supported
EEPROM_READ_VAR(i, dummy); // Kp EEPROM_READ_VAR(i, dummy); // Kp
if (e < EXTRUDERS && dummy != DUMMY_PID_VALUE) { if (e < EXTRUDERS && dummy != DUMMY_PID_VALUE) {
...@@ -363,7 +363,7 @@ void Config_RetrieveSettings() { ...@@ -363,7 +363,7 @@ void Config_RetrieveSettings() {
for (int q = 12; q--;) EEPROM_READ_VAR(i, dummy); // 4x Kp, Ki, Kd for (int q = 12; q--;) EEPROM_READ_VAR(i, dummy); // 4x Kp, Ki, Kd
#endif // !PIDTEMP #endif // !PIDTEMP
#ifndef PIDTEMPBED #if DISABLED(PIDTEMPBED)
float bedKp, bedKi, bedKd; float bedKp, bedKi, bedKd;
#endif #endif
...@@ -377,19 +377,19 @@ void Config_RetrieveSettings() { ...@@ -377,19 +377,19 @@ void Config_RetrieveSettings() {
for (int q = 2; q--;) EEPROM_READ_VAR(i, dummy); // bedKi, bedKd for (int q = 2; q--;) EEPROM_READ_VAR(i, dummy); // bedKi, bedKd
} }
#if !defined(DOGLCD) || LCD_CONTRAST < 0 #if DISABLED(DOGLCD) || LCD_CONTRAST < 0
int lcd_contrast; int lcd_contrast;
#endif //DOGLCD #endif
EEPROM_READ_VAR(i, lcd_contrast); EEPROM_READ_VAR(i, lcd_contrast);
#ifdef SCARA #if ENABLED(SCARA)
EEPROM_READ_VAR(i, axis_scaling); // 3 floats EEPROM_READ_VAR(i, axis_scaling); // 3 floats
#else #else
EEPROM_READ_VAR(i, dummy); EEPROM_READ_VAR(i, dummy);
#endif #endif
#ifdef FWRETRACT #if ENABLED(FWRETRACT)
EEPROM_READ_VAR(i, autoretract_enabled); EEPROM_READ_VAR(i, autoretract_enabled);
EEPROM_READ_VAR(i, retract_length); EEPROM_READ_VAR(i, retract_length);
#if EXTRUDERS > 1 #if EXTRUDERS > 1
...@@ -417,7 +417,7 @@ void Config_RetrieveSettings() { ...@@ -417,7 +417,7 @@ void Config_RetrieveSettings() {
calculate_volumetric_multipliers(); calculate_volumetric_multipliers();
#ifdef IDLE_OOZING_PREVENT #if ENABLED(IDLE_OOZING_PREVENT)
EEPROM_READ_VAR(i, idleoozing_enabled); EEPROM_READ_VAR(i, idleoozing_enabled);
#endif #endif
...@@ -444,13 +444,13 @@ void Config_ResetDefault() { ...@@ -444,13 +444,13 @@ void Config_ResetDefault() {
float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT; float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT;
float tmp2[] = DEFAULT_MAX_FEEDRATE; float tmp2[] = DEFAULT_MAX_FEEDRATE;
long tmp3[] = DEFAULT_MAX_ACCELERATION; long tmp3[] = DEFAULT_MAX_ACCELERATION;
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
float tmp4[] = DEFAULT_Kp; float tmp4[] = DEFAULT_Kp;
float tmp5[] = DEFAULT_Ki; float tmp5[] = DEFAULT_Ki;
float tmp6[] = DEFAULT_Kd; float tmp6[] = DEFAULT_Kd;
#endif // PIDTEMP #endif // PIDTEMP
#if defined(HOTEND_OFFSET_X) && defined(HOTEND_OFFSET_Y) #if ENABLED(HOTEND_OFFSET_X) && ENABLED(HOTEND_OFFSET_Y)
float tmp7[] = HOTEND_OFFSET_X; float tmp7[] = HOTEND_OFFSET_X;
float tmp8[] = HOTEND_OFFSET_Y; float tmp8[] = HOTEND_OFFSET_Y;
#else #else
...@@ -469,7 +469,7 @@ void Config_ResetDefault() { ...@@ -469,7 +469,7 @@ void Config_ResetDefault() {
hotend_offset[X_AXIS][i] = tmp7[i]; hotend_offset[X_AXIS][i] = tmp7[i];
hotend_offset[Y_AXIS][i] = tmp8[i]; hotend_offset[Y_AXIS][i] = tmp8[i];
#endif #endif
#ifdef SCARA #if ENABLED(SCARA)
if (i < sizeof(axis_scaling) / sizeof(*axis_scaling)) if (i < sizeof(axis_scaling) / sizeof(*axis_scaling))
axis_scaling[i] = 1; axis_scaling[i] = 1;
#endif #endif
...@@ -489,13 +489,13 @@ void Config_ResetDefault() { ...@@ -489,13 +489,13 @@ void Config_ResetDefault() {
max_e_jerk = DEFAULT_EJERK; max_e_jerk = DEFAULT_EJERK;
home_offset[X_AXIS] = home_offset[Y_AXIS] = home_offset[Z_AXIS] = 0; home_offset[X_AXIS] = home_offset[Y_AXIS] = home_offset[Z_AXIS] = 0;
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
zprobe_zoffset = -Z_PROBE_OFFSET_FROM_EXTRUDER; zprobe_zoffset = -Z_PROBE_OFFSET_FROM_EXTRUDER;
#elif !defined DELTA #elif DISABLED(DELTA)
zprobe_zoffset = 0; zprobe_zoffset = 0;
#endif //ENABLE_AUTO_BED_LEVELING #endif
#ifdef DELTA #if ENABLED(DELTA)
endstop_adj[X_AXIS] = endstop_adj[Y_AXIS] = endstop_adj[Z_AXIS] = 0; endstop_adj[X_AXIS] = endstop_adj[Y_AXIS] = endstop_adj[Z_AXIS] = 0;
delta_radius = DEFAULT_DELTA_RADIUS; delta_radius = DEFAULT_DELTA_RADIUS;
delta_diagonal_rod = DEFAULT_DELTA_DIAGONAL_ROD; delta_diagonal_rod = DEFAULT_DELTA_DIAGONAL_ROD;
...@@ -503,9 +503,9 @@ void Config_ResetDefault() { ...@@ -503,9 +503,9 @@ void Config_ResetDefault() {
max_pos[2] = MANUAL_Z_HOME_POS; max_pos[2] = MANUAL_Z_HOME_POS;
set_default_z_probe_offset(); set_default_z_probe_offset();
set_delta_constants(); set_delta_constants();
#endif //DELTA #endif
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP; plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP;
plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP; plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP;
plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED; plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
...@@ -517,11 +517,11 @@ void Config_ResetDefault() { ...@@ -517,11 +517,11 @@ void Config_ResetDefault() {
gumPreheatFanSpeed = GUM_PREHEAT_FAN_SPEED; gumPreheatFanSpeed = GUM_PREHEAT_FAN_SPEED;
#endif #endif
#if defined(DOGLCD) && LCD_CONTRAST >= 0 #if ENABLED(HAS_LCD_CONTRAST)
lcd_contrast = DEFAULT_LCD_CONTRAST; lcd_contrast = DEFAULT_LCD_CONTRAST;
#endif //DOGLCD #endif //DOGLCD
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
for (int e = 0; e < HOTENDS; e++) for (int e = 0; e < HOTENDS; e++)
{ {
Kp[e] = tmp4[e]; Kp[e] = tmp4[e];
...@@ -530,9 +530,15 @@ void Config_ResetDefault() { ...@@ -530,9 +530,15 @@ void Config_ResetDefault() {
} }
// call updatePID (similar to when we have processed M301) // call updatePID (similar to when we have processed M301)
updatePID(); updatePID();
#endif//PIDTEMP #endif // PIDTEMP
#ifdef FWRETRACT #if ENABLED(PIDTEMPBED)
bedKp = DEFAULT_bedKp;
bedKi = scalePID_i(DEFAULT_bedKi);
bedKd = scalePID_d(DEFAULT_bedKd);
#endif
#if ENABLED(FWRETRACT)
autoretract_enabled = false; autoretract_enabled = false;
retract_length = RETRACT_LENGTH; retract_length = RETRACT_LENGTH;
#if EXTRUDERS > 1 #if EXTRUDERS > 1
...@@ -555,22 +561,22 @@ void Config_ResetDefault() { ...@@ -555,22 +561,22 @@ void Config_ResetDefault() {
filament_size[2] = DEFAULT_NOMINAL_FILAMENT_DIA; filament_size[2] = DEFAULT_NOMINAL_FILAMENT_DIA;
#if EXTRUDERS > 3 #if EXTRUDERS > 3
filament_size[3] = DEFAULT_NOMINAL_FILAMENT_DIA; filament_size[3] = DEFAULT_NOMINAL_FILAMENT_DIA;
#endif //EXTRUDERS > 3 #endif // EXTRUDERS > 3
#endif //EXTRUDERS > 2 #endif // EXTRUDERS > 2
#endif //EXTRUDERS > 1 #endif // EXTRUDERS > 1
calculate_volumetric_multipliers(); calculate_volumetric_multipliers();
#ifdef IDLE_OOZING_PREVENT #if ENABLED(IDLE_OOZING_PREVENT)
idleoozing_enabled = true; idleoozing_enabled = true;
#endif #endif
ECHO_LM(DB, "Hardcoded Default Settings Loaded"); ECHO_LM(DB, "Hardcoded Default Settings Loaded");
} }
#ifndef DISABLE_M503 #if DISABLED(DISABLE_M503)
/** /**
* Print Configuration Settings - M502 * Print Configuration Settings - M503
*/ */
void Config_PrintSettings(bool forReplay) { void Config_PrintSettings(bool forReplay) {
// Always have this function, even with EEPROM_SETTINGS disabled, the current values will be shown // Always have this function, even with EEPROM_SETTINGS disabled, the current values will be shown
...@@ -593,7 +599,7 @@ void Config_ResetDefault() { ...@@ -593,7 +599,7 @@ void Config_ResetDefault() {
#endif //EXTRUDERS > 1 #endif //EXTRUDERS > 1
ECHO_E; ECHO_E;
#ifdef SCARA #if ENABLED(SCARA)
if (!forReplay) { if (!forReplay) {
ECHO_LM(DB, "Scaling factors:"); ECHO_LM(DB, "Scaling factors:");
} }
...@@ -673,7 +679,7 @@ void Config_ResetDefault() { ...@@ -673,7 +679,7 @@ void Config_ResetDefault() {
} }
#endif //HOTENDS > 1 #endif //HOTENDS > 1
#ifdef DELTA #if ENABLED(DELTA)
if (!forReplay) { if (!forReplay) {
ECHO_LM(DB, "Delta Geometry adjustment:"); ECHO_LM(DB, "Delta Geometry adjustment:");
} }
...@@ -701,19 +707,19 @@ void Config_ResetDefault() { ...@@ -701,19 +707,19 @@ void Config_ResetDefault() {
ECHO_MV(" Y", z_probe_offset[1]); ECHO_MV(" Y", z_probe_offset[1]);
ECHO_EMV(" Z", z_probe_offset[2]); ECHO_EMV(" Z", z_probe_offset[2]);
#elif defined(Z_DUAL_ENDSTOPS) #elif ENABLED(Z_DUAL_ENDSTOPS)
if (!forReplay) { if (!forReplay) {
ECHO_LM(DB, "Z2 Endstop adjustement (mm):"); ECHO_LM(DB, "Z2 Endstop adjustement (mm):");
} }
ECHO_LMV(DB, " M666 Z", z_endstop_adj ); ECHO_LMV(DB, " M666 Z", z_endstop_adj );
#elif defined(ENABLE_AUTO_BED_LEVELING) #elif ENABLED(ENABLE_AUTO_BED_LEVELING)
if (!forReplay) { if (!forReplay) {
ECHO_LM(DB, "Z Probe offset (mm)"); ECHO_LM(DB, "Z Probe offset (mm)");
} }
ECHO_LMV(DB, " M666 P", zprobe_zoffset); ECHO_LMV(DB, " M666 P", zprobe_zoffset);
#endif // DELTA #endif
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
if (!forReplay) { if (!forReplay) {
ECHO_LM(DB, "Material heatup parameters:"); ECHO_LM(DB, "Material heatup parameters:");
} }
...@@ -731,11 +737,11 @@ void Config_ResetDefault() { ...@@ -731,11 +737,11 @@ void Config_ResetDefault() {
ECHO_EM(" (Material GUM)"); ECHO_EM(" (Material GUM)");
#endif // ULTIPANEL #endif // ULTIPANEL
#if defined(PIDTEMP) || defined(PIDTEMPBED) #if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED)
if (!forReplay) { if (!forReplay) {
ECHO_LM(DB, "PID settings:"); ECHO_LM(DB, "PID settings:");
} }
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
for (int e = 0; e < HOTENDS; e++) { for (int e = 0; e < HOTENDS; e++) {
ECHO_SMV(DB, " M301 E", e); ECHO_SMV(DB, " M301 E", e);
ECHO_MV(" P", PID_PARAM(Kp, e)); ECHO_MV(" P", PID_PARAM(Kp, e));
...@@ -743,14 +749,14 @@ void Config_ResetDefault() { ...@@ -743,14 +749,14 @@ void Config_ResetDefault() {
ECHO_EMV(" D", unscalePID_d(PID_PARAM(Kd, e))); ECHO_EMV(" D", unscalePID_d(PID_PARAM(Kd, e)));
} }
#endif #endif
#ifdef PIDTEMPBED #if ENABLED(PIDTEMPBED)
ECHO_SMV(DB, " M304 P", bedKp); // for compatibility with hosts, only echos values for E0 ECHO_SMV(DB, " M304 P", bedKp); // for compatibility with hosts, only echos values for E0
ECHO_MV(" I", unscalePID_i(bedKi)); ECHO_MV(" I", unscalePID_i(bedKi));
ECHO_EMV(" D", unscalePID_d(bedKd)); ECHO_EMV(" D", unscalePID_d(bedKd));
#endif #endif
#endif #endif
#ifdef FWRETRACT #if ENABLED(FWRETRACT)
if (!forReplay) { if (!forReplay) {
ECHO_LM(DB,"Retract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)"); ECHO_LM(DB,"Retract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)");
} }
...@@ -807,7 +813,7 @@ void Config_ResetDefault() { ...@@ -807,7 +813,7 @@ void Config_ResetDefault() {
void ConfigSD_PrintSettings(bool forReplay) { void ConfigSD_PrintSettings(bool forReplay) {
// Always have this function, even with SD_SETTINGS disabled, the current values will be shown // Always have this function, even with SD_SETTINGS disabled, the current values will be shown
#ifdef POWER_CONSUMPTION #if ENABLED(POWER_CONSUMPTION)
if (!forReplay) { if (!forReplay) {
ECHO_LM(DB, "Watt/h consumed:"); ECHO_LM(DB, "Watt/h consumed:");
} }
...@@ -822,7 +828,7 @@ void Config_ResetDefault() { ...@@ -822,7 +828,7 @@ void Config_ResetDefault() {
ECHO_LV(DB, time); ECHO_LV(DB, time);
} }
#endif //!DISABLE_M503 #endif // !DISABLE_M503
/** /**
* Configuration on SD card * Configuration on SD card
...@@ -831,14 +837,14 @@ void Config_ResetDefault() { ...@@ -831,14 +837,14 @@ void Config_ResetDefault() {
* *
*/ */
void ConfigSD_ResetDefault() { void ConfigSD_ResetDefault() {
#ifdef POWER_CONSUMPTION #if ENABLED(POWER_CONSUMPTION)
power_consumption_hour = 0; power_consumption_hour = 0;
#endif #endif
printer_usage_seconds = 0; printer_usage_seconds = 0;
ECHO_LM(OK, "Hardcoded SD Default Settings Loaded"); ECHO_LM(OK, "Hardcoded SD Default Settings Loaded");
} }
#if defined(SDSUPPORT) && defined(SD_SETTINGS) #if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS)
void ConfigSD_StoreSettings() { void ConfigSD_StoreSettings() {
if(!IS_SD_INSERTED || card.isFileOpen() || card.sdprinting) return; if(!IS_SD_INSERTED || card.isFileOpen() || card.sdprinting) return;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
void Config_ResetDefault(); void Config_ResetDefault();
void ConfigSD_ResetDefault(); void ConfigSD_ResetDefault();
#ifndef DISABLE_M503 #if DISABLED(DISABLE_M503)
void Config_PrintSettings(bool forReplay = false); void Config_PrintSettings(bool forReplay = false);
void ConfigSD_PrintSettings(bool forReplay = false); void ConfigSD_PrintSettings(bool forReplay = false);
#else #else
...@@ -22,7 +22,7 @@ void ConfigSD_ResetDefault(); ...@@ -22,7 +22,7 @@ void ConfigSD_ResetDefault();
FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); } FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
#endif #endif
#if defined(SDSUPPORT) && defined(SD_SETTINGS) #if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS)
static const char *cfgSD_KEY[] = { //Keep this in lexicographical order for better search performance(O(Nlog2(N)) insted of O(N*N)) (if you don't keep this sorted, the algorithm for find the key index won't work, keep attention.) static const char *cfgSD_KEY[] = { //Keep this in lexicographical order for better search performance(O(Nlog2(N)) insted of O(N*N)) (if you don't keep this sorted, the algorithm for find the key index won't work, keep attention.)
#ifdef POWER_CONSUMPTION #ifdef POWER_CONSUMPTION
"PWR", "PWR",
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// Please note that using the high-res version takes 402Bytes of PROGMEM. // Please note that using the high-res version takes 402Bytes of PROGMEM.
//#define START_BMPHIGH //#define START_BMPHIGH
#ifdef START_BMPHIGH #if ENABLED(START_BMPHIGH)
#define START_BMPWIDTH 112 #define START_BMPWIDTH 112
#define START_BMPHEIGHT 38 #define START_BMPHEIGHT 38
#define START_BMPBYTEWIDTH 14 #define START_BMPBYTEWIDTH 14
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays. * Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays.
*/ */
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
#define BLEN_A 0 #define BLEN_A 0
#define BLEN_B 1 #define BLEN_B 1
#define BLEN_C 2 #define BLEN_C 2
...@@ -35,12 +35,12 @@ ...@@ -35,12 +35,12 @@
#include "ultralcd_st7920_u8glib_rrd.h" #include "ultralcd_st7920_u8glib_rrd.h"
#include "Configuration.h" #include "Configuration.h"
#if !defined(MAPPER_C2C3) && !defined(MAPPER_NON) && defined(USE_BIG_EDIT_FONT) #if DISABLED(MAPPER_C2C3) && DISABLED(MAPPER_NON) && ENABLED(USE_BIG_EDIT_FONT)
#undef USE_BIG_EDIT_FONT #undef USE_BIG_EDIT_FONT
#endif #endif
#ifdef USE_SMALL_INFOFONT #if ENABLED(USE_SMALL_INFOFONT)
#include "dogm_font_data_6x9_marlin.h" #include "dogm_font_data_6x9_marlin.h"
#define FONT_STATUSMENU_NAME u8g_font_6x9 #define FONT_STATUSMENU_NAME u8g_font_6x9
#else #else
...@@ -50,17 +50,17 @@ ...@@ -50,17 +50,17 @@
#include "dogm_font_data_Marlin_symbols.h" // The Marlin special symbols #include "dogm_font_data_Marlin_symbols.h" // The Marlin special symbols
#define FONT_SPECIAL_NAME Marlin_symbols #define FONT_SPECIAL_NAME Marlin_symbols
#ifndef SIMULATE_ROMFONT #if DISABLED(SIMULATE_ROMFONT)
#if defined( DISPLAY_CHARSET_ISO10646_1 ) #if ENABLED(DISPLAY_CHARSET_ISO10646_1)
#include "dogm_font_data_ISO10646_1.h" #include "dogm_font_data_ISO10646_1.h"
#define FONT_MENU_NAME ISO10646_1_5x7 #define FONT_MENU_NAME ISO10646_1_5x7
#elif defined( DISPLAY_CHARSET_ISO10646_5 ) #elif ENABLED(DISPLAY_CHARSET_ISO10646_5)
#include "dogm_font_data_ISO10646_5_Cyrillic.h" #include "dogm_font_data_ISO10646_5_Cyrillic.h"
#define FONT_MENU_NAME ISO10646_5_Cyrillic_5x7 #define FONT_MENU_NAME ISO10646_5_Cyrillic_5x7
#elif defined( DISPLAY_CHARSET_ISO10646_KANA ) #elif ENABLED(DISPLAY_CHARSET_ISO10646_KANA)
#include "dogm_font_data_ISO10646_Kana.h" #include "dogm_font_data_ISO10646_Kana.h"
#define FONT_MENU_NAME ISO10646_Kana_5x7 #define FONT_MENU_NAME ISO10646_Kana_5x7
#elif defined( DISPLAY_CHARSET_ISO10646_CN ) #elif ENABLED(DISPLAY_CHARSET_ISO10646_CN)
#include "dogm_font_data_ISO10646_CN.h" #include "dogm_font_data_ISO10646_CN.h"
#define FONT_MENU_NAME ISO10646_CN #define FONT_MENU_NAME ISO10646_CN
#define TALL_FONT_CORRECTION 1 #define TALL_FONT_CORRECTION 1
...@@ -69,13 +69,13 @@ ...@@ -69,13 +69,13 @@
#define FONT_MENU_NAME ISO10646_1_5x7 #define FONT_MENU_NAME ISO10646_1_5x7
#endif #endif
#else // SIMULATE_ROMFONT #else // SIMULATE_ROMFONT
#if defined( DISPLAY_CHARSET_HD44780_JAPAN ) #if ENABLED(DISPLAY_CHARSET_HD44780_JAPAN)
#include "dogm_font_data_HD44780_J.h" #include "dogm_font_data_HD44780_J.h"
#define FONT_MENU_NAME HD44780_J_5x7 #define FONT_MENU_NAME HD44780_J_5x7
#elif defined( DISPLAY_CHARSET_HD44780_WESTERN ) #elif ENABLED(DISPLAY_CHARSET_HD44780_WESTERN)
#include "dogm_font_data_HD44780_W.h" #include "dogm_font_data_HD44780_W.h"
#define FONT_MENU_NAME HD44780_W_5x7 #define FONT_MENU_NAME HD44780_W_5x7
#elif defined( DISPLAY_CHARSET_HD44780_CYRILLIC ) #elif ENABLED(DISPLAY_CHARSET_HD44780_CYRILLIC)
#include "dogm_font_data_HD44780_C.h" #include "dogm_font_data_HD44780_C.h"
#define FONT_MENU_NAME HD44780_C_5x7 #define FONT_MENU_NAME HD44780_C_5x7
#else // fall-back #else // fall-back
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
// DOGM parameters (size in pixels) // DOGM parameters (size in pixels)
#define DOG_CHAR_WIDTH 6 #define DOG_CHAR_WIDTH 6
#define DOG_CHAR_HEIGHT 12 #define DOG_CHAR_HEIGHT 12
#ifdef USE_BIG_EDIT_FONT #if ENABLED(USE_BIG_EDIT_FONT)
#define FONT_MENU_EDIT_NAME u8g_font_9x18 #define FONT_MENU_EDIT_NAME u8g_font_9x18
#define DOG_CHAR_WIDTH_EDIT 9 #define DOG_CHAR_WIDTH_EDIT 9
#define DOG_CHAR_HEIGHT_EDIT 18 #define DOG_CHAR_HEIGHT_EDIT 18
...@@ -113,16 +113,16 @@ ...@@ -113,16 +113,16 @@
#define START_ROW 0 #define START_ROW 0
// LCD selection // LCD selection
#ifdef U8GLIB_ST7920 #if ENABLED(U8GLIB_ST7920)
//U8GLIB_ST7920_128X64_RRD u8g(0,0,0); //U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
U8GLIB_ST7920_128X64_RRD u8g(0); U8GLIB_ST7920_128X64_RRD u8g(0);
#elif defined(MAKRPANEL) #elif ENABLED(MAKRPANEL)
// The MaKrPanel display, ST7565 controller as well // The MaKrPanel display, ST7565 controller as well
U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0); U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
#elif defined(VIKI2) || defined(miniVIKI) #elif ENABLED(VIKI2) || ENABLED(miniVIKI)
// Mini Viki and Viki 2.0 LCD, ST7565 controller as well // Mini Viki and Viki 2.0 LCD, ST7565 controller as well
U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0); U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
#elif defined(U8GLIB_LM6059_AF) #elif ENABLED(U8GLIB_LM6059_AF)
// Based on the Adafruit ST7565 (http://www.adafruit.com/products/250) // Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0); U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0);
#else #else
...@@ -189,7 +189,7 @@ static bool show_splashscreen = true; ...@@ -189,7 +189,7 @@ static bool show_splashscreen = true;
/* Warning: This function is called from interrupt context */ /* Warning: This function is called from interrupt context */
static void lcd_implementation_init() { static void lcd_implementation_init() {
#ifdef LCD_PIN_BL // Enable LCD backlight #if ENABLED(LCD_PIN_BL) // Enable LCD backlight
pinMode(LCD_PIN_BL, OUTPUT); pinMode(LCD_PIN_BL, OUTPUT);
digitalWrite(LCD_PIN_BL, HIGH); digitalWrite(LCD_PIN_BL, HIGH);
#endif #endif
...@@ -200,17 +200,17 @@ static void lcd_implementation_init() { ...@@ -200,17 +200,17 @@ static void lcd_implementation_init() {
// pinMode(17, OUTPUT); // Enable LCD backlight // pinMode(17, OUTPUT); // Enable LCD backlight
// digitalWrite(17, HIGH); // digitalWrite(17, HIGH);
#ifdef LCD_SCREEN_ROT_90 #if ENABLED(LCD_SCREEN_ROT_90)
u8g.setRot90(); // Rotate screen by 90° u8g.setRot90(); // Rotate screen by 90°
#elif defined(LCD_SCREEN_ROT_180) #elif ENABLED(LCD_SCREEN_ROT_180)
u8g.setRot180(); // Rotate screen by 180° u8g.setRot180(); // Rotate screen by 180°
#elif defined(LCD_SCREEN_ROT_270) #elif ENABLED(LCD_SCREEN_ROT_270)
u8g.setRot270(); // Rotate screen by 270° u8g.setRot270(); // Rotate screen by 270°
#endif #endif
// Show splashscreen // Show splashscreen
int offx = (u8g.getWidth() - START_BMPWIDTH) / 2; int offx = (u8g.getWidth() - START_BMPWIDTH) / 2;
#ifdef START_BMPHIGH #if ENABLED(START_BMPHIGH)
int offy = 0; int offy = 0;
#else #else
int offy = DOG_CHAR_HEIGHT; int offy = DOG_CHAR_HEIGHT;
...@@ -265,7 +265,7 @@ static void lcd_implementation_status_screen() { ...@@ -265,7 +265,7 @@ static void lcd_implementation_status_screen() {
// Symbols menu graphics, animated fan // Symbols menu graphics, animated fan
u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT, (blink % 2) && fanSpeed ? status_screen0_bmp : status_screen1_bmp); u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT, (blink % 2) && fanSpeed ? status_screen0_bmp : status_screen1_bmp);
#ifdef SDSUPPORT #if ENABLED(SDSUPPORT)
// SD Card Symbol // SD Card Symbol
u8g.drawBox(42, 42 - TALL_FONT_CORRECTION, 8, 7); u8g.drawBox(42, 42 - TALL_FONT_CORRECTION, 8, 7);
u8g.drawBox(50, 44 - TALL_FONT_CORRECTION, 2, 5); u8g.drawBox(50, 44 - TALL_FONT_CORRECTION, 2, 5);
...@@ -333,7 +333,7 @@ static void lcd_implementation_status_screen() { ...@@ -333,7 +333,7 @@ static void lcd_implementation_status_screen() {
#define XYZ_BASELINE 38 #define XYZ_BASELINE 38
lcd_setFont(FONT_STATUSMENU); lcd_setFont(FONT_STATUSMENU);
#ifdef USE_SMALL_INFOFONT #if ENABLED(USE_SMALL_INFOFONT)
u8g.drawBox(0,30,LCD_PIXEL_WIDTH,10); u8g.drawBox(0,30,LCD_PIXEL_WIDTH,10);
#else #else
u8g.drawBox(0,30,LCD_PIXEL_WIDTH,9); u8g.drawBox(0,30,LCD_PIXEL_WIDTH,9);
...@@ -379,7 +379,7 @@ static void lcd_implementation_status_screen() { ...@@ -379,7 +379,7 @@ static void lcd_implementation_status_screen() {
// Status line // Status line
lcd_setFont(FONT_STATUSMENU); lcd_setFont(FONT_STATUSMENU);
#ifdef USE_SMALL_INFOFONT #if ENABLED(USE_SMALL_INFOFONT)
u8g.setPrintPos(0,62); u8g.setPrintPos(0,62);
#else #else
u8g.setPrintPos(0,63); u8g.setPrintPos(0,63);
...@@ -491,7 +491,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) { ...@@ -491,7 +491,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
uint8_t lcd_width = LCD_WIDTH, char_width = DOG_CHAR_WIDTH; uint8_t lcd_width = LCD_WIDTH, char_width = DOG_CHAR_WIDTH;
uint8_t vallen = lcd_strlen(value); uint8_t vallen = lcd_strlen(value);
#ifdef USE_BIG_EDIT_FONT #if ENABLED(USE_BIG_EDIT_FONT)
if (lcd_strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) { if (lcd_strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) {
lcd_setFont(FONT_MENU_EDIT); lcd_setFont(FONT_MENU_EDIT);
lcd_width = LCD_WIDTH_EDIT + 1; lcd_width = LCD_WIDTH_EDIT + 1;
......
...@@ -104,14 +104,8 @@ ...@@ -104,14 +104,8 @@
#define MSG_FILE_PRINTED "Done printing file" #define MSG_FILE_PRINTED "Done printing file"
#define MSG_BEGIN_FILE_LIST "Begin file list" #define MSG_BEGIN_FILE_LIST "Begin file list"
#define MSG_END_FILE_LIST "End file list" #define MSG_END_FILE_LIST "End file list"
#define MSG_INVALID_EXTRUDER "Invalid extruder" #define MSG_INVALID_EXTRUDER " Invalid extruder "
#define MSG_INVALID_SOLENOID "Invalid solenoid" #define MSG_INVALID_SOLENOID "Invalid solenoid"
#define MSG_M104_INVALID_EXTRUDER "M104 " MSG_INVALID_EXTRUDER " "
#define MSG_M105_INVALID_EXTRUDER "M105 " MSG_INVALID_EXTRUDER " "
#define MSG_M109_INVALID_EXTRUDER "M109 " MSG_INVALID_EXTRUDER " "
#define MSG_M200_INVALID_EXTRUDER "M200 " MSG_INVALID_EXTRUDER " "
#define MSG_M218_INVALID_EXTRUDER "M218 " MSG_INVALID_EXTRUDER " "
#define MSG_M221_INVALID_EXTRUDER "M221 " MSG_INVALID_EXTRUDER " "
#define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature" #define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature"
#define MSG_HEATING "Heating..." #define MSG_HEATING "Heating..."
#define MSG_HEATING_COMPLETE "Heating done." #define MSG_HEATING_COMPLETE "Heating done."
...@@ -238,7 +232,7 @@ ...@@ -238,7 +232,7 @@
#define MSG_BED_LEVELLING_Z " Z: " #define MSG_BED_LEVELLING_Z " Z: "
// LCD Menu Messages // LCD Menu Messages
#if !(defined( DISPLAY_CHARSET_HD44780_JAPAN ) || defined( DISPLAY_CHARSET_HD44780_WESTERN ) || defined( DISPLAY_CHARSET_HD44780_CYRILLIC )) #if !(ENABLED(DISPLAY_CHARSET_HD44780_JAPAN) || ENABLED(DISPLAY_CHARSET_HD44780_WESTERN) || ENABLED(DISPLAY_CHARSET_HD44780_CYRILLIC))
#define DISPLAY_CHARSET_HD44780_JAPAN #define DISPLAY_CHARSET_HD44780_JAPAN
#endif #endif
......
#ifndef MACROS_H
#define MACROS_H
// Macros for bit masks
#define BIT(b) (1<<(b))
#define TEST(n,b) (((n)&BIT(b))!=0)
#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (BIT(b))
// Macros for maths shortcuts
#define M_PI 3.1415926536
#define RADIANS(d) ((d)*M_PI/180.0)
#define DEGREES(r) ((r)*180.0/M_PI)
#define SIN_60 0.8660254037844386
#define COS_60 0.5
// Macros to contrain values
#define NOLESS(v,n) do{ if (v < n) v = n; }while(0)
#define NOMORE(v,n) do{ if (v > n) v = n; }while(0)
// Macros to support option testing
#define _CAT(a, ...) a ## __VA_ARGS__
#define SWITCH_ENABLED_0 0
#define SWITCH_ENABLED_1 1
#define SWITCH_ENABLED_ 1
#define ENABLED(b) _CAT(SWITCH_ENABLED_, b)
#define DISABLED(b) (!_CAT(SWITCH_ENABLED_, b))
// Macros for check PIN
#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
/**
* Shorthand for pin tests, used wherever needed
*/
#define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 != -2)
#define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0)
#define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0)
#define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0)
#define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0)
#define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
#define HAS_HEATER_1 (PIN_EXISTS(HEATER_1))
#define HAS_HEATER_2 (PIN_EXISTS(HEATER_2))
#define HAS_HEATER_3 (PIN_EXISTS(HEATER_3))
#define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
#define HAS_AUTO_FAN_0 (PIN_EXISTS(EXTRUDER_0_AUTO_FAN))
#define HAS_AUTO_FAN_1 (PIN_EXISTS(EXTRUDER_1_AUTO_FAN))
#define HAS_AUTO_FAN_2 (PIN_EXISTS(EXTRUDER_2_AUTO_FAN))
#define HAS_AUTO_FAN_3 (PIN_EXISTS(EXTRUDER_3_AUTO_FAN))
#define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3)
#define HAS_FAN (PIN_EXISTS(FAN))
#define HAS_CONTROLLERFAN (PIN_EXISTS(CONTROLLERFAN))
#define HAS_SERVO_0 (PIN_EXISTS(SERVO0))
#define HAS_SERVO_1 (PIN_EXISTS(SERVO1))
#define HAS_SERVO_2 (PIN_EXISTS(SERVO2))
#define HAS_SERVO_3 (PIN_EXISTS(SERVO3))
#define HAS_FILAMENT_SENSOR (ENABLED(FILAMENT_SENSOR) && PIN_EXISTS(FILWIDTH))
#define HAS_POWER_CONSUMPTION_SENSOR (ENABLED(POWER_CONSUMPTION) && PIN_EXISTS(POWER_CONSUMPTION))
#define HAS_FILRUNOUT (ENABLED(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FILRUNOUT))
#define HAS_HOME (PIN_EXISTS(HOME))
#define HAS_KILL (PIN_EXISTS(KILL))
#define HAS_SUICIDE (PIN_EXISTS(SUICIDE))
#define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH))
#define HAS_X_MIN (PIN_EXISTS(X_MIN))
#define HAS_X_MAX (PIN_EXISTS(X_MAX))
#define HAS_Y_MIN (PIN_EXISTS(Y_MIN))
#define HAS_Y_MAX (PIN_EXISTS(Y_MAX))
#define HAS_Z_MIN (PIN_EXISTS(Z_MIN))
#define HAS_Z_MAX (PIN_EXISTS(Z_MAX))
#define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
#define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
#define HAS_Z_PROBE (PIN_EXISTS(Z_PROBE))
#define HAS_E_MIN (PIN_EXISTS(E_MIN))
#define HAS_SOLENOID_1 (PIN_EXISTS(SOL1))
#define HAS_SOLENOID_2 (PIN_EXISTS(SOL2))
#define HAS_SOLENOID_3 (PIN_EXISTS(SOL3))
#define HAS_MICROSTEPS (PIN_EXISTS(X_MS1))
#define HAS_MICROSTEPS_E0 (PIN_EXISTS(E0_MS1))
#define HAS_MICROSTEPS_E1 (PIN_EXISTS(E1_MS1))
#define HAS_MICROSTEPS_E2 (PIN_EXISTS(E2_MS1))
#define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE))
#define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE))
#define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE))
#define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE))
#define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE))
#define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE))
#define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE))
#define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE))
#define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE))
#define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE))
#define HAS_X_DIR (PIN_EXISTS(X_DIR))
#define HAS_X2_DIR (PIN_EXISTS(X2_DIR))
#define HAS_Y_DIR (PIN_EXISTS(Y_DIR))
#define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR))
#define HAS_Z_DIR (PIN_EXISTS(Z_DIR))
#define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR))
#define HAS_E0_DIR (PIN_EXISTS(E0_DIR))
#define HAS_E1_DIR (PIN_EXISTS(E1_DIR))
#define HAS_E2_DIR (PIN_EXISTS(E2_DIR))
#define HAS_E3_DIR (PIN_EXISTS(E3_DIR))
#define HAS_X_STEP (PIN_EXISTS(X_STEP))
#define HAS_X2_STEP (PIN_EXISTS(X2_STEP))
#define HAS_Y_STEP (PIN_EXISTS(Y_STEP))
#define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP))
#define HAS_Z_STEP (PIN_EXISTS(Z_STEP))
#define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP))
#define HAS_E0_STEP (PIN_EXISTS(E0_STEP))
#define HAS_E1_STEP (PIN_EXISTS(E1_STEP))
#define HAS_E2_STEP (PIN_EXISTS(E2_STEP))
#define HAS_E3_STEP (PIN_EXISTS(E3_STEP))
#define HAS_E0E1 (PIN_EXISTS(E0E1_CHOICE))
#define HAS_E0E2 (PIN_EXISTS(E0E2_CHOICE))
#define HAS_E0E3 (PIN_EXISTS(E0E3_CHOICE))
#define HAS_E0E4 (PIN_EXISTS(E0E4_CHOICE))
#define HAS_E1E3 (PIN_EXISTS(E1E3_CHOICE))
#define HAS_BTN_BACK (PIN_EXISTS(BTN_BACK))
/**
* Shorthand for filament sensor and power sensor for ultralcd.cpp, dogm_lcd_implementation.h, ultralcd_implementation_hitachi_HD44780.h
*/
#define HAS_LCD_FILAMENT_SENSOR (HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY))
#define HAS_LCD_POWER_SENSOR (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY))
#endif //__MACROS_H
...@@ -4909,7 +4909,7 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a ...@@ -4909,7 +4909,7 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
********************************* END MOTHERBOARD *************************************** ********************************* END MOTHERBOARD ***************************************
/****************************************************************************************/ /****************************************************************************************/
#ifndef KNOWN_BOARD #if DISABLED(KNOWN_BOARD)
#error Unknown MOTHERBOARD value in configuration.h #error Unknown MOTHERBOARD value in configuration.h
#endif #endif
...@@ -4980,35 +4980,35 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a ...@@ -4980,35 +4980,35 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#define Z_MAX_PIN -1 #define Z_MAX_PIN -1
#endif //Z_HOME_DIR > 0 #endif //Z_HOME_DIR > 0
#ifndef Z_PROBE_ENDSTOP // Allow code to compile regardless of Z_PROBE_ENDSTOP setting. #if DISABLED(Z_PROBE_ENDSTOP) // Allow code to compile regardless of Z_PROBE_ENDSTOP setting.
#define Z_PROBE_PIN -1 #define Z_PROBE_PIN -1
#endif #endif
#ifdef DISABLE_XMAX_ENDSTOP #if ENABLED(DISABLE_XMAX_ENDSTOP)
#undef X_MAX_PIN #undef X_MAX_PIN
#define X_MAX_PIN -1 #define X_MAX_PIN -1
#endif #endif
#ifdef DISABLE_XMIN_ENDSTOP #if ENABLED(DISABLE_XMIN_ENDSTOP)
#undef X_MIN_PIN #undef X_MIN_PIN
#define X_MIN_PIN -1 #define X_MIN_PIN -1
#endif #endif
#ifdef DISABLE_YMAX_ENDSTOP #if ENABLED(DISABLE_YMAX_ENDSTOP)
#define Y_MAX_PIN -1 #define Y_MAX_PIN -1
#endif #endif
#ifdef DISABLE_YMIN_ENDSTOP #if ENABLED(DISABLE_YMIN_ENDSTOP)
#undef Y_MIN_PIN #undef Y_MIN_PIN
#define Y_MIN_PIN -1 #define Y_MIN_PIN -1
#endif #endif
#ifdef DISABLE_ZMAX_ENDSTOP #if ENABLED(DISABLE_ZMAX_ENDSTOP)
#undef Z_MAX_PIN #undef Z_MAX_PIN
#define Z_MAX_PIN -1 #define Z_MAX_PIN -1
#endif #endif
#ifdef DISABLE_ZMIN_ENDSTOP #if ENABLED(DISABLE_ZMIN_ENDSTOP)
#undef Z_MIN_PIN #undef Z_MIN_PIN
#define Z_MIN_PIN -1 #define Z_MIN_PIN -1
#endif #endif
...@@ -5049,7 +5049,7 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a ...@@ -5049,7 +5049,7 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#define TEMP_3_PIN -1 #define TEMP_3_PIN -1
#endif #endif
#ifdef MKR4 #if ENABLED(MKR4)
#if (EXTRUDERS == 2) && (DRIVER_EXTRUDERS == 1) // Use this for one driver and two extruder #if (EXTRUDERS == 2) && (DRIVER_EXTRUDERS == 1) // Use this for one driver and two extruder
#define E0E1_CHOICE_PIN 5 #define E0E1_CHOICE_PIN 5
#elif (EXTRUDERS == 3) && (DRIVER_EXTRUDERS == 1) // Use this for one driver and 3 extruder #elif (EXTRUDERS == 3) && (DRIVER_EXTRUDERS == 1) // Use this for one driver and 3 extruder
...@@ -5067,20 +5067,20 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a ...@@ -5067,20 +5067,20 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#endif //EXTRUDERS #endif //EXTRUDERS
#endif //MKR4 #endif //MKR4
#ifdef NPR2 #if ENABLED(NPR2)
#define E_MIN_PIN -1 #define E_MIN_PIN -1
#endif //NPR2 #endif //NPR2
#ifdef LASERBEAM #if ENABLED(LASERBEAM)
#define LASER_PWR_PIN 41 #define LASER_PWR_PIN 41
#define LASER_TTL_PIN 42 #define LASER_TTL_PIN 42
#endif #endif
#ifdef FILAMENT_RUNOUT_SENSOR #if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define FILRUNOUT_PIN -1 #define FILRUNOUT_PIN -1
#endif #endif
#ifdef FILAMENT_SENSOR #if ENABLED(FILAMENT_SENSOR)
// FMM added for Filament Extruder // FMM added for Filament Extruder
//define analog pin for the filament width sensor input //define analog pin for the filament width sensor input
//Use the RAMPS 1.4 Analog input 5 on the AUX2 connector //Use the RAMPS 1.4 Analog input 5 on the AUX2 connector
......
...@@ -73,7 +73,7 @@ float max_e_jerk; ...@@ -73,7 +73,7 @@ float max_e_jerk;
float mintravelfeedrate; float mintravelfeedrate;
unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS]; unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS];
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
// Transform required to compensate for bed level // Transform required to compensate for bed level
matrix_3x3 plan_bed_level_matrix = { matrix_3x3 plan_bed_level_matrix = {
1.0, 0.0, 0.0, 1.0, 0.0, 0.0,
...@@ -82,7 +82,7 @@ unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS]; ...@@ -82,7 +82,7 @@ unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS];
}; };
#endif // ENABLE_AUTO_BED_LEVELING #endif // ENABLE_AUTO_BED_LEVELING
#ifdef AUTOTEMP #if ENABLED(AUTOTEMP)
float autotemp_max = 250; float autotemp_max = 250;
float autotemp_min = 210; float autotemp_min = 210;
float autotemp_factor = 0.1; float autotemp_factor = 0.1;
...@@ -117,7 +117,7 @@ unsigned char g_uc_extruder_last_move[4] = {0,0,0,0}; ...@@ -117,7 +117,7 @@ unsigned char g_uc_extruder_last_move[4] = {0,0,0,0};
static long axis_segment_time[2][3] = { {MAX_FREQ_TIME+1,0,0}, {MAX_FREQ_TIME+1,0,0} }; static long axis_segment_time[2][3] = { {MAX_FREQ_TIME+1,0,0}, {MAX_FREQ_TIME+1,0,0} };
#endif #endif
#ifdef FILAMENT_SENSOR #if ENABLED(FILAMENT_SENSOR)
static char meas_sample; //temporary variable to hold filament measurement sample static char meas_sample; //temporary variable to hold filament measurement sample
#endif #endif
...@@ -174,7 +174,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi ...@@ -174,7 +174,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi
plateau_steps = 0; plateau_steps = 0;
} }
#ifdef ADVANCE #if ENABLED(ADVANCE)
volatile long initial_advance = block->advance * entry_factor * entry_factor; volatile long initial_advance = block->advance * entry_factor * entry_factor;
volatile long final_advance = block->advance * exit_factor * exit_factor; volatile long final_advance = block->advance * exit_factor * exit_factor;
#endif // ADVANCE #endif // ADVANCE
...@@ -187,7 +187,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi ...@@ -187,7 +187,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi
block->decelerate_after = accelerate_steps+plateau_steps; block->decelerate_after = accelerate_steps+plateau_steps;
block->initial_rate = initial_rate; block->initial_rate = initial_rate;
block->final_rate = final_rate; block->final_rate = final_rate;
#ifdef ADVANCE #if ENABLED(ADVANCE)
block->initial_advance = initial_advance; block->initial_advance = initial_advance;
block->final_advance = final_advance; block->final_advance = final_advance;
#endif #endif
...@@ -357,7 +357,7 @@ void plan_init() { ...@@ -357,7 +357,7 @@ void plan_init() {
} }
#ifdef AUTOTEMP #if ENABLED(AUTOTEMP)
void getHighESpeed() { void getHighESpeed() {
static float oldt = 0; static float oldt = 0;
...@@ -390,11 +390,11 @@ void plan_init() { ...@@ -390,11 +390,11 @@ void plan_init() {
void check_axes_activity() { void check_axes_activity() {
unsigned char axis_active[NUM_AXIS] = { 0 }, unsigned char axis_active[NUM_AXIS] = { 0 },
tail_fan_speed = fanSpeed; tail_fan_speed = fanSpeed;
#ifdef BARICUDA #if ENABLED(BARICUDA)
unsigned char tail_valve_pressure = ValvePressure, unsigned char tail_valve_pressure = ValvePressure,
tail_e_to_p_pressure = EtoPPressure; tail_e_to_p_pressure = EtoPPressure;
#endif #endif
#ifdef LASERBEAM #if ENABLED(LASERBEAM)
unsigned char tail_laser_ttl_modulation = laser_ttl_modulation; unsigned char tail_laser_ttl_modulation = laser_ttl_modulation;
#endif #endif
block_t *block; block_t *block;
...@@ -402,12 +402,12 @@ void check_axes_activity() { ...@@ -402,12 +402,12 @@ void check_axes_activity() {
if (blocks_queued()) { if (blocks_queued()) {
uint8_t block_index = block_buffer_tail; uint8_t block_index = block_buffer_tail;
tail_fan_speed = block_buffer[block_index].fan_speed; tail_fan_speed = block_buffer[block_index].fan_speed;
#ifdef BARICUDA #if ENABLED(BARICUDA)
block = &block_buffer[block_index]; block = &block_buffer[block_index];
tail_valve_pressure = block->valve_pressure; tail_valve_pressure = block->valve_pressure;
tail_e_to_p_pressure = block->e_to_p_pressure; tail_e_to_p_pressure = block->e_to_p_pressure;
#endif #endif
#ifdef LASERBEAM #if ENABLED(LASERBEAM)
tail_laser_ttl_modulation = block_buffer[block_index].laser_ttlmodulation; tail_laser_ttl_modulation = block_buffer[block_index].laser_ttlmodulation;
#endif #endif
while (block_index != block_buffer_head) { while (block_index != block_buffer_head) {
...@@ -442,18 +442,18 @@ void check_axes_activity() { ...@@ -442,18 +442,18 @@ void check_axes_activity() {
fan_kick_end = 0; fan_kick_end = 0;
} }
#endif//FAN_KICKSTART_TIME #endif//FAN_KICKSTART_TIME
#ifdef FAN_SOFT_PWM #if ENABLED(FAN_SOFT_PWM)
fanSpeedSoftPwm = tail_fan_speed; fanSpeedSoftPwm = tail_fan_speed;
#else #else
analogWrite(FAN_PIN, tail_fan_speed); analogWrite(FAN_PIN, tail_fan_speed);
#endif //!FAN_SOFT_PWM #endif //!FAN_SOFT_PWM
#endif // HAS_FAN #endif // HAS_FAN
#ifdef AUTOTEMP #if ENABLED(AUTOTEMP)
getHighESpeed(); getHighESpeed();
#endif #endif
#ifdef BARICUDA #if ENABLED(BARICUDA)
#if HAS_HEATER_1 #if HAS_HEATER_1
analogWrite(HEATER_1_PIN,tail_valve_pressure); analogWrite(HEATER_1_PIN,tail_valve_pressure);
#endif #endif
...@@ -462,7 +462,7 @@ void check_axes_activity() { ...@@ -462,7 +462,7 @@ void check_axes_activity() {
#endif #endif
#endif #endif
#ifdef LASERBEAM #if ENABLED(LASERBEAM)
analogWrite(LASER_TTL_PIN, tail_laser_ttl_modulation); analogWrite(LASER_TTL_PIN, tail_laser_ttl_modulation);
#endif #endif
} }
...@@ -472,7 +472,7 @@ float junction_deviation = 0.1; ...@@ -472,7 +472,7 @@ float junction_deviation = 0.1;
// Add a new linear movement to the buffer. steps[X_AXIS], _y and _z is the absolute position in // Add a new linear movement to the buffer. steps[X_AXIS], _y and _z is the absolute position in
// mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration // mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration
// calculation the caller must also provide the physical length of the line in millimeters. // calculation the caller must also provide the physical length of the line in millimeters.
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate, const uint8_t &extruder, const uint8_t &driver) void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate, const uint8_t &extruder, const uint8_t &driver)
#else #else
void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder, const uint8_t &driver) void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder, const uint8_t &driver)
...@@ -483,13 +483,9 @@ float junction_deviation = 0.1; ...@@ -483,13 +483,9 @@ float junction_deviation = 0.1;
// If the buffer is full: good! That means we are well ahead of the robot. // If the buffer is full: good! That means we are well ahead of the robot.
// Rest here until there is room in the buffer. // Rest here until there is room in the buffer.
while(block_buffer_tail == next_buffer_head) { while (block_buffer_tail == next_buffer_head) idle();
manage_heater();
manage_inactivity();
lcd_update();
}
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
apply_rotation_xyz(plan_bed_level_matrix, x, y, z); apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
#endif #endif
...@@ -507,11 +503,11 @@ float junction_deviation = 0.1; ...@@ -507,11 +503,11 @@ float junction_deviation = 0.1;
dz = target[Z_AXIS] - position[Z_AXIS], dz = target[Z_AXIS] - position[Z_AXIS],
de = target[E_AXIS] - position[E_AXIS]; de = target[E_AXIS] - position[E_AXIS];
#ifdef PREVENT_DANGEROUS_EXTRUDE #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
if (de) { if (de) {
#ifdef NPR2 #if ENABLED(NPR2)
if (extruder != 1) if (extruder != 1)
#endif // NPR2 #endif
{ {
if (degHotend(extruder) < extrude_min_temp && !(debugLevel & DEBUG_DRYRUN)) { if (degHotend(extruder) < extrude_min_temp && !(debugLevel & DEBUG_DRYRUN)) {
position[E_AXIS] = target[E_AXIS]; //behave as if the move really took place, but ignore E part position[E_AXIS] = target[E_AXIS]; //behave as if the move really took place, but ignore E part
...@@ -520,7 +516,7 @@ float junction_deviation = 0.1; ...@@ -520,7 +516,7 @@ float junction_deviation = 0.1;
} }
} }
#ifdef PREVENT_LENGTHY_EXTRUDE #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
if (labs(de) > axis_steps_per_unit[E_AXIS + extruder] * EXTRUDE_MAXLENGTH) { if (labs(de) > axis_steps_per_unit[E_AXIS + extruder] * EXTRUDE_MAXLENGTH) {
#ifdef EASY_LOAD #ifdef EASY_LOAD
if (!allow_lengthy_extrude_once) { if (!allow_lengthy_extrude_once) {
...@@ -528,7 +524,7 @@ float junction_deviation = 0.1; ...@@ -528,7 +524,7 @@ float junction_deviation = 0.1;
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
de = 0; // no difference de = 0; // no difference
ECHO_LM(ER, MSG_ERR_LONG_EXTRUDE_STOP); ECHO_LM(ER, MSG_ERR_LONG_EXTRUDE_STOP);
#ifdef EASY_LOAD #if ENABLED(EASY_LOAD)
} }
allow_lengthy_extrude_once = false; allow_lengthy_extrude_once = false;
#endif #endif
...@@ -544,7 +540,7 @@ float junction_deviation = 0.1; ...@@ -544,7 +540,7 @@ float junction_deviation = 0.1;
block->busy = false; block->busy = false;
// Number of steps for each axis // Number of steps for each axis
#ifdef COREXY #if ENABLED(COREXY)
// corexy planning // corexy planning
// these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html // these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
block->steps[A_AXIS] = labs(dx + dy); block->steps[A_AXIS] = labs(dx + dy);
...@@ -566,17 +562,17 @@ float junction_deviation = 0.1; ...@@ -566,17 +562,17 @@ float junction_deviation = 0.1;
if (block->step_event_count <= dropsegments) return; if (block->step_event_count <= dropsegments) return;
block->fan_speed = fanSpeed; block->fan_speed = fanSpeed;
#ifdef BARICUDA #if ENABLED(BARICUDA)
block->valve_pressure = ValvePressure; block->valve_pressure = ValvePressure;
block->e_to_p_pressure = EtoPPressure; block->e_to_p_pressure = EtoPPressure;
#endif #endif
#ifdef LASERBEAM #if ENABLED(LASERBEAM)
block->laser_ttlmodulation = laser_ttl_modulation; block->laser_ttlmodulation = laser_ttl_modulation;
#endif #endif
// Compute direction bits for this block // Compute direction bits for this block
uint8_t db = 0; uint8_t db = 0;
#ifdef COREXY #if ENABLED(COREXY)
if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) db |= BIT(Y_HEAD); // ...and Y if (dy < 0) db |= BIT(Y_HEAD); // ...and Y
if (dx + dy < 0) db |= BIT(A_AXIS); // Motor A direction if (dx + dy < 0) db |= BIT(A_AXIS); // Motor A direction
...@@ -592,7 +588,7 @@ float junction_deviation = 0.1; ...@@ -592,7 +588,7 @@ float junction_deviation = 0.1;
block->active_driver = driver; block->active_driver = driver;
//enable active axes //enable active axes
#ifdef COREXY #if ENABLED(COREXY)
if (block->steps[A_AXIS] || block->steps[B_AXIS]) { if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
enable_x(); enable_x();
enable_y(); enable_y();
...@@ -602,13 +598,13 @@ float junction_deviation = 0.1; ...@@ -602,13 +598,13 @@ float junction_deviation = 0.1;
if (block->steps[Y_AXIS]) enable_y(); if (block->steps[Y_AXIS]) enable_y();
#endif #endif
#ifndef Z_LATE_ENABLE #if DISABLED(Z_LATE_ENABLE)
if (block->steps[Z_AXIS]) enable_z(); if (block->steps[Z_AXIS]) enable_z();
#endif #endif
// Enable extruder(s) // Enable extruder(s)
if (block->steps[E_AXIS]) { if (block->steps[E_AXIS]) {
#if !defined(MKR4) && !defined(NPR2) #if DISABLED(MKR4) && DISABLED(NPR2)
if (DISABLE_INACTIVE_EXTRUDER) { //enable only selected extruder if (DISABLE_INACTIVE_EXTRUDER) { //enable only selected extruder
for (int i=0; i<EXTRUDERS; i++) for (int i=0; i<EXTRUDERS; i++)
...@@ -687,7 +683,6 @@ float junction_deviation = 0.1; ...@@ -687,7 +683,6 @@ float junction_deviation = 0.1;
break; break;
} }
#endif //!MKR4 && !NPR2 #endif //!MKR4 && !NPR2
if (feed_rate < minimumfeedrate) feed_rate = minimumfeedrate;
} }
if (block->steps[E_AXIS]) if (block->steps[E_AXIS])
...@@ -703,7 +698,7 @@ float junction_deviation = 0.1; ...@@ -703,7 +698,7 @@ float junction_deviation = 0.1;
* So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head. * So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
* Having the real displacement of the head, we can calculate the total movement length and apply the desired speed. * Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
*/ */
#ifdef COREXY #if ENABLED(COREXY)
float delta_mm[6]; float delta_mm[6];
delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS]; delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
delta_mm[Y_HEAD] = dy / axis_steps_per_unit[B_AXIS]; delta_mm[Y_HEAD] = dy / axis_steps_per_unit[B_AXIS];
...@@ -722,7 +717,7 @@ float junction_deviation = 0.1; ...@@ -722,7 +717,7 @@ float junction_deviation = 0.1;
} }
else { else {
block->millimeters = sqrt( block->millimeters = sqrt(
#ifdef COREXY #if ENABLED(COREXY)
square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD]) square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD])
#else #else
square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS])
...@@ -738,12 +733,12 @@ float junction_deviation = 0.1; ...@@ -738,12 +733,12 @@ float junction_deviation = 0.1;
int moves_queued = movesplanned(); int moves_queued = movesplanned();
// Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill // Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill
#if defined(OLD_SLOWDOWN) || defined(SLOWDOWN) #if ENABLED(OLD_SLOWDOWN) || ENABLED(SLOWDOWN)
bool mq = moves_queued > 1 && moves_queued < BLOCK_BUFFER_SIZE / 2; bool mq = moves_queued > 1 && moves_queued < BLOCK_BUFFER_SIZE / 2;
#ifdef OLD_SLOWDOWN #if ENABLED(OLD_SLOWDOWN)
if (mq) feed_rate *= 2.0 * moves_queued / BLOCK_BUFFER_SIZE; if (mq) feed_rate *= 2.0 * moves_queued / BLOCK_BUFFER_SIZE;
#endif #endif
#ifdef SLOWDOWN #if ENABLED(SLOWDOWN)
// segment time im micro seconds // segment time im micro seconds
unsigned long segment_time = lround(1000000.0/inverse_second); unsigned long segment_time = lround(1000000.0/inverse_second);
if (mq) { if (mq) {
...@@ -761,7 +756,7 @@ float junction_deviation = 0.1; ...@@ -761,7 +756,7 @@ float junction_deviation = 0.1;
block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0 block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0
block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0 block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0
#ifdef FILAMENT_SENSOR #if ENABLED(FILAMENT_SENSOR)
//FMM update ring buffer used for delay with filament measurements //FMM update ring buffer used for delay with filament measurements
if (extruder == FILAMENT_SENSOR_EXTRUDER_NUM && delay_index2 > -1) { //only for extruder with filament sensor and if ring buffer is initialized if (extruder == FILAMENT_SENSOR_EXTRUDER_NUM && delay_index2 > -1) { //only for extruder with filament sensor and if ring buffer is initialized
...@@ -962,7 +957,7 @@ float junction_deviation = 0.1; ...@@ -962,7 +957,7 @@ float junction_deviation = 0.1;
for (int i = 0; i < NUM_AXIS; i++) previous_speed[i] = current_speed[i]; for (int i = 0; i < NUM_AXIS; i++) previous_speed[i] = current_speed[i];
previous_nominal_speed = block->nominal_speed; previous_nominal_speed = block->nominal_speed;
#ifdef ADVANCE #if ENABLED(ADVANCE)
// Calculate advance rate // Calculate advance rate
if (!bse || (!bsx && !bsy && !bsz)) { if (!bse || (!bsx && !bsy && !bsz)) {
block->advance_rate = 0; block->advance_rate = 0;
...@@ -994,7 +989,7 @@ float junction_deviation = 0.1; ...@@ -994,7 +989,7 @@ float junction_deviation = 0.1;
} // plan_buffer_line() } // plan_buffer_line()
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
vector_3 plan_get_position() { vector_3 plan_get_position() {
vector_3 position = vector_3(st_get_position_mm(X_AXIS), st_get_position_mm(Y_AXIS), st_get_position_mm(Z_AXIS)); vector_3 position = vector_3(st_get_position_mm(X_AXIS), st_get_position_mm(Y_AXIS), st_get_position_mm(Z_AXIS));
...@@ -1009,13 +1004,13 @@ float junction_deviation = 0.1; ...@@ -1009,13 +1004,13 @@ float junction_deviation = 0.1;
} }
#endif // ENABLE_AUTO_BED_LEVELING #endif // ENABLE_AUTO_BED_LEVELING
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
void plan_set_position(float x, float y, float z, const float &e) void plan_set_position(float x, float y, float z, const float &e)
#else #else
void plan_set_position(const float &x, const float &y, const float &z, const float &e) void plan_set_position(const float &x, const float &y, const float &z, const float &e)
#endif // ENABLE_AUTO_BED_LEVELING #endif // ENABLE_AUTO_BED_LEVELING
{ {
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
apply_rotation_xyz(plan_bed_level_matrix, x, y, z); apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
#endif #endif
......
...@@ -37,7 +37,7 @@ typedef struct { ...@@ -37,7 +37,7 @@ typedef struct {
long acceleration_rate; // The acceleration rate used for acceleration calculation long acceleration_rate; // The acceleration rate used for acceleration calculation
unsigned char direction_bits; // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h) unsigned char direction_bits; // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
unsigned char active_driver; // Selects the active driver unsigned char active_driver; // Selects the active driver
#ifdef ADVANCE #if ENABLED(ADVANCE)
long advance_rate; long advance_rate;
volatile long initial_advance; volatile long initial_advance;
volatile long final_advance; volatile long final_advance;
...@@ -60,11 +60,11 @@ typedef struct { ...@@ -60,11 +60,11 @@ typedef struct {
unsigned long final_rate; // The minimal rate at exit unsigned long final_rate; // The minimal rate at exit
unsigned long acceleration_st; // acceleration steps/sec^2 unsigned long acceleration_st; // acceleration steps/sec^2
unsigned long fan_speed; unsigned long fan_speed;
#ifdef BARICUDA #if ENABLED(BARICUDA)
unsigned long valve_pressure; unsigned long valve_pressure;
unsigned long e_to_p_pressure; unsigned long e_to_p_pressure;
#endif #endif
#ifdef LASERBEAM #if ENABLED(LASERBEAM)
unsigned long laser_ttlmodulation; unsigned long laser_ttlmodulation;
#endif #endif
volatile char busy; volatile char busy;
...@@ -82,7 +82,7 @@ extern volatile unsigned char block_buffer_head; ...@@ -82,7 +82,7 @@ extern volatile unsigned char block_buffer_head;
extern volatile unsigned char block_buffer_tail; extern volatile unsigned char block_buffer_tail;
FORCE_INLINE uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); } FORCE_INLINE uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); }
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
#include "vector_3.h" #include "vector_3.h"
...@@ -132,7 +132,7 @@ extern float max_e_jerk; ...@@ -132,7 +132,7 @@ extern float max_e_jerk;
extern float mintravelfeedrate; extern float mintravelfeedrate;
extern unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS]; extern unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS];
#ifdef AUTOTEMP #if ENABLED(AUTOTEMP)
extern bool autotemp_enabled; extern bool autotemp_enabled;
extern float autotemp_max; extern float autotemp_max;
extern float autotemp_min; extern float autotemp_min;
......
#include "qr_solve.h" #include "qr_solve.h"
#ifdef AUTO_BED_LEVELING_GRID #if ENABLED(AUTO_BED_LEVELING_GRID)
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
......
#include "Configuration.h" #include "Configuration.h"
#ifdef AUTO_BED_LEVELING_GRID #if ENABLED(AUTO_BED_LEVELING_GRID)
void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy ); void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy );
double ddot ( int n, double dx[], int incx, double dy[], int incy ); double ddot ( int n, double dx[], int incx, double dy[], int incy );
......
...@@ -9,24 +9,24 @@ ...@@ -9,24 +9,24 @@
/** /**
* Dual Stepper Drivers * Dual Stepper Drivers
*/ */
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Y_DUAL_STEPPER_DRIVERS) #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && ENABLED(Y_DUAL_STEPPER_DRIVERS)
#error You cannot have dual stepper drivers for both Y and Z. #error You cannot have dual stepper drivers for both Y and Z.
#endif #endif
/** /**
* Progress Bar * Progress Bar
*/ */
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
#ifndef SDSUPPORT #if DISABLED(SDSUPPORT)
#error LCD_PROGRESS_BAR requires SDSUPPORT. #error LCD_PROGRESS_BAR requires SDSUPPORT.
#endif #endif
#ifdef DOGLCD #if ENABLED(DOGLCD)
#error 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 #if ENABLED(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.
#endif #endif
#ifdef POWER_CONSUMPTION_LCD_DISPLAY #if ENABLED(POWER_CONSUMPTION_LCD_DISPLAY)
#error LCD_PROGRESS_BAR and POWER_CONSUMPTION_LCD_DISPLAY are not fully compatible. Comment out this line to use both. #error LCD_PROGRESS_BAR and POWER_CONSUMPTION_LCD_DISPLAY are not fully compatible. Comment out this line to use both.
#endif #endif
#endif #endif
...@@ -34,14 +34,14 @@ ...@@ -34,14 +34,14 @@
/** /**
* Babystepping * Babystepping
*/ */
#ifdef BABYSTEPPING #if ENABLED(BABYSTEPPING)
#ifdef COREXY #if ENABLED(COREXY)
#error BABYSTEPPING not implemented for COREXY yet. #error BABYSTEPPING not implemented for COREXY yet.
#endif #endif
#ifdef SCARA #if ENABLED(SCARA)
#error BABYSTEPPING is not implemented for SCARA yet. #error BABYSTEPPING is not implemented for SCARA yet.
#endif #endif
#if defined(DELTA) && defined(BABYSTEP_XY) #if ENABLED(DELTA) && ENABLED(BABYSTEP_XY)
#error BABYSTEPPING only implemented for Z axis on deltabots. #error BABYSTEPPING only implemented for Z axis on deltabots.
#endif #endif
#endif #endif
...@@ -49,28 +49,28 @@ ...@@ -49,28 +49,28 @@
/** /**
* Filament Change with Extruder Runout Prevention * Filament Change with Extruder Runout Prevention
*/ */
#if defined(FILAMENTCHANGEENABLE) && defined(EXTRUDER_RUNOUT_PREVENT) #if ENABLED(FILAMENTCHANGEENABLE) && ENABLED(EXTRUDER_RUNOUT_PREVENT)
#error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE. #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE.
#endif #endif
/** /**
* Extruder Runout Prevention * Extruder Runout Prevention
*/ */
#if defined(EXTRUDER_RUNOUT_PREVENT) && EXTRUDER_RUNOUT_MINTEMP < EXTRUDE_MINTEMP #if ENABLED(EXTRUDER_RUNOUT_PREVENT) && EXTRUDER_RUNOUT_MINTEMP < EXTRUDE_MINTEMP
#error EXTRUDER_RUNOUT_MINTEMP have to be greater than EXTRUDE_MINTEMP #error EXTRUDER_RUNOUT_MINTEMP have to be greater than EXTRUDE_MINTEMP
#endif #endif
/** /**
* Idle oozing prevent with Extruder Runout Prevention * Idle oozing prevent with Extruder Runout Prevention
*/ */
#if defined(EXTRUDER_RUNOUT_PREVENT) && defined(IDLE_OOZING_PREVENT) #if ENABLED(EXTRUDER_RUNOUT_PREVENT) && defined(IDLE_OOZING_PREVENT)
#error EXTRUDER_RUNOUT_PREVENT and IDLE_OOZING_PREVENT are incopatible. Please comment one of them. #error EXTRUDER_RUNOUT_PREVENT and IDLE_OOZING_PREVENT are incopatible. Please comment one of them.
#endif #endif
/** /**
* Idle oozing prevent * Idle oozing prevent
*/ */
#if defined(IDLE_OOZING_PREVENT) && IDLE_OOZING_MINTEMP < EXTRUDE_MINTEMP #if ENABLED(IDLE_OOZING_PREVENT) && IDLE_OOZING_MINTEMP < EXTRUDE_MINTEMP
#error IDLE_OOZING_MINTEMP have to be greater than EXTRUDE_MINTEMP #error IDLE_OOZING_MINTEMP have to be greater than EXTRUDE_MINTEMP
#endif #endif
...@@ -83,19 +83,19 @@ ...@@ -83,19 +83,19 @@
#error The maximum number of EXTRUDERS is 4. #error The maximum number of EXTRUDERS is 4.
#endif #endif
#ifdef TEMP_SENSOR_1_AS_REDUNDANT #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
#error EXTRUDERS must be 1 with TEMP_SENSOR_1_AS_REDUNDANT. #error EXTRUDERS must be 1 with TEMP_SENSOR_1_AS_REDUNDANT.
#endif #endif
#ifdef HEATERS_PARALLEL #if ENABLED(HEATERS_PARALLEL)
#error EXTRUDERS must be 1 with HEATERS_PARALLEL. #error EXTRUDERS must be 1 with HEATERS_PARALLEL.
#endif #endif
#ifdef Y_DUAL_STEPPER_DRIVERS #if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#error EXTRUDERS must be 1 with Y_DUAL_STEPPER_DRIVERS. #error EXTRUDERS must be 1 with Y_DUAL_STEPPER_DRIVERS.
#endif #endif
#ifdef Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS)
#error EXTRUDERS must be 1 with Z_DUAL_STEPPER_DRIVERS. #error EXTRUDERS must be 1 with Z_DUAL_STEPPER_DRIVERS.
#endif #endif
...@@ -111,21 +111,21 @@ ...@@ -111,21 +111,21 @@
/** /**
* Required LCD language * Required LCD language
*/ */
#if !defined(DOGLCD) && defined(ULTRA_LCD) && !defined(DISPLAY_CHARSET_HD44780_JAPAN) && !defined(DISPLAY_CHARSET_HD44780_WESTERN)&& !defined(DISPLAY_CHARSET_HD44780_CYRILLIC) #if DISABLED(DOGLCD) && ENABLED(ULTRA_LCD) && DISABLED(DISPLAY_CHARSET_HD44780_JAPAN) && DISABLED(DISPLAY_CHARSET_HD44780_WESTERN) && DISABLED(DISPLAY_CHARSET_HD44780_CYRILLIC)
#error You must enable either DISPLAY_CHARSET_HD44780_JAPAN or DISPLAY_CHARSET_HD44780_WESTERN or DISPLAY_CHARSET_HD44780_CYRILLIC for your LCD controller. #error You must enable either DISPLAY_CHARSET_HD44780_JAPAN or DISPLAY_CHARSET_HD44780_WESTERN or DISPLAY_CHARSET_HD44780_CYRILLIC for your LCD controller.
#endif #endif
/** /**
* Auto Bed Leveling * Auto Bed Leveling
*/ */
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
/** /**
* Require a Z Min pin * Require a Z Min pin
*/ */
#if Z_MIN_PIN == -1 #if Z_MIN_PIN == -1
#if Z_PROBE_PIN == -1 || (!defined(Z_PROBE_ENDSTOP) || defined(DISABLE_Z_PROBE_ENDSTOP)) // It's possible for someone to set a pin for the Z Probe, but not enable it. #if Z_PROBE_PIN == -1 || (DISABLED(Z_PROBE_ENDSTOP) // It's possible for someone to set a pin for the Z Probe, but not enable it.
#ifdef Z_PROBE_REPEATABILITY_TEST #if ENABLED(Z_PROBE_REPEATABILITY_TEST)
#error You must have a Z_MIN or Z_PROBE endstop to enable Z_PROBE_REPEATABILITY_TEST. #error You must have a Z_MIN or Z_PROBE endstop to enable Z_PROBE_REPEATABILITY_TEST.
#else #else
#error ENABLE_AUTO_BED_LEVELING requires a Z_MIN or Z_PROBE endstop. Z_MIN_PIN or Z_PROBE_PIN must point to a valid hardware pin. #error ENABLE_AUTO_BED_LEVELING requires a Z_MIN or Z_PROBE endstop. Z_MIN_PIN or Z_PROBE_PIN must point to a valid hardware pin.
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
/** /**
* Require a Z Probe Pin if Z_PROBE_ENDSTOP is enabled. * Require a Z Probe Pin if Z_PROBE_ENDSTOP is enabled.
*/ */
#if defined(Z_PROBE_ENDSTOP) #if ENABLED(Z_PROBE_ENDSTOP)
#ifndef Z_PROBE_PIN #ifndef Z_PROBE_PIN
#error You must have a Z_PROBE_PIN defined in your pins_XXXX.h file if you enable Z_PROBE_ENDSTOP #error You must have a Z_PROBE_PIN defined in your pins_XXXX.h file if you enable Z_PROBE_ENDSTOP
#endif #endif
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
/** /**
* Check if Probe_Offset * Grid Points is greater than Probing Range * Check if Probe_Offset * Grid Points is greater than Probing Range
*/ */
#ifdef AUTO_BED_LEVELING_GRID #if ENABLED(AUTO_BED_LEVELING_GRID)
// Make sure probing points are reachable // Make sure probing points are reachable
#if LEFT_PROBE_BED_POSITION < MIN_PROBE_X #if LEFT_PROBE_BED_POSITION < MIN_PROBE_X
...@@ -227,14 +227,14 @@ ...@@ -227,14 +227,14 @@
/** /**
* ULTIPANEL encoder * ULTIPANEL encoder
*/ */
#if defined(ULTIPANEL) && !defined(NEWPANEL) && !defined(SR_LCD_2W_NL) && !defined(SHIFT_CLK) #if ENABLED(ULTIPANEL) && DISABLED(NEWPANEL) && DISABLED(SR_LCD_2W_NL) && DISABLED(SHIFT_CLK)
#error ULTIPANEL requires some kind of encoder. #error ULTIPANEL requires some kind of encoder.
#endif #endif
/** /**
* Delta & Z_PROBE_ENDSTOP * Delta & Z_PROBE_ENDSTOP
*/ */
#if defined(DELTA) && defined(Z_PROBE_ENDSTOP) #if ENABLED(DELTA) && ENABLED(Z_PROBE_ENDSTOP)
#ifndef Z_PROBE_PIN #ifndef Z_PROBE_PIN
#error You must have a Z_PROBE_PIN defined in your pins2tool.h file if you enable Z_PROBE_ENDSTOP #error You must have a Z_PROBE_PIN defined in your pins2tool.h file if you enable Z_PROBE_ENDSTOP
#endif #endif
...@@ -243,18 +243,11 @@ ...@@ -243,18 +243,11 @@
#endif #endif
#endif #endif
/**
* Allen Key Z Probe requires Auto Bed Leveling grid and Delta
*/
#if defined(Z_PROBE_ALLEN_KEY) && !(defined(AUTO_BED_LEVELING_GRID) && defined(DELTA))
#error Invalid use of Z_PROBE_ALLEN_KEY.
#endif
/** /**
* Dual X Carriage requirements * Dual X Carriage requirements
*/ */
#ifdef DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE)
#if EXTRUDERS == 1 || defined(COREXY) \ #if EXTRUDERS == 1 || ENABLED(COREXY) \
|| !HAS_X2_ENABLE || !HAS_X2_STEP || !HAS_X2_DIR \ || !HAS_X2_ENABLE || !HAS_X2_STEP || !HAS_X2_DIR \
|| !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS) \ || !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS) \
|| !HAS_X_MAX || !HAS_X_MAX
...@@ -295,7 +288,7 @@ ...@@ -295,7 +288,7 @@
#if !HAS_HEATER_2 #if !HAS_HEATER_2
#error HEATER_2_PIN not defined for this board #error HEATER_2_PIN not defined for this board
#endif #endif
#elif HOTENDS > 1 || defined(HEATERS_PARALLEL) #elif HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)
#if !HAS_HEATER_1 #if !HAS_HEATER_1
#error HEATER_1_PIN not defined for this board #error HEATER_1_PIN not defined for this board
#endif #endif
...@@ -315,11 +308,11 @@ ...@@ -315,11 +308,11 @@
#error WATCH_TEMP_PERIOD now uses seconds instead of milliseconds #error WATCH_TEMP_PERIOD now uses seconds instead of milliseconds
#endif #endif
#if !defined(THERMAL_PROTECTION_HOTENDS) && (defined(WATCH_TEMP_PERIOD) || defined(THERMAL_PROTECTION_PERIOD)) #if DISABLED(THERMAL_PROTECTION_HOTENDS) && (ENABLED(WATCH_TEMP_PERIOD) || defined(THERMAL_PROTECTION_PERIOD))
#error Thermal Runaway Protection for hotends must now be enabled with THERMAL_PROTECTION_HOTENDS #error Thermal Runaway Protection for hotends must now be enabled with THERMAL_PROTECTION_HOTENDS
#endif #endif
#if !defined(THERMAL_PROTECTION_BED) && defined(THERMAL_PROTECTION_BED_PERIOD) #if DISABLED(THERMAL_PROTECTION_BED) && ENABLED(THERMAL_PROTECTION_BED_PERIOD)
#error Thermal Runaway Protection for the bed must now be enabled with THERMAL_PROTECTION_BED #error Thermal Runaway Protection for the bed must now be enabled with THERMAL_PROTECTION_BED
#endif #endif
......
/* /*
Servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
Copyright (c) 2009 Michael Margolis. All right reserved. Copyright (c) 2009 Michael Margolis. All right reserved.
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
......
...@@ -49,7 +49,7 @@ block_t *current_block; // A pointer to the block currently being traced ...@@ -49,7 +49,7 @@ block_t *current_block; // A pointer to the block currently being traced
static unsigned char out_bits = 0; // The next stepping-bits to be output static unsigned char out_bits = 0; // The next stepping-bits to be output
static unsigned int cleaning_buffer_counter; static unsigned int cleaning_buffer_counter;
#ifdef Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS)
static bool performing_homing = false, static bool performing_homing = false,
locked_z_motor = false, locked_z_motor = false,
locked_z2_motor = false; locked_z2_motor = false;
...@@ -59,7 +59,7 @@ static unsigned int cleaning_buffer_counter; ...@@ -59,7 +59,7 @@ static unsigned int cleaning_buffer_counter;
static long counter_x, counter_y, counter_z, counter_e; static long counter_x, counter_y, counter_z, counter_e;
volatile static unsigned long step_events_completed; // The number of step events executed in the current block volatile static unsigned long step_events_completed; // The number of step events executed in the current block
#ifdef ADVANCE #if ENABLED(ADVANCE)
static long advance_rate, advance, final_advance = 0; static long advance_rate, advance, final_advance = 0;
static long old_advance = 0; static long old_advance = 0;
static long e_steps[4]; static long e_steps[4];
...@@ -76,13 +76,13 @@ volatile long endstops_trigsteps[3] = { 0 }; ...@@ -76,13 +76,13 @@ volatile long endstops_trigsteps[3] = { 0 };
volatile long endstops_stepsTotal, endstops_stepsDone; volatile long endstops_stepsTotal, endstops_stepsDone;
static volatile char endstop_hit_bits = 0; // use X_MIN, Y_MIN, Z_MIN and Z_PROBE as BIT value static volatile char endstop_hit_bits = 0; // use X_MIN, Y_MIN, Z_MIN and Z_PROBE as BIT value
#ifndef Z_DUAL_ENDSTOPS #if DISABLED(Z_DUAL_ENDSTOPS)
static byte old_endstop_bits = 0; // use X_MIN, X_MAX... Z_MAX, Z_PROBE, Z2_MIN, Z2_MAX static byte old_endstop_bits = 0; // use X_MIN, X_MAX... Z_MAX, Z_PROBE, Z2_MIN, Z2_MAX
#else #else
static uint16_t old_endstop_bits = 0; // use X_MIN, X_MAX... Z_MAX, Z_PROBE, Z2_MIN, Z2_MAX static uint16_t old_endstop_bits = 0; // use X_MIN, X_MAX... Z_MAX, Z_PROBE, Z2_MIN, Z2_MAX
#endif #endif
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
bool abort_on_endstop_hit = false; bool abort_on_endstop_hit = false;
#endif #endif
...@@ -100,7 +100,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; ...@@ -100,7 +100,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
//================================ functions ================================ //================================ functions ================================
//=========================================================================== //===========================================================================
#ifdef DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE)
#define X_APPLY_DIR(v,ALWAYS) \ #define X_APPLY_DIR(v,ALWAYS) \
if (extruder_duplication_enabled || ALWAYS) { \ if (extruder_duplication_enabled || ALWAYS) { \
X_DIR_WRITE(v); \ X_DIR_WRITE(v); \
...@@ -122,7 +122,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; ...@@ -122,7 +122,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
#define X_APPLY_STEP(v,Q) X_STEP_WRITE(v) #define X_APPLY_STEP(v,Q) X_STEP_WRITE(v)
#endif #endif
#ifdef Y_DUAL_STEPPER_DRIVERS #if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#define Y_APPLY_DIR(v,Q) { Y_DIR_WRITE(v); Y2_DIR_WRITE((v) != INVERT_Y2_VS_Y_DIR); } #define Y_APPLY_DIR(v,Q) { Y_DIR_WRITE(v); Y2_DIR_WRITE((v) != INVERT_Y2_VS_Y_DIR); }
#define Y_APPLY_STEP(v,Q) { Y_STEP_WRITE(v); Y2_STEP_WRITE(v); } #define Y_APPLY_STEP(v,Q) { Y_STEP_WRITE(v); Y2_STEP_WRITE(v); }
#else #else
...@@ -130,9 +130,9 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; ...@@ -130,9 +130,9 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
#define Y_APPLY_STEP(v,Q) Y_STEP_WRITE(v) #define Y_APPLY_STEP(v,Q) Y_STEP_WRITE(v)
#endif #endif
#ifdef Z_DUAL_STEPPER_DRIVERS #if ENABLED(Z_DUAL_STEPPER_DRIVERS)
#define Z_APPLY_DIR(v,Q) { Z_DIR_WRITE(v); Z2_DIR_WRITE(v); } #define Z_APPLY_DIR(v,Q) { Z_DIR_WRITE(v); Z2_DIR_WRITE(v); }
#ifdef Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS)
#define Z_APPLY_STEP(v,Q) \ #define Z_APPLY_STEP(v,Q) \
if (performing_homing) { \ if (performing_homing) { \
if (Z_HOME_DIR > 0) {\ if (Z_HOME_DIR > 0) {\
...@@ -261,13 +261,13 @@ void checkHitEndstops() { ...@@ -261,13 +261,13 @@ void checkHitEndstops() {
ECHO_MV(MSG_ENDSTOP_Z, (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]); ECHO_MV(MSG_ENDSTOP_Z, (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT MSG_ENDSTOP_ZS); LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT MSG_ENDSTOP_ZS);
} }
#ifdef Z_PROBE_ENDSTOP #if ENABLED(Z_PROBE_ENDSTOP)
if (endstop_hit_bits & BIT(Z_PROBE)) { if (endstop_hit_bits & BIT(Z_PROBE)) {
ECHO_MV(MSG_ENDSTOP_ZPS, (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]); ECHO_MV(MSG_ENDSTOP_ZPS, (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT MSG_ENDSTOP_ZPS); LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT MSG_ENDSTOP_ZPS);
} }
#endif #endif
#ifdef NPR2 #if ENABLED(NPR2)
if (endstop_hit_bits & BIT(E_MIN)) { if (endstop_hit_bits & BIT(E_MIN)) {
ECHO_MV(MSG_ENDSTOP_E, (float)endstops_trigsteps[E_AXIS] / axis_steps_per_unit[E_AXIS]); ECHO_MV(MSG_ENDSTOP_E, (float)endstops_trigsteps[E_AXIS] / axis_steps_per_unit[E_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT MSG_ENDSTOP_ES); LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT MSG_ENDSTOP_ES);
...@@ -277,16 +277,12 @@ void checkHitEndstops() { ...@@ -277,16 +277,12 @@ void checkHitEndstops() {
endstops_hit_on_purpose(); endstops_hit_on_purpose();
#if defined(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && defined(SDSUPPORT) #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED(SDSUPPORT)
if (abort_on_endstop_hit) { if (abort_on_endstop_hit) {
card.sdprinting = false; card.sdprinting = false;
card.closeFile(); card.closeFile();
quickStop(); quickStop();
setTargetHotend0(0); disable_all_heaters(); // switch off all heaters.
setTargetHotend1(0);
setTargetHotend2(0);
setTargetHotend3(0);
setTargetBed(0);
} }
#endif #endif
} }
...@@ -381,7 +377,7 @@ void set_stepper_direction() { ...@@ -381,7 +377,7 @@ void set_stepper_direction() {
count_direction[Z_AXIS] = 1; count_direction[Z_AXIS] = 1;
} }
#ifndef ADVANCE #if DISABLED(ADVANCE)
if (TEST(out_bits, E_AXIS)) { if (TEST(out_bits, E_AXIS)) {
REV_E_DIR(); REV_E_DIR();
count_direction[E_AXIS] = -1; count_direction[E_AXIS] = -1;
...@@ -402,7 +398,7 @@ FORCE_INLINE void trapezoid_generator_reset() { ...@@ -402,7 +398,7 @@ FORCE_INLINE void trapezoid_generator_reset() {
set_stepper_direction(); set_stepper_direction();
} }
#ifdef ADVANCE #if ENABLED(ADVANCE)
advance = current_block->initial_advance; advance = current_block->initial_advance;
final_advance = current_block->final_advance; final_advance = current_block->final_advance;
// Do E steps + advance steps // Do E steps + advance steps
...@@ -445,7 +441,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -445,7 +441,7 @@ ISR(TIMER1_COMPA_vect) {
counter_y = counter_z = counter_e = counter_x; counter_y = counter_z = counter_e = counter_x;
step_events_completed = 0; step_events_completed = 0;
#ifdef Z_LATE_ENABLE #if ENABLED(Z_LATE_ENABLE)
if (current_block->steps[Z_AXIS] > 0) { if (current_block->steps[Z_AXIS] > 0) {
enable_z(); enable_z();
OCR1A = 2000; //1ms wait OCR1A = 2000; //1ms wait
...@@ -453,7 +449,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -453,7 +449,7 @@ ISR(TIMER1_COMPA_vect) {
} }
#endif #endif
// #ifdef ADVANCE // #if ENABLED(ADVANCE)
// e_steps[current_block->active_driver] = 0; // e_steps[current_block->active_driver] = 0;
// #endif // #endif
} }
...@@ -467,10 +463,10 @@ ISR(TIMER1_COMPA_vect) { ...@@ -467,10 +463,10 @@ ISR(TIMER1_COMPA_vect) {
// Check endstops // Check endstops
if (check_endstops) { if (check_endstops) {
#ifdef Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS)
uint16_t current_endstop_bits; uint16_t current_endstop_bits = 0;
#else #else
byte current_endstop_bits; byte current_endstop_bits = 0;
#endif #endif
#define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN #define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
...@@ -494,7 +490,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -494,7 +490,7 @@ ISR(TIMER1_COMPA_vect) {
step_events_completed = current_block->step_event_count; \ step_events_completed = current_block->step_event_count; \
} }
#ifdef COREXY #if ENABLED(COREXY)
// Head direction in -X axis for CoreXY bots. // Head direction in -X axis for CoreXY bots.
// If DeltaX == -DeltaY, the movement is only in Y axis // If DeltaX == -DeltaY, the movement is only in Y axis
if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) { if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) {
...@@ -503,7 +499,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -503,7 +499,7 @@ ISR(TIMER1_COMPA_vect) {
if (TEST(out_bits, X_AXIS)) // stepping along -X axis (regular Cartesian bot) if (TEST(out_bits, X_AXIS)) // stepping along -X axis (regular Cartesian bot)
#endif #endif
{ // -direction { // -direction
#ifdef DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE)
// with 2 x-carriages, endstops are only checked in the homing direction for the active extruder // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
if ((current_block->active_driver == 0 && X_HOME_DIR == -1) || (current_block->active_driver != 0 && X2_HOME_DIR == -1)) if ((current_block->active_driver == 0 && X_HOME_DIR == -1) || (current_block->active_driver != 0 && X2_HOME_DIR == -1))
#endif #endif
...@@ -514,7 +510,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -514,7 +510,7 @@ ISR(TIMER1_COMPA_vect) {
} }
} }
else { // +direction else { // +direction
#ifdef DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE)
// with 2 x-carriages, endstops are only checked in the homing direction for the active extruder // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
if ((current_block->active_driver == 0 && X_HOME_DIR == 1) || (current_block->active_driver != 0 && X2_HOME_DIR == 1)) if ((current_block->active_driver == 0 && X_HOME_DIR == 1) || (current_block->active_driver != 0 && X2_HOME_DIR == 1))
#endif #endif
...@@ -524,7 +520,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -524,7 +520,7 @@ ISR(TIMER1_COMPA_vect) {
#endif #endif
} }
} }
#ifdef COREXY #if ENABLED(COREXY)
} }
// Head direction in -Y axis for CoreXY bots. // Head direction in -Y axis for CoreXY bots.
// If DeltaX == DeltaY, the movement is only in X axis // If DeltaX == DeltaY, the movement is only in X axis
...@@ -543,13 +539,13 @@ ISR(TIMER1_COMPA_vect) { ...@@ -543,13 +539,13 @@ ISR(TIMER1_COMPA_vect) {
UPDATE_ENDSTOP(Y, MAX); UPDATE_ENDSTOP(Y, MAX);
#endif #endif
} }
#ifdef COREXY #if ENABLED(COREXY)
} }
#endif #endif
if (TEST(out_bits, Z_AXIS)) { // z -direction if (TEST(out_bits, Z_AXIS)) { // z -direction
#if HAS_Z_MIN #if HAS_Z_MIN
#ifdef Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS)
SET_ENDSTOP_BIT(Z, MIN); SET_ENDSTOP_BIT(Z, MIN);
#if HAS_Z2_MIN #if HAS_Z2_MIN
SET_ENDSTOP_BIT(Z2, MIN); SET_ENDSTOP_BIT(Z2, MIN);
...@@ -571,7 +567,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -571,7 +567,7 @@ ISR(TIMER1_COMPA_vect) {
#endif // !Z_DUAL_ENDSTOPS #endif // !Z_DUAL_ENDSTOPS
#endif // Z_MIN_PIN #endif // Z_MIN_PIN
#ifdef Z_PROBE_ENDSTOP #if ENABLED(Z_PROBE_ENDSTOP)
UPDATE_ENDSTOP(Z, PROBE); UPDATE_ENDSTOP(Z, PROBE);
SET_ENDSTOP_BIT(Z, PROBE); SET_ENDSTOP_BIT(Z, PROBE);
...@@ -584,7 +580,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -584,7 +580,7 @@ ISR(TIMER1_COMPA_vect) {
else { // z +direction else { // z +direction
#if HAS_Z_MAX #if HAS_Z_MAX
#ifdef Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS)
SET_ENDSTOP_BIT(Z, MAX); SET_ENDSTOP_BIT(Z, MAX);
#if HAS_Z2_MAX #if HAS_Z2_MAX
...@@ -620,7 +616,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -620,7 +616,7 @@ ISR(TIMER1_COMPA_vect) {
MSerial.checkRx(); // Check for serial chars. MSerial.checkRx(); // Check for serial chars.
#endif #endif
#ifdef ADVANCE #if ENABLED(ADVANCE)
counter_e += current_block->steps[E_AXIS]; counter_e += current_block->steps[E_AXIS];
if (counter_e > 0) { if (counter_e > 0) {
counter_e -= current_block->step_event_count; counter_e -= current_block->step_event_count;
...@@ -643,7 +639,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -643,7 +639,7 @@ ISR(TIMER1_COMPA_vect) {
STEP_START(e,E); STEP_START(e,E);
#endif #endif
#ifdef STEPPER_HIGH_LOW_DELAY #if ENABLED(STEPPER_HIGH_LOW_DELAY)
delayMicroseconds(STEPPER_HIGH_LOW_DELAY); delayMicroseconds(STEPPER_HIGH_LOW_DELAY);
#endif #endif
...@@ -680,7 +676,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -680,7 +676,7 @@ ISR(TIMER1_COMPA_vect) {
timer = calc_timer(acc_step_rate); timer = calc_timer(acc_step_rate);
OCR1A = timer; OCR1A = timer;
acceleration_time += timer; acceleration_time += timer;
#ifdef ADVANCE #if ENABLED(ADVANCE)
for(int8_t i=0; i < step_loops; i++) { for(int8_t i=0; i < step_loops; i++) {
advance += advance_rate; advance += advance_rate;
} }
...@@ -709,7 +705,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -709,7 +705,7 @@ ISR(TIMER1_COMPA_vect) {
timer = calc_timer(step_rate); timer = calc_timer(step_rate);
OCR1A = timer; OCR1A = timer;
deceleration_time += timer; deceleration_time += timer;
#ifdef ADVANCE #if ENABLED(ADVANCE)
for(int8_t i=0; i < step_loops; i++) { for(int8_t i=0; i < step_loops; i++) {
advance -= advance_rate; advance -= advance_rate;
} }
...@@ -733,7 +729,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -733,7 +729,7 @@ ISR(TIMER1_COMPA_vect) {
} }
} }
#ifdef ADVANCE #if ENABLED(ADVANCE)
unsigned char old_OCR0A; unsigned char old_OCR0A;
// Timer interrupt for E. e_steps is set in the main routine; // Timer interrupt for E. e_steps is set in the main routine;
// Timer 0 is shared with millies // Timer 0 is shared with millies
...@@ -811,11 +807,11 @@ void st_init() { ...@@ -811,11 +807,11 @@ void st_init() {
microstep_init(); //Initialize Microstepping Pins microstep_init(); //Initialize Microstepping Pins
// initialise TMC Steppers // initialise TMC Steppers
#ifdef HAVE_TMCDRIVER #if ENABLED(HAVE_TMCDRIVER)
tmc_init(); tmc_init();
#endif #endif
// initialise L6470 Steppers // initialise L6470 Steppers
#ifdef HAVE_L6470DRIVER #if ENABLED(HAVE_L6470DRIVER)
L6470_init(); L6470_init();
#endif #endif
...@@ -828,13 +824,13 @@ void st_init() { ...@@ -828,13 +824,13 @@ void st_init() {
#endif #endif
#if HAS_Y_DIR #if HAS_Y_DIR
Y_DIR_INIT; Y_DIR_INIT;
#if defined(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_DIR #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_DIR
Y2_DIR_INIT; Y2_DIR_INIT;
#endif #endif
#endif #endif
#if HAS_Z_DIR #if HAS_Z_DIR
Z_DIR_INIT; Z_DIR_INIT;
#if defined(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_DIR #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_DIR
Z2_DIR_INIT; Z2_DIR_INIT;
#endif #endif
#endif #endif
...@@ -865,7 +861,7 @@ void st_init() { ...@@ -865,7 +861,7 @@ void st_init() {
Y_ENABLE_INIT; Y_ENABLE_INIT;
if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH); if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH);
#if defined(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE
Y2_ENABLE_INIT; Y2_ENABLE_INIT;
if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH); if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH);
#endif #endif
...@@ -874,7 +870,7 @@ void st_init() { ...@@ -874,7 +870,7 @@ void st_init() {
Z_ENABLE_INIT; Z_ENABLE_INIT;
if (!Z_ENABLE_ON) Z_ENABLE_WRITE(HIGH); if (!Z_ENABLE_ON) Z_ENABLE_WRITE(HIGH);
#if defined(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_ENABLE #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_ENABLE
Z2_ENABLE_INIT; Z2_ENABLE_INIT;
if (!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH); if (!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH);
#endif #endif
...@@ -914,63 +910,63 @@ void st_init() { ...@@ -914,63 +910,63 @@ void st_init() {
#if HAS_X_MIN #if HAS_X_MIN
SET_INPUT(X_MIN_PIN); SET_INPUT(X_MIN_PIN);
#ifdef ENDSTOPPULLUP_XMIN #if ENABLED(ENDSTOPPULLUP_XMIN)
WRITE(X_MIN_PIN,HIGH); WRITE(X_MIN_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Y_MIN #if HAS_Y_MIN
SET_INPUT(Y_MIN_PIN); SET_INPUT(Y_MIN_PIN);
#ifdef ENDSTOPPULLUP_YMIN #if ENABLED(ENDSTOPPULLUP_YMIN)
WRITE(Y_MIN_PIN,HIGH); WRITE(Y_MIN_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Z_MIN #if HAS_Z_MIN
SET_INPUT(Z_MIN_PIN); SET_INPUT(Z_MIN_PIN);
#ifdef ENDSTOPPULLUP_ZMIN #if ENABLED(ENDSTOPPULLUP_ZMIN)
WRITE(Z_MIN_PIN,HIGH); WRITE(Z_MIN_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_E_MIN #if HAS_E_MIN
SET_INPUT(E_MIN_PIN); SET_INPUT(E_MIN_PIN);
#ifdef ENDSTOPPULLUP_EMIN #if ENABLED(ENDSTOPPULLUP_EMIN)
WRITE(E_MIN_PIN, HIGH); WRITE(E_MIN_PIN, HIGH);
#endif #endif
#endif #endif
#if HAS_X_MAX #if HAS_X_MAX
SET_INPUT(X_MAX_PIN); SET_INPUT(X_MAX_PIN);
#ifdef ENDSTOPPULLUP_XMAX #if ENABLED(ENDSTOPPULLUP_XMAX)
WRITE(X_MAX_PIN,HIGH); WRITE(X_MAX_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Y_MAX #if HAS_Y_MAX
SET_INPUT(Y_MAX_PIN); SET_INPUT(Y_MAX_PIN);
#ifdef ENDSTOPPULLUP_YMAX #if ENABLED(ENDSTOPPULLUP_YMAX)
WRITE(Y_MAX_PIN,HIGH); WRITE(Y_MAX_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Z_MAX #if HAS_Z_MAX
SET_INPUT(Z_MAX_PIN); SET_INPUT(Z_MAX_PIN);
#ifdef ENDSTOPPULLUP_ZMAX #if ENABLED(ENDSTOPPULLUP_ZMAX)
WRITE(Z_MAX_PIN,HIGH); WRITE(Z_MAX_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Z2_MAX #if HAS_Z2_MAX
SET_INPUT(Z2_MAX_PIN); SET_INPUT(Z2_MAX_PIN);
#ifdef ENDSTOPPULLUP_ZMAX #if ENABLED(ENDSTOPPULLUP_ZMAX)
WRITE(Z2_MAX_PIN,HIGH); WRITE(Z2_MAX_PIN,HIGH);
#endif #endif
#endif #endif
#if (defined(Z_PROBE_PIN) && Z_PROBE_PIN >= 0) && defined(Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used. #if HAS_Z_PROBE && ENABLED(Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
SET_INPUT(Z_PROBE_PIN); SET_INPUT(Z_PROBE_PIN);
#ifdef ENDSTOPPULLUP_ZPROBE #if ENABLED(ENDSTOPPULLUP_ZPROBE)
WRITE(Z_PROBE_PIN,HIGH); WRITE(Z_PROBE_PIN,HIGH);
#endif #endif
#endif #endif
...@@ -994,14 +990,14 @@ void st_init() { ...@@ -994,14 +990,14 @@ void st_init() {
AXIS_INIT(x, X2, X); AXIS_INIT(x, X2, X);
#endif #endif
#if HAS_Y_STEP #if HAS_Y_STEP
#if defined(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_STEP #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_STEP
Y2_STEP_INIT; Y2_STEP_INIT;
Y2_STEP_WRITE(INVERT_Y_STEP_PIN); Y2_STEP_WRITE(INVERT_Y_STEP_PIN);
#endif #endif
AXIS_INIT(y, Y, Y); AXIS_INIT(y, Y, Y);
#endif #endif
#if HAS_Z_STEP #if HAS_Z_STEP
#if defined(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_STEP #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_STEP
Z2_STEP_INIT; Z2_STEP_INIT;
Z2_STEP_WRITE(INVERT_Z_STEP_PIN); Z2_STEP_WRITE(INVERT_Z_STEP_PIN);
#endif #endif
...@@ -1041,7 +1037,7 @@ void st_init() { ...@@ -1041,7 +1037,7 @@ void st_init() {
TCNT1 = 0; TCNT1 = 0;
ENABLE_STEPPER_DRIVER_INTERRUPT(); ENABLE_STEPPER_DRIVER_INTERRUPT();
#ifdef ADVANCE #if ENABLED(ADVANCE)
#if defined(TCCR0A) && defined(WGM01) #if defined(TCCR0A) && defined(WGM01)
TCCR0A &= ~BIT(WGM01); TCCR0A &= ~BIT(WGM01);
TCCR0A &= ~BIT(WGM00); TCCR0A &= ~BIT(WGM00);
...@@ -1057,14 +1053,10 @@ void st_init() { ...@@ -1057,14 +1053,10 @@ void st_init() {
} }
// Block until all buffered steps are executed /**
void st_synchronize() { * Block until all buffered steps are executed
while (blocks_queued()) { */
manage_heater(); void st_synchronize() { while (blocks_queued()) idle(); }
manage_inactivity();
lcd_update();
}
}
void st_set_position(const long &x, const long &y, const long &z, const long &e) { void st_set_position(const long &x, const long &y, const long &z, const long &e) {
CRITICAL_SECTION_START; CRITICAL_SECTION_START;
...@@ -1089,7 +1081,7 @@ long st_get_position(uint8_t axis) { ...@@ -1089,7 +1081,7 @@ long st_get_position(uint8_t axis) {
return count_pos; return count_pos;
} }
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
float st_get_position_mm(AxisEnum axis) { float st_get_position_mm(AxisEnum axis) {
return st_get_position(axis) / axis_steps_per_unit[axis]; return st_get_position(axis) / axis_steps_per_unit[axis];
...@@ -1110,7 +1102,7 @@ void quickStop() { ...@@ -1110,7 +1102,7 @@ void quickStop() {
ENABLE_STEPPER_DRIVER_INTERRUPT(); ENABLE_STEPPER_DRIVER_INTERRUPT();
} }
#ifdef NPR2 #if ENABLED(NPR2)
void colorstep(long csteps,const bool direction) { void colorstep(long csteps,const bool direction) {
enable_e1(); enable_e1();
//setup new step //setup new step
...@@ -1158,7 +1150,7 @@ void quickStop() { ...@@ -1158,7 +1150,7 @@ void quickStop() {
case Z_AXIS: { case Z_AXIS: {
#ifndef DELTA #if DISABLED(DELTA)
BABYSTEP_AXIS(z, Z, BABYSTEP_INVERT_Z); BABYSTEP_AXIS(z, Z, BABYSTEP_INVERT_Z);
...@@ -1293,7 +1285,7 @@ void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2) { ...@@ -1293,7 +1285,7 @@ void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2) {
case 1: digitalWrite(Y_MS2_PIN, ms2); break; case 1: digitalWrite(Y_MS2_PIN, ms2); break;
case 2: digitalWrite(Z_MS2_PIN, ms2); break; case 2: digitalWrite(Z_MS2_PIN, ms2); break;
case 3: digitalWrite(E0_MS2_PIN, ms2); break; case 3: digitalWrite(E0_MS2_PIN, ms2); break;
#if defined(E1_MS2_PIN) && E1_MS2_PIN >= 0 #if PIN_EXISTS(E1_MS2)
case 4: digitalWrite(E1_MS2_PIN, ms2); break; case 4: digitalWrite(E1_MS2_PIN, ms2); break;
#endif #endif
} }
...@@ -1313,27 +1305,27 @@ void microstep_mode(uint8_t driver, uint8_t stepping_mode) { ...@@ -1313,27 +1305,27 @@ void microstep_mode(uint8_t driver, uint8_t stepping_mode) {
} }
void microstep_readings() { void microstep_readings() {
ECHO_SM(OK, MSG_MICROSTEP_MS1_MS2); ECHO_SM(DB, MSG_MICROSTEP_MS1_MS2);
ECHO_M(MSG_MICROSTEP_X); ECHO_M(MSG_MICROSTEP_X);
ECHO_V(digitalRead(X_MS1_PIN)); ECHO_V(digitalRead(X_MS1_PIN));
ECHO_EV(digitalRead(X_MS2_PIN)); ECHO_EV(digitalRead(X_MS2_PIN));
ECHO_SM(OK, MSG_MICROSTEP_Y); ECHO_SM(DB, MSG_MICROSTEP_Y);
ECHO_V(digitalRead(Y_MS1_PIN)); ECHO_V(digitalRead(Y_MS1_PIN));
ECHO_EV(digitalRead(Y_MS2_PIN)); ECHO_EV(digitalRead(Y_MS2_PIN));
ECHO_SM(OK, MSG_MICROSTEP_Z); ECHO_SM(DB, MSG_MICROSTEP_Z);
ECHO_V(digitalRead(Z_MS1_PIN)); ECHO_V(digitalRead(Z_MS1_PIN));
ECHO_EV(digitalRead(Z_MS2_PIN)); ECHO_EV(digitalRead(Z_MS2_PIN));
ECHO_SM(OK, MSG_MICROSTEP_E0); ECHO_SM(DB, MSG_MICROSTEP_E0);
ECHO_V(digitalRead(E0_MS1_PIN)); ECHO_V(digitalRead(E0_MS1_PIN));
ECHO_EV(digitalRead(E0_MS2_PIN)); ECHO_EV(digitalRead(E0_MS2_PIN));
#if HAS_MICROSTEPS_E1 #if HAS_MICROSTEPS_E1
ECHO_SM(OK, MSG_MICROSTEP_E1); ECHO_SM(DB, MSG_MICROSTEP_E1);
ECHO_V(digitalRead(E1_MS1_PIN)); ECHO_V(digitalRead(E1_MS1_PIN));
ECHO_EV(digitalRead(E1_MS2_PIN)); ECHO_EV(digitalRead(E1_MS2_PIN));
#endif #endif
} }
#ifdef Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS)
void In_Homing_Process(bool state) { performing_homing = state; } void In_Homing_Process(bool state) { performing_homing = state; }
void Lock_z_motor(bool state) { locked_z_motor = state; } void Lock_z_motor(bool state) { locked_z_motor = state; }
void Lock_z2_motor(bool state) { locked_z2_motor = state; } void Lock_z2_motor(bool state) { locked_z2_motor = state; }
......
...@@ -53,8 +53,8 @@ ...@@ -53,8 +53,8 @@
#define REV_E_DIR() E0_DIR_WRITE(INVERT_E0_DIR) #define REV_E_DIR() E0_DIR_WRITE(INVERT_E0_DIR)
#endif //DRIVER_EXTRUDERS #endif //DRIVER_EXTRUDERS
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
extern bool abort_on_endstop_hit; extern bool abort_on_endstop_hit;
#endif #endif
// Initialize and start the stepper motor subsystem // Initialize and start the stepper motor subsystem
...@@ -70,7 +70,7 @@ void st_set_e_position(const long &e); ...@@ -70,7 +70,7 @@ void st_set_e_position(const long &e);
// Get current position in steps // Get current position in steps
long st_get_position(uint8_t axis); long st_get_position(uint8_t axis);
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
// Get current position in mm // Get current position in mm
float st_get_position_mm(AxisEnum axis); float st_get_position_mm(AxisEnum axis);
#endif #endif
...@@ -101,18 +101,18 @@ void digipot_current(uint8_t driver, int current); ...@@ -101,18 +101,18 @@ void digipot_current(uint8_t driver, int current);
void microstep_init(); void microstep_init();
void microstep_readings(); void microstep_readings();
#ifdef Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS)
void In_Homing_Process(bool state); void In_Homing_Process(bool state);
void Lock_z_motor(bool state); void Lock_z_motor(bool state);
void Lock_z2_motor(bool state); void Lock_z2_motor(bool state);
#endif #endif
#ifdef BABYSTEPPING #if ENABLED(BABYSTEPPING)
void babystep(const uint8_t axis,const bool direction); // perform a short step with a single stepper motor, outside of any convention void babystep(const uint8_t axis,const bool direction); // perform a short step with a single stepper motor, outside of any convention
#endif #endif
#ifdef NPR2 //Multiextruder #if ENABLED(NPR2) // Multiextruder
void colorstep(long csteps,const bool direction); void colorstep(long csteps,const bool direction);
#endif //NPR2 #endif // NPR2
#endif //stepper_h #endif // stepper_h
...@@ -22,203 +22,203 @@ ...@@ -22,203 +22,203 @@
#include "stepper_indirection.h" #include "stepper_indirection.h"
#include "Configuration.h" #include "Configuration.h"
#ifdef HAVE_TMCDRIVER #if ENABLED(HAVE_TMCDRIVER)
#include <SPI.h> #include <SPI.h>
#include <TMC26XStepper.h> #include <TMC26XStepper.h>
#endif #endif
// Stepper objects of TMC steppers used // Stepper objects of TMC steppers used
#ifdef X_IS_TMC #if ENABLED(X_IS_TMC)
TMC26XStepper stepperX(200,X_ENABLE_PIN,X_STEP_PIN,X_DIR_PIN,X_MAX_CURRENT,X_SENSE_RESISTOR); TMC26XStepper stepperX(200,X_ENABLE_PIN,X_STEP_PIN,X_DIR_PIN,X_MAX_CURRENT,X_SENSE_RESISTOR);
#endif #endif
#ifdef X2_IS_TMC #if ENABLED(X2_IS_TMC)
TMC26XStepper stepperX2(200,X2_ENABLE_PIN,X2_STEP_PIN,X2_DIR_PIN,X2_MAX_CURRENT,X2_SENSE_RESISTOR); TMC26XStepper stepperX2(200,X2_ENABLE_PIN,X2_STEP_PIN,X2_DIR_PIN,X2_MAX_CURRENT,X2_SENSE_RESISTOR);
#endif #endif
#ifdef Y_IS_TMC #if ENABLED(Y_IS_TMC)
TMC26XStepper stepperY(200,Y_ENABLE_PIN,Y_STEP_PIN,Y_DIR_PIN,Y_MAX_CURRENT,Y_SENSE_RESISTOR); TMC26XStepper stepperY(200,Y_ENABLE_PIN,Y_STEP_PIN,Y_DIR_PIN,Y_MAX_CURRENT,Y_SENSE_RESISTOR);
#endif #endif
#ifdef Y2_IS_TMC #if ENABLED(Y2_IS_TMC)
TMC26XStepper stepperY2(200,Y2_ENABLE_PIN,Y2_STEP_PIN,Y2_DIR_PIN,Y2_MAX_CURRENT,Y2_SENSE_RESISTOR); TMC26XStepper stepperY2(200,Y2_ENABLE_PIN,Y2_STEP_PIN,Y2_DIR_PIN,Y2_MAX_CURRENT,Y2_SENSE_RESISTOR);
#endif #endif
#ifdef Z_IS_TMC #if ENABLED(Z_IS_TMC)
TMC26XStepper stepperZ(200,Z_ENABLE_PIN,Z_STEP_PIN,Z_DIR_PIN,Z_MAX_CURRENT,Z_SENSE_RESISTOR); TMC26XStepper stepperZ(200,Z_ENABLE_PIN,Z_STEP_PIN,Z_DIR_PIN,Z_MAX_CURRENT,Z_SENSE_RESISTOR);
#endif #endif
#ifdef Z2_IS_TMC #if ENABLED(Z2_IS_TMC)
TMC26XStepper stepperZ2(200,Z2_ENABLE_PIN,Z2_STEP_PIN,Z2_DIR_PIN,Z2_MAX_CURRENT,Z2_SENSE_RESISTOR); TMC26XStepper stepperZ2(200,Z2_ENABLE_PIN,Z2_STEP_PIN,Z2_DIR_PIN,Z2_MAX_CURRENT,Z2_SENSE_RESISTOR);
#endif #endif
#ifdef E0_IS_TMC #if ENABLED(E0_IS_TMC)
TMC26XStepper stepperE0(200,E0_ENABLE_PIN,E0_STEP_PIN,E0_DIR_PIN,E0_MAX_CURRENT,E0_SENSE_RESISTOR); TMC26XStepper stepperE0(200,E0_ENABLE_PIN,E0_STEP_PIN,E0_DIR_PIN,E0_MAX_CURRENT,E0_SENSE_RESISTOR);
#endif #endif
#ifdef E1_IS_TMC #if ENABLED(E1_IS_TMC)
TMC26XStepper stepperE1(200,E1_ENABLE_PIN,E1_STEP_PIN,E1_DIR_PIN,E1_MAX_CURRENT,E1_SENSE_RESISTOR); TMC26XStepper stepperE1(200,E1_ENABLE_PIN,E1_STEP_PIN,E1_DIR_PIN,E1_MAX_CURRENT,E1_SENSE_RESISTOR);
#endif #endif
#ifdef E2_IS_TMC #if ENABLED(E2_IS_TMC)
TMC26XStepper stepperE2(200,E2_ENABLE_PIN,E2_STEP_PIN,E2_DIR_PIN,E2_MAX_CURRENT,E2_SENSE_RESISTOR); TMC26XStepper stepperE2(200,E2_ENABLE_PIN,E2_STEP_PIN,E2_DIR_PIN,E2_MAX_CURRENT,E2_SENSE_RESISTOR);
#endif #endif
#ifdef E3_IS_TMC #if ENABLED(E3_IS_TMC)
TMC26XStepper stepperE3(200,E3_ENABLE_PIN,E3_STEP_PIN,E3_DIR_PIN,E3_MAX_CURRENT,E3_SENSE_RESISTOR); TMC26XStepper stepperE3(200,E3_ENABLE_PIN,E3_STEP_PIN,E3_DIR_PIN,E3_MAX_CURRENT,E3_SENSE_RESISTOR);
#endif #endif
#ifdef HAVE_TMCDRIVER #if ENABLED(HAVE_TMCDRIVER)
void tmc_init() void tmc_init()
{ {
#ifdef X_IS_TMC #if ENABLED(X_IS_TMC)
stepperX.setMicrosteps(X_MICROSTEPS); stepperX.setMicrosteps(X_MICROSTEPS);
stepperX.start(); stepperX.start();
#endif #endif
#ifdef X2_IS_TMC #if ENABLED(X2_IS_TMC)
stepperX2.setMicrosteps(X2_MICROSTEPS); stepperX2.setMicrosteps(X2_MICROSTEPS);
stepperX2.start(); stepperX2.start();
#endif #endif
#ifdef Y_IS_TMC #if ENABLED(Y_IS_TMC)
stepperY.setMicrosteps(Y_MICROSTEPS); stepperY.setMicrosteps(Y_MICROSTEPS);
stepperY.start(); stepperY.start();
#endif #endif
#ifdef Y2_IS_TMC #if ENABLED(Y2_IS_TMC)
stepperY2.setMicrosteps(Y2_MICROSTEPS); stepperY2.setMicrosteps(Y2_MICROSTEPS);
stepperY2.start(); stepperY2.start();
#endif #endif
#ifdef Z_IS_TMC #if ENABLED(Z_IS_TMC)
stepperZ.setMicrosteps(Z_MICROSTEPS); stepperZ.setMicrosteps(Z_MICROSTEPS);
stepperZ.start(); stepperZ.start();
#endif #endif
#ifdef Z2_IS_TMC #if ENABLED(Z2_IS_TMC)
stepperZ2.setMicrosteps(Z2_MICROSTEPS); stepperZ2.setMicrosteps(Z2_MICROSTEPS);
stepperZ2.start(); stepperZ2.start();
#endif #endif
#ifdef E0_IS_TMC #if ENABLED(E0_IS_TMC)
stepperE0.setMicrosteps(E0_MICROSTEPS); stepperE0.setMicrosteps(E0_MICROSTEPS);
stepperE0.start(); stepperE0.start();
#endif #endif
#ifdef E1_IS_TMC #if ENABLED(E1_IS_TMC)
stepperE1.setMicrosteps(E1_MICROSTEPS); stepperE1.setMicrosteps(E1_MICROSTEPS);
stepperE1.start(); stepperE1.start();
#endif #endif
#ifdef E2_IS_TMC #if ENABLED(E2_IS_TMC)
stepperE2.setMicrosteps(E2_MICROSTEPS); stepperE2.setMicrosteps(E2_MICROSTEPS);
stepperE2.start(); stepperE2.start();
#endif #endif
#ifdef E3_IS_TMC #if ENABLED(E3_IS_TMC)
stepperE3.setMicrosteps(E3_MICROSTEPS); stepperE3.setMicrosteps(E3_MICROSTEPS);
stepperE3.start(); stepperE3.start();
#endif #endif
} }
#endif #endif
// L6470 Driver objects and inits // L6470 Driver objects and inits
#ifdef HAVE_L6470DRIVER #if ENABLED(HAVE_L6470DRIVER)
#include <SPI.h> #include <SPI.h>
#include <L6470.h> #include <L6470.h>
#endif #endif
// L6470 Stepper objects // L6470 Stepper objects
#ifdef X_IS_L6470 #if ENABLED(X_IS_L6470)
L6470 stepperX(X_ENABLE_PIN); L6470 stepperX(X_ENABLE_PIN);
#endif #endif
#ifdef X2_IS_L6470 #if ENABLED(X2_IS_L6470)
L6470 stepperX2(X2_ENABLE_PIN); L6470 stepperX2(X2_ENABLE_PIN);
#endif #endif
#ifdef Y_IS_L6470 #if ENABLED(Y_IS_L6470)
L6470 stepperY(Y_ENABLE_PIN); L6470 stepperY(Y_ENABLE_PIN);
#endif #endif
#ifdef Y2_IS_L6470 #if ENABLED(Y2_IS_L6470)
L6470 stepperY2(Y2_ENABLE_PIN); L6470 stepperY2(Y2_ENABLE_PIN);
#endif #endif
#ifdef Z_IS_L6470 #if ENABLED(Z_IS_L6470)
L6470 stepperZ(Z_ENABLE_PIN); L6470 stepperZ(Z_ENABLE_PIN);
#endif #endif
#ifdef Z2_IS_L6470 #if ENABLED(Z2_IS_L6470)
L6470 stepperZ2(Z2_ENABLE_PIN); L6470 stepperZ2(Z2_ENABLE_PIN);
#endif #endif
#ifdef E0_IS_L6470 #if ENABLED(E0_IS_L6470)
L6470 stepperE0(E0_ENABLE_PIN); L6470 stepperE0(E0_ENABLE_PIN);
#endif #endif
#ifdef E1_IS_L6470 #if ENABLED(E1_IS_L6470)
L6470 stepperE1(E1_ENABLE_PIN); L6470 stepperE1(E1_ENABLE_PIN);
#endif #endif
#ifdef E2_IS_L6470 #if ENABLED(E2_IS_L6470)
L6470 stepperE2(E2_ENABLE_PIN); L6470 stepperE2(E2_ENABLE_PIN);
#endif #endif
#ifdef E3_IS_L6470 #if ENABLED(E3_IS_L6470)
L6470 stepperE3(E3_ENABLE_PIN); L6470 stepperE3(E3_ENABLE_PIN);
#endif #endif
// init routine // init routine
#ifdef HAVE_L6470DRIVER #if ENABLED(HAVE_L6470DRIVER)
void L6470_init() void L6470_init()
{ {
#ifdef X_IS_L6470 #if ENABLED(X_IS_L6470)
stepperX.init(X_K_VAL); stepperX.init(X_K_VAL);
stepperX.softFree(); stepperX.softFree();
stepperX.setMicroSteps(X_MICROSTEPS); stepperX.setMicroSteps(X_MICROSTEPS);
stepperX.setOverCurrent(X_OVERCURRENT); //set overcurrent protection stepperX.setOverCurrent(X_OVERCURRENT); //set overcurrent protection
stepperX.setStallCurrent(X_STALLCURRENT); stepperX.setStallCurrent(X_STALLCURRENT);
#endif #endif
#ifdef X2_IS_L6470 #if ENABLED(X2_IS_L6470)
stepperX2.init(X2_K_VAL); stepperX2.init(X2_K_VAL);
stepperX2.softFree(); stepperX2.softFree();
stepperX2.setMicroSteps(X2_MICROSTEPS); stepperX2.setMicroSteps(X2_MICROSTEPS);
stepperX2.setOverCurrent(X2_OVERCURRENT); //set overcurrent protection stepperX2.setOverCurrent(X2_OVERCURRENT); //set overcurrent protection
stepperX2.setStallCurrent(X2_STALLCURRENT); stepperX2.setStallCurrent(X2_STALLCURRENT);
#endif #endif
#ifdef Y_IS_L6470 #if ENABLED(Y_IS_L6470)
stepperY.init(Y_K_VAL); stepperY.init(Y_K_VAL);
stepperY.softFree(); stepperY.softFree();
stepperY.setMicroSteps(Y_MICROSTEPS); stepperY.setMicroSteps(Y_MICROSTEPS);
stepperY.setOverCurrent(Y_OVERCURRENT); //set overcurrent protection stepperY.setOverCurrent(Y_OVERCURRENT); //set overcurrent protection
stepperY.setStallCurrent(Y_STALLCURRENT); stepperY.setStallCurrent(Y_STALLCURRENT);
#endif #endif
#ifdef Y2_IS_L6470 #if ENABLED(Y2_IS_L6470)
stepperY2.init(Y2_K_VAL); stepperY2.init(Y2_K_VAL);
stepperY2.softFree(); stepperY2.softFree();
stepperY2.setMicroSteps(Y2_MICROSTEPS); stepperY2.setMicroSteps(Y2_MICROSTEPS);
stepperY2.setOverCurrent(Y2_OVERCURRENT); //set overcurrent protection stepperY2.setOverCurrent(Y2_OVERCURRENT); //set overcurrent protection
stepperY2.setStallCurrent(Y2_STALLCURRENT); stepperY2.setStallCurrent(Y2_STALLCURRENT);
#endif #endif
#ifdef Z_IS_L6470 #if ENABLED(Z_IS_L6470)
stepperZ.init(Z_K_VAL); stepperZ.init(Z_K_VAL);
stepperZ.softFree(); stepperZ.softFree();
stepperZ.setMicroSteps(Z_MICROSTEPS); stepperZ.setMicroSteps(Z_MICROSTEPS);
stepperZ.setOverCurrent(Z_OVERCURRENT); //set overcurrent protection stepperZ.setOverCurrent(Z_OVERCURRENT); //set overcurrent protection
stepperZ.setStallCurrent(Z_STALLCURRENT); stepperZ.setStallCurrent(Z_STALLCURRENT);
#endif #endif
#ifdef Z2_IS_L6470 #if ENABLED(Z2_IS_L6470)
stepperZ2.init(Z2_K_VAL); stepperZ2.init(Z2_K_VAL);
stepperZ2.softFree(); stepperZ2.softFree();
stepperZ2.setMicroSteps(Z2_MICROSTEPS); stepperZ2.setMicroSteps(Z2_MICROSTEPS);
stepperZ2.setOverCurrent(Z2_OVERCURRENT); //set overcurrent protection stepperZ2.setOverCurrent(Z2_OVERCURRENT); //set overcurrent protection
stepperZ2.setStallCurrent(Z2_STALLCURRENT); stepperZ2.setStallCurrent(Z2_STALLCURRENT);
#endif #endif
#ifdef E0_IS_L6470 #if ENABLED(E0_IS_L6470)
stepperE0.init(E0_K_VAL); stepperE0.init(E0_K_VAL);
stepperE0.softFree(); stepperE0.softFree();
stepperE0.setMicroSteps(E0_MICROSTEPS); stepperE0.setMicroSteps(E0_MICROSTEPS);
stepperE0.setOverCurrent(E0_OVERCURRENT); //set overcurrent protection stepperE0.setOverCurrent(E0_OVERCURRENT); //set overcurrent protection
stepperE0.setStallCurrent(E0_STALLCURRENT); stepperE0.setStallCurrent(E0_STALLCURRENT);
#endif #endif
#ifdef E1_IS_L6470 #if ENABLED(E1_IS_L6470)
stepperE1.init(E1_K_VAL); stepperE1.init(E1_K_VAL);
stepperE1.softFree(); stepperE1.softFree();
stepperE1.setMicroSteps(E1_MICROSTEPS); stepperE1.setMicroSteps(E1_MICROSTEPS);
stepperE1.setOverCurrent(E1_OVERCURRENT); //set overcurrent protection stepperE1.setOverCurrent(E1_OVERCURRENT); //set overcurrent protection
stepperE1.setStallCurrent(E1_STALLCURRENT); stepperE1.setStallCurrent(E1_STALLCURRENT);
#endif #endif
#ifdef E2_IS_L6470 #if ENABLED(E2_IS_L6470)
stepperE2.init(E2_K_VAL); stepperE2.init(E2_K_VAL);
stepperE2.softFree(); stepperE2.softFree();
stepperE2.setMicroSteps(E2_MICROSTEPS); stepperE2.setMicroSteps(E2_MICROSTEPS);
stepperE2.setOverCurrent(E2_OVERCURRENT); //set overcurrent protection stepperE2.setOverCurrent(E2_OVERCURRENT); //set overcurrent protection
stepperE2.setStallCurrent(E2_STALLCURRENT); stepperE2.setStallCurrent(E2_STALLCURRENT);
#endif #endif
#ifdef E3_IS_L6470 #if ENABLED(E3_IS_L6470)
stepperE3.init(E3_K_VAL); stepperE3.init(E3_K_VAL);
stepperE3.softFree(); stepperE3.softFree();
stepperE3.setMicroSteps(E3_MICROSTEPS); stepperE3.setMicroSteps(E3_MICROSTEPS);
stepperE3.setOverCurrent(E3_OVERCURRENT); //set overcurrent protection stepperE3.setOverCurrent(E3_OVERCURRENT); //set overcurrent protection
stepperE3.setStallCurrent(E3_STALLCURRENT); stepperE3.setStallCurrent(E3_STALLCURRENT);
#endif #endif
} }
#endif #endif
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#ifndef STEPPER_INDIRECTION_H #ifndef STEPPER_INDIRECTION_H
#define STEPPER_INDIRECTION_H #define STEPPER_INDIRECTION_H
#include "macros.h"
// X motor // X motor
#define X_STEP_INIT SET_OUTPUT(X_STEP_PIN) #define X_STEP_INIT SET_OUTPUT(X_STEP_PIN)
#define X_STEP_WRITE(STATE) WRITE(X_STEP_PIN,STATE) #define X_STEP_WRITE(STATE) WRITE(X_STEP_PIN,STATE)
...@@ -156,12 +158,12 @@ ...@@ -156,12 +158,12 @@
// Pin redefines for TMC drivers. // Pin redefines for TMC drivers.
// TMC26X drivers have step and dir on normal pins, but everything else via SPI // TMC26X drivers have step and dir on normal pins, but everything else via SPI
////////////////////////////////// //////////////////////////////////
#ifdef HAVE_TMCDRIVER #if ENABLED(HAVE_TMCDRIVER)
#include <SPI.h> #include <SPI.h>
#include <TMC26XStepper.h> #include <TMC26XStepper.h>
void tmc_init(); void tmc_init();
#ifdef X_IS_TMC #if ENABLED(X_IS_TMC)
extern TMC26XStepper stepperX; extern TMC26XStepper stepperX;
#undef X_ENABLE_INIT #undef X_ENABLE_INIT
#define X_ENABLE_INIT ((void)0) #define X_ENABLE_INIT ((void)0)
...@@ -173,7 +175,7 @@ ...@@ -173,7 +175,7 @@
#define X_ENABLE_READ stepperX.isEnabled() #define X_ENABLE_READ stepperX.isEnabled()
#endif #endif
#ifdef X2_IS_TMC #if ENABLED(X2_IS_TMC)
extern TMC26XStepper stepperX2; extern TMC26XStepper stepperX2;
#undef X2_ENABLE_INIT #undef X2_ENABLE_INIT
#define X2_ENABLE_INIT ((void)0) #define X2_ENABLE_INIT ((void)0)
...@@ -184,7 +186,7 @@ ...@@ -184,7 +186,7 @@
#undef X2_ENABLE_READ #undef X2_ENABLE_READ
#define X2_ENABLE_READ stepperX2.isEnabled() #define X2_ENABLE_READ stepperX2.isEnabled()
#endif #endif
#ifdef Y_IS_TMC #if ENABLED(Y_IS_TMC)
extern TMC26XStepper stepperY; extern TMC26XStepper stepperY;
#undef Y_ENABLE_INIT #undef Y_ENABLE_INIT
#define Y_ENABLE_INIT ((void)0) #define Y_ENABLE_INIT ((void)0)
...@@ -195,7 +197,7 @@ ...@@ -195,7 +197,7 @@
#undef Y_ENABLE_READ #undef Y_ENABLE_READ
#define Y_ENABLE_READ stepperY.isEnabled() #define Y_ENABLE_READ stepperY.isEnabled()
#endif #endif
#ifdef Y2_IS_TMC #if ENABLED(Y2_IS_TMC)
extern TMC26XStepper stepperY2; extern TMC26XStepper stepperY2;
#undef Y2_ENABLE_INIT #undef Y2_ENABLE_INIT
#define Y2_ENABLE_INIT ((void)0) #define Y2_ENABLE_INIT ((void)0)
...@@ -206,7 +208,7 @@ ...@@ -206,7 +208,7 @@
#undef Y2_ENABLE_READ #undef Y2_ENABLE_READ
#define Y2_ENABLE_READ stepperY2.isEnabled() #define Y2_ENABLE_READ stepperY2.isEnabled()
#endif #endif
#ifdef Z_IS_TMC #if ENABLED(Z_IS_TMC)
extern TMC26XStepper stepperZ; extern TMC26XStepper stepperZ;
#undef Z_ENABLE_INIT #undef Z_ENABLE_INIT
#define Z_ENABLE_INIT ((void)0) #define Z_ENABLE_INIT ((void)0)
...@@ -217,7 +219,7 @@ ...@@ -217,7 +219,7 @@
#undef Z_ENABLE_READ #undef Z_ENABLE_READ
#define Z_ENABLE_READ stepperZ.isEnabled() #define Z_ENABLE_READ stepperZ.isEnabled()
#endif #endif
#ifdef Z2_IS_TMC #if ENABLED(Z2_IS_TMC)
extern TMC26XStepper stepperZ2; extern TMC26XStepper stepperZ2;
#undef Z2_ENABLE_INIT #undef Z2_ENABLE_INIT
#define Z2_ENABLE_INIT ((void)0) #define Z2_ENABLE_INIT ((void)0)
...@@ -228,7 +230,7 @@ ...@@ -228,7 +230,7 @@
#undef Z2_ENABLE_READ #undef Z2_ENABLE_READ
#define Z2_ENABLE_READ stepperZ2.isEnabled() #define Z2_ENABLE_READ stepperZ2.isEnabled()
#endif #endif
#ifdef E0_IS_TMC #if ENABLED(E0_IS_TMC)
extern TMC26XStepper stepperE0; extern TMC26XStepper stepperE0;
#undef E0_ENABLE_INIT #undef E0_ENABLE_INIT
#define E0_ENABLE_INIT ((void)0) #define E0_ENABLE_INIT ((void)0)
...@@ -239,7 +241,7 @@ ...@@ -239,7 +241,7 @@
#undef E0_ENABLE_READ #undef E0_ENABLE_READ
#define E0_ENABLE_READ stepperE0.isEnabled() #define E0_ENABLE_READ stepperE0.isEnabled()
#endif #endif
#ifdef E1_IS_TMC #if ENABLED(E1_IS_TMC)
extern TMC26XStepper stepperE1; extern TMC26XStepper stepperE1;
#undef E1_ENABLE_INIT #undef E1_ENABLE_INIT
#define E1_ENABLE_INIT ((void)0) #define E1_ENABLE_INIT ((void)0)
...@@ -250,7 +252,7 @@ ...@@ -250,7 +252,7 @@
#undef E1_ENABLE_READ #undef E1_ENABLE_READ
#define E1_ENABLE_READ stepperE1.isEnabled() #define E1_ENABLE_READ stepperE1.isEnabled()
#endif #endif
#ifdef E2_IS_TMC #if ENABLED(E2_IS_TMC)
extern TMC26XStepper stepperE2; extern TMC26XStepper stepperE2;
#undef E2_ENABLE_INIT #undef E2_ENABLE_INIT
#define E2_ENABLE_INIT ((void)0) #define E2_ENABLE_INIT ((void)0)
...@@ -261,7 +263,7 @@ ...@@ -261,7 +263,7 @@
#undef E2_ENABLE_READ #undef E2_ENABLE_READ
#define E2_ENABLE_READ stepperE2.isEnabled() #define E2_ENABLE_READ stepperE2.isEnabled()
#endif #endif
#ifdef E3_IS_TMC #if ENABLED(E3_IS_TMC)
extern TMC26XStepper stepperE3; extern TMC26XStepper stepperE3;
#undef E3_ENABLE_INIT #undef E3_ENABLE_INIT
#define E3_ENABLE_INIT ((void)0) #define E3_ENABLE_INIT ((void)0)
...@@ -279,13 +281,13 @@ ...@@ -279,13 +281,13 @@
// Pin redefines for L6470 drivers. // Pin redefines for L6470 drivers.
// L640 drivers have step on normal pins, but dir and everything else via SPI // L640 drivers have step on normal pins, but dir and everything else via SPI
////////////////////////////////// //////////////////////////////////
#ifdef HAVE_L6470DRIVER #if ENABLED(HAVE_L6470DRIVER)
#include <SPI.h> #include <SPI.h>
#include <L6470.h> #include <L6470.h>
void L6470_init(); void L6470_init();
#ifdef X_IS_L6470 #if ENABLED(X_IS_L6470)
extern L6470 stepperX; extern L6470 stepperX;
#undef X_ENABLE_INIT #undef X_ENABLE_INIT
#define X_ENABLE_INIT ((void)0) #define X_ENABLE_INIT ((void)0)
...@@ -306,7 +308,7 @@ ...@@ -306,7 +308,7 @@
#define X_DIR_READ (stepperX.getStatus() & STATUS_DIR) #define X_DIR_READ (stepperX.getStatus() & STATUS_DIR)
#endif #endif
#ifdef X2_IS_L6470 #if ENABLED(X2_IS_L6470)
extern L6470 stepperX2; extern L6470 stepperX2;
#undef X2_ENABLE_INIT #undef X2_ENABLE_INIT
#define X2_ENABLE_INIT ((void)0) #define X2_ENABLE_INIT ((void)0)
...@@ -326,7 +328,7 @@ ...@@ -326,7 +328,7 @@
#undef X2_DIR_READ #undef X2_DIR_READ
#define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR) #define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR)
#endif #endif
#ifdef Y_IS_L6470 #if ENABLED(Y_IS_L6470)
extern L6470 stepperY; extern L6470 stepperY;
#undef Y_ENABLE_INIT #undef Y_ENABLE_INIT
#define Y_ENABLE_INIT ((void)0) #define Y_ENABLE_INIT ((void)0)
...@@ -346,7 +348,7 @@ ...@@ -346,7 +348,7 @@
#undef Y_DIR_READ #undef Y_DIR_READ
#define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR) #define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR)
#endif #endif
#ifdef Y2_IS_L6470 #if ENABLED(Y2_IS_L6470)
extern L6470 stepperY2; extern L6470 stepperY2;
#undef Y2_ENABLE_INIT #undef Y2_ENABLE_INIT
#define Y2_ENABLE_INIT ((void)0) #define Y2_ENABLE_INIT ((void)0)
...@@ -366,7 +368,7 @@ ...@@ -366,7 +368,7 @@
#undef Y2_DIR_READ #undef Y2_DIR_READ
#define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR) #define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR)
#endif #endif
#ifdef Z_IS_L6470 #if ENABLED(Z_IS_L6470)
extern L6470 stepperZ; extern L6470 stepperZ;
#undef Z_ENABLE_INIT #undef Z_ENABLE_INIT
#define Z_ENABLE_INIT ((void)0) #define Z_ENABLE_INIT ((void)0)
...@@ -386,7 +388,7 @@ ...@@ -386,7 +388,7 @@
#undef Y_DIR_READ #undef Y_DIR_READ
#define Y_DIR_READ (stepperZ.getStatus() & STATUS_DIR) #define Y_DIR_READ (stepperZ.getStatus() & STATUS_DIR)
#endif #endif
#ifdef Z2_IS_L6470 #if ENABLED(Z2_IS_L6470)
extern L6470 stepperZ2; extern L6470 stepperZ2;
#undef Z2_ENABLE_INIT #undef Z2_ENABLE_INIT
#define Z2_ENABLE_INIT ((void)0) #define Z2_ENABLE_INIT ((void)0)
...@@ -406,7 +408,7 @@ ...@@ -406,7 +408,7 @@
#undef Y2_DIR_READ #undef Y2_DIR_READ
#define Y2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR) #define Y2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR)
#endif #endif
#ifdef E0_IS_L6470 #if ENABLED(E0_IS_L6470)
extern L6470 stepperE0; extern L6470 stepperE0;
#undef E0_ENABLE_INIT #undef E0_ENABLE_INIT
#define E0_ENABLE_INIT ((void)0) #define E0_ENABLE_INIT ((void)0)
...@@ -426,7 +428,7 @@ ...@@ -426,7 +428,7 @@
#undef E0_DIR_READ #undef E0_DIR_READ
#define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR) #define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR)
#endif #endif
#ifdef E1_IS_L6470 #if ENABLED(E1_IS_L6470)
extern L6470 stepperE1; extern L6470 stepperE1;
#undef E1_ENABLE_INIT #undef E1_ENABLE_INIT
#define E1_ENABLE_INIT ((void)0) #define E1_ENABLE_INIT ((void)0)
...@@ -446,7 +448,7 @@ ...@@ -446,7 +448,7 @@
#undef E1_DIR_READ #undef E1_DIR_READ
#define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR) #define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR)
#endif #endif
#ifdef E2_IS_L6470 #if ENABLED(E2_IS_L6470)
extern L6470 stepperE2; extern L6470 stepperE2;
#undef E2_ENABLE_INIT #undef E2_ENABLE_INIT
#define E2_ENABLE_INIT ((void)0) #define E2_ENABLE_INIT ((void)0)
...@@ -466,7 +468,7 @@ ...@@ -466,7 +468,7 @@
#undef E2_DIR_READ #undef E2_DIR_READ
#define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR) #define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR)
#endif #endif
#ifdef E3_IS_L6470 #if ENABLED(E3_IS_L6470)
extern L6470 stepperE3; extern L6470 stepperE3;
#undef E3_ENABLE_INIT #undef E3_ENABLE_INIT
#define E3_ENABLE_INIT ((void)0) #define E3_ENABLE_INIT ((void)0)
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#define K2 (1.0 - K1) #define K2 (1.0 - K1)
#endif #endif
#if defined(PIDTEMPBED) || defined(PIDTEMP) #if ENABLED(PIDTEMPBED) || ENABLED(PIDTEMP)
#define PID_dT ((OVERSAMPLENR * 14.0)/(F_CPU / 64.0 / 256.0)) #define PID_dT ((OVERSAMPLENR * 14.0)/(F_CPU / 64.0 / 256.0))
#define RECI_PID_dT ( 1 / PID_dT ) #define RECI_PID_dT ( 1 / PID_dT )
#endif #endif
...@@ -49,39 +49,39 @@ int current_temperature_raw[4] = { 0 }; ...@@ -49,39 +49,39 @@ int current_temperature_raw[4] = { 0 };
float current_temperature[4] = { 0.0 }; float current_temperature[4] = { 0.0 };
int current_temperature_bed_raw = 0; int current_temperature_bed_raw = 0;
float current_temperature_bed = 0.0; float current_temperature_bed = 0.0;
#ifdef TEMP_SENSOR_1_AS_REDUNDANT #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
int redundant_temperature_raw = 0; int redundant_temperature_raw = 0;
float redundant_temperature = 0.0; float redundant_temperature = 0.0;
#endif #endif
#ifdef PIDTEMPBED #if ENABLED(PIDTEMPBED)
float bedKp = DEFAULT_bedKp; float bedKp = DEFAULT_bedKp;
float bedKi = (DEFAULT_bedKi * PID_dT); float bedKi = (DEFAULT_bedKi * PID_dT);
float bedKd = (DEFAULT_bedKd / PID_dT); float bedKd = (DEFAULT_bedKd / PID_dT);
#endif //PIDTEMPBED #endif //PIDTEMPBED
#ifdef FAN_SOFT_PWM #if ENABLED(FAN_SOFT_PWM)
unsigned char fanSpeedSoftPwm; unsigned char fanSpeedSoftPwm;
#endif #endif
unsigned char soft_pwm_bed; unsigned char soft_pwm_bed;
#ifdef BABYSTEPPING #if ENABLED(BABYSTEPPING)
volatile int babystepsTodo[3] = { 0 }; volatile int babystepsTodo[3] = { 0 };
#endif #endif
#if HAS_FILAMENT_SENSOR #if ENABLED(FILAMENT_SENSOR)
int current_raw_filwidth = 0; //Holds measured filament diameter - one extruder only int current_raw_filwidth = 0; //Holds measured filament diameter - one extruder only
#endif #endif
#if defined(THERMAL_PROTECTION_HOTENDS) || defined(THERMAL_PROTECTION_BED) #if ENABLED(THERMAL_PROTECTION_HOTENDS) || ENABLED(THERMAL_PROTECTION_BED)
enum TRState { TRReset, TRInactive, TRFirstHeating, TRStable, TRRunaway }; enum TRState { TRReset, TRInactive, TRFirstHeating, TRStable, TRRunaway };
void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc); void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
#ifdef THERMAL_PROTECTION_HOTENDS #if ENABLED(THERMAL_PROTECTION_HOTENDS)
static TRState thermal_runaway_state_machine[4] = { TRReset, TRReset, TRReset, TRReset }; static TRState thermal_runaway_state_machine[4] = { TRReset, TRReset, TRReset, TRReset };
static millis_t thermal_runaway_timer[4]; // = {0,0,0,0}; static millis_t thermal_runaway_timer[4]; // = {0,0,0,0};
#endif #endif
#ifdef THERMAL_PROTECTION_BED #if ENABLED(THERMAL_PROTECTION_BED)
static TRState thermal_runaway_bed_state_machine = TRReset; static TRState thermal_runaway_bed_state_machine = TRReset;
static millis_t thermal_runaway_bed_timer; static millis_t thermal_runaway_bed_timer;
#endif #endif
...@@ -97,7 +97,7 @@ unsigned char soft_pwm_bed; ...@@ -97,7 +97,7 @@ unsigned char soft_pwm_bed;
static volatile bool temp_meas_ready = false; static volatile bool temp_meas_ready = false;
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
//static cannot be external: //static cannot be external:
static float temp_iState[HOTENDS] = { 0 }; static float temp_iState[HOTENDS] = { 0 };
static float temp_dState[HOTENDS] = { 0 }; static float temp_dState[HOTENDS] = { 0 };
...@@ -110,7 +110,7 @@ static volatile bool temp_meas_ready = false; ...@@ -110,7 +110,7 @@ static volatile bool temp_meas_ready = false;
static float temp_iState_max[HOTENDS]; static float temp_iState_max[HOTENDS];
static bool pid_reset[HOTENDS]; static bool pid_reset[HOTENDS];
#endif //PIDTEMP #endif //PIDTEMP
#ifdef PIDTEMPBED #if ENABLED(PIDTEMPBED)
//static cannot be external: //static cannot be external:
static float temp_iState_bed = { 0 }; static float temp_iState_bed = { 0 };
static float temp_dState_bed = { 0 }; static float temp_dState_bed = { 0 };
...@@ -127,14 +127,14 @@ static volatile bool temp_meas_ready = false; ...@@ -127,14 +127,14 @@ static volatile bool temp_meas_ready = false;
static unsigned char soft_pwm[HOTENDS]; static unsigned char soft_pwm[HOTENDS];
#ifdef FAN_SOFT_PWM #if ENABLED(FAN_SOFT_PWM)
static unsigned char soft_pwm_fan; static unsigned char soft_pwm_fan;
#endif #endif
#if HAS_AUTO_FAN #if HAS_AUTO_FAN
static millis_t next_auto_fan_check_ms; static millis_t next_auto_fan_check_ms;
#endif #endif
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS]; float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS];
#endif //PIDTEMP #endif //PIDTEMP
...@@ -144,13 +144,13 @@ static int maxttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS( HEATER_0_RAW_HI_TEMP , HEAT ...@@ -144,13 +144,13 @@ static int maxttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS( HEATER_0_RAW_HI_TEMP , HEAT
static int minttemp[HOTENDS] = { 0 }; static int minttemp[HOTENDS] = { 0 };
static int maxttemp[HOTENDS] = ARRAY_BY_HOTENDS( 16383, 16383, 16383, 16383 ); static int maxttemp[HOTENDS] = ARRAY_BY_HOTENDS( 16383, 16383, 16383, 16383 );
#ifdef BED_MINTEMP #ifdef BED_MINTEMP
static int bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP; static int bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP;
#endif #endif
#ifdef BED_MAXTEMP #ifdef BED_MAXTEMP
static int bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP; static int bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP;
#endif #endif
#ifdef TEMP_SENSOR_1_AS_REDUNDANT #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
static void *heater_ttbl_map[2] = {(void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE }; static void *heater_ttbl_map[2] = {(void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE };
static uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN }; static uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
#else #else
...@@ -162,7 +162,7 @@ static float analog2temp(int raw, uint8_t e); ...@@ -162,7 +162,7 @@ static float analog2temp(int raw, uint8_t e);
static float analog2tempBed(int raw); static float analog2tempBed(int raw);
static void updateTemperaturesFromRawValues(); static void updateTemperaturesFromRawValues();
#ifdef THERMAL_PROTECTION_HOTENDS #if ENABLED(THERMAL_PROTECTION_HOTENDS)
int watch_target_temp[HOTENDS] = { 0 }; int watch_target_temp[HOTENDS] = { 0 };
millis_t watch_heater_next_ms[HOTENDS] = { 0 }; millis_t watch_heater_next_ms[HOTENDS] = { 0 };
#endif #endif
...@@ -175,7 +175,7 @@ static void updateTemperaturesFromRawValues(); ...@@ -175,7 +175,7 @@ static void updateTemperaturesFromRawValues();
static int meas_shift_index; //used to point to a delayed sample in buffer for filament width sensor static int meas_shift_index; //used to point to a delayed sample in buffer for filament width sensor
#endif #endif
#ifdef HEATER_0_USES_MAX6675 #if ENABLED(HEATER_0_USES_MAX6675)
static int read_max6675(); static int read_max6675();
#endif #endif
...@@ -352,12 +352,12 @@ void PID_autotune(float temp, int hotend, int ncycles) { ...@@ -352,12 +352,12 @@ void PID_autotune(float temp, int hotend, int ncycles) {
} }
void updatePID() { void updatePID() {
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
for (int e = 0; e < HOTENDS; e++) { for (int e = 0; e < HOTENDS; e++) {
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / PID_PARAM(Ki,e); temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / PID_PARAM(Ki,e);
} }
#endif #endif
#ifdef PIDTEMPBED #if ENABLED(PIDTEMPBED)
temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / bedKi; temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / bedKi;
#endif #endif
} }
...@@ -457,7 +457,7 @@ inline void _temp_error(int e, const char *serial_msg, const char *lcd_msg) { ...@@ -457,7 +457,7 @@ inline void _temp_error(int e, const char *serial_msg, const char *lcd_msg) {
lcd_setalertstatuspgm(lcd_msg); lcd_setalertstatuspgm(lcd_msg);
#endif #endif
} }
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE #if DISABLED(BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE)
if (!killed) { if (!killed) {
Running = false; Running = false;
killed = true; killed = true;
...@@ -477,8 +477,10 @@ void min_temp_error(uint8_t e) { ...@@ -477,8 +477,10 @@ void min_temp_error(uint8_t e) {
float get_pid_output(int e) { float get_pid_output(int e) {
float pid_output; float pid_output;
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
#ifndef PID_OPENLOOP #if ENABLED(PID_OPENLOOP)
pid_output = constrain(target_temperature[e], 0, PID_MAX);
#else
pid_error[e] = target_temperature[e] - current_temperature[e]; pid_error[e] = target_temperature[e] - current_temperature[e];
if (pid_error[e] > PID_FUNCTIONAL_RANGE) { if (pid_error[e] > PID_FUNCTIONAL_RANGE) {
pid_output = BANG_MAX; pid_output = BANG_MAX;
...@@ -510,11 +512,9 @@ float get_pid_output(int e) { ...@@ -510,11 +512,9 @@ float get_pid_output(int e) {
} }
} }
temp_dState[e] = current_temperature[e]; temp_dState[e] = current_temperature[e];
#else
pid_output = constrain(target_temperature[e], 0, PID_MAX);
#endif //PID_OPENLOOP #endif //PID_OPENLOOP
#ifdef PID_DEBUG #if ENABLED(PID_DEBUG)
ECHO_SMV(DB, MSG_PID_DEBUG, e); ECHO_SMV(DB, MSG_PID_DEBUG, e);
ECHO_MV(MSG_PID_DEBUG_INPUT, current_temperature[e]); ECHO_MV(MSG_PID_DEBUG_INPUT, current_temperature[e]);
ECHO_MV(MSG_PID_DEBUG_OUTPUT, pid_output); ECHO_MV(MSG_PID_DEBUG_OUTPUT, pid_output);
...@@ -530,10 +530,10 @@ float get_pid_output(int e) { ...@@ -530,10 +530,10 @@ float get_pid_output(int e) {
return pid_output; return pid_output;
} }
#ifdef PIDTEMPBED #if ENABLED(PIDTEMPBED)
float get_pid_output_bed() { float get_pid_output_bed() {
float pid_output; float pid_output;
#ifndef PID_OPENLOOP #if DISABLED(PID_OPENLOOP)
pid_error_bed = target_temperature_bed - current_temperature_bed; pid_error_bed = target_temperature_bed - current_temperature_bed;
pTerm_bed = bedKp * pid_error_bed; pTerm_bed = bedKp * pid_error_bed;
temp_iState_bed += pid_error_bed; temp_iState_bed += pid_error_bed;
...@@ -556,7 +556,7 @@ float get_pid_output(int e) { ...@@ -556,7 +556,7 @@ float get_pid_output(int e) {
pid_output = constrain(target_temperature_bed, 0, MAX_BED_POWER); pid_output = constrain(target_temperature_bed, 0, MAX_BED_POWER);
#endif // PID_OPENLOOP #endif // PID_OPENLOOP
#ifdef PID_BED_DEBUG #if ENABLED(PID_BED_DEBUG)
ECHO_SM(DB ," PID_BED_DEBUG "); ECHO_SM(DB ," PID_BED_DEBUG ");
ECHO_MV(": Input ", current_temperature_bed); ECHO_MV(": Input ", current_temperature_bed);
ECHO_MV(" Output ", pid_output); ECHO_MV(" Output ", pid_output);
...@@ -583,20 +583,20 @@ void manage_heater() { ...@@ -583,20 +583,20 @@ void manage_heater() {
updateTemperaturesFromRawValues(); updateTemperaturesFromRawValues();
#ifdef HEATER_0_USES_MAX6675 #if ENABLED(HEATER_0_USES_MAX6675)
float ct = current_temperature[0]; float ct = current_temperature[0];
if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0); if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0);
if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0); if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
#endif #endif
#if defined(THERMAL_PROTECTION_HOTENDS) || !defined(PIDTEMPBED) || HAS_AUTO_FAN #if ENABLED(THERMAL_PROTECTION_HOTENDS) || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN
millis_t ms = millis(); millis_t ms = millis();
#endif #endif
// Loop through all hotends // Loop through all hotends
for (int e = 0; e < HOTENDS; e++) { for (int e = 0; e < HOTENDS; e++) {
#ifdef THERMAL_PROTECTION_HOTENDS #if ENABLED(THERMAL_PROTECTION_HOTENDS)
thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS); thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS);
#endif #endif
...@@ -606,7 +606,7 @@ void manage_heater() { ...@@ -606,7 +606,7 @@ void manage_heater() {
soft_pwm[e] = current_temperature[e] > minttemp[e] && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0; soft_pwm[e] = current_temperature[e] > minttemp[e] && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0;
// Check if the temperature is failing to increase // Check if the temperature is failing to increase
#ifdef THERMAL_PROTECTION_HOTENDS #if ENABLED(THERMAL_PROTECTION_HOTENDS)
// Is it time to check this extruder's heater? // Is it time to check this extruder's heater?
if (watch_heater_next_ms[e] && ms > watch_heater_next_ms[e]) { if (watch_heater_next_ms[e] && ms > watch_heater_next_ms[e]) {
...@@ -623,7 +623,7 @@ void manage_heater() { ...@@ -623,7 +623,7 @@ void manage_heater() {
#endif // THERMAL_PROTECTION_HOTENDS #endif // THERMAL_PROTECTION_HOTENDS
#ifdef TEMP_SENSOR_1_AS_REDUNDANT #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) { if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
_temp_error(0, PSTR(MSG_EXTRUDER_SWITCHED_OFF), PSTR(MSG_ERR_REDUNDANT_TEMP)); _temp_error(0, PSTR(MSG_EXTRUDER_SWITCHED_OFF), PSTR(MSG_ERR_REDUNDANT_TEMP));
} }
...@@ -639,7 +639,7 @@ void manage_heater() { ...@@ -639,7 +639,7 @@ void manage_heater() {
#endif #endif
// Control the extruder rate based on the width sensor // Control the extruder rate based on the width sensor
#ifdef FILAMENT_SENSOR #if ENABLED(FILAMENT_SENSOR)
if (filament_sensor) { if (filament_sensor) {
meas_shift_index = delay_index1 - meas_delay_cm; meas_shift_index = delay_index1 - meas_delay_cm;
if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1; //loop around buffer if needed if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1; //loop around buffer if needed
...@@ -653,23 +653,23 @@ void manage_heater() { ...@@ -653,23 +653,23 @@ void manage_heater() {
} }
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
#ifndef PIDTEMPBED #if DISABLED(PIDTEMPBED)
if (ms < next_bed_check_ms) return; if (ms < next_bed_check_ms) return;
next_bed_check_ms = ms + BED_CHECK_INTERVAL; next_bed_check_ms = ms + BED_CHECK_INTERVAL;
#endif #endif
#if TEMP_SENSOR_BED != 0 #if TEMP_SENSOR_BED != 0
#ifdef THERMAL_PROTECTION_BED #if ENABLED(THERMAL_PROTECTION_BED)
thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, -1, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS); thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, -1, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS);
#endif #endif
#ifdef PIDTEMPBED #if ENABLED(PIDTEMPBED)
float pid_output = get_pid_output_bed(); float pid_output = get_pid_output_bed();
soft_pwm_bed = current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP ? (int)pid_output >> 1 : 0; soft_pwm_bed = current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP ? (int)pid_output >> 1 : 0;
#elif defined(BED_LIMIT_SWITCHING) #elif ENABLED(BED_LIMIT_SWITCHING)
// Check if temperature is within the correct band // Check if temperature is within the correct band
if (current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP) { if (current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP) {
if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS) if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS)
...@@ -698,7 +698,7 @@ void manage_heater() { ...@@ -698,7 +698,7 @@ void manage_heater() {
// Derived from RepRap FiveD extruder::getTemperature() // Derived from RepRap FiveD extruder::getTemperature()
// For hot end temperature measurement. // For hot end temperature measurement.
static float analog2temp(int raw, uint8_t e) { static float analog2temp(int raw, uint8_t e) {
#ifdef TEMP_SENSOR_1_AS_REDUNDANT #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
if (e > EXTRUDERS) if (e > EXTRUDERS)
#else #else
if (e >= EXTRUDERS) if (e >= EXTRUDERS)
...@@ -709,7 +709,7 @@ static float analog2temp(int raw, uint8_t e) { ...@@ -709,7 +709,7 @@ static float analog2temp(int raw, uint8_t e) {
return 0.0; return 0.0;
} }
#ifdef HEATER_0_USES_MAX6675 #if ENABLED(HEATER_0_USES_MAX6675)
if (e == 0) return 0.25 * raw; if (e == 0) return 0.25 * raw;
#endif #endif
...@@ -744,7 +744,7 @@ static float analog2temp(int raw, uint8_t e) { ...@@ -744,7 +744,7 @@ static float analog2temp(int raw, uint8_t e) {
// Derived from RepRap FiveD extruder::getTemperature() // Derived from RepRap FiveD extruder::getTemperature()
// For bed temperature measurement. // For bed temperature measurement.
static float analog2tempBed(int raw) { static float analog2tempBed(int raw) {
#ifdef BED_USES_THERMISTOR #if ENABLED(BED_USES_THERMISTOR)
float celsius = 0; float celsius = 0;
byte i; byte i;
...@@ -779,14 +779,14 @@ static void updateTemperaturesFromRawValues() { ...@@ -779,14 +779,14 @@ static void updateTemperaturesFromRawValues() {
static millis_t last_update = millis(); static millis_t last_update = millis();
millis_t temp_last_update = millis(); millis_t temp_last_update = millis();
millis_t from_last_update = temp_last_update - last_update; millis_t from_last_update = temp_last_update - last_update;
#ifdef HEATER_0_USES_MAX6675 #if ENABLED(HEATER_0_USES_MAX6675)
current_temperature_raw[0] = read_max6675(); current_temperature_raw[0] = read_max6675();
#endif #endif
for (uint8_t e = 0; e < HOTENDS; e++) { for (uint8_t e = 0; e < HOTENDS; e++) {
current_temperature[e] = analog2temp(current_temperature_raw[e], e); current_temperature[e] = analog2temp(current_temperature_raw[e], e);
} }
current_temperature_bed = analog2tempBed(current_temperature_bed_raw); current_temperature_bed = analog2tempBed(current_temperature_bed_raw);
#ifdef TEMP_SENSOR_1_AS_REDUNDANT #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
redundant_temperature = analog2temp(redundant_temperature_raw, 1); redundant_temperature = analog2temp(redundant_temperature_raw, 1);
#endif #endif
#if HAS_FILAMENT_SENSOR #if HAS_FILAMENT_SENSOR
...@@ -866,11 +866,11 @@ void tp_init() { ...@@ -866,11 +866,11 @@ void tp_init() {
for (int e = 0; e < HOTENDS; e++) { for (int e = 0; e < HOTENDS; e++) {
// populate with the first value // populate with the first value
maxttemp[e] = maxttemp[0]; maxttemp[e] = maxttemp[0];
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
temp_iState_min[e] = 0.0; temp_iState_min[e] = 0.0;
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / PID_PARAM(Ki,e); temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / PID_PARAM(Ki,e);
#endif //PIDTEMP #endif //PIDTEMP
#ifdef PIDTEMPBED #if ENABLED(PIDTEMPBED)
temp_iState_min_bed = 0.0; temp_iState_min_bed = 0.0;
temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / bedKi; temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / bedKi;
#endif // PIDTEMPBED #endif // PIDTEMPBED
...@@ -893,17 +893,17 @@ void tp_init() { ...@@ -893,17 +893,17 @@ void tp_init() {
#endif #endif
#if HAS_FAN #if HAS_FAN
SET_OUTPUT(FAN_PIN); SET_OUTPUT(FAN_PIN);
#ifdef FAST_PWM_FAN #if ENABLED(FAST_PWM_FAN)
setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
#endif #endif
#ifdef FAN_SOFT_PWM #if ENABLED(FAN_SOFT_PWM)
soft_pwm_fan = fanSpeedSoftPwm / 2; soft_pwm_fan = fanSpeedSoftPwm / 2;
#endif #endif
#endif #endif
#ifdef HEATER_0_USES_MAX6675 #if ENABLED(HEATER_0_USES_MAX6675)
#ifndef SDSUPPORT #if DISABLED(SDSUPPORT)
OUT_WRITE(SCK_PIN, LOW); OUT_WRITE(SCK_PIN, LOW);
OUT_WRITE(MOSI_PIN, HIGH); OUT_WRITE(MOSI_PIN, HIGH);
OUT_WRITE(MISO_PIN, HIGH); OUT_WRITE(MISO_PIN, HIGH);
...@@ -1036,24 +1036,23 @@ void tp_init() { ...@@ -1036,24 +1036,23 @@ void tp_init() {
#endif // BED_MAXTEMP #endif // BED_MAXTEMP
} }
#ifdef THERMAL_PROTECTION_HOTENDS #if ENABLED(THERMAL_PROTECTION_HOTENDS)
/** /**
* Start Heating Sanity Check for hotends that are below * Start Heating Sanity Check for hotends that are below
* their target temperature by a configurable margin. * their target temperature by a configurable margin.
* This is called when the temperature is set. (M104, M109) * This is called when the temperature is set. (M104, M109)
*/ */
void start_watching_heater(int e) { void start_watching_heater(int e) {
millis_t ms = millis() + WATCH_TEMP_PERIOD * 1000;
if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) { if (degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) {
watch_target_temp[e] = degHotend(e) + WATCH_TEMP_INCREASE; watch_target_temp[e] = degHotend(e) + WATCH_TEMP_INCREASE;
watch_heater_next_ms[e] = ms; watch_heater_next_ms[e] = millis() + WATCH_TEMP_PERIOD * 1000;
} }
else else
watch_heater_next_ms[e] = 0; watch_heater_next_ms[e] = 0;
} }
#endif #endif
#if defined(THERMAL_PROTECTION_HOTENDS) || defined(THERMAL_PROTECTION_BED) #if ENABLED(THERMAL_PROTECTION_HOTENDS) || ENABLED(THERMAL_PROTECTION_BED)
void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) { void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) {
...@@ -1141,7 +1140,7 @@ void disable_all_heaters() { ...@@ -1141,7 +1140,7 @@ void disable_all_heaters() {
#endif #endif
} }
#ifdef HEATER_0_USES_MAX6675 #if ENABLED(HEATER_0_USES_MAX6675)
#define MAX6675_HEAT_INTERVAL 250u #define MAX6675_HEAT_INTERVAL 250u
static millis_t next_max6675_ms = 0; static millis_t next_max6675_ms = 0;
int max6675_temp = 2000; int max6675_temp = 2000;
...@@ -1224,11 +1223,11 @@ static unsigned long raw_temp_value[4] = { 0 }; ...@@ -1224,11 +1223,11 @@ static unsigned long raw_temp_value[4] = { 0 };
static unsigned long raw_temp_bed_value = 0; static unsigned long raw_temp_bed_value = 0;
static void set_current_temp_raw() { static void set_current_temp_raw() {
#if HAS_TEMP_0 && !defined(HEATER_0_USES_MAX6675) #if HAS_TEMP_0 && DISABLED(HEATER_0_USES_MAX6675)
current_temperature_raw[0] = raw_temp_value[0]; current_temperature_raw[0] = raw_temp_value[0];
#endif #endif
#if HAS_TEMP_1 #if HAS_TEMP_1
#ifdef TEMP_SENSOR_1_AS_REDUNDANT #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
redundant_temperature_raw = raw_temp_value[1]; redundant_temperature_raw = raw_temp_value[1];
#else #else
current_temperature_raw[1] = raw_temp_value[1]; current_temperature_raw[1] = raw_temp_value[1];
...@@ -1266,7 +1265,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1266,7 +1265,7 @@ ISR(TIMER0_COMPB_vect) {
static unsigned char pwm_count = BIT(SOFT_PWM_SCALE); static unsigned char pwm_count = BIT(SOFT_PWM_SCALE);
// Static members for each heater // Static members for each heater
#ifdef SLOW_PWM_HEATERS #if ENABLED(SLOW_PWM_HEATERS)
static unsigned char slow_pwm_count = 0; static unsigned char slow_pwm_count = 0;
#define ISR_STATICS(n) \ #define ISR_STATICS(n) \
static unsigned char soft_pwm_ ## n; \ static unsigned char soft_pwm_ ## n; \
...@@ -1278,7 +1277,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1278,7 +1277,7 @@ ISR(TIMER0_COMPB_vect) {
// Statics per heater // Statics per heater
ISR_STATICS(0); ISR_STATICS(0);
#if (HOTENDS > 1) || defined(HEATERS_PARALLEL) #if (HOTENDS > 1) || ENABLED(HEATERS_PARALLEL)
ISR_STATICS(1); ISR_STATICS(1);
#if HOTENDS > 2 #if HOTENDS > 2
ISR_STATICS(2); ISR_STATICS(2);
...@@ -1295,7 +1294,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1295,7 +1294,7 @@ ISR(TIMER0_COMPB_vect) {
static unsigned long raw_filwidth_value = 0; static unsigned long raw_filwidth_value = 0;
#endif #endif
#ifndef SLOW_PWM_HEATERS #if DISABLED(SLOW_PWM_HEATERS)
/** /**
* standard PWM modulation * standard PWM modulation
*/ */
...@@ -1323,7 +1322,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1323,7 +1322,7 @@ ISR(TIMER0_COMPB_vect) {
soft_pwm_BED = soft_pwm_bed; soft_pwm_BED = soft_pwm_bed;
WRITE_HEATER_BED(soft_pwm_BED > 0 ? 1 : 0); WRITE_HEATER_BED(soft_pwm_BED > 0 ? 1 : 0);
#endif #endif
#ifdef FAN_SOFT_PWM #if ENABLED(FAN_SOFT_PWM)
soft_pwm_fan = fanSpeedSoftPwm / 2; soft_pwm_fan = fanSpeedSoftPwm / 2;
WRITE_FAN(soft_pwm_fan > 0 ? 1 : 0); WRITE_FAN(soft_pwm_fan > 0 ? 1 : 0);
#endif #endif
...@@ -1344,7 +1343,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1344,7 +1343,7 @@ ISR(TIMER0_COMPB_vect) {
if (soft_pwm_BED < pwm_count) WRITE_HEATER_BED(0); if (soft_pwm_BED < pwm_count) WRITE_HEATER_BED(0);
#endif #endif
#ifdef FAN_SOFT_PWM #if ENABLED(FAN_SOFT_PWM)
if (soft_pwm_fan < pwm_count) WRITE_FAN(0); if (soft_pwm_fan < pwm_count) WRITE_FAN(0);
#endif #endif
...@@ -1423,7 +1422,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1423,7 +1422,7 @@ ISR(TIMER0_COMPB_vect) {
PWM_OFF_ROUTINE(BED); // BED PWM_OFF_ROUTINE(BED); // BED
#endif #endif
#ifdef FAN_SOFT_PWM #if ENABLED(FAN_SOFT_PWM)
if (pwm_count == 0) { if (pwm_count == 0) {
soft_pwm_fan = fanSpeedSoftPwm / 2; soft_pwm_fan = fanSpeedSoftPwm / 2;
WRITE_FAN(soft_pwm_fan > 0 ? 1 : 0); WRITE_FAN(soft_pwm_fan > 0 ? 1 : 0);
...@@ -1596,7 +1595,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1596,7 +1595,7 @@ ISR(TIMER0_COMPB_vect) {
raw_powconsumption_value = 0; raw_powconsumption_value = 0;
#endif #endif
#if HAS_TEMP_0 && !defined(HEATER_0_USES_MAX6675) #if HAS_TEMP_0 && DISABLED(HEATER_0_USES_MAX6675)
#if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP #if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP
#define GE0 <= #define GE0 <=
#else #else
...@@ -1648,7 +1647,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1648,7 +1647,7 @@ ISR(TIMER0_COMPB_vect) {
} // temp_count >= OVERSAMPLENR } // temp_count >= OVERSAMPLENR
#ifdef BABYSTEPPING #if ENABLED(BABYSTEPPING)
for (uint8_t axis = X_AXIS; axis <= Z_AXIS; axis++) { for (uint8_t axis = X_AXIS; axis <= Z_AXIS; axis++) {
int curTodo = babystepsTodo[axis]; //get rid of volatile for performance int curTodo = babystepsTodo[axis]; //get rid of volatile for performance
...@@ -1664,7 +1663,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1664,7 +1663,7 @@ ISR(TIMER0_COMPB_vect) {
#endif //BABYSTEPPING #endif //BABYSTEPPING
} }
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
// Apply the scale factors to the PID values // Apply the scale factors to the PID values
float scalePID_i(float i) { return i * PID_dT; } float scalePID_i(float i) { return i * PID_dT; }
float unscalePID_i(float i) { return i / PID_dT; } float unscalePID_i(float i) { return i / PID_dT; }
......
...@@ -50,13 +50,13 @@ void manage_heater(); //it is critical that this is called periodically. ...@@ -50,13 +50,13 @@ void manage_heater(); //it is critical that this is called periodically.
// do not use these routines and variables outside of temperature.cpp // do not use these routines and variables outside of temperature.cpp
extern int target_temperature[4]; extern int target_temperature[4];
extern float current_temperature[4]; extern float current_temperature[4];
#ifdef SHOW_TEMP_ADC_VALUES #if ENABLED(SHOW_TEMP_ADC_VALUES)
extern int current_temperature_raw[4]; extern int current_temperature_raw[4];
extern int current_temperature_bed_raw; extern int current_temperature_bed_raw;
#endif #endif
extern int target_temperature_bed; extern int target_temperature_bed;
extern float current_temperature_bed; extern float current_temperature_bed;
#ifdef TEMP_SENSOR_1_AS_REDUNDANT #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
extern float redundant_temperature; extern float redundant_temperature;
#endif #endif
...@@ -64,7 +64,7 @@ extern float current_temperature_bed; ...@@ -64,7 +64,7 @@ extern float current_temperature_bed;
extern unsigned char soft_pwm_bed; extern unsigned char soft_pwm_bed;
#endif #endif
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
extern float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS]; extern float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS];
#define PID_PARAM(param, e) param[e] // use macro to point to array value #define PID_PARAM(param, e) param[e] // use macro to point to array value
float scalePID_i(float i); float scalePID_i(float i);
...@@ -72,11 +72,12 @@ extern float current_temperature_bed; ...@@ -72,11 +72,12 @@ extern float current_temperature_bed;
float unscalePID_i(float i); float unscalePID_i(float i);
float unscalePID_d(float d); float unscalePID_d(float d);
#endif #endif
#ifdef PIDTEMPBED
#if ENABLED(PIDTEMPBED)
extern float bedKp,bedKi,bedKd; extern float bedKp,bedKi,bedKd;
#endif #endif
#ifdef BABYSTEPPING #if ENABLED(BABYSTEPPING)
extern volatile int babystepsTodo[3]; extern volatile int babystepsTodo[3];
#endif #endif
...@@ -92,25 +93,30 @@ extern float current_temperature_bed; ...@@ -92,25 +93,30 @@ extern float current_temperature_bed;
FORCE_INLINE float degHotend(uint8_t hotend) { return current_temperature[HOTEND_ARG]; } FORCE_INLINE float degHotend(uint8_t hotend) { return current_temperature[HOTEND_ARG]; }
FORCE_INLINE float degBed() { return current_temperature_bed; } FORCE_INLINE float degBed() { return current_temperature_bed; }
#ifdef SHOW_TEMP_ADC_VALUES #if ENABLED(SHOW_TEMP_ADC_VALUES)
FORCE_INLINE float rawHotendTemp(uint8_t hotend) { return current_temperature_raw[HOTEND_ARG]; } FORCE_INLINE float rawHotendTemp(uint8_t hotend) { return current_temperature_raw[HOTEND_ARG]; }
FORCE_INLINE float rawBedTemp() { return current_temperature_bed_raw; } FORCE_INLINE float rawBedTemp() { return current_temperature_bed_raw; }
#endif #endif
FORCE_INLINE float degTargetHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG]; } FORCE_INLINE float degTargetHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG]; }
FORCE_INLINE float degTargetBed() { return target_temperature_bed; } FORCE_INLINE float degTargetBed() { return target_temperature_bed; }
FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t hotend) { target_temperature[HOTEND_ARG] = celsius; } #if ENABLED(THERMAL_PROTECTION_HOTENDS)
void start_watching_heater(int e=0);
#endif
FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t hotend) {
target_temperature[HOTEND_ARG] = celsius;
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
start_watching_heater(HOTEND_ARG);
#endif
}
FORCE_INLINE void setTargetBed(const float &celsius) { target_temperature_bed = celsius; } FORCE_INLINE void setTargetBed(const float &celsius) { target_temperature_bed = celsius; }
FORCE_INLINE bool isHeatingHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG] > current_temperature[HOTEND_ARG]; } FORCE_INLINE bool isHeatingHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG] > current_temperature[HOTEND_ARG]; }
FORCE_INLINE bool isHeatingBed() { return target_temperature_bed > current_temperature_bed; } FORCE_INLINE bool isHeatingBed() { return target_temperature_bed > current_temperature_bed; }
FORCE_INLINE bool isCoolingHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG] < current_temperature[HOTEND_ARG]; } FORCE_INLINE bool isCoolingHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG] < current_temperature[HOTEND_ARG]; }
FORCE_INLINE bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; } FORCE_INLINE bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; }
#define HOTEND_ROUTINES(NR) \ #define HOTEND_ROUTINES(NR) \
...@@ -138,7 +144,6 @@ HOTEND_ROUTINES(0); ...@@ -138,7 +144,6 @@ HOTEND_ROUTINES(0);
int getHeaterPower(int heater); int getHeaterPower(int heater);
void disable_all_heaters(); void disable_all_heaters();
void setWatch();
void updatePID(); void updatePID();
void PID_autotune(float temp, int extruder, int ncycles); void PID_autotune(float temp, int extruder, int ncycles);
...@@ -146,12 +151,8 @@ void PID_autotune(float temp, int extruder, int ncycles); ...@@ -146,12 +151,8 @@ void PID_autotune(float temp, int extruder, int ncycles);
void setExtruderAutoFanState(int pin, bool state); void setExtruderAutoFanState(int pin, bool state);
void checkExtruderAutoFans(); void checkExtruderAutoFans();
#ifdef WATCH_TEMP_PERIOD
void start_watching_heater(int e=0);
#endif
FORCE_INLINE void autotempShutdown() { FORCE_INLINE void autotempShutdown() {
#ifdef AUTOTEMP #if ENABLED(AUTOTEMP)
if (autotemp_enabled) { if (autotemp_enabled) {
autotemp_enabled = false; autotemp_enabled = false;
if (degTargetHotend(active_extruder) > autotemp_min) if (degTargetHotend(active_extruder) > autotemp_min)
......
...@@ -84,7 +84,7 @@ static void lcd_status_screen(); ...@@ -84,7 +84,7 @@ static void lcd_status_screen();
#endif #endif
static void lcd_sdcard_menu(); static void lcd_sdcard_menu();
#ifdef DELTA #if ENABLED(DELTA)
static void lcd_delta_calibrate_menu(); static void lcd_delta_calibrate_menu();
#endif // DELTA #endif // DELTA
...@@ -116,7 +116,7 @@ static void lcd_status_screen(); ...@@ -116,7 +116,7 @@ static void lcd_status_screen();
#define ENCODER_FEEDRATE_DEADZONE 10 #define ENCODER_FEEDRATE_DEADZONE 10
#if !defined(LCD_I2C_VIKI) #if DISABLED(LCD_I2C_VIKI)
#ifndef ENCODER_STEPS_PER_MENU_ITEM #ifndef ENCODER_STEPS_PER_MENU_ITEM
#define ENCODER_STEPS_PER_MENU_ITEM 5 #define ENCODER_STEPS_PER_MENU_ITEM 5
#endif #endif
...@@ -138,7 +138,7 @@ static void lcd_status_screen(); ...@@ -138,7 +138,7 @@ static void lcd_status_screen();
/** /**
* START_MENU generates the init code for a menu function * START_MENU generates the init code for a menu function
*/ */
#if defined(BTN_BACK) && BTN_BACK > 0 #if ENABLED(BTN_BACK) && BTN_BACK > 0
#define START_MENU(last_menu) do { \ #define START_MENU(last_menu) do { \
encoderRateMultiplierEnabled = false; \ encoderRateMultiplierEnabled = false; \
if (encoderPosition > 0x8000) encoderPosition = 0; \ if (encoderPosition > 0x8000) encoderPosition = 0; \
...@@ -352,7 +352,7 @@ static void lcd_status_screen() { ...@@ -352,7 +352,7 @@ static void lcd_status_screen() {
} }
#endif #endif
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
bool current_click = LCD_CLICKED; bool current_click = LCD_CLICKED;
...@@ -414,18 +414,20 @@ static void lcd_status_screen() { ...@@ -414,18 +414,20 @@ static void lcd_status_screen() {
static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen); } static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen); }
static void lcd_sdcard_pause() { card.pauseSDPrint(); } #if ENABLED(SDSUPPORT)
static void lcd_sdcard_pause() { card.pauseSDPrint(); }
static void lcd_sdcard_resume() { card.startFileprint(); } static void lcd_sdcard_resume() { card.startFileprint(); }
static void lcd_sdcard_stop() { static void lcd_sdcard_stop() {
quickStop(); quickStop();
card.sdprinting = false; card.sdprinting = false;
card.closeFile(); card.closeFile();
autotempShutdown(); autotempShutdown();
cancel_heatup = true; cancel_heatup = true;
lcd_setstatus(MSG_PRINT_ABORTED, true); lcd_setstatus(MSG_PRINT_ABORTED, true);
} }
#endif
/** /**
* *
...@@ -441,7 +443,7 @@ static void lcd_main_menu() { ...@@ -441,7 +443,7 @@ static void lcd_main_menu() {
} }
else { else {
MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu); MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu);
#ifdef DELTA #if ENABLED(DELTA)
MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu); MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu);
#endif // DELTA #endif // DELTA
} }
...@@ -474,7 +476,7 @@ static void lcd_main_menu() { ...@@ -474,7 +476,7 @@ static void lcd_main_menu() {
END_MENU(); END_MENU();
} }
#if defined(SDSUPPORT) && defined(MENU_ADDAUTOSTART) #if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
static void lcd_autostart_sd() { static void lcd_autostart_sd() {
card.autostart_index = 0; card.autostart_index = 0;
card.setroot(); card.setroot();
...@@ -559,7 +561,7 @@ static void lcd_tune_menu() { ...@@ -559,7 +561,7 @@ static void lcd_tune_menu() {
END_MENU(); END_MENU();
} }
#if defined(EASY_LOAD) #if ENABLED(EASY_LOAD)
static void lcd_extrude(float length, float feedrate) { static void lcd_extrude(float length, float feedrate) {
current_position[E_AXIS] += length; current_position[E_AXIS] += length;
#ifdef DELTA #ifdef DELTA
...@@ -585,12 +587,11 @@ static void lcd_tune_menu() { ...@@ -585,12 +587,11 @@ static void lcd_tune_menu() {
void _lcd_preheat(int endnum, const float temph, const float tempb, const int fan) { void _lcd_preheat(int endnum, const float temph, const float tempb, const int fan) {
if (temph > 0) setTargetHotend(temph, endnum); if (temph > 0) setTargetHotend(temph, endnum);
setTargetBed(tempb); #if TEMP_SENSOR_BED != 0
setTargetBed(tempb);
#endif
fanSpeed = fan; fanSpeed = fan;
lcd_return_to_status(); lcd_return_to_status();
#ifdef WATCH_TEMP_PERIOD
if (endnum >= 0) start_watching_heater(endnum);
#endif
} }
void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
...@@ -811,10 +812,10 @@ static void lcd_prepare_menu() { ...@@ -811,10 +812,10 @@ static void lcd_prepare_menu() {
// //
// Level Bed // Level Bed
// //
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS])
MENU_ITEM(gcode, MSG_LEVEL_BED, PSTR("G29")); MENU_ITEM(gcode, MSG_LEVEL_BED, PSTR("G29"));
#elif !defined(DELTA) && !defined(Z_SAFE_HOMING) && !defined(DOGLCD) #elif DISABLED(DELTA) && DISABLED(Z_SAFE_HOMING)
MENU_ITEM(function, MSG_BED_SETTING, config_lcd_level_bed); MENU_ITEM(function, MSG_BED_SETTING, config_lcd_level_bed);
#endif #endif
...@@ -825,7 +826,7 @@ static void lcd_prepare_menu() { ...@@ -825,7 +826,7 @@ static void lcd_prepare_menu() {
//MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0")); //MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
//Add Preset menu for LASER setting '14. 7. 22 //Add Preset menu for LASER setting '14. 7. 22
#ifdef LASERBEAM #if ENABLED(LASERBEAM)
MENU_ITEM_EDIT(int3, MSG_LASER, &laser_ttl_modulation, 0, 255); MENU_ITEM_EDIT(int3, MSG_LASER, &laser_ttl_modulation, 0, 255);
if(laser_ttl_modulation == 0) { if(laser_ttl_modulation == 0) {
WRITE(LASER_PWR_PIN, LOW); WRITE(LASER_PWR_PIN, LOW);
...@@ -870,7 +871,7 @@ static void lcd_prepare_menu() { ...@@ -870,7 +871,7 @@ static void lcd_prepare_menu() {
// //
// Easy Load // Easy Load
// //
#if defined(EASY_LOAD) #if ENABLED(EASY_LOAD)
MENU_ITEM(function, MSG_E_BOWDEN_LENGTH, lcd_easy_load); MENU_ITEM(function, MSG_E_BOWDEN_LENGTH, lcd_easy_load);
MENU_ITEM(function, MSG_R_BOWDEN_LENGTH, lcd_easy_unload); MENU_ITEM(function, MSG_R_BOWDEN_LENGTH, lcd_easy_unload);
MENU_ITEM(function, MSG_PURGE_XMM, lcd_purge); MENU_ITEM(function, MSG_PURGE_XMM, lcd_purge);
...@@ -890,14 +891,14 @@ static void lcd_prepare_menu() { ...@@ -890,14 +891,14 @@ static void lcd_prepare_menu() {
// //
// Autostart // Autostart
// //
#if defined(SDSUPPORT) && defined(MENU_ADDAUTOSTART) #if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd); MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd);
#endif #endif
END_MENU(); END_MENU();
} }
#ifdef DELTA #if ENABLED(DELTA)
static void lcd_delta_calibrate_menu() { static void lcd_delta_calibrate_menu() {
START_MENU(lcd_main_menu); START_MENU(lcd_main_menu);
...@@ -1113,14 +1114,14 @@ static void lcd_control_temperature_menu() { ...@@ -1113,14 +1114,14 @@ static void lcd_control_temperature_menu() {
// Fan Speed // Fan Speed
// //
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255); MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
#ifdef IDLE_OOZING_PREVENT #if ENABLED(IDLE_OOZING_PREVENT)
MENU_ITEM_EDIT(bool, MSG_IDLEOOZING, &idleoozing_enabled); MENU_ITEM_EDIT(bool, MSG_IDLEOOZING, &idleoozing_enabled);
#endif #endif
// //
// Autotemp, Min, Max, Fact // Autotemp, Min, Max, Fact
// //
#if defined(AUTOTEMP) && (TEMP_SENSOR_0 != 0) #if ENABLED(AUTOTEMP) && (TEMP_SENSOR_0 != 0)
MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled); MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled);
MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP + LCD_MAX_TEMP_OFFSET); MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP + LCD_MAX_TEMP_OFFSET);
MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP + LCD_MAX_TEMP_OFFSET); MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP + LCD_MAX_TEMP_OFFSET);
...@@ -1130,7 +1131,7 @@ static void lcd_control_temperature_menu() { ...@@ -1130,7 +1131,7 @@ static void lcd_control_temperature_menu() {
// //
// PID-P, PID-I, PID-D // PID-P, PID-I, PID-D
// //
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
// set up temp variables - undo the default scaling // set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(PID_PARAM(Ki,0)); raw_Ki = unscalePID_i(PID_PARAM(Ki,0));
raw_Kd = unscalePID_d(PID_PARAM(Kd,0)); raw_Kd = unscalePID_d(PID_PARAM(Kd,0));
...@@ -1287,10 +1288,10 @@ static void lcd_control_motion_menu() { ...@@ -1287,10 +1288,10 @@ static void lcd_control_motion_menu() {
#if EXTRUDERS > 3 #if EXTRUDERS > 3
MENU_ITEM_EDIT(float51, MSG_E3STEPS, &axis_steps_per_unit[E_AXIS+3], 5, 9999); MENU_ITEM_EDIT(float51, MSG_E3STEPS, &axis_steps_per_unit[E_AXIS+3], 5, 9999);
#endif #endif
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &abort_on_endstop_hit); MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &abort_on_endstop_hit);
#endif #endif
#ifdef SCARA #if ENABLED(SCARA)
MENU_ITEM_EDIT(float52, MSG_XSCALE, &axis_scaling[X_AXIS],0.5,2); MENU_ITEM_EDIT(float52, MSG_XSCALE, &axis_scaling[X_AXIS],0.5,2);
MENU_ITEM_EDIT(float52, MSG_YSCALE, &axis_scaling[Y_AXIS],0.5,2); MENU_ITEM_EDIT(float52, MSG_YSCALE, &axis_scaling[Y_AXIS],0.5,2);
#endif #endif
...@@ -1329,16 +1330,27 @@ static void lcd_control_volumetric_menu() { ...@@ -1329,16 +1330,27 @@ static void lcd_control_volumetric_menu() {
* "Control" > "Contrast" submenu * "Control" > "Contrast" submenu
* *
*/ */
#ifdef HAS_LCD_CONTRAST #if HAS_LCD_CONTRAST
static void lcd_set_contrast() { static void lcd_set_contrast() {
if (encoderPosition != 0) { if (encoderPosition != 0) {
lcd_contrast -= encoderPosition; #ifdef U8GLIB_LM6059_AF
lcd_contrast &= 0x3F; lcd_contrast += encoderPosition;
lcd_contrast &= 0xFF;
#else
lcd_contrast -= encoderPosition;
lcd_contrast &= 0x3F;
#endif
encoderPosition = 0; encoderPosition = 0;
lcdDrawUpdate = 1; lcdDrawUpdate = 1;
u8g.setContrast(lcd_contrast); u8g.setContrast(lcd_contrast);
} }
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast)); if (lcdDrawUpdate) {
#ifdef U8GLIB_LM6059_AF
lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr3(lcd_contrast));
#else
lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast));
#endif
}
if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu); if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu);
} }
#endif // HAS_LCD_CONTRAST #endif // HAS_LCD_CONTRAST
...@@ -1368,57 +1380,59 @@ static void lcd_control_volumetric_menu() { ...@@ -1368,57 +1380,59 @@ static void lcd_control_volumetric_menu() {
} }
#endif // FWRETRACT #endif // FWRETRACT
#if SDCARDDETECT == -1 #if ENABLED(SDSUPPORT)
static void lcd_sd_refresh() { #if SDCARDDETECT == -1
card.initsd(); static void lcd_sd_refresh() {
currentMenuViewOffset = 0; card.initsd();
} currentMenuViewOffset = 0;
#endif }
#endif
static void lcd_sd_updir() {
card.updir();
currentMenuViewOffset = 0;
}
/** static void lcd_sd_updir() {
* card.updir();
* "Print from SD" submenu currentMenuViewOffset = 0;
*
*/
void lcd_sdcard_menu() {
if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) return; // nothing to do (so don't thrash the SD card)
uint16_t fileCnt = card.getnrfilenames();
START_MENU(lcd_main_menu);
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
card.getWorkDirName();
if (card.filename[0] == '/') {
#if SDCARDDETECT == -1
MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh);
#endif
}
else {
MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
} }
for (uint16_t i = 0; i < fileCnt; i++) { /**
if (_menuItemNr == _lineNr) { *
card.getfilename( * "Print from SD" submenu
#ifdef SDCARD_RATHERRECENTFIRST *
fileCnt-1 - */
#endif void lcd_sdcard_menu() {
i if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) return; // nothing to do (so don't thrash the SD card)
); uint16_t fileCnt = card.getnrfilenames();
if (card.filenameIsDir) START_MENU(lcd_main_menu);
MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename); MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
else card.getWorkDirName();
MENU_ITEM(sdfile, MSG_CARD_MENU, card.filename, card.longFilename); if (card.filename[0] == '/') {
#if SDCARDDETECT == -1
MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh);
#endif
} }
else { else {
MENU_ITEM_DUMMY(); MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
}
for (uint16_t i = 0; i < fileCnt; i++) {
if (_menuItemNr == _lineNr) {
card.getfilename(
#ifdef SDCARD_RATHERRECENTFIRST
fileCnt-1 -
#endif
i
);
if (card.filenameIsDir)
MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename);
else
MENU_ITEM(sdfile, MSG_CARD_MENU, card.filename, card.longFilename);
}
else {
MENU_ITEM_DUMMY();
}
} }
END_MENU();
} }
END_MENU(); #endif // SDSUPPORT
}
/** /**
* *
...@@ -1555,19 +1569,23 @@ static void menu_action_back(menuFunc_t func) { lcd_goto_menu(func); } ...@@ -1555,19 +1569,23 @@ static void menu_action_back(menuFunc_t func) { lcd_goto_menu(func); }
static void menu_action_submenu(menuFunc_t func) { lcd_goto_menu(func); } static void menu_action_submenu(menuFunc_t func) { lcd_goto_menu(func); }
static void menu_action_gcode(const char* pgcode) { enqueuecommands_P(pgcode); } static void menu_action_gcode(const char* pgcode) { enqueuecommands_P(pgcode); }
static void menu_action_function(menuFunc_t func) { (*func)(); } static void menu_action_function(menuFunc_t func) { (*func)(); }
static void menu_action_sdfile(const char* filename, char* longFilename) {
char cmd[30]; #if ENABLED(SDSUPPORT)
char* c; static void menu_action_sdfile(const char* filename, char* longFilename) {
sprintf_P(cmd, PSTR("M23 %s"), filename); char cmd[30];
for(c = &cmd[4]; *c; c++) *c = tolower(*c); char* c;
enqueuecommand(cmd); sprintf_P(cmd, PSTR("M23 %s"), filename);
enqueuecommands_P(PSTR("M24")); for(c = &cmd[4]; *c; c++) *c = tolower(*c);
lcd_return_to_status(); enqueuecommand(cmd);
} enqueuecommands_P(PSTR("M24"));
static void menu_action_sddirectory(const char* filename, char* longFilename) { lcd_return_to_status();
card.chdir(filename); }
encoderPosition = 0; static void menu_action_sddirectory(const char* filename, char* longFilename) {
} card.chdir(filename);
encoderPosition = 0;
}
#endif // SDSUPPORT
static void menu_action_setting_edit_bool(const char* pstr, bool* ptr) { *ptr = !(*ptr); } static void menu_action_setting_edit_bool(const char* pstr, bool* ptr) { *ptr = !(*ptr); }
static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callback) { static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callback) {
menu_action_setting_edit_bool(pstr, ptr); menu_action_setting_edit_bool(pstr, ptr);
...@@ -1612,7 +1630,7 @@ void lcd_init() { ...@@ -1612,7 +1630,7 @@ void lcd_init() {
#endif // SR_LCD_2W_NL #endif // SR_LCD_2W_NL
#endif//!NEWPANEL #endif//!NEWPANEL
#if defined(SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0) #if ENABLED(SDSUPPORT) && ENABLED(SDCARDDETECT) && (SDCARDDETECT > 0)
pinMode(SDCARDDETECT, INPUT); pinMode(SDCARDDETECT, INPUT);
WRITE(SDCARDDETECT, HIGH); WRITE(SDCARDDETECT, HIGH);
lcd_oldcardstatus = IS_SD_INSERTED; lcd_oldcardstatus = IS_SD_INSERTED;
...@@ -1725,7 +1743,7 @@ void lcd_update() { ...@@ -1725,7 +1743,7 @@ void lcd_update() {
if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100; if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100;
else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10; else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10;
#ifdef ENCODER_RATE_MULTIPLIER_DEBUG #if ENABLED(ENCODER_RATE_MULTIPLIER_DEBUG)
ECHO_SMV(DB, "Enc Step Rate: ", encoderStepRate); ECHO_SMV(DB, "Enc Step Rate: ", encoderStepRate);
ECHO_MV(" Multiplier: ", encoderMultiplier); ECHO_MV(" Multiplier: ", encoderMultiplier);
ECHO_MV(" ENCODER_10X_STEPS_PER_SEC: ", ENCODER_10X_STEPS_PER_SEC); ECHO_MV(" ENCODER_10X_STEPS_PER_SEC: ", ENCODER_10X_STEPS_PER_SEC);
...@@ -1807,7 +1825,7 @@ void lcd_finishstatus(bool persist=false) { ...@@ -1807,7 +1825,7 @@ void lcd_finishstatus(bool persist=false) {
#endif #endif
} }
#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
void dontExpireStatus() { expire_status_ms = 0; } void dontExpireStatus() { expire_status_ms = 0; }
#endif #endif
...@@ -1876,7 +1894,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } ...@@ -1876,7 +1894,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
void lcd_buttons_update() { void lcd_buttons_update() {
#ifdef NEWPANEL #ifdef NEWPANEL
uint8_t newbutton = 0; uint8_t newbutton = 0;
#ifdef INVERT_ROTARY_SWITCH #if ENABLED(INVERT_ROTARY_SWITCH)
if (READ(BTN_EN1) == 0) newbutton |= EN_B; if (READ(BTN_EN1) == 0) newbutton |= EN_B;
if (READ(BTN_EN2) == 0) newbutton |= EN_A; if (READ(BTN_EN2) == 0) newbutton |= EN_A;
#else #else
...@@ -1949,7 +1967,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } ...@@ -1949,7 +1967,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
} }
bool lcd_detected(void) { bool lcd_detected(void) {
#if (defined(LCD_I2C_TYPE_MCP23017) || defined(LCD_I2C_TYPE_MCP23008)) && defined(DETECT_DEVICE) #if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE)
return lcd.LcdDetected() == 1; return lcd.LcdDetected() == 1;
#else #else
return true; return true;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "Marlin.h" #include "Marlin.h"
#ifdef ULTRA_LCD #if ENABLED(ULTRA_LCD)
int lcd_strlen(char *s); int lcd_strlen(char *s);
int lcd_strlen_P(const char *s); int lcd_strlen_P(const char *s);
void lcd_update(); void lcd_update();
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
void lcd_reset_alert_level(); void lcd_reset_alert_level();
bool lcd_detected(void); bool lcd_detected(void);
#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
void dontExpireStatus(); void dontExpireStatus();
#endif #endif
#if defined(DOGLCD) && LCD_CONTRAST >= 0 #if ENABLED(DOGLCD) && LCD_CONTRAST >= 0
extern int lcd_contrast; extern int lcd_contrast;
void lcd_setcontrast(uint8_t value); void lcd_setcontrast(uint8_t value);
#endif #endif
...@@ -33,10 +33,10 @@ ...@@ -33,10 +33,10 @@
#define LCD_UPDATE_INTERVAL 100 #define LCD_UPDATE_INTERVAL 100
#define LCD_TIMEOUT_TO_STATUS 15000 #define LCD_TIMEOUT_TO_STATUS 15000
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
void lcd_buttons_update(); void lcd_buttons_update();
extern volatile uint8_t buttons; //the last checked buttons in a bit array. extern volatile uint8_t buttons; //the last checked buttons in a bit array.
#ifdef REPRAPWORLD_KEYPAD #if ENABLED(REPRAPWORLD_KEYPAD)
extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
#endif #endif
#else #else
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
extern bool cancel_heatup; extern bool cancel_heatup;
#if (HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)) || (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY)) #if (HAS_FILAMENT_SENSOR && ENABLED(FILAMENT_LCD_DISPLAY)) || (HAS_POWER_CONSUMPTION_SENSOR && ENABLED(POWER_CONSUMPTION_LCD_DISPLAY))
extern millis_t previous_lcd_status_ms; extern millis_t previous_lcd_status_ms;
#endif #endif
...@@ -65,17 +65,17 @@ ...@@ -65,17 +65,17 @@
void lcd_ignore_click(bool b=true); void lcd_ignore_click(bool b=true);
#ifdef NEWPANEL #if ENABLED(NEWPANEL)
#define EN_C BIT(BLEN_C) #define EN_C BIT(BLEN_C)
#define EN_B BIT(BLEN_B) #define EN_B BIT(BLEN_B)
#define EN_A BIT(BLEN_A) #define EN_A BIT(BLEN_A)
#define LCD_CLICKED (buttons&EN_C) #define LCD_CLICKED (buttons&EN_C)
#if defined(BTN_BACK) && BTN_BACK > 0 #if ENABLED(BTN_BACK) && BTN_BACK > 0
#define EN_D BIT(BLEN_D) #define EN_D BIT(BLEN_D)
#define LCD_BACK_CLICKED (buttons&EN_D) #define LCD_BACK_CLICKED (buttons&EN_D)
#endif #endif
#ifdef REPRAPWORLD_KEYPAD #if ENABLED(REPRAPWORLD_KEYPAD)
#define EN_REPRAPWORLD_KEYPAD_F3 (BIT(BLEN_REPRAPWORLD_KEYPAD_F3)) #define EN_REPRAPWORLD_KEYPAD_F3 (BIT(BLEN_REPRAPWORLD_KEYPAD_F3))
#define EN_REPRAPWORLD_KEYPAD_F2 (BIT(BLEN_REPRAPWORLD_KEYPAD_F2)) #define EN_REPRAPWORLD_KEYPAD_F2 (BIT(BLEN_REPRAPWORLD_KEYPAD_F2))
#define EN_REPRAPWORLD_KEYPAD_F1 (BIT(BLEN_REPRAPWORLD_KEYPAD_F1)) #define EN_REPRAPWORLD_KEYPAD_F1 (BIT(BLEN_REPRAPWORLD_KEYPAD_F1))
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
// macro name. The mapping is independent of whether the button is directly connected or // macro name. The mapping is independent of whether the button is directly connected or
// via a shift/i2c register. // via a shift/i2c register.
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
// All UltiPanels might have an encoder - so this is always be mapped onto first two bits // All UltiPanels might have an encoder - so this is always be mapped onto first two bits
#define BLEN_B 1 #define BLEN_B 1
#define BLEN_A 0 #define BLEN_A 0
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
// //
// Setup other button mappings of each panel // Setup other button mappings of each panel
// //
#if defined(LCD_I2C_VIKI) #if ENABLED(LCD_I2C_VIKI)
#define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C) #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
// button and encoder bit positions within 'buttons' // button and encoder bit positions within 'buttons'
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
// I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
#define LCD_HAS_SLOW_BUTTONS #define LCD_HAS_SLOW_BUTTONS
#elif defined(LCD_I2C_PANELOLU2) #elif ENABLED(LCD_I2C_PANELOLU2)
// encoder click can be read through I2C if not directly connected // encoder click can be read through I2C if not directly connected
#if BTN_ENC <= 0 #if BTN_ENC <= 0
#define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C) #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
#define LCD_CLICKED (buttons&EN_C) #define LCD_CLICKED (buttons&EN_C)
#endif #endif
#elif defined(REPRAPWORLD_KEYPAD) #elif ENABLED(REPRAPWORLD_KEYPAD)
// define register bit values, don't change it // define register bit values, don't change it
#define BLEN_REPRAPWORLD_KEYPAD_F3 0 #define BLEN_REPRAPWORLD_KEYPAD_F3 0
#define BLEN_REPRAPWORLD_KEYPAD_F2 1 #define BLEN_REPRAPWORLD_KEYPAD_F2 1
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
//#define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons&EN_REPRAPWORLD_KEYPAD_UP) //#define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons&EN_REPRAPWORLD_KEYPAD_UP)
//#define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons&EN_REPRAPWORLD_KEYPAD_MIDDLE) //#define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons&EN_REPRAPWORLD_KEYPAD_MIDDLE)
#elif defined(NEWPANEL) #elif ENABLED(NEWPANEL)
#define LCD_CLICKED (buttons&EN_C) #define LCD_CLICKED (buttons&EN_C)
#if HAS_BTN_BACK #if HAS_BTN_BACK
#define LCD_BACK_CLICKED (buttons&EN_D) #define LCD_BACK_CLICKED (buttons&EN_D)
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
//////////////////////////////////// ////////////////////////////////////
// Create LCD class instance and chipset-specific information // Create LCD class instance and chipset-specific information
#if defined(LCD_I2C_TYPE_PCF8575) #if ENABLED(LCD_I2C_TYPE_PCF8575)
// note: these are register mapped pins on the PCF8575 controller not Arduino pins // note: these are register mapped pins on the PCF8575 controller not Arduino pins
#define LCD_I2C_PIN_BL 3 #define LCD_I2C_PIN_BL 3
#define LCD_I2C_PIN_EN 2 #define LCD_I2C_PIN_EN 2
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
#define LCD_CLASS LiquidCrystal_I2C #define LCD_CLASS LiquidCrystal_I2C
LCD_CLASS lcd(LCD_I2C_ADDRESS,LCD_I2C_PIN_EN,LCD_I2C_PIN_RW,LCD_I2C_PIN_RS,LCD_I2C_PIN_D4,LCD_I2C_PIN_D5,LCD_I2C_PIN_D6,LCD_I2C_PIN_D7); LCD_CLASS lcd(LCD_I2C_ADDRESS,LCD_I2C_PIN_EN,LCD_I2C_PIN_RW,LCD_I2C_PIN_RS,LCD_I2C_PIN_D4,LCD_I2C_PIN_D5,LCD_I2C_PIN_D6,LCD_I2C_PIN_D7);
#elif defined(LCD_I2C_TYPE_MCP23017) #elif ENABLED(LCD_I2C_TYPE_MCP23017)
//for the LED indicators (which maybe mapped to different things in lcd_implementation_update_indicators()) //for the LED indicators (which maybe mapped to different things in lcd_implementation_update_indicators())
#define LED_A 0x04 //100 #define LED_A 0x04 //100
#define LED_B 0x02 //010 #define LED_B 0x02 //010
...@@ -163,30 +163,30 @@ ...@@ -163,30 +163,30 @@
#include <Wire.h> #include <Wire.h>
#include <LiquidTWI2.h> #include <LiquidTWI2.h>
#define LCD_CLASS LiquidTWI2 #define LCD_CLASS LiquidTWI2
#if defined(DETECT_DEVICE) #if ENABLED(DETECT_DEVICE)
LCD_CLASS lcd(LCD_I2C_ADDRESS, 1); LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
#else #else
LCD_CLASS lcd(LCD_I2C_ADDRESS); LCD_CLASS lcd(LCD_I2C_ADDRESS);
#endif #endif
#elif defined(LCD_I2C_TYPE_MCP23008) #elif ENABLED(LCD_I2C_TYPE_MCP23008)
#include <Wire.h> #include <Wire.h>
#include <LiquidTWI2.h> #include <LiquidTWI2.h>
#define LCD_CLASS LiquidTWI2 #define LCD_CLASS LiquidTWI2
#if defined(DETECT_DEVICE) #if ENABLED(DETECT_DEVICE)
LCD_CLASS lcd(LCD_I2C_ADDRESS, 1); LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
#else #else
LCD_CLASS lcd(LCD_I2C_ADDRESS); LCD_CLASS lcd(LCD_I2C_ADDRESS);
#endif #endif
#elif defined(LCD_I2C_TYPE_PCA8574) #elif ENABLED(LCD_I2C_TYPE_PCA8574)
#include <LiquidCrystal_I2C.h> #include <LiquidCrystal_I2C.h>
#define LCD_CLASS LiquidCrystal_I2C #define LCD_CLASS LiquidCrystal_I2C
LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT); LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT);
// 2 wire Non-latching LCD SR from: // 2 wire Non-latching LCD SR from:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
#elif defined(SR_LCD_2W_NL) #elif ENABLED(SR_LCD_2W_NL)
extern "C" void __cxa_pure_virtual() { while (1); } extern "C" void __cxa_pure_virtual() { while (1); }
#include <LCD.h> #include <LCD.h>
#include <LiquidCrystal_SR.h> #include <LiquidCrystal_SR.h>
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
#include "utf_mapper.h" #include "utf_mapper.h"
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
static millis_t progress_bar_ms = 0; static millis_t progress_bar_ms = 0;
#if PROGRESS_MSG_EXPIRE > 0 #if PROGRESS_MSG_EXPIRE > 0
static millis_t expire_status_ms = 0; static millis_t expire_status_ms = 0;
...@@ -210,11 +210,11 @@ ...@@ -210,11 +210,11 @@
#endif #endif
static void lcd_set_custom_characters( static void lcd_set_custom_characters(
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
bool progress_bar_set=true bool progress_bar_set=true
#endif #endif
) { ) {
#ifdef DELTA #if ENABLED(DELTA)
byte bedTemp[8] = byte bedTemp[8] =
{ {
B00000, B00000,
...@@ -312,7 +312,7 @@ static void lcd_set_custom_characters( ...@@ -312,7 +312,7 @@ static void lcd_set_custom_characters(
B00000 B00000
}; //thanks Sonny Mounicou }; //thanks Sonny Mounicou
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
static bool char_mode = false; static bool char_mode = false;
byte progress[3][8] = { { byte progress[3][8] = { {
B00000, B00000,
...@@ -373,28 +373,28 @@ static void lcd_set_custom_characters( ...@@ -373,28 +373,28 @@ static void lcd_set_custom_characters(
} }
static void lcd_implementation_init( static void lcd_implementation_init(
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
bool progress_bar_set=true bool progress_bar_set=true
#endif #endif
) { ) {
#if defined(LCD_I2C_TYPE_PCF8575) #if ENABLED(LCD_I2C_TYPE_PCF8575)
lcd.begin(LCD_WIDTH, LCD_HEIGHT); lcd.begin(LCD_WIDTH, LCD_HEIGHT);
#ifdef LCD_I2C_PIN_BL #ifdef LCD_I2C_PIN_BL
lcd.setBacklightPin(LCD_I2C_PIN_BL, POSITIVE); lcd.setBacklightPin(LCD_I2C_PIN_BL, POSITIVE);
lcd.setBacklight(HIGH); lcd.setBacklight(HIGH);
#endif #endif
#elif defined(LCD_I2C_TYPE_MCP23017) #elif ENABLED(LCD_I2C_TYPE_MCP23017)
lcd.setMCPType(LTI_TYPE_MCP23017); lcd.setMCPType(LTI_TYPE_MCP23017);
lcd.begin(LCD_WIDTH, LCD_HEIGHT); lcd.begin(LCD_WIDTH, LCD_HEIGHT);
lcd.setBacklight(0); //set all the LEDs off to begin with lcd.setBacklight(0); //set all the LEDs off to begin with
#elif defined(LCD_I2C_TYPE_MCP23008) #elif ENABLED(LCD_I2C_TYPE_MCP23008)
lcd.setMCPType(LTI_TYPE_MCP23008); lcd.setMCPType(LTI_TYPE_MCP23008);
lcd.begin(LCD_WIDTH, LCD_HEIGHT); lcd.begin(LCD_WIDTH, LCD_HEIGHT);
#elif defined(LCD_I2C_TYPE_PCA8574) #elif ENABLED(LCD_I2C_TYPE_PCA8574)
lcd.init(); lcd.init();
lcd.backlight(); lcd.backlight();
...@@ -408,7 +408,7 @@ static void lcd_implementation_init( ...@@ -408,7 +408,7 @@ static void lcd_implementation_init(
#endif #endif
lcd_set_custom_characters( lcd_set_custom_characters(
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
progress_bar_set progress_bar_set
#endif #endif
); );
...@@ -426,7 +426,7 @@ char lcd_printPGM(const char* str) { ...@@ -426,7 +426,7 @@ char lcd_printPGM(const char* str) {
} }
char lcd_print(char* str) { char lcd_print(char* str) {
char c, n = 0;; char c, n = 0;
unsigned char i = 0; unsigned char i = 0;
while ((c = str[i++])) n += charset_mapper(c); while ((c = str[i++])) n += charset_mapper(c);
return n; return n;
...@@ -530,7 +530,7 @@ static void lcd_implementation_status_screen() { ...@@ -530,7 +530,7 @@ static void lcd_implementation_status_screen() {
#if LCD_WIDTH < 20 #if LCD_WIDTH < 20
#ifdef SDSUPPORT #if ENABLED(SDSUPPORT)
lcd.setCursor(0, 2); lcd.setCursor(0, 2);
lcd_printPGM(PSTR("SD")); lcd_printPGM(PSTR("SD"));
if (IS_SD_PRINTING) if (IS_SD_PRINTING)
...@@ -596,7 +596,7 @@ static void lcd_implementation_status_screen() { ...@@ -596,7 +596,7 @@ static void lcd_implementation_status_screen() {
lcd.print(itostr3(feedrate_multiplier)); lcd.print(itostr3(feedrate_multiplier));
lcd.print('%'); lcd.print('%');
#if LCD_WIDTH > 19 && defined(SDSUPPORT) #if LCD_WIDTH > 19 && ENABLED(SDSUPPORT)
lcd.setCursor(7, 2); lcd.setCursor(7, 2);
lcd_printPGM(PSTR("SD")); lcd_printPGM(PSTR("SD"));
...@@ -643,7 +643,7 @@ static void lcd_implementation_status_screen() { ...@@ -643,7 +643,7 @@ static void lcd_implementation_status_screen() {
lcd.setCursor(0, LCD_HEIGHT - 1); lcd.setCursor(0, LCD_HEIGHT - 1);
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
if (card.isFileOpen()) { if (card.isFileOpen()) {
// Draw the progress bar if the message has shown long enough // Draw the progress bar if the message has shown long enough
...@@ -800,10 +800,10 @@ static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const ...@@ -800,10 +800,10 @@ static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const
#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
#ifdef LCD_HAS_STATUS_INDICATORS #if ENABLED(LCD_HAS_STATUS_INDICATORS)
static void lcd_implementation_update_indicators() { static void lcd_implementation_update_indicators() {
#if defined(LCD_I2C_PANELOLU2) || defined(LCD_I2C_VIKI) #if ENABLED(LCD_I2C_PANELOLU2) || ENABLED(LCD_I2C_VIKI)
// Set the LEDS - referred to as backlights by the LiquidTWI2 library // Set the LEDS - referred to as backlights by the LiquidTWI2 library
static uint8_t ledsprev = 0; static uint8_t ledsprev = 0;
uint8_t leds = 0; uint8_t leds = 0;
...@@ -822,17 +822,17 @@ static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const ...@@ -822,17 +822,17 @@ static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const
#endif // LCD_HAS_STATUS_INDICATORS #endif // LCD_HAS_STATUS_INDICATORS
#ifdef LCD_HAS_SLOW_BUTTONS #if ENABLED(LCD_HAS_SLOW_BUTTONS)
extern millis_t next_button_update_ms; extern millis_t next_button_update_ms;
static uint8_t lcd_implementation_read_slow_buttons() { static uint8_t lcd_implementation_read_slow_buttons() {
#ifdef LCD_I2C_TYPE_MCP23017 #if ENABLED(LCD_I2C_TYPE_MCP23017)
uint8_t slow_buttons; uint8_t slow_buttons;
// Reading these buttons this is likely to be too slow to call inside interrupt context // Reading these buttons this is likely to be too slow to call inside interrupt context
// so they are called during normal lcd_update // so they are called during normal lcd_update
slow_buttons = lcd.readButtons() << B_I2C_BTN_OFFSET; slow_buttons = lcd.readButtons() << B_I2C_BTN_OFFSET;
#ifdef LCD_I2C_VIKI #if ENABLED(LCD_I2C_VIKI)
if ((slow_buttons & (B_MI|B_RI)) && millis() < next_button_update_ms) // LCD clicked if ((slow_buttons & (B_MI|B_RI)) && millis() < next_button_update_ms) // LCD clicked
slow_buttons &= ~(B_MI|B_RI); // Disable LCD clicked buttons if screen is updated slow_buttons &= ~(B_MI|B_RI); // Disable LCD clicked buttons if screen is updated
#endif #endif
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "Marlin.h" #include "Marlin.h"
#ifdef U8GLIB_ST7920 #if ENABLED(U8GLIB_ST7920)
//set optimization so ARDUINO optimizes this file //set optimization so ARDUINO optimizes this file
#pragma GCC optimize (3) #pragma GCC optimize (3)
......
...@@ -3,23 +3,23 @@ ...@@ -3,23 +3,23 @@
#include "language.h" #include "language.h"
#ifdef DOGLCD #if ENABLED(DOGLCD)
#define HARDWARE_CHAR_OUT u8g.print #define HARDWARE_CHAR_OUT u8g.print
#else #else
#define HARDWARE_CHAR_OUT lcd.write #define HARDWARE_CHAR_OUT lcd.write
#endif #endif
#if !(defined( SIMULATE_ROMFONT )) && defined( DOGLCD ) #if DISABLED(SIMULATE_ROMFONT) && ENABLED(DOGLCD)
#if defined( DISPLAY_CHARSET_ISO10646_1 ) #if ENABLED(DISPLAY_CHARSET_ISO10646_1)
#define MAPPER_ONE_TO_ONE #define MAPPER_ONE_TO_ONE
#elif defined( DISPLAY_CHARSET_ISO10646_5 ) #elif ENABLED(DISPLAY_CHARSET_ISO10646_5)
#define MAPPER_ONE_TO_ONE #define MAPPER_ONE_TO_ONE
#elif defined( DISPLAY_CHARSET_ISO10646_KANA ) #elif ENABLED(DISPLAY_CHARSET_ISO10646_KANA)
#define MAPPER_ONE_TO_ONE #define MAPPER_ONE_TO_ONE
#endif #endif
#else // SIMULATE_ROMFONT #else // SIMULATE_ROMFONT
#if defined( DISPLAY_CHARSET_HD44780_JAPAN ) #if ENABLED(DISPLAY_CHARSET_HD44780_JAPAN)
#if defined( MAPPER_C2C3 ) #if ENABLED(MAPPER_C2C3)
const PROGMEM uint8_t utf_recode[] = const PROGMEM uint8_t utf_recode[] =
{ // 0 1 2 3 4 5 6 7 8 9 a b c d e f This is fair for symbols { // 0 1 2 3 4 5 6 7 8 9 a b c d e f This is fair for symbols
0x20,0x3f,0xec,0xed,0x3f,0x5c,0x7c,0x3f,0x22,0x63,0x61,0x7f,0x3f,0x3f,0x52,0xb0, // c2a 0x20,0x3f,0xec,0xed,0x3f,0x5c,0x7c,0x3f,0x22,0x63,0x61,0x7f,0x3f,0x3f,0x52,0xb0, // c2a
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
0x3f,0xee,0x3f,0x3f,0x3f,0x3f,0xef,0xfd,0x3f,0x3f,0x3f,0x3f,0xf5,0x3f,0x3f,0x3f // c3b 0x3f,0xee,0x3f,0x3f,0x3f,0x3f,0xef,0xfd,0x3f,0x3f,0x3f,0x3f,0xf5,0x3f,0x3f,0x3f // c3b
// n ö ÷ ü // n ö ÷ ü
}; };
#elif defined( MAPPER_E382E383 ) #elif ENABLED(MAPPER_E382E383)
const PROGMEM uint8_t utf_recode[] = const PROGMEM uint8_t utf_recode[] =
{ // 0 1 2 3 4 5 6 7 8 9 a b c d e f { // 0 1 2 3 4 5 6 7 8 9 a b c d e f
0x3d,0xb1,0xb1,0xa8,0xb2,0xa9,0xb3,0xaa,0xb4,0xab,0xb5,0xb6,0xb6,0xb7,0xb7,0xb8, // e382a Please test and correct 0x3d,0xb1,0xb1,0xa8,0xb2,0xa9,0xb3,0xaa,0xb4,0xab,0xb5,0xb6,0xb6,0xb7,0xb7,0xb8, // e382a Please test and correct
...@@ -51,12 +51,12 @@ ...@@ -51,12 +51,12 @@
0xec,0xa7,0xa6,0xdd,0xcc,0x3f,0x3f,0x3f,0x3f,0x3f,0xa6,0xa5,0xb0,0xa4,0xa4,0x3f // e383b 0xec,0xa7,0xa6,0xdd,0xcc,0x3f,0x3f,0x3f,0x3f,0x3f,0xa6,0xa5,0xb0,0xa4,0xa4,0x3f // e383b
// ヰ ヱ ヲ ン フ ? ? ? ? ? ヲ ・ ー ヽ ヽ ? // ヰ ヱ ヲ ン フ ? ? ? ? ? ヲ ・ ー ヽ ヽ ?
}; };
#elif defined( MAPPER_D0D1 ) #elif ENABLED(MAPPER_D0D1)
#error( "Cyrillic on a japanese dsplay makes no sense. There are no matching symbols."); #error( "Cyrillic on a japanese dsplay makes no sense. There are no matching symbols.");
#endif #endif
#elif defined( DISPLAY_CHARSET_HD44780_WESTERN ) #elif ENABLED(DISPLAY_CHARSET_HD44780_WESTERN)
#if defined( MAPPER_C2C3 ) #if ENABLED(MAPPER_C2C3)
: :
const PROGMEM uint8_t utf_recode[] = const PROGMEM uint8_t utf_recode[] =
{ // 0 1 2 3 4 5 6 7 8 9 a b c d e f This is relative complete. { // 0 1 2 3 4 5 6 7 8 9 a b c d e f This is relative complete.
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff // c3b ðñóôõö÷øùúûüýþÿ 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff // c3b ðñóôõö÷øùúûüýþÿ
// ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ // ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ
}; };
#elif defined( MAPPER_D0D1 ) #elif ENABLED(MAPPER_D0D1)
#define MAPPER_D0D1_MOD #define MAPPER_D0D1_MOD
const PROGMEM uint8_t utf_recode[] = const PROGMEM uint8_t utf_recode[] =
{//0 1 2 3 4 5 6 7 8 9 a b c d e f {//0 1 2 3 4 5 6 7 8 9 a b c d e f
...@@ -86,12 +86,12 @@ ...@@ -86,12 +86,12 @@
0x70,0x63,0x54,0x79,0xd8,0x78,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x62,0x8f,0xac,0xad // d19 0x70,0x63,0x54,0x79,0xd8,0x78,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x62,0x8f,0xac,0xad // d19
// p c T y Ф x Ч ч Ш Щ Ъ Ы b Э Ю Я // p c T y Ф x Ч ч Ш Щ Ъ Ы b Э Ю Я
}; };
#elif defined( MAPPER_E382E383 ) #elif ENABLED(MAPPER_E382E383)
#error( "Katakana on a western display makes no sense. There are no matching symbols." ); #error( "Katakana on a western display makes no sense. There are no matching symbols." );
#endif #endif
#elif defined( DISPLAY_CHARSET_HD44780_CYRILLIC ) #elif ENABLED(DISPLAY_CHARSET_HD44780_CYRILLIC)
#if defined( MAPPER_D0D1 ) #if ENABLED(MAPPER_D0D1)
#define MAPPER_D0D1_MOD #define MAPPER_D0D1_MOD
// it is a Russian alphabet translation // it is a Russian alphabet translation
// except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё // except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё
...@@ -113,9 +113,9 @@ ...@@ -113,9 +113,9 @@
0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7 // Ѫ ѩ Ѫ ѫ Ѭ ѭ Ѯ ѯ 0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7 // Ѫ ѩ Ѫ ѫ Ѭ ѭ Ѯ ѯ
// ш щ ъ ы ь э ю я // 7 Ѱ ѱ Ѳ ѳ Ѵ ѵ Ѷ ѷ // ш щ ъ ы ь э ю я // 7 Ѱ ѱ Ѳ ѳ Ѵ ѵ Ѷ ѷ
}; // ѻ ѹ Ѻ ѻ Ѽ ѽ Ѿ ѿ }; // ѻ ѹ Ѻ ѻ Ѽ ѽ Ѿ ѿ
#elif defined( MAPPER_C2C3 ) #elif ENABLED(MAPPER_C2C3)
#error( "Western languages on a cyrillic display makes no sense. There are no matching symbols." ); #error( "Western languages on a cyrillic display makes no sense. There are no matching symbols." );
#elif defined( MAPPER_E382E383 ) #elif ENABLED(MAPPER_E382E383)
#error( "Katakana on a cyrillic display makes no sense. There are no matching symbols." ); #error( "Katakana on a cyrillic display makes no sense. There are no matching symbols." );
#endif #endif
#else #else
...@@ -123,12 +123,12 @@ ...@@ -123,12 +123,12 @@
#endif // DISPLAY_CHARSET_HD44780_CYRILLIC #endif // DISPLAY_CHARSET_HD44780_CYRILLIC
#endif // SIMULATE_ROMFONT #endif // SIMULATE_ROMFONT
#if defined( MAPPER_NON ) #if ENABLED(MAPPER_NON)
char charset_mapper(char c){ char charset_mapper(char c){
HARDWARE_CHAR_OUT( c ); HARDWARE_CHAR_OUT( c );
return 1; return 1;
} }
#elif defined( MAPPER_C2C3 ) #elif ENABLED(MAPPER_C2C3)
uint8_t utf_hi_char; // UTF-8 high part uint8_t utf_hi_char; // UTF-8 high part
bool seen_c2 = false; bool seen_c2 = false;
char charset_mapper(char c){ char charset_mapper(char c){
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
seen_c2 = false; seen_c2 = false;
return 1; return 1;
} }
#elif defined( MAPPER_D0D1_MOD ) #elif ENABLED(MAPPER_D0D1_MOD)
uint8_t utf_hi_char; // UTF-8 high part uint8_t utf_hi_char; // UTF-8 high part
bool seen_d5 = false; bool seen_d5 = false;
char charset_mapper(char c){ char charset_mapper(char c){
...@@ -188,7 +188,7 @@ ...@@ -188,7 +188,7 @@
seen_d5 = false; seen_d5 = false;
return 1; return 1;
} }
#elif defined( MAPPER_D0D1 ) #elif ENABLED(MAPPER_D0D1)
uint8_t utf_hi_char; // UTF-8 high part uint8_t utf_hi_char; // UTF-8 high part
bool seen_d5 = false; bool seen_d5 = false;
char charset_mapper(char c){ char charset_mapper(char c){
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
seen_d5 = false; seen_d5 = false;
return 1; return 1;
} }
#elif defined( MAPPER_E382E383 ) #elif ENABLED(MAPPER_E382E383)
uint8_t utf_hi_char; // UTF-8 high part uint8_t utf_hi_char; // UTF-8 high part
bool seen_e3 = false; bool seen_e3 = false;
bool seen_82_83 = false; bool seen_82_83 = false;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <math.h> #include <math.h>
#include "Marlin.h" #include "Marlin.h"
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
#include "vector_3.h" #include "vector_3.h"
vector_3::vector_3() : x(0), y(0), z(0) { } vector_3::vector_3() : x(0), y(0), z(0) { }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#ifndef VECTOR_3_H #ifndef VECTOR_3_H
#define VECTOR_3_H #define VECTOR_3_H
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
class matrix_3x3; class matrix_3x3;
struct vector_3 struct vector_3
......
#include "Marlin.h" #include "Marlin.h"
#ifdef USE_WATCHDOG #if ENABLED(USE_WATCHDOG)
#include <avr/wdt.h> #include <avr/wdt.h>
#include "watchdog.h" #include "watchdog.h"
...@@ -18,15 +18,15 @@ ...@@ -18,15 +18,15 @@
/// intialise watch dog with a 4 sec interrupt time /// intialise watch dog with a 4 sec interrupt time
void watchdog_init() void watchdog_init()
{ {
#ifdef WATCHDOG_RESET_MANUAL #if ENABLED(WATCHDOG_RESET_MANUAL)
//We enable the watchdog timer, but only for the interrupt. //We enable the watchdog timer, but only for the interrupt.
//Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details. //Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details.
wdt_reset(); wdt_reset();
_WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE); _WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
_WD_CONTROL_REG = _BV(WDIE) | WDTO_4S; _WD_CONTROL_REG = _BV(WDIE) | WDTO_4S;
#else #else
wdt_enable(WDTO_4S); wdt_enable(WDTO_4S);
#endif #endif
} }
/// reset watchdog. MUST be called every 1s after init or avr will reset. /// reset watchdog. MUST be called every 1s after init or avr will reset.
...@@ -40,7 +40,7 @@ void watchdog_reset() ...@@ -40,7 +40,7 @@ void watchdog_reset()
//=========================================================================== //===========================================================================
// Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled. // Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled.
#ifdef WATCHDOG_RESET_MANUAL #if ENABLED(WATCHDOG_RESET_MANUAL)
ISR(WDT_vect) { ISR(WDT_vect) {
ECHO_LM(ER, MSG_WATCHDOG_RESET); ECHO_LM(ER, MSG_WATCHDOG_RESET);
kill(PSTR("ERR:Please Reset")); // kill blocks //16 characters so it fits on a 16x2 display kill(PSTR("ERR:Please Reset")); // kill blocks //16 characters so it fits on a 16x2 display
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "Marlin.h" #include "Marlin.h"
#ifdef USE_WATCHDOG #if ENABLED(USE_WATCHDOG)
// initialize watch dog with a 1 sec interrupt time // initialize watch dog with a 1 sec interrupt time
void watchdog_init(); void watchdog_init();
// pad the dog/reset watchdog. MUST be called at least every second after the first watchdog_init or AVR will go into emergency procedures.. // pad the dog/reset watchdog. MUST be called at least every second after the first watchdog_init or AVR will go into emergency procedures..
......
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