Commit 768a1272 authored by MagoKimbra's avatar MagoKimbra

Update

parent 7bd1de66
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
// This configuration file contains basic settings. Select your:
// - board type
// - 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
#include "boards.h"
#include "macros.h"
//===========================================================================
//============================= Getting Started =============================
//===========================================================================
#include "boards.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
/*
* This configuration file contains basic settings. Select your:
* - board type
* - 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
// User-specified version info of this build to display in [Pronterface, etc] terminal window during
......@@ -57,13 +65,13 @@
/***********************************************************************\
********************** Do not touch this section **********************
***********************************************************************/
#if defined(CARTESIAN)
#if ENABLED(CARTESIAN)
#include "Configuration_Cartesian.h"
#elif defined(COREXY)
#elif ENABLED(COREXY)
#include "Configuration_Corexy.h"
#elif defined(DELTA)
#elif ENABLED(DELTA)
#include "Configuration_Delta.h"
#elif defined(SCARA)
#elif ENABLED(SCARA)
#include "Configuration_Scara.h"
#endif
/***********************************************************************/
......@@ -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
// It is assumed that when logic high = filament available
// 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
#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
......
......@@ -9,7 +9,7 @@
// coarse Endstop Settings
#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
// #define ENDSTOPPULLUP_XMAX
// #define ENDSTOPPULLUP_YMAX
......@@ -90,7 +90,7 @@
//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!!!
//#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_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28) or homing Z
#endif
......@@ -98,7 +98,7 @@
//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (ABL)
//#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
//
......@@ -115,7 +115,7 @@
// Note: this feature generates 10KB extra code size
#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
......@@ -176,7 +176,7 @@
//#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)
//Manual homing switch locations:
#ifdef MANUAL_HOME_POSITIONS
#if ENABLED(MANUAL_HOME_POSITIONS)
#define MANUAL_X_HOME_POS 0
#define MANUAL_Y_HOME_POS 0
#define MANUAL_Z_HOME_POS 0
......@@ -210,7 +210,7 @@
// Custom M code points
//#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES
#if ENABLED(CUSTOM_M_CODES)
#define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851
#define Z_PROBE_OFFSET_RANGE_MIN -20
#define Z_PROBE_OFFSET_RANGE_MAX 20
......
......@@ -9,7 +9,7 @@
// coarse Endstop Settings
#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
// #define ENDSTOPPULLUP_XMAX
// #define ENDSTOPPULLUP_YMAX
......@@ -90,7 +90,7 @@
//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!!!
//#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_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28) or homing Z
#endif
......@@ -98,7 +98,7 @@
//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (ABL)
//#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
//
......@@ -115,7 +115,7 @@
// Note: this feature generates 10KB extra code size
#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
......@@ -176,7 +176,7 @@
//#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)
//Manual homing switch locations:
#ifdef MANUAL_HOME_POSITIONS
#if ENABLED(MANUAL_HOME_POSITIONS)
#define MANUAL_X_HOME_POS 0
#define MANUAL_Y_HOME_POS 0
#define MANUAL_Z_HOME_POS 0
......@@ -210,7 +210,7 @@
// Custom M code points
//#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES
#if ENABLED(CUSTOM_M_CODES)
#define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851
#define Z_PROBE_OFFSET_RANGE_MIN -20
#define Z_PROBE_OFFSET_RANGE_MAX 20
......
......@@ -56,7 +56,7 @@
// coarse Endstop Settings
#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
// #define ENDSTOPPULLUP_XMAX
// #define ENDSTOPPULLUP_YMAX
......
......@@ -17,7 +17,7 @@
//=============================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
#endif
#define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
......@@ -25,7 +25,7 @@
/**
* Thermal Protection parameters
*/
#ifdef THERMAL_PROTECTION_HOTENDS
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
......@@ -39,7 +39,7 @@
#define WATCH_TEMP_INCREASE 4 // Degrees Celsius
#endif
#ifdef THERMAL_PROTECTION_BED
#if ENABLED(THERMAL_PROTECTION_BED)
#define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
#endif
......@@ -56,7 +56,7 @@
* On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
*/
#define AUTOTEMP
#ifdef AUTOTEMP
#if ENABLED(AUTOTEMP)
#define AUTOTEMP_OLDWEIGHT 0.98
#endif
......@@ -135,7 +135,7 @@
// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
//#define Z_DUAL_STEPPER_DRIVERS
#ifdef Z_DUAL_STEPPER_DRIVERS
#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.
// That way the machine is capable to align the bed during home, since both Z steppers are homed.
......@@ -148,7 +148,7 @@
#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_DIR_PIN E2_DIR_PIN
#define Z2_ENABLE_PIN E2_ENABLE_PIN
......@@ -170,7 +170,7 @@
// prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
// allowing faster printing speeds.
//#define DUAL_X_CARRIAGE
#ifdef DUAL_X_CARRIAGE
#if ENABLED(DUAL_X_CARRIAGE)
// Configuration for second X-carriage
// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop;
// the second x-carriage always homes to the maximum endstop.
......@@ -236,7 +236,7 @@
#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate
#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 ULTIPANEL_FEEDMULTIPLY // Comment to disable setting feedrate multiplier via encoder
#endif
......@@ -294,11 +294,8 @@
// be commented out otherwise
#define SDCARDDETECTINVERTED
// Disable steppers when the file is done printing
#define SD_FINISHED_STEPPERRELEASE true
// 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 SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers?
#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
#define SDCARD_RATHERRECENTFIRST //reverse file order of sd card menu display. Its sorted practically after the file system block order.
// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that.
......@@ -308,7 +305,7 @@
// Show a progress bar on HD44780 LCDs for SD printing
//#define LCD_PROGRESS_BAR
#ifdef LCD_PROGRESS_BAR
#if ENABLED(LCD_PROGRESS_BAR)
// Amount of time (ms) to show the bar
#define PROGRESS_BAR_BAR_TIME 5000
// Amount of time (ms) to show the status message
......@@ -325,7 +322,7 @@
#endif // SDSUPPORT
// 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
// we don't have a big font for Cyrillic, Kana
//#define USE_BIG_EDIT_FONT
......@@ -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.
//#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.
// 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.
......@@ -352,7 +349,7 @@
// it can e.g. be used to change z-positions in the print startup phase in real-time
// does not respect endstops!
//#define BABYSTEPPING
#ifdef BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#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_Z_MULTIPLICATOR 2 //faster z movements
......@@ -367,7 +364,7 @@
// so: v ^ 2 is proportional to number of steps we advance the extruder
//#define ADVANCE
#ifdef ADVANCE
#if ENABLED(ADVANCE)
#define EXTRUDER_ADVANCE_K .0
#define D_FILAMENT 2.85
#define STEPS_MM_E 836
......@@ -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 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
#else
#define BLOCK_BUFFER_SIZE 16 // maximize block buffer
......@@ -400,9 +397,10 @@ const unsigned int dropsegments = 5; // everything with less than this number of
#define BUFSIZE 4
// 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'.
// This wait is only send when the buffer is empty. The timeout-length is in milliseconds. 1000 is a good value.
#define NO_TIMEOUTS 1000
// Therefore some clients abort after 30 seconds in a timeout.
// Some other clients start sending commands while receiving a 'wait'.
// 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.
#define ADVANCED_OK
......@@ -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.
//#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 RETRACT_LENGTH 3 //default retract length (positive mm)
#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
#define RETRACT_RECOVER_FEEDRATE 8 //default feedrate for recovering from retraction (mm/s)
#endif
// Add support for experimental filament exchange support M600; requires display
#ifdef ULTIPANEL
// Add support for filament exchange support M600; requires display
#if ENABLED(ULTIPANEL)
#define FILAMENTCHANGEENABLE
#ifdef FILAMENTCHANGEENABLE
#if ENABLED(FILAMENTCHANGEENABLE)
#define FILAMENTCHANGE_XPOS 3
#define FILAMENTCHANGE_YPOS 3
#define FILAMENTCHANGE_ZADD 10
......@@ -444,7 +442,7 @@ const unsigned int dropsegments = 5; // everything with less than this number of
******************************************************************************/
//#define HAVE_TMCDRIVER
#ifdef HAVE_TMCDRIVER
#if ENABLED(HAVE_TMCDRIVER)
// #define X_IS_TMC
#define X_MAX_CURRENT 1000 //in mA
......@@ -504,7 +502,7 @@ const unsigned int dropsegments = 5; // everything with less than this number of
******************************************************************************/
//#define HAVE_L6470DRIVER
#ifdef HAVE_L6470DRIVER
#if ENABLED(HAVE_L6470DRIVER)
// #define X_IS_L6470
#define X_MICROSTEPS 16 //number of microsteps
......
......@@ -23,6 +23,7 @@
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include "Configuration.h"
#include "pins.h"
#ifndef SANITYCHECK_H
#error Your Configuration.h and Configuration_adv.h files are outdated!
......@@ -34,14 +35,6 @@
#include "WProgram.h"
#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;
// Arduino < 1.0.0 does not define this, so we need to do it ourselves
......@@ -53,9 +46,11 @@ typedef unsigned long millis_t;
void get_command();
void idle(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 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
......@@ -67,7 +62,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#endif
#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 disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#else
......@@ -80,7 +75,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#endif
#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 disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#else
......@@ -147,7 +142,7 @@ void disable_all_steppers();
void FlushSerialRequestResend();
void ok_to_send();
#ifdef DELTA
#if ENABLED(DELTA)
float probe_bed(float x, float y);
void set_delta_constants();
void home_delta_axis();
......@@ -165,7 +160,7 @@ extern float delta_tower1_x, delta_tower1_y;
extern float delta_tower2_x, delta_tower2_y;
extern float delta_tower3_x, delta_tower3_y;
#endif
#ifdef SCARA
#if ENABLED(SCARA)
void calculate_delta(float cartesian[3]);
void calculate_SCARA_forward_Transform(float f_scara[3]);
#endif
......@@ -173,7 +168,7 @@ void prepare_move();
void kill(const char *);
void Stop();
#ifdef FILAMENT_RUNOUT_SENSOR
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
void filrunout();
#endif
......@@ -202,7 +197,7 @@ void clamp_to_software_endstops(float target[3]);
extern millis_t previous_cmd_ms;
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);
#endif
......@@ -224,7 +219,7 @@ extern float home_offset[3];
// Hotend offset
#if HOTENDS > 1
#ifndef DUAL_X_CARRIAGE
#if DISABLED(DUAL_X_CARRIAGE)
#define NUM_HOTEND_OFFSETS 2 // only in XY plane
#else
#define NUM_HOTEND_OFFSETS 3 // supports offsets in XYZ plane
......@@ -232,22 +227,22 @@ extern float home_offset[3];
extern float hotend_offset[NUM_HOTEND_OFFSETS][HOTENDS];
#endif // HOTENDS > 1
#ifdef NPR2
#if ENABLED(NPR2)
extern int old_color; // old color for system NPR2
#endif
#ifdef DELTA
#if ENABLED(DELTA)
extern float z_probe_offset[3];
extern float endstop_adj[3];
extern float tower_adj[6];
extern float delta_radius;
extern float delta_diagonal_rod;
extern float delta_segments_per_second;
#elif defined(Z_DUAL_ENDSTOPS)
#elif ENABLED(Z_DUAL_ENDSTOPS)
extern float z_endstop_adj;
#endif
#ifdef SCARA
#if ENABLED(SCARA)
extern float axis_scaling[3]; // Build size scaling
#endif
......@@ -260,18 +255,18 @@ extern float zprobe_zoffset;
// 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.
#ifdef PREVENT_DANGEROUS_EXTRUDE
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
extern float extrude_min_temp;
#endif
extern int fanSpeed;
#ifdef BARICUDA
#if ENABLED(BARICUDA)
extern int ValvePressure;
extern int EtoPPressure;
#endif
#ifdef FAN_SOFT_PWM
#if ENABLED(FAN_SOFT_PWM)
extern unsigned char fanSpeedSoftPwm;
#endif
......@@ -292,26 +287,26 @@ extern int fanSpeed;
extern unsigned long stoppower;
#endif
#ifdef IDLE_OOZING_PREVENT
#if ENABLED(IDLE_OOZING_PREVENT)
extern bool idleoozing_enabled;
#endif
#ifdef FWRETRACT
#if ENABLED(FWRETRACT)
extern bool autoretract_enabled;
extern bool retracted[EXTRUDERS];
extern float retract_length, retract_length_swap, retract_feedrate, retract_zlift;
extern float retract_recover_length, retract_recover_length_swap, retract_recover_feedrate;
#endif
#ifdef EASY_LOAD
#if ENABLED(EASY_LOAD)
extern bool allow_lengthy_extrude_once; // for load/unload
#endif
#ifdef LASERBEAM
#if ENABLED(LASERBEAM)
extern int laser_ttl_modulation;
#endif
#if defined(SDSUPPORT) && defined(SD_SETTINGS)
#if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS)
extern millis_t config_last_update;
extern bool config_readed;
#endif
......@@ -323,12 +318,12 @@ extern millis_t print_job_stop_ms;
extern uint8_t active_extruder;
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_init();
#endif
#ifdef FIRMWARE_TEST
#if ENABLED(FIRMWARE_TEST)
void FirmwareTest();
#endif
......
......@@ -287,6 +287,6 @@ MarlinSerial MSerial;
#endif // !AT90USB
// For AT90USB targets use the UART for BT interfacing
#if defined(AT90USB) && defined(BTENABLED)
#if defined(AT90USB) && ENABLED(BTENABLED)
HardwareSerial bt;
#endif
......@@ -153,7 +153,7 @@ extern MarlinSerial MSerial;
#endif // !AT90USB
// Use the UART for BT in AT90USB configurations
#if defined(AT90USB) && defined(BTENABLED)
#if defined(AT90USB) && ENABLED(BTENABLED)
extern HardwareSerial bt;
#endif
......
......@@ -285,12 +285,12 @@ bool target_direction;
unsigned long printer_usage_seconds;
#ifndef DELTA
#if DISABLED(DELTA)
int xy_travel_speed = XY_TRAVEL_SPEED;
float zprobe_zoffset = 0;
#endif
#if defined(Z_DUAL_ENDSTOPS) && !defined(DELTA)
#if ENABLED(Z_DUAL_ENDSTOPS) && DISABLED(DELTA)
float z_endstop_adj = 0;
#endif
......@@ -304,7 +304,7 @@ unsigned long printer_usage_seconds;
float hotend_offset[NUM_HOTEND_OFFSETS][HOTENDS];
#endif
#ifdef NPR2
#if ENABLED(NPR2)
int old_color = 99;
#endif
......@@ -313,13 +313,12 @@ unsigned long printer_usage_seconds;
int servo_endstop_angles[] = SERVO_ENDSTOP_ANGLES;
#endif
#ifdef BARICUDA
#if ENABLED(BARICUDA)
int ValvePressure = 0;
int EtoPPressure = 0;
#endif
#ifdef FWRETRACT
#if ENABLED(FWRETRACT)
bool autoretract_enabled = false;
bool retracted[EXTRUDERS] = { false };
bool retracted_swap[EXTRUDERS] = { false };
......@@ -331,10 +330,9 @@ unsigned long printer_usage_seconds;
float retract_recover_length = RETRACT_RECOVER_LENGTH;
float retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP;
float retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
#endif // FWRETRACT
#if defined(ULTIPANEL) && HAS_POWER_SWITCH
#if ENABLED(ULTIPANEL) && HAS_POWER_SWITCH
bool powersupply =
#ifdef PS_DEFAULT_OFF
false
......@@ -344,7 +342,7 @@ unsigned long printer_usage_seconds;
;
#endif
#ifdef DELTA
#if ENABLED(DELTA)
float delta[3] = { 0.0 };
float tower_adj[6] = { 0, 0, 0, 0, 0, 0 };
float delta_radius; // = DEFAULT_delta_radius;
......@@ -377,8 +375,6 @@ unsigned long printer_usage_seconds;
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_end_location[] = Z_PROBE_RETRACT_END_LOCATION;
#define SIN_60 0.8660254037844386
#define COS_60 0.5
float endstop_adj[3] = { 0 };
static float bed_level[7][7] = {
{ 0, 0, 0, 0, 0, 0, 0 },
......@@ -399,7 +395,7 @@ unsigned long printer_usage_seconds;
static bool home_all_axis = true;
#endif // DELTA
#ifdef SCARA
#if ENABLED(SCARA)
float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND;
static float delta[3] = { 0 };
float axis_scaling[3] = { 1, 1, 1 }; // Build size scaling, default to 1
......@@ -422,7 +418,7 @@ unsigned long printer_usage_seconds;
bool printing = false;
#endif
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
static bool fromsd[BUFSIZE];
#ifdef SD_SETTINGS
millis_t config_last_update = 0;
......@@ -430,16 +426,16 @@ unsigned long printer_usage_seconds;
#endif
#endif
#ifdef FILAMENTCHANGEENABLE
#if ENABLED(FILAMENTCHANGEENABLE)
bool filament_changing = false;
#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;
bool axis_is_moving = false;
#endif
#ifdef IDLE_OOZING_PREVENT
#if ENABLED(IDLE_OOZING_PREVENT)
bool idleoozing_enabled = true;
bool IDLE_OOZING_retracted[EXTRUDERS] = ARRAY_BY_EXTRUDERS(false, false, false, false);
#endif
......@@ -451,16 +447,16 @@ unsigned long printer_usage_seconds;
unsigned long stoppower = 0;
#endif
#ifdef LASERBEAM
#if ENABLED(LASERBEAM)
int laser_ttl_modulation = 0;
#endif
#ifdef NPR2
static float color_position[] = COLOR_STEP; //variabile per la scelta del colore
#if ENABLED(NPR2)
static float color_position[] = COLOR_STEP;
static float color_step_moltiplicator = (DRIVER_MICROSTEP / MOTOR_ANGLE) * CARTER_MOLTIPLICATOR;
#endif // NPR2
#ifdef EASY_LOAD
#if ENABLED(EASY_LOAD)
bool allow_lengthy_extrude_once; // for load/unload
#endif
......@@ -481,7 +477,7 @@ void process_next_command();
bool setTargetedHotend(int code);
#ifdef PREVENT_DANGEROUS_EXTRUDE
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
float extrude_min_temp = EXTRUDE_MINTEMP;
#endif
......@@ -709,7 +705,7 @@ void setup() {
ECHO_SMV(DB, MSG_FREE_MEMORY, freeMemory());
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;
#endif
......@@ -719,6 +715,9 @@ void setup() {
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
Config_RetrieveSettings();
lcd_init();
_delay_ms(SPLASH_SCREEN_DURATION); // wait to display the splash screen
tp_init(); // Initialize temperature loop
plan_init(); // Initialize planner;
watchdog_init();
......@@ -727,9 +726,6 @@ void setup() {
setup_laserbeampin(); // Initialize Laserbeam pin
servo_init();
lcd_init();
_delay_ms(SPLASH_SCREEN_DURATION); // wait to display the splash screen
#if HAS_CONTROLLERFAN
SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
#endif
......@@ -738,7 +734,7 @@ void setup() {
digipot_i2c_init();
#endif
#ifdef Z_PROBE_SLED
#if ENABLED(Z_PROBE_SLED)
OUT_WRITE(SERVO0_PIN, LOW); // turn it off
#endif // Z_PROBE_SLED
......@@ -754,7 +750,7 @@ void setup() {
digitalWrite(STAT_LED_BLUE, LOW); // turn it off
#endif
#ifdef FIRMWARE_TEST
#if ENABLED(FIRMWARE_TEST)
FirmwareTest();
#endif // FIRMWARE_TEST
}
......@@ -772,13 +768,13 @@ void setup() {
void loop() {
if (commands_in_queue < BUFSIZE - 1) get_command();
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
card.checkautostart(false);
#endif
if (commands_in_queue) {
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
if (card.saving) {
char *command = command_queue[cmd_queue_index_r];
......@@ -808,11 +804,8 @@ void loop() {
commands_in_queue--;
cmd_queue_index_r = (cmd_queue_index_r + 1) % BUFSIZE;
}
// Check heater every n milliseconds
manage_heater();
manage_inactivity();
checkHitEndstops();
lcd_update();
idle();
}
void gcode_line_error(const char *err, bool doFlush = true) {
......@@ -834,7 +827,7 @@ void get_command() {
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;
millis_t ms = millis();
......@@ -849,7 +842,7 @@ void get_command() {
//
while (MYSERIAL.available() > 0 && commands_in_queue < BUFSIZE) {
#ifdef NO_TIMEOUTS
#if ENABLED(NO_TIMEOUTS)
last_command_time = ms;
#endif
......@@ -869,7 +862,7 @@ void get_command() {
command[serial_count] = 0; // terminate string
// this item in the queue is not from sd
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
fromsd[cmd_queue_index_w] = false;
#endif
......@@ -928,6 +921,10 @@ void get_command() {
// If command was e-stop process now
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;
commands_in_queue += 1;
......@@ -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(signed char, home_dir, HOME_DIR);
#ifdef DUAL_X_CARRIAGE
#if ENABLED(DUAL_X_CARRIAGE)
#define DXC_FULL_CONTROL_MODE 0
#define DXC_AUTO_PARK_MODE 1
......@@ -1198,7 +1195,7 @@ inline void line_to_destination() {
inline void sync_plan_position() {
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
}
#if defined(DELTA) || defined(SCARA)
#if ENABLED(DELTA) || ENABLED(SCARA)
inline void sync_plan_position_delta() {
calculate_delta(current_position);
plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
......@@ -1215,7 +1212,7 @@ static void setup_for_endstop_move() {
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) {
float oldFeedRate = feedrate;
......@@ -1538,7 +1535,7 @@ static void setup_for_endstop_move() {
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
#endif // Cartesian || CoreXY || Scara
#ifdef DELTA
#if ENABLED(DELTA)
static void homeaxis(AxisEnum axis) {
#define HOMEAXIS_DO(LETTER) \
......@@ -2395,7 +2392,7 @@ static void setup_for_endstop_move() {
}
#endif //DELTA
#ifdef IDLE_OOZING_PREVENT
#if ENABLED(IDLE_OOZING_PREVENT)
void IDLE_OOZING_retract(bool retracting) {
if (retracting && !IDLE_OOZING_retracted[active_extruder]) {
set_destination_to_current();
......@@ -2420,7 +2417,7 @@ static void setup_for_endstop_move() {
}
#endif
#ifdef FWRETRACT
#if ENABLED(FWRETRACT)
void retract(bool retracting, bool swapping = false) {
if (retracting == retracted[active_extruder]) return;
......@@ -2471,7 +2468,7 @@ static void setup_for_endstop_move() {
} // retract()
#endif //FWRETRACT
#ifdef Z_PROBE_SLED
#if ENABLED(Z_PROBE_SLED)
#ifndef SLED_DOCKING_OFFSET
#define SLED_DOCKING_OFFSET 0
......@@ -2504,10 +2501,6 @@ static void setup_for_endstop_move() {
inline void wait_heater() {
#ifdef THERMAL_PROTECTION_HOTENDS
start_watching_heater(target_extruder);
#endif
millis_t temp_ms = millis();
/* See if we are heating up or cooling down */
......@@ -2527,8 +2520,8 @@ inline void wait_heater() {
{ // while loop
if (millis() > temp_ms + 1000UL) { //Print temp & remaining time every 1s while waiting
ECHO_MV("T:", degHotend(target_extruder),1);
ECHO_MV(" E:", target_extruder);
ECHO_MV("T:", degHotend(target_extruder), 1);
ECHO_MV(" E:", (int)target_extruder);
#ifdef TEMP_RESIDENCY_TIME
ECHO_M(" W:");
if (residency_start_ms > -1) {
......@@ -2543,9 +2536,9 @@ inline void wait_heater() {
#endif
temp_ms = millis();
}
manage_heater();
manage_inactivity();
lcd_update();
idle();
#ifdef TEMP_RESIDENCY_TIME
// start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
// or when current temp falls outside the hysteresis after target temp was reached
......@@ -2586,6 +2579,10 @@ inline void wait_bed() {
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 ********************************
......@@ -2815,11 +2812,7 @@ inline void gcode_G4() {
if (!lcd_hasstatus()) LCD_MESSAGEPGM(MSG_DWELL);
while (millis() < codenum) {
manage_heater();
manage_inactivity();
lcd_update();
}
while (millis() < codenum) idle();
}
#ifdef FWRETRACT
......@@ -3431,9 +3424,7 @@ inline void gcode_G28(boolean home_XY = false) {
probePointCounter++;
manage_heater();
manage_inactivity();
lcd_update();
idle();
} //xProbe
} //yProbe
......@@ -3517,6 +3508,8 @@ inline void gcode_G28(boolean home_XY = false) {
#ifdef Z_PROBE_SLED
dock_sled(true, -SLED_DOCKING_OFFSET); // dock the probe, correcting for over-travel
#endif
FlushSerialRequestResend();
}
#ifndef Z_PROBE_SLED
......@@ -3537,8 +3530,8 @@ inline void gcode_G28(boolean home_XY = false) {
clean_up_after_endstop_move();
stow_z_probe(); // Retract Z Servo endstop if available
}
#endif //Z_PROBE_SLED
#endif //ENABLE_AUTO_BED_LEVELING
#endif // !Z_PROBE_SLED
#endif // ENABLE_AUTO_BED_LEVELING
#if defined(DELTA) && defined(Z_PROBE_ENDSTOP)
......@@ -3571,6 +3564,7 @@ inline void gcode_G28(boolean home_XY = false) {
feedrate_multiplier = saved_feedrate_multiplier;
refresh_cmd_timeout();
endstops_hit_on_purpose(); // clear endstop hit flags
FlushSerialRequestResend();
}
// G30: Delta AutoCalibration
......@@ -3637,6 +3631,8 @@ inline void gcode_G28(boolean home_XY = false) {
//Restore saved variables
feedrate = saved_feedrate;
feedrate_multiplier = saved_feedrate_multiplier;
FlushSerialRequestResend();
}
#endif // DELTA && Z_PROBE_ENDSTOP
......@@ -3705,7 +3701,7 @@ inline void gcode_G92() {
* M1: // M1 - Conditional stop - Wait for user button press on LCD
*/
inline void gcode_M0_M1() {
char *src = seen_pointer + 2;
char *args = current_command_args;
millis_t codenum = 0;
bool hasP = false, hasS = false;
......@@ -3714,14 +3710,12 @@ inline void gcode_G92() {
hasP = codenum > 0;
}
if (code_seen('S')) {
codenum = code_value_short() * 1000UL; // seconds to wait
codenum = code_value() * 1000; // seconds to wait
hasS = codenum > 0;
}
char* starpos = strchr(src, '*');
if (starpos != NULL) *(starpos) = '\0';
while (*src == ' ') ++src;
if (!hasP && !hasS && *src != '\0')
lcd_setstatus(src, true);
if (!hasP && !hasS && *args != '\0')
lcd_setstatus(args, true);
else {
LCD_MESSAGEPGM(MSG_USERWAIT);
#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
......@@ -3734,20 +3728,12 @@ inline void gcode_G92() {
refresh_cmd_timeout();
if (codenum > 0) {
codenum += previous_cmd_ms; // keep track of when we started waiting
while(millis() < codenum && !lcd_clicked()) {
manage_heater();
manage_inactivity();
lcd_update();
}
while(millis() < codenum && !lcd_clicked()) idle();
lcd_ignore_click(false);
}
else {
if (!lcd_detected()) return;
while (!lcd_clicked()) {
manage_heater();
manage_inactivity();
lcd_update();
}
while (!lcd_clicked()) idle();
}
if (IS_SD_PRINTING)
LCD_MESSAGEPGM(MSG_RESUMING);
......@@ -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
*
......@@ -3975,12 +3960,8 @@ inline void gcode_M31() {
* /Miscellaneous/Armchair/Armchair.gcode
*/
inline void gcode_M33() {
char *args = seen_pointer + 4;
while (*args == ' ') ++args;
//clear_asterisk(args);
card.printLongPath(args);
card.printLongPath(current_command_args);
}
#endif
/**
......@@ -4245,13 +4226,11 @@ inline void gcode_M42() {
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);
FlushSerialRequestResend();
}
#endif // ENABLE_AUTO_BED_LEVELING && Z_PROBE_REPEATABILITY_TEST
......@@ -4778,7 +4757,7 @@ inline void gcode_M200() {
if (code_seen('T')) {
tmp_extruder = code_value_short();
if (tmp_extruder >= EXTRUDERS) {
ECHO_LM(ER, MSG_M200_INVALID_EXTRUDER);
error_invalid_extruder(200, tmp_extruder);
return;
}
}
......@@ -5036,11 +5015,7 @@ inline void gcode_M226() {
break;
}
while(digitalRead(pin_number) != target) {
manage_heater();
manage_inactivity();
lcd_update();
}
while(digitalRead(pin_number) != target) idle();
} // pin_number > -1
} // pin_state -1 0 1
......@@ -5550,7 +5525,7 @@ inline void gcode_M503() {
inline void gcode_M600() {
float target[NUM_AXIS], fr60 = feedrate / 60;
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];
#ifdef DELTA
......@@ -5604,11 +5579,10 @@ inline void gcode_M503() {
delay(100);
boolean beep = true;
boolean sleep = false;
int cnt = 0;
uint8_t cnt = 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];
}
int old_target_temperature_bed = target_temperature_bed;
......@@ -5617,9 +5591,7 @@ inline void gcode_M503() {
PRESSBUTTON:
LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE);
while (!lcd_clicked()) {
manage_heater();
manage_inactivity(true);
lcd_update();
idle(true);
if ((millis() - last_set > 60000) && cnt <= FILAMENTCHANGE_PRINTEROFF) beep = true;
if (cnt >= FILAMENTCHANGE_PRINTEROFF && !sleep) {
disable_all_heaters();
......@@ -5629,17 +5601,15 @@ inline void gcode_M503() {
LCD_ALERTMESSAGEPGM("Zzzz Zzzz Zzzz");
}
if (beep) {
for(int8_t i = 0; i < 3; i++) lcd_buzz(100, 1000);
last_set = millis();
for(int8_t i = 0; i < 3; i++) {
lcd_buzz(100, 1000);
}
beep = false;
cnt += 1;
}
++cnt;
}
} // while(!lcd_clicked)
//reset LCD alert message
lcd_reset_alert_level();
lcd_quick_feedback(); // click sound feedback
lcd_reset_alert_level(); //reset LCD alert message
if (sleep) {
enable_all_steppers(); // Enable all stepper
......@@ -5687,6 +5657,12 @@ inline void gcode_M503() {
filrunoutEnqueued = false;
#endif
}
/**
* M601: Resume the print from filament change
*/
inline void gcode_M601() { filament_changing = false; }
#endif //FILAMENTCHANGEENABLE
#ifdef DUAL_X_CARRIAGE
......@@ -6283,27 +6259,29 @@ void process_next_command() {
gcode_M20(); break;
case 21: // M21 - init SD card
gcode_M21(); break;
case 22: //M22 - release SD card
case 22: // M22 - release SD card
gcode_M22(); break;
case 23: //M23 - Select file
case 23: // M23 - Select file
gcode_M23(); break;
case 24: //M24 - Start SD print
case 24: // M24 - Start SD print
gcode_M24(); break;
case 25: //M25 - Pause SD print
case 25: // M25 - Pause SD print
gcode_M25(); break;
case 26: //M26 - Set SD index
case 26: // M26 - Set SD index
gcode_M26(); break;
case 27: //M27 - Get SD status
case 27: // M27 - Get SD status
gcode_M27(); break;
case 28: //M28 - Start SD write
case 28: // M28 - Start SD write
gcode_M28(); break;
case 29: //M29 - Stop SD write
case 29: // M29 - Stop SD write
gcode_M29(); break;
case 30: //M30 <filename> Delete File
case 30: // M30 <filename> Delete File
gcode_M30(); break;
case 32: //M32 - Select file and start SD print
case 32: // M32 - Select file and start SD print
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;
#endif //SDSUPPORT
......@@ -6550,7 +6528,7 @@ void process_next_command() {
#endif
#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;
#endif // FILAMENTCHANGEENABLE
......@@ -6950,6 +6928,15 @@ void disable_all_steppers() {
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:
* - Check for Filament Runout
......@@ -7254,25 +7241,15 @@ bool setTargetedHotend(int code) {
if (code_seen('T')) {
target_extruder = code_value_short();
if (target_extruder >= EXTRUDERS) {
ECHO_S(ER);
switch(code) {
case 104:
ECHO_M(MSG_M104_INVALID_EXTRUDER);
break;
case 105:
ECHO_M(MSG_M105_INVALID_EXTRUDER);
break;
case 109:
ECHO_M(MSG_M109_INVALID_EXTRUDER);
break;
case 218:
ECHO_M(MSG_M218_INVALID_EXTRUDER);
break;
case 221:
ECHO_M(MSG_M221_INVALID_EXTRUDER);
error_invalid_extruder(code, target_extruder);
break;
}
ECHO_EV(target_extruder);
return true;
}
}
......
......@@ -3,7 +3,7 @@
Created by Tim Koster, August 21 2013.
*/
#include "Marlin.h"
#ifdef BLINKM
#if ENABLED(BLINKM)
#include "blinkm.h"
......
......@@ -5,7 +5,7 @@
#include "temperature.h"
#include "language.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
CardReader::CardReader() {
filesize = 0;
......@@ -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_index = 0;
//power to SD reader
#if SDPOWER > -1
OUT_WRITE(SDPOWER, HIGH);
......@@ -125,7 +126,7 @@ void CardReader::ls() {
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
......@@ -190,7 +191,7 @@ void CardReader::initsd() {
cardOK = false;
if (root.isOpen()) root.close();
#ifdef SDSLOW
#if ENABLED(SDSLOW)
#define SPI_SPEED SPI_HALF_SPEED
#else
#define SPI_SPEED SPI_FULL_SPEED
......@@ -448,7 +449,7 @@ void CardReader::checkautostart(bool force) {
if (!cardOK) return; // fail
}
char autoname[30];
char autoname[10];
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]);
......@@ -460,7 +461,7 @@ void CardReader::checkautostart(bool force) {
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]);
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);
enqueuecommand(cmd);
enqueuecommands_P(PSTR("M24"));
......@@ -607,22 +608,22 @@ void CardReader::chdir(const char * relpath) {
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) {
workDirDepth++;
++workDirDepth;
for (int d = workDirDepth; d--;) workDirParents[d + 1] = workDirParents[d];
workDirParents[0] = *parent;
}
workDir = newfile;
}
else {
ECHO_LMV(ER, MSG_SD_CANT_ENTER_SUBDIR, relpath);
}
}
void CardReader::updir() {
if (workDirDepth > 0) {
workDirDepth--;
--workDirDepth;
workDir = workDirParents[0];
for (uint16_t d = 0; d < workDirDepth; d++)
workDirParents[d] = workDirParents[d+1];
......
#ifndef CARDREADER_H
#define CARDREADER_H
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#define MAX_DIR_DEPTH 10 // Maximum folder depth
......@@ -84,7 +84,7 @@ extern CardReader card;
#define IS_SD_PRINTING (card.sdprinting)
#if (SDCARDDETECT > -1)
#ifdef SDCARDDETECTINVERTED
#if ENABLED(SDCARDDETECTINVERTED)
#define IS_SD_INSERTED (READ(SDCARDDETECT) != 0)
#else
#define IS_SD_INSERTED (READ(SDCARDDETECT) == 0)
......
......@@ -43,7 +43,7 @@
#define OK "ok" //ok answer for host
#define ER "Error: " //error 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 PAUSE "//action:pause" //command for host that support action
#define RESUME "//action:resume" //command for host that support action
......
......@@ -4,17 +4,10 @@
*/
#ifndef CONDITIONALS_H
#ifndef M_PI
#define M_PI 3.1415926536
#endif
#ifndef CONFIGURATION_LCD // Get the LCD defines which are needed first
#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
#ifndef CONFIGURATION_LCD // Get the LCD defines which are needed first
#define CONFIGURATION_LCD
#if defined(MAKRPANEL)
#if ENABLED(MAKRPANEL)
#define DOGLCD
#define SDSUPPORT
#define DEFAULT_LCD_CONTRAST 17
......@@ -22,16 +15,16 @@
#define NEWPANEL
#endif
#if defined(miniVIKI) || defined(VIKI2) || defined(ELB_FULL_GRAPHIC_CONTROLLER)
#if ENABLED(miniVIKI) || ENABLED(VIKI2) || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
#define ULTRA_LCD //general LCD support, also 16x2
#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
#ifdef miniVIKI
#if ENABLED(miniVIKI)
#define DEFAULT_LCD_CONTRAST 95
#elif defined(VIKI2)
#elif ENABLED(VIKI2)
#define DEFAULT_LCD_CONTRAST 40
#elif defined(ELB_FULL_GRAPHIC_CONTROLLER)
#elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
#define DEFAULT_LCD_CONTRAST 110
#define SDCARDDETECTINVERTED
#define SDSLOW
......@@ -42,23 +35,23 @@
#define ENCODER_STEPS_PER_MENU_ITEM 1
#endif
#ifdef PANEL_ONE
#if ENABLED(PANEL_ONE)
#define SDSUPPORT
#define ULTIMAKERCONTROLLER
#endif
#ifdef REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
#if ENABLED(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)
#if ENABLED(ULTIMAKERCONTROLLER) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL)
#define ULTIPANEL
#define NEWPANEL
#endif
#if defined(RADDS_DISPLAY)
#if ENABLED(RADDS_DISPLAY)
#define ENCODER_PULSES_PER_STEP 2
#define ENCODER_STEPS_PER_MENU_ITEM 1
......@@ -66,12 +59,12 @@
#define NEWPANEL
#endif
#ifdef REPRAPWORLD_KEYPAD
#if ENABLED(REPRAPWORLD_KEYPAD)
#define ULTIPANEL
#define NEWPANEL
#endif
#ifdef RA_CONTROL_PANEL
#if ENABLED(RA_CONTROL_PANEL)
#define LCD_I2C_TYPE_PCA8574
#define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
#define ULTIPANEL
......@@ -82,7 +75,7 @@
* I2C PANELS
*/
#ifdef LCD_I2C_SAINSMART_YWROBOT
#if ENABLED(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
......@@ -92,7 +85,7 @@
#endif
// PANELOLU2 LCD with status LEDs, separate encoder and click inputs
#ifdef LCD_I2C_PANELOLU2
#if ENABLED(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)
......@@ -102,15 +95,15 @@
#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
#if DISABLED(ENCODER_PULSES_PER_STEP)
#define ENCODER_PULSES_PER_STEP 4
#endif
#ifndef ENCODER_STEPS_PER_MENU_ITEM
#if DISABLED(ENCODER_STEPS_PER_MENU_ITEM)
#define ENCODER_STEPS_PER_MENU_ITEM 1
#endif
#ifdef LCD_USE_I2C_BUZZER
#if ENABLED(LCD_USE_I2C_BUZZER)
#define LCD_FEEDBACK_FREQUENCY_HZ 1000
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
#endif
......@@ -120,7 +113,7 @@
#endif
// Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
#ifdef LCD_I2C_VIKI
#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
......@@ -137,17 +130,17 @@
// 2 wire Non-latching LCD SR from:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
#ifdef SAV_3DLCD
#if ENABLED(SAV_3DLCD)
#define SR_LCD_2W_NL // Non latching 2 wire shiftregister
#define ULTIPANEL
#define NEWPANEL
#endif
#ifdef ULTIPANEL
#if ENABLED(ULTIPANEL)
#define NEWPANEL //enable this if you have a click-encoder panel
#define SDSUPPORT
#define ULTRA_LCD
#ifdef DOGLCD // Change number of lines to match the DOG graphic display
#if ENABLED(DOGLCD) // Change number of lines to match the DOG graphic display
#define LCD_WIDTH 22
#define LCD_HEIGHT 5
#else
......@@ -155,8 +148,8 @@
#define LCD_HEIGHT 4
#endif
#else //no panel but just LCD
#ifdef ULTRA_LCD
#ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
#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
......@@ -166,7 +159,7 @@
#endif
#endif
#ifdef DOGLCD
#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"
......@@ -198,13 +191,13 @@
/**
* Default LCD contrast for dogm-like LCD displays
*/
#if defined(DOGLCD) && !defined(DEFAULT_LCD_CONTRAST)
#if ENABLED(DOGLCD) && DISABLED(DEFAULT_LCD_CONTRAST)
#define DEFAULT_LCD_CONTRAST 32
#endif
#ifdef DOGLCD
#if ENABLED(DOGLCD)
#define HAS_LCD_CONTRAST
#ifdef U8GLIB_ST7920
#if ENABLED(U8GLIB_ST7920)
#undef HAS_LCD_CONTRAST
#endif
#endif
......@@ -212,24 +205,23 @@
/**
* LCD BUZZ
*/
#define HAS_LCD_BUZZ (defined(ULTRALCD) || (defined(BEEPER) && BEEPER >= 0) || defined(LCD_USE_I2C_BUZZER))
#define HAS_LCD_BUZZ (ENABLED(ULTRALCD) || (ENABLED(BEEPER) && BEEPER >= 0) || ENABLED(LCD_USE_I2C_BUZZER))
/**
* SPLASH_SCREEN_DURATION for no DOGLCD display
*/
#ifndef DOGLCD
#if DISABLED(DOGLCD)
#undef SPLASH_SCREEN_DURATION
#define SPLASH_SCREEN_DURATION 500
#endif
#else // CONFIGURATION_LCD
#else // CONFIGURATION_LCD
#define CONDITIONALS_H
/**
* SINGLENOZZLE
*/
#ifdef SINGLENOZZLE
#if ENABLED(SINGLENOZZLE)
#define HOTENDS 1
#undef TEMP_SENSOR_1_AS_REDUNDANT
#else
......@@ -239,7 +231,7 @@
/**
* DRIVER_EXTRUDERS
*/
#if !defined(MKR4) && !defined(NPR2)
#if DISABLED(MKR4) && DISABLED(NPR2)
#define DRIVER_EXTRUDERS EXTRUDERS // This defines the number of Driver extruder
#endif
......@@ -260,7 +252,7 @@
/**
* ENDSTOPPULLUPS
*/
#ifdef ENDSTOPPULLUPS
#if ENABLED(ENDSTOPPULLUPS)
#define ENDSTOPPULLUP_XMAX
#define ENDSTOPPULLUP_YMAX
#define ENDSTOPPULLUP_ZMAX
......@@ -301,7 +293,7 @@
/**
* Firmware Test
*/
#ifdef FIRMWARE_TEST
#if ENABLED(FIRMWARE_TEST)
#undef BAUDRATE
#define BAUDRATE 115200 // Baudrate setting to 115200 because serial monitor arduino function at max 115200 baudrate.
#endif
......@@ -316,7 +308,7 @@
/**
* SCARA
*/
#ifdef SCARA
#if ENABLED(SCARA)
#undef SLOWDOWN
#define QUICK_HOME //SCARA needs Quickhome
#endif
......@@ -324,7 +316,7 @@
/**
* DELTA
*/
#ifdef DELTA
#if ENABLED(DELTA)
#undef SLOWDOWN //DELTA not needs SLOWDOWN
// DELTA must have same valour for 3 axis endstop hits
#undef Y_HOME_BUMP_MM
......@@ -337,12 +329,12 @@
* AUTOSET LOCATIONS OF LIMIT SWITCHES
* Added by ZetaPhoenix 09-15-2012
*/
#ifdef MANUAL_HOME_POSITIONS // Use manual limit switch locations
#if ENABLED(MANUAL_HOME_POSITIONS) // Use manual limit switch locations
#define X_HOME_POS MANUAL_X_HOME_POS
#define Y_HOME_POS MANUAL_Y_HOME_POS
#define Z_HOME_POS MANUAL_Z_HOME_POS
#else //!MANUAL_HOME_POSITIONS – Use home switch positions based on homing direction and travel limits
#ifdef BED_CENTER_AT_0_0
#if ENABLED(BED_CENTER_AT_0_0)
#define X_HOME_POS X_MAX_LENGTH * X_HOME_DIR * 0.5
#define Y_HOME_POS Y_MAX_LENGTH * Y_HOME_DIR * 0.5
#else
......@@ -355,7 +347,7 @@
/**
* Auto Bed Leveling
*/
#ifdef ENABLE_AUTO_BED_LEVELING
#if ENABLED(ENABLE_AUTO_BED_LEVELING)
// Boundaries for probing based on set limits
#define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
......@@ -366,7 +358,7 @@
/**
* Sled Options
*/
#ifdef Z_PROBE_SLED
#if ENABLED(Z_PROBE_SLED)
#define Z_SAFE_HOMING
#endif
......@@ -380,7 +372,7 @@
* MAX_STEP_FREQUENCY differs for TOSHIBA OR ARDUINO DUE OR ARDUINO MEGA
*/
#ifdef __SAM3X8E__
#ifdef CONFIG_STEPPERS_TOSHIBA
#if ENABLED(CONFIG_STEPPERS_TOSHIBA)
#define MAX_STEP_FREQUENCY 120000 // Max step frequency for Toshiba Stepper Controllers
#define DOUBLE_STEP_FREQUENCY MAX_STEP_FREQUENCY
#else
......@@ -388,7 +380,7 @@
#define DOUBLE_STEP_FREQUENCY 120000 //96kHz is close to maximum for an Arduino Due
#endif
#else
#ifdef CONFIG_STEPPERS_TOSHIBA
#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
......@@ -411,12 +403,12 @@
/**
* Advance calculated values
*/
#ifdef ADVANCE
#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
#ifdef ULTIPANEL
#if ENABLED(ULTIPANEL)
#undef SDCARDDETECTINVERTED
#endif
......@@ -484,6 +476,8 @@
#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
......@@ -515,96 +509,10 @@
#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
#if ENABLED(INVERTED_HEATER_PINS)
#define WRITE_HEATER(pin,value) WRITE(pin,!value)
#else
#define WRITE_HEATER(pin,value) WRITE(pin,value)
......@@ -619,7 +527,7 @@
#endif
#endif
#endif
#ifdef HEATERS_PARALLEL
#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)
......@@ -631,11 +539,6 @@
#define WRITE_FAN(v) WRITE(FAN_PIN, v)
#endif
/**
* 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 //CONFIGURATION_LCD
#endif //CONFIGURATION_LCD
#endif //CONDITIONALS_H
......@@ -102,7 +102,7 @@
#include "ultralcd.h"
#include "configuration_store.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#include "cardreader.h"
#endif
......@@ -138,7 +138,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) {
#define EEPROM_OFFSET 100
#ifdef EEPROM_SETTINGS
#if ENABLED(EEPROM_SETTINGS)
void Config_StoreSettings() {
float dummy = 0.0f;
......@@ -159,7 +159,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, max_e_jerk);
EEPROM_WRITE_VAR(i, home_offset);
#ifndef DELTA
#if DISABLED(DELTA)
EEPROM_WRITE_VAR(i, zprobe_zoffset);
#endif
......@@ -167,21 +167,21 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, hotend_offset);
#endif
#ifdef DELTA
#if ENABLED(DELTA)
EEPROM_WRITE_VAR(i, endstop_adj);
EEPROM_WRITE_VAR(i, delta_radius);
EEPROM_WRITE_VAR(i, delta_diagonal_rod);
EEPROM_WRITE_VAR(i, max_pos);
EEPROM_WRITE_VAR(i, tower_adj);
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
#endif
#ifndef ULTIPANEL
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;
int gumPreheatHotendTemp = GUM_PREHEAT_HOTEND_TEMP, gumPreheatHPBTemp = GUM_PREHEAT_HPB_TEMP, gumPreheatFanSpeed = GUM_PREHEAT_FAN_SPEED;
#if DISABLED(ULTIPANEL)
int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED,
absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED,
gumPreheatHotendTemp = GUM_PREHEAT_HOTEND_TEMP, gumPreheatHPBTemp = GUM_PREHEAT_HPB_TEMP, gumPreheatFanSpeed = GUM_PREHEAT_FAN_SPEED;
#endif
EEPROM_WRITE_VAR(i, plaPreheatHotendTemp);
......@@ -195,7 +195,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, gumPreheatFanSpeed);
for (int e = 0; e < 4; e++) {
#ifdef PIDTEMP
#if ENABLED(PIDTEMP)
if (e < HOTENDS) {
EEPROM_WRITE_VAR(i, PID_PARAM(Kp, e));
EEPROM_WRITE_VAR(i, PID_PARAM(Ki, e));
......@@ -212,7 +212,7 @@ void Config_StoreSettings() {
} // Extruders Loop
#ifndef PIDTEMPBED
#if DISABLED(PIDTEMPBED)
float bedKp = DUMMY_PID_VALUE, bedKi = DUMMY_PID_VALUE, bedKd = DUMMY_PID_VALUE;
#endif
......@@ -220,19 +220,19 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, bedKi);
EEPROM_WRITE_VAR(i, bedKd);
#if !defined(DOGLCD) || LCD_CONTRAST < 0
int lcd_contrast = 32;
#if DISABLED(DOGLCD) || LCD_CONTRAST < 0
const int lcd_contrast = 32;
#endif
EEPROM_WRITE_VAR(i, lcd_contrast);
#ifdef SCARA
#if ENABLED(SCARA)
EEPROM_WRITE_VAR(i, axis_scaling); // 3 floats
#else
dummy = 1.0f;
EEPROM_WRITE_VAR(i, dummy);
#endif
#ifdef FWRETRACT
#if ENABLED(FWRETRACT)
EEPROM_WRITE_VAR(i, autoretract_enabled);
EEPROM_WRITE_VAR(i, retract_length);
#if EXTRUDERS > 1
......@@ -261,7 +261,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, dummy);
}
#ifdef IDLE_OOZING_PREVENT
#if ENABLED(IDLE_OOZING_PREVENT)
EEPROM_WRITE_VAR(i, idleoozing_enabled);
#endif
......@@ -310,7 +310,7 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, max_e_jerk);
EEPROM_READ_VAR(i, home_offset);
#ifndef DELTA
#if DISABLED(DELTA)
EEPROM_READ_VAR(i, zprobe_zoffset);
#endif
......@@ -318,7 +318,7 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, hotend_offset);
#endif
#ifdef DELTA
#if ENABLED(DELTA)
EEPROM_READ_VAR(i, endstop_adj);
EEPROM_READ_VAR(i, delta_radius);
EEPROM_READ_VAR(i, delta_diagonal_rod);
......@@ -329,7 +329,7 @@ void Config_RetrieveSettings() {
set_delta_constants();
#endif //DELTA
#ifndef ULTIPANEL
#if DISABLED(ULTIPANEL)
int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed,
absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed,
gumPreheatHotendTemp, gumPreheatHPBTemp, gumPreheatFanSpeed;
......@@ -345,7 +345,7 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, gumPreheatHPBTemp);
EEPROM_READ_VAR(i, gumPreheatFanSpeed);
#ifdef PIDTEMP
#if ENABLED(PIDTEMP)
for (int e = 0; e < 4; e++) { // 4 = max hotend currently supported
EEPROM_READ_VAR(i, dummy); // Kp
if (e < EXTRUDERS && dummy != DUMMY_PID_VALUE) {
......@@ -363,7 +363,7 @@ void Config_RetrieveSettings() {
for (int q = 12; q--;) EEPROM_READ_VAR(i, dummy); // 4x Kp, Ki, Kd
#endif // !PIDTEMP
#ifndef PIDTEMPBED
#if DISABLED(PIDTEMPBED)
float bedKp, bedKi, bedKd;
#endif
......@@ -377,19 +377,19 @@ void Config_RetrieveSettings() {
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;
#endif //DOGLCD
#endif
EEPROM_READ_VAR(i, lcd_contrast);
#ifdef SCARA
#if ENABLED(SCARA)
EEPROM_READ_VAR(i, axis_scaling); // 3 floats
#else
EEPROM_READ_VAR(i, dummy);
#endif
#ifdef FWRETRACT
#if ENABLED(FWRETRACT)
EEPROM_READ_VAR(i, autoretract_enabled);
EEPROM_READ_VAR(i, retract_length);
#if EXTRUDERS > 1
......@@ -417,7 +417,7 @@ void Config_RetrieveSettings() {
calculate_volumetric_multipliers();
#ifdef IDLE_OOZING_PREVENT
#if ENABLED(IDLE_OOZING_PREVENT)
EEPROM_READ_VAR(i, idleoozing_enabled);
#endif
......@@ -444,13 +444,13 @@ void Config_ResetDefault() {
float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT;
float tmp2[] = DEFAULT_MAX_FEEDRATE;
long tmp3[] = DEFAULT_MAX_ACCELERATION;
#ifdef PIDTEMP
#if ENABLED(PIDTEMP)
float tmp4[] = DEFAULT_Kp;
float tmp5[] = DEFAULT_Ki;
float tmp6[] = DEFAULT_Kd;
#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 tmp8[] = HOTEND_OFFSET_Y;
#else
......@@ -469,7 +469,7 @@ void Config_ResetDefault() {
hotend_offset[X_AXIS][i] = tmp7[i];
hotend_offset[Y_AXIS][i] = tmp8[i];
#endif
#ifdef SCARA
#if ENABLED(SCARA)
if (i < sizeof(axis_scaling) / sizeof(*axis_scaling))
axis_scaling[i] = 1;
#endif
......@@ -489,13 +489,13 @@ void Config_ResetDefault() {
max_e_jerk = DEFAULT_EJERK;
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;
#elif !defined DELTA
#elif DISABLED(DELTA)
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;
delta_radius = DEFAULT_DELTA_RADIUS;
delta_diagonal_rod = DEFAULT_DELTA_DIAGONAL_ROD;
......@@ -503,9 +503,9 @@ void Config_ResetDefault() {
max_pos[2] = MANUAL_Z_HOME_POS;
set_default_z_probe_offset();
set_delta_constants();
#endif //DELTA
#endif
#ifdef ULTIPANEL
#if ENABLED(ULTIPANEL)
plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP;
plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP;
plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
......@@ -517,11 +517,11 @@ void Config_ResetDefault() {
gumPreheatFanSpeed = GUM_PREHEAT_FAN_SPEED;
#endif
#if defined(DOGLCD) && LCD_CONTRAST >= 0
#if ENABLED(HAS_LCD_CONTRAST)
lcd_contrast = DEFAULT_LCD_CONTRAST;
#endif //DOGLCD
#ifdef PIDTEMP
#if ENABLED(PIDTEMP)
for (int e = 0; e < HOTENDS; e++)
{
Kp[e] = tmp4[e];
......@@ -530,9 +530,15 @@ void Config_ResetDefault() {
}
// call updatePID (similar to when we have processed M301)
updatePID();
#endif//PIDTEMP
#endif // PIDTEMP
#if ENABLED(PIDTEMPBED)
bedKp = DEFAULT_bedKp;
bedKi = scalePID_i(DEFAULT_bedKi);
bedKd = scalePID_d(DEFAULT_bedKd);
#endif
#ifdef FWRETRACT
#if ENABLED(FWRETRACT)
autoretract_enabled = false;
retract_length = RETRACT_LENGTH;
#if EXTRUDERS > 1
......@@ -555,22 +561,22 @@ void Config_ResetDefault() {
filament_size[2] = DEFAULT_NOMINAL_FILAMENT_DIA;
#if EXTRUDERS > 3
filament_size[3] = DEFAULT_NOMINAL_FILAMENT_DIA;
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
#endif // EXTRUDERS > 3
#endif // EXTRUDERS > 2
#endif // EXTRUDERS > 1
calculate_volumetric_multipliers();
#ifdef IDLE_OOZING_PREVENT
#if ENABLED(IDLE_OOZING_PREVENT)
idleoozing_enabled = true;
#endif
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) {
// Always have this function, even with EEPROM_SETTINGS disabled, the current values will be shown
......@@ -593,7 +599,7 @@ void Config_ResetDefault() {
#endif //EXTRUDERS > 1
ECHO_E;
#ifdef SCARA
#if ENABLED(SCARA)
if (!forReplay) {
ECHO_LM(DB, "Scaling factors:");
}
......@@ -673,7 +679,7 @@ void Config_ResetDefault() {
}
#endif //HOTENDS > 1
#ifdef DELTA
#if ENABLED(DELTA)
if (!forReplay) {
ECHO_LM(DB, "Delta Geometry adjustment:");
}
......@@ -701,19 +707,19 @@ void Config_ResetDefault() {
ECHO_MV(" Y", z_probe_offset[1]);
ECHO_EMV(" Z", z_probe_offset[2]);
#elif defined(Z_DUAL_ENDSTOPS)
#elif ENABLED(Z_DUAL_ENDSTOPS)
if (!forReplay) {
ECHO_LM(DB, "Z2 Endstop adjustement (mm):");
}
ECHO_LMV(DB, " M666 Z", z_endstop_adj );
#elif defined(ENABLE_AUTO_BED_LEVELING)
#elif ENABLED(ENABLE_AUTO_BED_LEVELING)
if (!forReplay) {
ECHO_LM(DB, "Z Probe offset (mm)");
}
ECHO_LMV(DB, " M666 P", zprobe_zoffset);
#endif // DELTA
#endif
#ifdef ULTIPANEL
#if ENABLED(ULTIPANEL)
if (!forReplay) {
ECHO_LM(DB, "Material heatup parameters:");
}
......@@ -731,11 +737,11 @@ void Config_ResetDefault() {
ECHO_EM(" (Material GUM)");
#endif // ULTIPANEL
#if defined(PIDTEMP) || defined(PIDTEMPBED)
#if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED)
if (!forReplay) {
ECHO_LM(DB, "PID settings:");
}
#ifdef PIDTEMP
#if ENABLED(PIDTEMP)
for (int e = 0; e < HOTENDS; e++) {
ECHO_SMV(DB, " M301 E", e);
ECHO_MV(" P", PID_PARAM(Kp, e));
......@@ -743,14 +749,14 @@ void Config_ResetDefault() {
ECHO_EMV(" D", unscalePID_d(PID_PARAM(Kd, e)));
}
#endif
#ifdef PIDTEMPBED
#if ENABLED(PIDTEMPBED)
ECHO_SMV(DB, " M304 P", bedKp); // for compatibility with hosts, only echos values for E0
ECHO_MV(" I", unscalePID_i(bedKi));
ECHO_EMV(" D", unscalePID_d(bedKd));
#endif
#endif
#ifdef FWRETRACT
#if ENABLED(FWRETRACT)
if (!forReplay) {
ECHO_LM(DB,"Retract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)");
}
......@@ -807,7 +813,7 @@ void Config_ResetDefault() {
void ConfigSD_PrintSettings(bool forReplay) {
// Always have this function, even with SD_SETTINGS disabled, the current values will be shown
#ifdef POWER_CONSUMPTION
#if ENABLED(POWER_CONSUMPTION)
if (!forReplay) {
ECHO_LM(DB, "Watt/h consumed:");
}
......@@ -822,7 +828,7 @@ void Config_ResetDefault() {
ECHO_LV(DB, time);
}
#endif //!DISABLE_M503
#endif // !DISABLE_M503
/**
* Configuration on SD card
......@@ -831,14 +837,14 @@ void Config_ResetDefault() {
*
*/
void ConfigSD_ResetDefault() {
#ifdef POWER_CONSUMPTION
#if ENABLED(POWER_CONSUMPTION)
power_consumption_hour = 0;
#endif
printer_usage_seconds = 0;
ECHO_LM(OK, "Hardcoded SD Default Settings Loaded");
}
#if defined(SDSUPPORT) && defined(SD_SETTINGS)
#if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS)
void ConfigSD_StoreSettings() {
if(!IS_SD_INSERTED || card.isFileOpen() || card.sdprinting) return;
......
......@@ -6,7 +6,7 @@
void Config_ResetDefault();
void ConfigSD_ResetDefault();
#ifndef DISABLE_M503
#if DISABLED(DISABLE_M503)
void Config_PrintSettings(bool forReplay = false);
void ConfigSD_PrintSettings(bool forReplay = false);
#else
......@@ -22,7 +22,7 @@ void ConfigSD_ResetDefault();
FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
#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.)
#ifdef POWER_CONSUMPTION
"PWR",
......
......@@ -3,7 +3,7 @@
// Please note that using the high-res version takes 402Bytes of PROGMEM.
//#define START_BMPHIGH
#ifdef START_BMPHIGH
#if ENABLED(START_BMPHIGH)
#define START_BMPWIDTH 112
#define START_BMPHEIGHT 38
#define START_BMPBYTEWIDTH 14
......
......@@ -18,7 +18,7 @@
* 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_B 1
#define BLEN_C 2
......@@ -35,12 +35,12 @@
#include "ultralcd_st7920_u8glib_rrd.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
#endif
#ifdef USE_SMALL_INFOFONT
#if ENABLED(USE_SMALL_INFOFONT)
#include "dogm_font_data_6x9_marlin.h"
#define FONT_STATUSMENU_NAME u8g_font_6x9
#else
......@@ -50,17 +50,17 @@
#include "dogm_font_data_Marlin_symbols.h" // The Marlin special symbols
#define FONT_SPECIAL_NAME Marlin_symbols
#ifndef SIMULATE_ROMFONT
#if defined( DISPLAY_CHARSET_ISO10646_1 )
#if DISABLED(SIMULATE_ROMFONT)
#if ENABLED(DISPLAY_CHARSET_ISO10646_1)
#include "dogm_font_data_ISO10646_1.h"
#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"
#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"
#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"
#define FONT_MENU_NAME ISO10646_CN
#define TALL_FONT_CORRECTION 1
......@@ -69,13 +69,13 @@
#define FONT_MENU_NAME ISO10646_1_5x7
#endif
#else // SIMULATE_ROMFONT
#if defined( DISPLAY_CHARSET_HD44780_JAPAN )
#if ENABLED(DISPLAY_CHARSET_HD44780_JAPAN)
#include "dogm_font_data_HD44780_J.h"
#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"
#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"
#define FONT_MENU_NAME HD44780_C_5x7
#else // fall-back
......@@ -94,7 +94,7 @@
// DOGM parameters (size in pixels)
#define DOG_CHAR_WIDTH 6
#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 DOG_CHAR_WIDTH_EDIT 9
#define DOG_CHAR_HEIGHT_EDIT 18
......@@ -113,16 +113,16 @@
#define START_ROW 0
// LCD selection
#ifdef U8GLIB_ST7920
#if ENABLED(U8GLIB_ST7920)
//U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
U8GLIB_ST7920_128X64_RRD u8g(0);
#elif defined(MAKRPANEL)
#elif ENABLED(MAKRPANEL)
// The MaKrPanel display, ST7565 controller as well
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
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)
U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0);
#else
......@@ -189,7 +189,7 @@ static bool show_splashscreen = true;
/* Warning: This function is called from interrupt context */
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);
digitalWrite(LCD_PIN_BL, HIGH);
#endif
......@@ -200,17 +200,17 @@ static void lcd_implementation_init() {
// pinMode(17, OUTPUT); // Enable LCD backlight
// digitalWrite(17, HIGH);
#ifdef LCD_SCREEN_ROT_90
#if ENABLED(LCD_SCREEN_ROT_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°
#elif defined(LCD_SCREEN_ROT_270)
#elif ENABLED(LCD_SCREEN_ROT_270)
u8g.setRot270(); // Rotate screen by 270°
#endif
// Show splashscreen
int offx = (u8g.getWidth() - START_BMPWIDTH) / 2;
#ifdef START_BMPHIGH
#if ENABLED(START_BMPHIGH)
int offy = 0;
#else
int offy = DOG_CHAR_HEIGHT;
......@@ -265,7 +265,7 @@ static void lcd_implementation_status_screen() {
// Symbols menu graphics, animated fan
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
u8g.drawBox(42, 42 - TALL_FONT_CORRECTION, 8, 7);
u8g.drawBox(50, 44 - TALL_FONT_CORRECTION, 2, 5);
......@@ -333,7 +333,7 @@ static void lcd_implementation_status_screen() {
#define XYZ_BASELINE 38
lcd_setFont(FONT_STATUSMENU);
#ifdef USE_SMALL_INFOFONT
#if ENABLED(USE_SMALL_INFOFONT)
u8g.drawBox(0,30,LCD_PIXEL_WIDTH,10);
#else
u8g.drawBox(0,30,LCD_PIXEL_WIDTH,9);
......@@ -379,7 +379,7 @@ static void lcd_implementation_status_screen() {
// Status line
lcd_setFont(FONT_STATUSMENU);
#ifdef USE_SMALL_INFOFONT
#if ENABLED(USE_SMALL_INFOFONT)
u8g.setPrintPos(0,62);
#else
u8g.setPrintPos(0,63);
......@@ -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 vallen = lcd_strlen(value);
#ifdef USE_BIG_EDIT_FONT
#if ENABLED(USE_BIG_EDIT_FONT)
if (lcd_strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) {
lcd_setFont(FONT_MENU_EDIT);
lcd_width = LCD_WIDTH_EDIT + 1;
......
......@@ -104,14 +104,8 @@
#define MSG_FILE_PRINTED "Done printing file"
#define MSG_BEGIN_FILE_LIST "Begin 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_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_HEATING "Heating..."
#define MSG_HEATING_COMPLETE "Heating done."
......@@ -238,7 +232,7 @@
#define MSG_BED_LEVELLING_Z " Z: "
// 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
#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
********************************* END MOTHERBOARD ***************************************
/****************************************************************************************/
#ifndef KNOWN_BOARD
#if DISABLED(KNOWN_BOARD)
#error Unknown MOTHERBOARD value in configuration.h
#endif
......@@ -4980,35 +4980,35 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#define Z_MAX_PIN -1
#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
#endif
#ifdef DISABLE_XMAX_ENDSTOP
#if ENABLED(DISABLE_XMAX_ENDSTOP)
#undef X_MAX_PIN
#define X_MAX_PIN -1
#endif
#ifdef DISABLE_XMIN_ENDSTOP
#if ENABLED(DISABLE_XMIN_ENDSTOP)
#undef X_MIN_PIN
#define X_MIN_PIN -1
#endif
#ifdef DISABLE_YMAX_ENDSTOP
#if ENABLED(DISABLE_YMAX_ENDSTOP)
#define Y_MAX_PIN -1
#endif
#ifdef DISABLE_YMIN_ENDSTOP
#if ENABLED(DISABLE_YMIN_ENDSTOP)
#undef Y_MIN_PIN
#define Y_MIN_PIN -1
#endif
#ifdef DISABLE_ZMAX_ENDSTOP
#if ENABLED(DISABLE_ZMAX_ENDSTOP)
#undef Z_MAX_PIN
#define Z_MAX_PIN -1
#endif
#ifdef DISABLE_ZMIN_ENDSTOP
#if ENABLED(DISABLE_ZMIN_ENDSTOP)
#undef Z_MIN_PIN
#define Z_MIN_PIN -1
#endif
......@@ -5049,7 +5049,7 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#define TEMP_3_PIN -1
#endif
#ifdef MKR4
#if ENABLED(MKR4)
#if (EXTRUDERS == 2) && (DRIVER_EXTRUDERS == 1) // Use this for one driver and two extruder
#define E0E1_CHOICE_PIN 5
#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
#endif //EXTRUDERS
#endif //MKR4
#ifdef NPR2
#if ENABLED(NPR2)
#define E_MIN_PIN -1
#endif //NPR2
#ifdef LASERBEAM
#if ENABLED(LASERBEAM)
#define LASER_PWR_PIN 41
#define LASER_TTL_PIN 42
#endif
#ifdef FILAMENT_RUNOUT_SENSOR
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define FILRUNOUT_PIN -1
#endif
#ifdef FILAMENT_SENSOR
#if ENABLED(FILAMENT_SENSOR)
// FMM added for Filament Extruder
//define analog pin for the filament width sensor input
//Use the RAMPS 1.4 Analog input 5 on the AUX2 connector
......
......@@ -73,7 +73,7 @@ float max_e_jerk;
float mintravelfeedrate;
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
matrix_3x3 plan_bed_level_matrix = {
1.0, 0.0, 0.0,
......@@ -82,7 +82,7 @@ unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS];
};
#endif // ENABLE_AUTO_BED_LEVELING
#ifdef AUTOTEMP
#if ENABLED(AUTOTEMP)
float autotemp_max = 250;
float autotemp_min = 210;
float autotemp_factor = 0.1;
......@@ -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} };
#endif
#ifdef FILAMENT_SENSOR
#if ENABLED(FILAMENT_SENSOR)
static char meas_sample; //temporary variable to hold filament measurement sample
#endif
......@@ -174,7 +174,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi
plateau_steps = 0;
}
#ifdef ADVANCE
#if ENABLED(ADVANCE)
volatile long initial_advance = block->advance * entry_factor * entry_factor;
volatile long final_advance = block->advance * exit_factor * exit_factor;
#endif // ADVANCE
......@@ -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->initial_rate = initial_rate;
block->final_rate = final_rate;
#ifdef ADVANCE
#if ENABLED(ADVANCE)
block->initial_advance = initial_advance;
block->final_advance = final_advance;
#endif
......@@ -357,7 +357,7 @@ void plan_init() {
}
#ifdef AUTOTEMP
#if ENABLED(AUTOTEMP)
void getHighESpeed() {
static float oldt = 0;
......@@ -390,11 +390,11 @@ void plan_init() {
void check_axes_activity() {
unsigned char axis_active[NUM_AXIS] = { 0 },
tail_fan_speed = fanSpeed;
#ifdef BARICUDA
#if ENABLED(BARICUDA)
unsigned char tail_valve_pressure = ValvePressure,
tail_e_to_p_pressure = EtoPPressure;
#endif
#ifdef LASERBEAM
#if ENABLED(LASERBEAM)
unsigned char tail_laser_ttl_modulation = laser_ttl_modulation;
#endif
block_t *block;
......@@ -402,12 +402,12 @@ void check_axes_activity() {
if (blocks_queued()) {
uint8_t block_index = block_buffer_tail;
tail_fan_speed = block_buffer[block_index].fan_speed;
#ifdef BARICUDA
#if ENABLED(BARICUDA)
block = &block_buffer[block_index];
tail_valve_pressure = block->valve_pressure;
tail_e_to_p_pressure = block->e_to_p_pressure;
#endif
#ifdef LASERBEAM
#if ENABLED(LASERBEAM)
tail_laser_ttl_modulation = block_buffer[block_index].laser_ttlmodulation;
#endif
while (block_index != block_buffer_head) {
......@@ -442,18 +442,18 @@ void check_axes_activity() {
fan_kick_end = 0;
}
#endif//FAN_KICKSTART_TIME
#ifdef FAN_SOFT_PWM
#if ENABLED(FAN_SOFT_PWM)
fanSpeedSoftPwm = tail_fan_speed;
#else
analogWrite(FAN_PIN, tail_fan_speed);
#endif //!FAN_SOFT_PWM
#endif // HAS_FAN
#ifdef AUTOTEMP
#if ENABLED(AUTOTEMP)
getHighESpeed();
#endif
#ifdef BARICUDA
#if ENABLED(BARICUDA)
#if HAS_HEATER_1
analogWrite(HEATER_1_PIN,tail_valve_pressure);
#endif
......@@ -462,7 +462,7 @@ void check_axes_activity() {
#endif
#endif
#ifdef LASERBEAM
#if ENABLED(LASERBEAM)
analogWrite(LASER_TTL_PIN, tail_laser_ttl_modulation);
#endif
}
......@@ -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
// 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.
#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)
#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)
......@@ -483,13 +483,9 @@ float junction_deviation = 0.1;
// If the buffer is full: good! That means we are well ahead of the robot.
// Rest here until there is room in the buffer.
while(block_buffer_tail == next_buffer_head) {
manage_heater();
manage_inactivity();
lcd_update();
}
while (block_buffer_tail == next_buffer_head) idle();
#ifdef ENABLE_AUTO_BED_LEVELING
#if ENABLED(ENABLE_AUTO_BED_LEVELING)
apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
#endif
......@@ -507,11 +503,11 @@ float junction_deviation = 0.1;
dz = target[Z_AXIS] - position[Z_AXIS],
de = target[E_AXIS] - position[E_AXIS];
#ifdef PREVENT_DANGEROUS_EXTRUDE
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
if (de) {
#ifdef NPR2
#if ENABLED(NPR2)
if (extruder != 1)
#endif // NPR2
#endif
{
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
......@@ -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) {
#ifdef EASY_LOAD
if (!allow_lengthy_extrude_once) {
......@@ -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
de = 0; // no difference
ECHO_LM(ER, MSG_ERR_LONG_EXTRUDE_STOP);
#ifdef EASY_LOAD
#if ENABLED(EASY_LOAD)
}
allow_lengthy_extrude_once = false;
#endif
......@@ -544,7 +540,7 @@ float junction_deviation = 0.1;
block->busy = false;
// Number of steps for each axis
#ifdef COREXY
#if ENABLED(COREXY)
// corexy planning
// 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);
......@@ -566,17 +562,17 @@ float junction_deviation = 0.1;
if (block->step_event_count <= dropsegments) return;
block->fan_speed = fanSpeed;
#ifdef BARICUDA
#if ENABLED(BARICUDA)
block->valve_pressure = ValvePressure;
block->e_to_p_pressure = EtoPPressure;
#endif
#ifdef LASERBEAM
#if ENABLED(LASERBEAM)
block->laser_ttlmodulation = laser_ttl_modulation;
#endif
// Compute direction bits for this block
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 (dy < 0) db |= BIT(Y_HEAD); // ...and Y
if (dx + dy < 0) db |= BIT(A_AXIS); // Motor A direction
......@@ -592,7 +588,7 @@ float junction_deviation = 0.1;
block->active_driver = driver;
//enable active axes
#ifdef COREXY
#if ENABLED(COREXY)
if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
enable_x();
enable_y();
......@@ -602,13 +598,13 @@ float junction_deviation = 0.1;
if (block->steps[Y_AXIS]) enable_y();
#endif
#ifndef Z_LATE_ENABLE
#if DISABLED(Z_LATE_ENABLE)
if (block->steps[Z_AXIS]) enable_z();
#endif
// Enable extruder(s)
if (block->steps[E_AXIS]) {
#if !defined(MKR4) && !defined(NPR2)
#if DISABLED(MKR4) && DISABLED(NPR2)
if (DISABLE_INACTIVE_EXTRUDER) { //enable only selected extruder
for (int i=0; i<EXTRUDERS; i++)
......@@ -687,7 +683,6 @@ float junction_deviation = 0.1;
break;
}
#endif //!MKR4 && !NPR2
if (feed_rate < minimumfeedrate) feed_rate = minimumfeedrate;
}
if (block->steps[E_AXIS])
......@@ -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.
* 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];
delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
delta_mm[Y_HEAD] = dy / axis_steps_per_unit[B_AXIS];
......@@ -722,7 +717,7 @@ float junction_deviation = 0.1;
}
else {
block->millimeters = sqrt(
#ifdef COREXY
#if ENABLED(COREXY)
square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD])
#else
square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS])
......@@ -738,12 +733,12 @@ float junction_deviation = 0.1;
int moves_queued = movesplanned();
// 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;
#ifdef OLD_SLOWDOWN
#if ENABLED(OLD_SLOWDOWN)
if (mq) feed_rate *= 2.0 * moves_queued / BLOCK_BUFFER_SIZE;
#endif
#ifdef SLOWDOWN
#if ENABLED(SLOWDOWN)
// segment time im micro seconds
unsigned long segment_time = lround(1000000.0/inverse_second);
if (mq) {
......@@ -761,7 +756,7 @@ float junction_deviation = 0.1;
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
#ifdef FILAMENT_SENSOR
#if ENABLED(FILAMENT_SENSOR)
//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
......@@ -962,7 +957,7 @@ float junction_deviation = 0.1;
for (int i = 0; i < NUM_AXIS; i++) previous_speed[i] = current_speed[i];
previous_nominal_speed = block->nominal_speed;
#ifdef ADVANCE
#if ENABLED(ADVANCE)
// Calculate advance rate
if (!bse || (!bsx && !bsy && !bsz)) {
block->advance_rate = 0;
......@@ -994,7 +989,7 @@ float junction_deviation = 0.1;
} // plan_buffer_line()
#ifdef ENABLE_AUTO_BED_LEVELING
#if ENABLED(ENABLE_AUTO_BED_LEVELING)
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));
......@@ -1009,13 +1004,13 @@ float junction_deviation = 0.1;
}
#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)
#else
void plan_set_position(const float &x, const float &y, const float &z, const float &e)
#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);
#endif
......
......@@ -37,7 +37,7 @@ typedef struct {
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 active_driver; // Selects the active driver
#ifdef ADVANCE
#if ENABLED(ADVANCE)
long advance_rate;
volatile long initial_advance;
volatile long final_advance;
......@@ -60,11 +60,11 @@ typedef struct {
unsigned long final_rate; // The minimal rate at exit
unsigned long acceleration_st; // acceleration steps/sec^2
unsigned long fan_speed;
#ifdef BARICUDA
#if ENABLED(BARICUDA)
unsigned long valve_pressure;
unsigned long e_to_p_pressure;
#endif
#ifdef LASERBEAM
#if ENABLED(LASERBEAM)
unsigned long laser_ttlmodulation;
#endif
volatile char busy;
......@@ -82,7 +82,7 @@ extern volatile unsigned char block_buffer_head;
extern volatile unsigned char block_buffer_tail;
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"
......@@ -132,7 +132,7 @@ extern float max_e_jerk;
extern float mintravelfeedrate;
extern unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS];
#ifdef AUTOTEMP
#if ENABLED(AUTOTEMP)
extern bool autotemp_enabled;
extern float autotemp_max;
extern float autotemp_min;
......
#include "qr_solve.h"
#ifdef AUTO_BED_LEVELING_GRID
#if ENABLED(AUTO_BED_LEVELING_GRID)
#include <stdlib.h>
#include <math.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 );
double ddot ( int n, double dx[], int incx, double dy[], int incy );
......
......@@ -9,24 +9,24 @@
/**
* 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.
#endif
/**
* Progress Bar
*/
#ifdef LCD_PROGRESS_BAR
#ifndef SDSUPPORT
#if ENABLED(LCD_PROGRESS_BAR)
#if DISABLED(SDSUPPORT)
#error LCD_PROGRESS_BAR requires SDSUPPORT.
#endif
#ifdef DOGLCD
#if ENABLED(DOGLCD)
#error LCD_PROGRESS_BAR does not apply to graphical displays.
#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.
#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.
#endif
#endif
......@@ -34,14 +34,14 @@
/**
* Babystepping
*/
#ifdef BABYSTEPPING
#ifdef COREXY
#if ENABLED(BABYSTEPPING)
#if ENABLED(COREXY)
#error BABYSTEPPING not implemented for COREXY yet.
#endif
#ifdef SCARA
#if ENABLED(SCARA)
#error BABYSTEPPING is not implemented for SCARA yet.
#endif
#if defined(DELTA) && defined(BABYSTEP_XY)
#if ENABLED(DELTA) && ENABLED(BABYSTEP_XY)
#error BABYSTEPPING only implemented for Z axis on deltabots.
#endif
#endif
......@@ -49,28 +49,28 @@
/**
* 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.
#endif
/**
* 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
#endif
/**
* 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.
#endif
/**
* 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
#endif
......@@ -83,19 +83,19 @@
#error The maximum number of EXTRUDERS is 4.
#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.
#endif
#ifdef HEATERS_PARALLEL
#if ENABLED(HEATERS_PARALLEL)
#error EXTRUDERS must be 1 with HEATERS_PARALLEL.
#endif
#ifdef Y_DUAL_STEPPER_DRIVERS
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#error EXTRUDERS must be 1 with Y_DUAL_STEPPER_DRIVERS.
#endif
#ifdef Z_DUAL_STEPPER_DRIVERS
#if ENABLED(Z_DUAL_STEPPER_DRIVERS)
#error EXTRUDERS must be 1 with Z_DUAL_STEPPER_DRIVERS.
#endif
......@@ -111,21 +111,21 @@
/**
* 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.
#endif
/**
* Auto Bed Leveling
*/
#ifdef ENABLE_AUTO_BED_LEVELING
#if ENABLED(ENABLE_AUTO_BED_LEVELING)
/**
* Require a Z Min pin
*/
#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.
#ifdef Z_PROBE_REPEATABILITY_TEST
#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.
#if ENABLED(Z_PROBE_REPEATABILITY_TEST)
#error You must have a Z_MIN or Z_PROBE endstop to enable Z_PROBE_REPEATABILITY_TEST.
#else
#error ENABLE_AUTO_BED_LEVELING requires a Z_MIN or Z_PROBE endstop. Z_MIN_PIN or Z_PROBE_PIN must point to a valid hardware pin.
......@@ -136,7 +136,7 @@
/**
* 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
#error You must have a Z_PROBE_PIN defined in your pins_XXXX.h file if you enable Z_PROBE_ENDSTOP
#endif
......@@ -160,7 +160,7 @@
/**
* 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
#if LEFT_PROBE_BED_POSITION < MIN_PROBE_X
......@@ -227,14 +227,14 @@
/**
* 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.
#endif
/**
* Delta & Z_PROBE_ENDSTOP
*/
#if defined(DELTA) && defined(Z_PROBE_ENDSTOP)
#if ENABLED(DELTA) && ENABLED(Z_PROBE_ENDSTOP)
#ifndef Z_PROBE_PIN
#error You must have a Z_PROBE_PIN defined in your pins2tool.h file if you enable Z_PROBE_ENDSTOP
#endif
......@@ -243,18 +243,11 @@
#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
*/
#ifdef DUAL_X_CARRIAGE
#if EXTRUDERS == 1 || defined(COREXY) \
#if ENABLED(DUAL_X_CARRIAGE)
#if EXTRUDERS == 1 || ENABLED(COREXY) \
|| !HAS_X2_ENABLE || !HAS_X2_STEP || !HAS_X2_DIR \
|| !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS) \
|| !HAS_X_MAX
......@@ -295,7 +288,7 @@
#if !HAS_HEATER_2
#error HEATER_2_PIN not defined for this board
#endif
#elif HOTENDS > 1 || defined(HEATERS_PARALLEL)
#elif HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)
#if !HAS_HEATER_1
#error HEATER_1_PIN not defined for this board
#endif
......@@ -315,11 +308,11 @@
#error WATCH_TEMP_PERIOD now uses seconds instead of milliseconds
#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
#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
#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.
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
static unsigned char out_bits = 0; // The next stepping-bits to be output
static unsigned int cleaning_buffer_counter;
#ifdef Z_DUAL_ENDSTOPS
#if ENABLED(Z_DUAL_ENDSTOPS)
static bool performing_homing = false,
locked_z_motor = false,
locked_z2_motor = false;
......@@ -59,7 +59,7 @@ static unsigned int cleaning_buffer_counter;
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
#ifdef ADVANCE
#if ENABLED(ADVANCE)
static long advance_rate, advance, final_advance = 0;
static long old_advance = 0;
static long e_steps[4];
......@@ -76,13 +76,13 @@ volatile long endstops_trigsteps[3] = { 0 };
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
#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
#else
static uint16_t old_endstop_bits = 0; // use X_MIN, X_MAX... Z_MAX, Z_PROBE, Z2_MIN, Z2_MAX
#endif
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
bool abort_on_endstop_hit = false;
#endif
......@@ -100,7 +100,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
//================================ functions ================================
//===========================================================================
#ifdef DUAL_X_CARRIAGE
#if ENABLED(DUAL_X_CARRIAGE)
#define X_APPLY_DIR(v,ALWAYS) \
if (extruder_duplication_enabled || ALWAYS) { \
X_DIR_WRITE(v); \
......@@ -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)
#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_STEP(v,Q) { Y_STEP_WRITE(v); Y2_STEP_WRITE(v); }
#else
......@@ -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)
#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); }
#ifdef Z_DUAL_ENDSTOPS
#if ENABLED(Z_DUAL_ENDSTOPS)
#define Z_APPLY_STEP(v,Q) \
if (performing_homing) { \
if (Z_HOME_DIR > 0) {\
......@@ -261,13 +261,13 @@ void checkHitEndstops() {
ECHO_MV(MSG_ENDSTOP_Z, (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT MSG_ENDSTOP_ZS);
}
#ifdef Z_PROBE_ENDSTOP
#if ENABLED(Z_PROBE_ENDSTOP)
if (endstop_hit_bits & BIT(Z_PROBE)) {
ECHO_MV(MSG_ENDSTOP_ZPS, (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT MSG_ENDSTOP_ZPS);
}
#endif
#ifdef NPR2
#if ENABLED(NPR2)
if (endstop_hit_bits & BIT(E_MIN)) {
ECHO_MV(MSG_ENDSTOP_E, (float)endstops_trigsteps[E_AXIS] / axis_steps_per_unit[E_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT MSG_ENDSTOP_ES);
......@@ -277,16 +277,12 @@ void checkHitEndstops() {
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) {
card.sdprinting = false;
card.closeFile();
quickStop();
setTargetHotend0(0);
setTargetHotend1(0);
setTargetHotend2(0);
setTargetHotend3(0);
setTargetBed(0);
disable_all_heaters(); // switch off all heaters.
}
#endif
}
......@@ -381,7 +377,7 @@ void set_stepper_direction() {
count_direction[Z_AXIS] = 1;
}
#ifndef ADVANCE
#if DISABLED(ADVANCE)
if (TEST(out_bits, E_AXIS)) {
REV_E_DIR();
count_direction[E_AXIS] = -1;
......@@ -402,7 +398,7 @@ FORCE_INLINE void trapezoid_generator_reset() {
set_stepper_direction();
}
#ifdef ADVANCE
#if ENABLED(ADVANCE)
advance = current_block->initial_advance;
final_advance = current_block->final_advance;
// Do E steps + advance steps
......@@ -445,7 +441,7 @@ ISR(TIMER1_COMPA_vect) {
counter_y = counter_z = counter_e = counter_x;
step_events_completed = 0;
#ifdef Z_LATE_ENABLE
#if ENABLED(Z_LATE_ENABLE)
if (current_block->steps[Z_AXIS] > 0) {
enable_z();
OCR1A = 2000; //1ms wait
......@@ -453,7 +449,7 @@ ISR(TIMER1_COMPA_vect) {
}
#endif
// #ifdef ADVANCE
// #if ENABLED(ADVANCE)
// e_steps[current_block->active_driver] = 0;
// #endif
}
......@@ -467,10 +463,10 @@ ISR(TIMER1_COMPA_vect) {
// Check endstops
if (check_endstops) {
#ifdef Z_DUAL_ENDSTOPS
uint16_t current_endstop_bits;
#if ENABLED(Z_DUAL_ENDSTOPS)
uint16_t current_endstop_bits = 0;
#else
byte current_endstop_bits;
byte current_endstop_bits = 0;
#endif
#define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
......@@ -494,7 +490,7 @@ ISR(TIMER1_COMPA_vect) {
step_events_completed = current_block->step_event_count; \
}
#ifdef COREXY
#if ENABLED(COREXY)
// Head direction in -X axis for CoreXY bots.
// If DeltaX == -DeltaY, the movement is only in Y axis
if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) {
......@@ -503,7 +499,7 @@ ISR(TIMER1_COMPA_vect) {
if (TEST(out_bits, X_AXIS)) // stepping along -X axis (regular Cartesian bot)
#endif
{ // -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
if ((current_block->active_driver == 0 && X_HOME_DIR == -1) || (current_block->active_driver != 0 && X2_HOME_DIR == -1))
#endif
......@@ -514,7 +510,7 @@ ISR(TIMER1_COMPA_vect) {
}
}
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
if ((current_block->active_driver == 0 && X_HOME_DIR == 1) || (current_block->active_driver != 0 && X2_HOME_DIR == 1))
#endif
......@@ -524,7 +520,7 @@ ISR(TIMER1_COMPA_vect) {
#endif
}
}
#ifdef COREXY
#if ENABLED(COREXY)
}
// Head direction in -Y axis for CoreXY bots.
// If DeltaX == DeltaY, the movement is only in X axis
......@@ -543,13 +539,13 @@ ISR(TIMER1_COMPA_vect) {
UPDATE_ENDSTOP(Y, MAX);
#endif
}
#ifdef COREXY
#if ENABLED(COREXY)
}
#endif
if (TEST(out_bits, Z_AXIS)) { // z -direction
#if HAS_Z_MIN
#ifdef Z_DUAL_ENDSTOPS
#if ENABLED(Z_DUAL_ENDSTOPS)
SET_ENDSTOP_BIT(Z, MIN);
#if HAS_Z2_MIN
SET_ENDSTOP_BIT(Z2, MIN);
......@@ -571,7 +567,7 @@ ISR(TIMER1_COMPA_vect) {
#endif // !Z_DUAL_ENDSTOPS
#endif // Z_MIN_PIN
#ifdef Z_PROBE_ENDSTOP
#if ENABLED(Z_PROBE_ENDSTOP)
UPDATE_ENDSTOP(Z, PROBE);
SET_ENDSTOP_BIT(Z, PROBE);
......@@ -584,7 +580,7 @@ ISR(TIMER1_COMPA_vect) {
else { // z +direction
#if HAS_Z_MAX
#ifdef Z_DUAL_ENDSTOPS
#if ENABLED(Z_DUAL_ENDSTOPS)
SET_ENDSTOP_BIT(Z, MAX);
#if HAS_Z2_MAX
......@@ -620,7 +616,7 @@ ISR(TIMER1_COMPA_vect) {
MSerial.checkRx(); // Check for serial chars.
#endif
#ifdef ADVANCE
#if ENABLED(ADVANCE)
counter_e += current_block->steps[E_AXIS];
if (counter_e > 0) {
counter_e -= current_block->step_event_count;
......@@ -643,7 +639,7 @@ ISR(TIMER1_COMPA_vect) {
STEP_START(e,E);
#endif
#ifdef STEPPER_HIGH_LOW_DELAY
#if ENABLED(STEPPER_HIGH_LOW_DELAY)
delayMicroseconds(STEPPER_HIGH_LOW_DELAY);
#endif
......@@ -680,7 +676,7 @@ ISR(TIMER1_COMPA_vect) {
timer = calc_timer(acc_step_rate);
OCR1A = timer;
acceleration_time += timer;
#ifdef ADVANCE
#if ENABLED(ADVANCE)
for(int8_t i=0; i < step_loops; i++) {
advance += advance_rate;
}
......@@ -709,7 +705,7 @@ ISR(TIMER1_COMPA_vect) {
timer = calc_timer(step_rate);
OCR1A = timer;
deceleration_time += timer;
#ifdef ADVANCE
#if ENABLED(ADVANCE)
for(int8_t i=0; i < step_loops; i++) {
advance -= advance_rate;
}
......@@ -733,7 +729,7 @@ ISR(TIMER1_COMPA_vect) {
}
}
#ifdef ADVANCE
#if ENABLED(ADVANCE)
unsigned char old_OCR0A;
// Timer interrupt for E. e_steps is set in the main routine;
// Timer 0 is shared with millies
......@@ -811,11 +807,11 @@ void st_init() {
microstep_init(); //Initialize Microstepping Pins
// initialise TMC Steppers
#ifdef HAVE_TMCDRIVER
#if ENABLED(HAVE_TMCDRIVER)
tmc_init();
#endif
// initialise L6470 Steppers
#ifdef HAVE_L6470DRIVER
#if ENABLED(HAVE_L6470DRIVER)
L6470_init();
#endif
......@@ -828,13 +824,13 @@ void st_init() {
#endif
#if HAS_Y_DIR
Y_DIR_INIT;
#if defined(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_DIR
#if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_DIR
Y2_DIR_INIT;
#endif
#endif
#if HAS_Z_DIR
Z_DIR_INIT;
#if defined(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_DIR
#if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_DIR
Z2_DIR_INIT;
#endif
#endif
......@@ -865,7 +861,7 @@ void st_init() {
Y_ENABLE_INIT;
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;
if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH);
#endif
......@@ -874,7 +870,7 @@ void st_init() {
Z_ENABLE_INIT;
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;
if (!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH);
#endif
......@@ -914,63 +910,63 @@ void st_init() {
#if HAS_X_MIN
SET_INPUT(X_MIN_PIN);
#ifdef ENDSTOPPULLUP_XMIN
#if ENABLED(ENDSTOPPULLUP_XMIN)
WRITE(X_MIN_PIN,HIGH);
#endif
#endif
#if HAS_Y_MIN
SET_INPUT(Y_MIN_PIN);
#ifdef ENDSTOPPULLUP_YMIN
#if ENABLED(ENDSTOPPULLUP_YMIN)
WRITE(Y_MIN_PIN,HIGH);
#endif
#endif
#if HAS_Z_MIN
SET_INPUT(Z_MIN_PIN);
#ifdef ENDSTOPPULLUP_ZMIN
#if ENABLED(ENDSTOPPULLUP_ZMIN)
WRITE(Z_MIN_PIN,HIGH);
#endif
#endif
#if HAS_E_MIN
SET_INPUT(E_MIN_PIN);
#ifdef ENDSTOPPULLUP_EMIN
#if ENABLED(ENDSTOPPULLUP_EMIN)
WRITE(E_MIN_PIN, HIGH);
#endif
#endif
#if HAS_X_MAX
SET_INPUT(X_MAX_PIN);
#ifdef ENDSTOPPULLUP_XMAX
#if ENABLED(ENDSTOPPULLUP_XMAX)
WRITE(X_MAX_PIN,HIGH);
#endif
#endif
#if HAS_Y_MAX
SET_INPUT(Y_MAX_PIN);
#ifdef ENDSTOPPULLUP_YMAX
#if ENABLED(ENDSTOPPULLUP_YMAX)
WRITE(Y_MAX_PIN,HIGH);
#endif
#endif
#if HAS_Z_MAX
SET_INPUT(Z_MAX_PIN);
#ifdef ENDSTOPPULLUP_ZMAX
#if ENABLED(ENDSTOPPULLUP_ZMAX)
WRITE(Z_MAX_PIN,HIGH);
#endif
#endif
#if HAS_Z2_MAX
SET_INPUT(Z2_MAX_PIN);
#ifdef ENDSTOPPULLUP_ZMAX
#if ENABLED(ENDSTOPPULLUP_ZMAX)
WRITE(Z2_MAX_PIN,HIGH);
#endif
#endif
#if (defined(Z_PROBE_PIN) && Z_PROBE_PIN >= 0) && defined(Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
#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);
#ifdef ENDSTOPPULLUP_ZPROBE
#if ENABLED(ENDSTOPPULLUP_ZPROBE)
WRITE(Z_PROBE_PIN,HIGH);
#endif
#endif
......@@ -994,14 +990,14 @@ void st_init() {
AXIS_INIT(x, X2, X);
#endif
#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_WRITE(INVERT_Y_STEP_PIN);
#endif
AXIS_INIT(y, Y, Y);
#endif
#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_WRITE(INVERT_Z_STEP_PIN);
#endif
......@@ -1041,7 +1037,7 @@ void st_init() {
TCNT1 = 0;
ENABLE_STEPPER_DRIVER_INTERRUPT();
#ifdef ADVANCE
#if ENABLED(ADVANCE)
#if defined(TCCR0A) && defined(WGM01)
TCCR0A &= ~BIT(WGM01);
TCCR0A &= ~BIT(WGM00);
......@@ -1057,14 +1053,10 @@ void st_init() {
}
// Block until all buffered steps are executed
void st_synchronize() {
while (blocks_queued()) {
manage_heater();
manage_inactivity();
lcd_update();
}
}
/**
* Block until all buffered steps are executed
*/
void st_synchronize() { while (blocks_queued()) idle(); }
void st_set_position(const long &x, const long &y, const long &z, const long &e) {
CRITICAL_SECTION_START;
......@@ -1089,7 +1081,7 @@ long st_get_position(uint8_t axis) {
return count_pos;
}
#ifdef ENABLE_AUTO_BED_LEVELING
#if ENABLED(ENABLE_AUTO_BED_LEVELING)
float st_get_position_mm(AxisEnum axis) {
return st_get_position(axis) / axis_steps_per_unit[axis];
......@@ -1110,7 +1102,7 @@ void quickStop() {
ENABLE_STEPPER_DRIVER_INTERRUPT();
}
#ifdef NPR2
#if ENABLED(NPR2)
void colorstep(long csteps,const bool direction) {
enable_e1();
//setup new step
......@@ -1158,7 +1150,7 @@ void quickStop() {
case Z_AXIS: {
#ifndef DELTA
#if DISABLED(DELTA)
BABYSTEP_AXIS(z, Z, BABYSTEP_INVERT_Z);
......@@ -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 2: digitalWrite(Z_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;
#endif
}
......@@ -1313,27 +1305,27 @@ void microstep_mode(uint8_t driver, uint8_t stepping_mode) {
}
void microstep_readings() {
ECHO_SM(OK, MSG_MICROSTEP_MS1_MS2);
ECHO_SM(DB, MSG_MICROSTEP_MS1_MS2);
ECHO_M(MSG_MICROSTEP_X);
ECHO_V(digitalRead(X_MS1_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_EV(digitalRead(Y_MS2_PIN));
ECHO_SM(OK, MSG_MICROSTEP_Z);
ECHO_SM(DB, MSG_MICROSTEP_Z);
ECHO_V(digitalRead(Z_MS1_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_EV(digitalRead(E0_MS2_PIN));
#if HAS_MICROSTEPS_E1
ECHO_SM(OK, MSG_MICROSTEP_E1);
ECHO_SM(DB, MSG_MICROSTEP_E1);
ECHO_V(digitalRead(E1_MS1_PIN));
ECHO_EV(digitalRead(E1_MS2_PIN));
#endif
}
#ifdef Z_DUAL_ENDSTOPS
#if ENABLED(Z_DUAL_ENDSTOPS)
void In_Homing_Process(bool state) { performing_homing = state; }
void Lock_z_motor(bool state) { locked_z_motor = state; }
void Lock_z2_motor(bool state) { locked_z2_motor = state; }
......
......@@ -53,8 +53,8 @@
#define REV_E_DIR() E0_DIR_WRITE(INVERT_E0_DIR)
#endif //DRIVER_EXTRUDERS
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
extern bool abort_on_endstop_hit;
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
extern bool abort_on_endstop_hit;
#endif
// Initialize and start the stepper motor subsystem
......@@ -70,7 +70,7 @@ void st_set_e_position(const long &e);
// Get current position in steps
long st_get_position(uint8_t axis);
#ifdef ENABLE_AUTO_BED_LEVELING
#if ENABLED(ENABLE_AUTO_BED_LEVELING)
// Get current position in mm
float st_get_position_mm(AxisEnum axis);
#endif
......@@ -101,18 +101,18 @@ void digipot_current(uint8_t driver, int current);
void microstep_init();
void microstep_readings();
#ifdef Z_DUAL_ENDSTOPS
#if ENABLED(Z_DUAL_ENDSTOPS)
void In_Homing_Process(bool state);
void Lock_z_motor(bool state);
void Lock_z2_motor(bool state);
#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
#endif
#ifdef NPR2 //Multiextruder
#if ENABLED(NPR2) // Multiextruder
void colorstep(long csteps,const bool direction);
#endif //NPR2
#endif // NPR2
#endif //stepper_h
#endif // stepper_h
......@@ -22,203 +22,203 @@
#include "stepper_indirection.h"
#include "Configuration.h"
#ifdef HAVE_TMCDRIVER
#include <SPI.h>
#include <TMC26XStepper.h>
#if ENABLED(HAVE_TMCDRIVER)
#include <SPI.h>
#include <TMC26XStepper.h>
#endif
// 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);
#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);
#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);
#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);
#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);
#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);
#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);
#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);
#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);
#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);
#endif
#ifdef HAVE_TMCDRIVER
#if ENABLED(HAVE_TMCDRIVER)
void tmc_init()
{
#ifdef X_IS_TMC
#if ENABLED(X_IS_TMC)
stepperX.setMicrosteps(X_MICROSTEPS);
stepperX.start();
#endif
#ifdef X2_IS_TMC
#endif
#if ENABLED(X2_IS_TMC)
stepperX2.setMicrosteps(X2_MICROSTEPS);
stepperX2.start();
#endif
#ifdef Y_IS_TMC
#endif
#if ENABLED(Y_IS_TMC)
stepperY.setMicrosteps(Y_MICROSTEPS);
stepperY.start();
#endif
#ifdef Y2_IS_TMC
#endif
#if ENABLED(Y2_IS_TMC)
stepperY2.setMicrosteps(Y2_MICROSTEPS);
stepperY2.start();
#endif
#ifdef Z_IS_TMC
#endif
#if ENABLED(Z_IS_TMC)
stepperZ.setMicrosteps(Z_MICROSTEPS);
stepperZ.start();
#endif
#ifdef Z2_IS_TMC
#endif
#if ENABLED(Z2_IS_TMC)
stepperZ2.setMicrosteps(Z2_MICROSTEPS);
stepperZ2.start();
#endif
#ifdef E0_IS_TMC
#endif
#if ENABLED(E0_IS_TMC)
stepperE0.setMicrosteps(E0_MICROSTEPS);
stepperE0.start();
#endif
#ifdef E1_IS_TMC
#endif
#if ENABLED(E1_IS_TMC)
stepperE1.setMicrosteps(E1_MICROSTEPS);
stepperE1.start();
#endif
#ifdef E2_IS_TMC
#endif
#if ENABLED(E2_IS_TMC)
stepperE2.setMicrosteps(E2_MICROSTEPS);
stepperE2.start();
#endif
#ifdef E3_IS_TMC
#endif
#if ENABLED(E3_IS_TMC)
stepperE3.setMicrosteps(E3_MICROSTEPS);
stepperE3.start();
#endif
#endif
}
#endif
// L6470 Driver objects and inits
#ifdef HAVE_L6470DRIVER
#if ENABLED(HAVE_L6470DRIVER)
#include <SPI.h>
#include <L6470.h>
#endif
// L6470 Stepper objects
#ifdef X_IS_L6470
#if ENABLED(X_IS_L6470)
L6470 stepperX(X_ENABLE_PIN);
#endif
#ifdef X2_IS_L6470
#endif
#if ENABLED(X2_IS_L6470)
L6470 stepperX2(X2_ENABLE_PIN);
#endif
#ifdef Y_IS_L6470
#endif
#if ENABLED(Y_IS_L6470)
L6470 stepperY(Y_ENABLE_PIN);
#endif
#ifdef Y2_IS_L6470
#endif
#if ENABLED(Y2_IS_L6470)
L6470 stepperY2(Y2_ENABLE_PIN);
#endif
#ifdef Z_IS_L6470
#endif
#if ENABLED(Z_IS_L6470)
L6470 stepperZ(Z_ENABLE_PIN);
#endif
#ifdef Z2_IS_L6470
#endif
#if ENABLED(Z2_IS_L6470)
L6470 stepperZ2(Z2_ENABLE_PIN);
#endif
#ifdef E0_IS_L6470
#endif
#if ENABLED(E0_IS_L6470)
L6470 stepperE0(E0_ENABLE_PIN);
#endif
#ifdef E1_IS_L6470
#endif
#if ENABLED(E1_IS_L6470)
L6470 stepperE1(E1_ENABLE_PIN);
#endif
#ifdef E2_IS_L6470
#endif
#if ENABLED(E2_IS_L6470)
L6470 stepperE2(E2_ENABLE_PIN);
#endif
#ifdef E3_IS_L6470
#endif
#if ENABLED(E3_IS_L6470)
L6470 stepperE3(E3_ENABLE_PIN);
#endif
#endif
// init routine
#ifdef HAVE_L6470DRIVER
#if ENABLED(HAVE_L6470DRIVER)
void L6470_init()
{
#ifdef X_IS_L6470
#if ENABLED(X_IS_L6470)
stepperX.init(X_K_VAL);
stepperX.softFree();
stepperX.setMicroSteps(X_MICROSTEPS);
stepperX.setOverCurrent(X_OVERCURRENT); //set overcurrent protection
stepperX.setStallCurrent(X_STALLCURRENT);
#endif
#ifdef X2_IS_L6470
#endif
#if ENABLED(X2_IS_L6470)
stepperX2.init(X2_K_VAL);
stepperX2.softFree();
stepperX2.setMicroSteps(X2_MICROSTEPS);
stepperX2.setOverCurrent(X2_OVERCURRENT); //set overcurrent protection
stepperX2.setStallCurrent(X2_STALLCURRENT);
#endif
#ifdef Y_IS_L6470
#endif
#if ENABLED(Y_IS_L6470)
stepperY.init(Y_K_VAL);
stepperY.softFree();
stepperY.setMicroSteps(Y_MICROSTEPS);
stepperY.setOverCurrent(Y_OVERCURRENT); //set overcurrent protection
stepperY.setStallCurrent(Y_STALLCURRENT);
#endif
#ifdef Y2_IS_L6470
#endif
#if ENABLED(Y2_IS_L6470)
stepperY2.init(Y2_K_VAL);
stepperY2.softFree();
stepperY2.setMicroSteps(Y2_MICROSTEPS);
stepperY2.setOverCurrent(Y2_OVERCURRENT); //set overcurrent protection
stepperY2.setStallCurrent(Y2_STALLCURRENT);
#endif
#ifdef Z_IS_L6470
#endif
#if ENABLED(Z_IS_L6470)
stepperZ.init(Z_K_VAL);
stepperZ.softFree();
stepperZ.setMicroSteps(Z_MICROSTEPS);
stepperZ.setOverCurrent(Z_OVERCURRENT); //set overcurrent protection
stepperZ.setStallCurrent(Z_STALLCURRENT);
#endif
#ifdef Z2_IS_L6470
#endif
#if ENABLED(Z2_IS_L6470)
stepperZ2.init(Z2_K_VAL);
stepperZ2.softFree();
stepperZ2.setMicroSteps(Z2_MICROSTEPS);
stepperZ2.setOverCurrent(Z2_OVERCURRENT); //set overcurrent protection
stepperZ2.setStallCurrent(Z2_STALLCURRENT);
#endif
#ifdef E0_IS_L6470
#endif
#if ENABLED(E0_IS_L6470)
stepperE0.init(E0_K_VAL);
stepperE0.softFree();
stepperE0.setMicroSteps(E0_MICROSTEPS);
stepperE0.setOverCurrent(E0_OVERCURRENT); //set overcurrent protection
stepperE0.setStallCurrent(E0_STALLCURRENT);
#endif
#ifdef E1_IS_L6470
#endif
#if ENABLED(E1_IS_L6470)
stepperE1.init(E1_K_VAL);
stepperE1.softFree();
stepperE1.setMicroSteps(E1_MICROSTEPS);
stepperE1.setOverCurrent(E1_OVERCURRENT); //set overcurrent protection
stepperE1.setStallCurrent(E1_STALLCURRENT);
#endif
#ifdef E2_IS_L6470
#endif
#if ENABLED(E2_IS_L6470)
stepperE2.init(E2_K_VAL);
stepperE2.softFree();
stepperE2.setMicroSteps(E2_MICROSTEPS);
stepperE2.setOverCurrent(E2_OVERCURRENT); //set overcurrent protection
stepperE2.setStallCurrent(E2_STALLCURRENT);
#endif
#ifdef E3_IS_L6470
#endif
#if ENABLED(E3_IS_L6470)
stepperE3.init(E3_K_VAL);
stepperE3.softFree();
stepperE3.setMicroSteps(E3_MICROSTEPS);
stepperE3.setOverCurrent(E3_OVERCURRENT); //set overcurrent protection
stepperE3.setStallCurrent(E3_STALLCURRENT);
#endif
#endif
}
#endif
......@@ -22,6 +22,8 @@
#ifndef STEPPER_INDIRECTION_H
#define STEPPER_INDIRECTION_H
#include "macros.h"
// X motor
#define X_STEP_INIT SET_OUTPUT(X_STEP_PIN)
#define X_STEP_WRITE(STATE) WRITE(X_STEP_PIN,STATE)
......@@ -156,12 +158,12 @@
// Pin redefines for TMC drivers.
// 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 <TMC26XStepper.h>
void tmc_init();
#ifdef X_IS_TMC
#if ENABLED(X_IS_TMC)
extern TMC26XStepper stepperX;
#undef X_ENABLE_INIT
#define X_ENABLE_INIT ((void)0)
......@@ -173,7 +175,7 @@
#define X_ENABLE_READ stepperX.isEnabled()
#endif
#ifdef X2_IS_TMC
#if ENABLED(X2_IS_TMC)
extern TMC26XStepper stepperX2;
#undef X2_ENABLE_INIT
#define X2_ENABLE_INIT ((void)0)
......@@ -184,7 +186,7 @@
#undef X2_ENABLE_READ
#define X2_ENABLE_READ stepperX2.isEnabled()
#endif
#ifdef Y_IS_TMC
#if ENABLED(Y_IS_TMC)
extern TMC26XStepper stepperY;
#undef Y_ENABLE_INIT
#define Y_ENABLE_INIT ((void)0)
......@@ -195,7 +197,7 @@
#undef Y_ENABLE_READ
#define Y_ENABLE_READ stepperY.isEnabled()
#endif
#ifdef Y2_IS_TMC
#if ENABLED(Y2_IS_TMC)
extern TMC26XStepper stepperY2;
#undef Y2_ENABLE_INIT
#define Y2_ENABLE_INIT ((void)0)
......@@ -206,7 +208,7 @@
#undef Y2_ENABLE_READ
#define Y2_ENABLE_READ stepperY2.isEnabled()
#endif
#ifdef Z_IS_TMC
#if ENABLED(Z_IS_TMC)
extern TMC26XStepper stepperZ;
#undef Z_ENABLE_INIT
#define Z_ENABLE_INIT ((void)0)
......@@ -217,7 +219,7 @@
#undef Z_ENABLE_READ
#define Z_ENABLE_READ stepperZ.isEnabled()
#endif
#ifdef Z2_IS_TMC
#if ENABLED(Z2_IS_TMC)
extern TMC26XStepper stepperZ2;
#undef Z2_ENABLE_INIT
#define Z2_ENABLE_INIT ((void)0)
......@@ -228,7 +230,7 @@
#undef Z2_ENABLE_READ
#define Z2_ENABLE_READ stepperZ2.isEnabled()
#endif
#ifdef E0_IS_TMC
#if ENABLED(E0_IS_TMC)
extern TMC26XStepper stepperE0;
#undef E0_ENABLE_INIT
#define E0_ENABLE_INIT ((void)0)
......@@ -239,7 +241,7 @@
#undef E0_ENABLE_READ
#define E0_ENABLE_READ stepperE0.isEnabled()
#endif
#ifdef E1_IS_TMC
#if ENABLED(E1_IS_TMC)
extern TMC26XStepper stepperE1;
#undef E1_ENABLE_INIT
#define E1_ENABLE_INIT ((void)0)
......@@ -250,7 +252,7 @@
#undef E1_ENABLE_READ
#define E1_ENABLE_READ stepperE1.isEnabled()
#endif
#ifdef E2_IS_TMC
#if ENABLED(E2_IS_TMC)
extern TMC26XStepper stepperE2;
#undef E2_ENABLE_INIT
#define E2_ENABLE_INIT ((void)0)
......@@ -261,7 +263,7 @@
#undef E2_ENABLE_READ
#define E2_ENABLE_READ stepperE2.isEnabled()
#endif
#ifdef E3_IS_TMC
#if ENABLED(E3_IS_TMC)
extern TMC26XStepper stepperE3;
#undef E3_ENABLE_INIT
#define E3_ENABLE_INIT ((void)0)
......@@ -279,13 +281,13 @@
// Pin redefines for L6470 drivers.
// 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 <L6470.h>
void L6470_init();
#ifdef X_IS_L6470
#if ENABLED(X_IS_L6470)
extern L6470 stepperX;
#undef X_ENABLE_INIT
#define X_ENABLE_INIT ((void)0)
......@@ -306,7 +308,7 @@
#define X_DIR_READ (stepperX.getStatus() & STATUS_DIR)
#endif
#ifdef X2_IS_L6470
#if ENABLED(X2_IS_L6470)
extern L6470 stepperX2;
#undef X2_ENABLE_INIT
#define X2_ENABLE_INIT ((void)0)
......@@ -326,7 +328,7 @@
#undef X2_DIR_READ
#define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR)
#endif
#ifdef Y_IS_L6470
#if ENABLED(Y_IS_L6470)
extern L6470 stepperY;
#undef Y_ENABLE_INIT
#define Y_ENABLE_INIT ((void)0)
......@@ -346,7 +348,7 @@
#undef Y_DIR_READ
#define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR)
#endif
#ifdef Y2_IS_L6470
#if ENABLED(Y2_IS_L6470)
extern L6470 stepperY2;
#undef Y2_ENABLE_INIT
#define Y2_ENABLE_INIT ((void)0)
......@@ -366,7 +368,7 @@
#undef Y2_DIR_READ
#define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR)
#endif
#ifdef Z_IS_L6470
#if ENABLED(Z_IS_L6470)
extern L6470 stepperZ;
#undef Z_ENABLE_INIT
#define Z_ENABLE_INIT ((void)0)
......@@ -386,7 +388,7 @@
#undef Y_DIR_READ
#define Y_DIR_READ (stepperZ.getStatus() & STATUS_DIR)
#endif
#ifdef Z2_IS_L6470
#if ENABLED(Z2_IS_L6470)
extern L6470 stepperZ2;
#undef Z2_ENABLE_INIT
#define Z2_ENABLE_INIT ((void)0)
......@@ -406,7 +408,7 @@
#undef Y2_DIR_READ
#define Y2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR)
#endif
#ifdef E0_IS_L6470
#if ENABLED(E0_IS_L6470)
extern L6470 stepperE0;
#undef E0_ENABLE_INIT
#define E0_ENABLE_INIT ((void)0)
......@@ -426,7 +428,7 @@
#undef E0_DIR_READ
#define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR)
#endif
#ifdef E1_IS_L6470
#if ENABLED(E1_IS_L6470)
extern L6470 stepperE1;
#undef E1_ENABLE_INIT
#define E1_ENABLE_INIT ((void)0)
......@@ -446,7 +448,7 @@
#undef E1_DIR_READ
#define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR)
#endif
#ifdef E2_IS_L6470
#if ENABLED(E2_IS_L6470)
extern L6470 stepperE2;
#undef E2_ENABLE_INIT
#define E2_ENABLE_INIT ((void)0)
......@@ -466,7 +468,7 @@
#undef E2_DIR_READ
#define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR)
#endif
#ifdef E3_IS_L6470
#if ENABLED(E3_IS_L6470)
extern L6470 stepperE3;
#undef E3_ENABLE_INIT
#define E3_ENABLE_INIT ((void)0)
......
......@@ -34,7 +34,7 @@
#define K2 (1.0 - K1)
#endif
#if defined(PIDTEMPBED) || defined(PIDTEMP)
#if ENABLED(PIDTEMPBED) || ENABLED(PIDTEMP)
#define PID_dT ((OVERSAMPLENR * 14.0)/(F_CPU / 64.0 / 256.0))
#define RECI_PID_dT ( 1 / PID_dT )
#endif
......@@ -49,39 +49,39 @@ int current_temperature_raw[4] = { 0 };
float current_temperature[4] = { 0.0 };
int current_temperature_bed_raw = 0;
float current_temperature_bed = 0.0;
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
int redundant_temperature_raw = 0;
float redundant_temperature = 0.0;
#endif
#ifdef PIDTEMPBED
#if ENABLED(PIDTEMPBED)
float bedKp = DEFAULT_bedKp;
float bedKi = (DEFAULT_bedKi * PID_dT);
float bedKd = (DEFAULT_bedKd / PID_dT);
#endif //PIDTEMPBED
#ifdef FAN_SOFT_PWM
#if ENABLED(FAN_SOFT_PWM)
unsigned char fanSpeedSoftPwm;
#endif
unsigned char soft_pwm_bed;
#ifdef BABYSTEPPING
#if ENABLED(BABYSTEPPING)
volatile int babystepsTodo[3] = { 0 };
#endif
#if HAS_FILAMENT_SENSOR
#if ENABLED(FILAMENT_SENSOR)
int current_raw_filwidth = 0; //Holds measured filament diameter - one extruder only
#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 };
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 millis_t thermal_runaway_timer[4]; // = {0,0,0,0};
#endif
#ifdef THERMAL_PROTECTION_BED
#if ENABLED(THERMAL_PROTECTION_BED)
static TRState thermal_runaway_bed_state_machine = TRReset;
static millis_t thermal_runaway_bed_timer;
#endif
......@@ -97,7 +97,7 @@ unsigned char soft_pwm_bed;
static volatile bool temp_meas_ready = false;
#ifdef PIDTEMP
#if ENABLED(PIDTEMP)
//static cannot be external:
static float temp_iState[HOTENDS] = { 0 };
static float temp_dState[HOTENDS] = { 0 };
......@@ -110,7 +110,7 @@ static volatile bool temp_meas_ready = false;
static float temp_iState_max[HOTENDS];
static bool pid_reset[HOTENDS];
#endif //PIDTEMP
#ifdef PIDTEMPBED
#if ENABLED(PIDTEMPBED)
//static cannot be external:
static float temp_iState_bed = { 0 };
static float temp_dState_bed = { 0 };
......@@ -127,14 +127,14 @@ static volatile bool temp_meas_ready = false;
static unsigned char soft_pwm[HOTENDS];
#ifdef FAN_SOFT_PWM
#if ENABLED(FAN_SOFT_PWM)
static unsigned char soft_pwm_fan;
#endif
#if HAS_AUTO_FAN
static millis_t next_auto_fan_check_ms;
#endif
#ifdef PIDTEMP
#if ENABLED(PIDTEMP)
float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS];
#endif //PIDTEMP
......@@ -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 maxttemp[HOTENDS] = ARRAY_BY_HOTENDS( 16383, 16383, 16383, 16383 );
#ifdef BED_MINTEMP
static int bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP;
static int bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP;
#endif
#ifdef BED_MAXTEMP
static int bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP;
#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 uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
#else
......@@ -162,7 +162,7 @@ static float analog2temp(int raw, uint8_t e);
static float analog2tempBed(int raw);
static void updateTemperaturesFromRawValues();
#ifdef THERMAL_PROTECTION_HOTENDS
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
int watch_target_temp[HOTENDS] = { 0 };
millis_t watch_heater_next_ms[HOTENDS] = { 0 };
#endif
......@@ -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
#endif
#ifdef HEATER_0_USES_MAX6675
#if ENABLED(HEATER_0_USES_MAX6675)
static int read_max6675();
#endif
......@@ -352,12 +352,12 @@ void PID_autotune(float temp, int hotend, int ncycles) {
}
void updatePID() {
#ifdef PIDTEMP
#if ENABLED(PIDTEMP)
for (int e = 0; e < HOTENDS; e++) {
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / PID_PARAM(Ki,e);
}
#endif
#ifdef PIDTEMPBED
#if ENABLED(PIDTEMPBED)
temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / bedKi;
#endif
}
......@@ -457,7 +457,7 @@ inline void _temp_error(int e, const char *serial_msg, const char *lcd_msg) {
lcd_setalertstatuspgm(lcd_msg);
#endif
}
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
#if DISABLED(BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE)
if (!killed) {
Running = false;
killed = true;
......@@ -477,8 +477,10 @@ void min_temp_error(uint8_t e) {
float get_pid_output(int e) {
float pid_output;
#ifdef PIDTEMP
#ifndef PID_OPENLOOP
#if ENABLED(PIDTEMP)
#if ENABLED(PID_OPENLOOP)
pid_output = constrain(target_temperature[e], 0, PID_MAX);
#else
pid_error[e] = target_temperature[e] - current_temperature[e];
if (pid_error[e] > PID_FUNCTIONAL_RANGE) {
pid_output = BANG_MAX;
......@@ -510,11 +512,9 @@ float get_pid_output(int e) {
}
}
temp_dState[e] = current_temperature[e];
#else
pid_output = constrain(target_temperature[e], 0, PID_MAX);
#endif //PID_OPENLOOP
#ifdef PID_DEBUG
#if ENABLED(PID_DEBUG)
ECHO_SMV(DB, MSG_PID_DEBUG, e);
ECHO_MV(MSG_PID_DEBUG_INPUT, current_temperature[e]);
ECHO_MV(MSG_PID_DEBUG_OUTPUT, pid_output);
......@@ -530,10 +530,10 @@ float get_pid_output(int e) {
return pid_output;
}
#ifdef PIDTEMPBED
#if ENABLED(PIDTEMPBED)
float get_pid_output_bed() {
float pid_output;
#ifndef PID_OPENLOOP
#if DISABLED(PID_OPENLOOP)
pid_error_bed = target_temperature_bed - current_temperature_bed;
pTerm_bed = bedKp * pid_error_bed;
temp_iState_bed += pid_error_bed;
......@@ -556,7 +556,7 @@ float get_pid_output(int e) {
pid_output = constrain(target_temperature_bed, 0, MAX_BED_POWER);
#endif // PID_OPENLOOP
#ifdef PID_BED_DEBUG
#if ENABLED(PID_BED_DEBUG)
ECHO_SM(DB ," PID_BED_DEBUG ");
ECHO_MV(": Input ", current_temperature_bed);
ECHO_MV(" Output ", pid_output);
......@@ -583,20 +583,20 @@ void manage_heater() {
updateTemperaturesFromRawValues();
#ifdef HEATER_0_USES_MAX6675
#if ENABLED(HEATER_0_USES_MAX6675)
float ct = current_temperature[0];
if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0);
if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
#endif
#if defined(THERMAL_PROTECTION_HOTENDS) || !defined(PIDTEMPBED) || HAS_AUTO_FAN
#if ENABLED(THERMAL_PROTECTION_HOTENDS) || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN
millis_t ms = millis();
#endif
// Loop through all hotends
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);
#endif
......@@ -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;
// 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?
if (watch_heater_next_ms[e] && ms > watch_heater_next_ms[e]) {
......@@ -623,7 +623,7 @@ void manage_heater() {
#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) {
_temp_error(0, PSTR(MSG_EXTRUDER_SWITCHED_OFF), PSTR(MSG_ERR_REDUNDANT_TEMP));
}
......@@ -639,7 +639,7 @@ void manage_heater() {
#endif
// Control the extruder rate based on the width sensor
#ifdef FILAMENT_SENSOR
#if ENABLED(FILAMENT_SENSOR)
if (filament_sensor) {
meas_shift_index = delay_index1 - meas_delay_cm;
if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1; //loop around buffer if needed
......@@ -653,23 +653,23 @@ void manage_heater() {
}
#endif //FILAMENT_SENSOR
#ifndef PIDTEMPBED
#if DISABLED(PIDTEMPBED)
if (ms < next_bed_check_ms) return;
next_bed_check_ms = ms + BED_CHECK_INTERVAL;
#endif
#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);
#endif
#ifdef PIDTEMPBED
#if ENABLED(PIDTEMPBED)
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;
#elif defined(BED_LIMIT_SWITCHING)
#elif ENABLED(BED_LIMIT_SWITCHING)
// Check if temperature is within the correct band
if (current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP) {
if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS)
......@@ -698,7 +698,7 @@ void manage_heater() {
// Derived from RepRap FiveD extruder::getTemperature()
// For hot end temperature measurement.
static float analog2temp(int raw, uint8_t e) {
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
if (e > EXTRUDERS)
#else
if (e >= EXTRUDERS)
......@@ -709,7 +709,7 @@ static float analog2temp(int raw, uint8_t e) {
return 0.0;
}
#ifdef HEATER_0_USES_MAX6675
#if ENABLED(HEATER_0_USES_MAX6675)
if (e == 0) return 0.25 * raw;
#endif
......@@ -744,7 +744,7 @@ static float analog2temp(int raw, uint8_t e) {
// Derived from RepRap FiveD extruder::getTemperature()
// For bed temperature measurement.
static float analog2tempBed(int raw) {
#ifdef BED_USES_THERMISTOR
#if ENABLED(BED_USES_THERMISTOR)
float celsius = 0;
byte i;
......@@ -779,14 +779,14 @@ static void updateTemperaturesFromRawValues() {
static millis_t last_update = millis();
millis_t temp_last_update = millis();
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();
#endif
for (uint8_t e = 0; e < HOTENDS; e++) {
current_temperature[e] = analog2temp(current_temperature_raw[e], e);
}
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);
#endif
#if HAS_FILAMENT_SENSOR
......@@ -866,11 +866,11 @@ void tp_init() {
for (int e = 0; e < HOTENDS; e++) {
// populate with the first value
maxttemp[e] = maxttemp[0];
#ifdef PIDTEMP
#if ENABLED(PIDTEMP)
temp_iState_min[e] = 0.0;
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / PID_PARAM(Ki,e);
#endif //PIDTEMP
#ifdef PIDTEMPBED
#if ENABLED(PIDTEMPBED)
temp_iState_min_bed = 0.0;
temp_iState_max_bed = PID_INTEGRAL_DRIVE_MAX / bedKi;
#endif // PIDTEMPBED
......@@ -893,17 +893,17 @@ void tp_init() {
#endif
#if HAS_FAN
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
#endif
#ifdef FAN_SOFT_PWM
#if ENABLED(FAN_SOFT_PWM)
soft_pwm_fan = fanSpeedSoftPwm / 2;
#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(MOSI_PIN, HIGH);
OUT_WRITE(MISO_PIN, HIGH);
......@@ -1036,24 +1036,23 @@ void tp_init() {
#endif // BED_MAXTEMP
}
#ifdef THERMAL_PROTECTION_HOTENDS
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
/**
* Start Heating Sanity Check for hotends that are below
* their target temperature by a configurable margin.
* This is called when the temperature is set. (M104, M109)
*/
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)) {
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
watch_heater_next_ms[e] = 0;
}
#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) {
......@@ -1141,7 +1140,7 @@ void disable_all_heaters() {
#endif
}
#ifdef HEATER_0_USES_MAX6675
#if ENABLED(HEATER_0_USES_MAX6675)
#define MAX6675_HEAT_INTERVAL 250u
static millis_t next_max6675_ms = 0;
int max6675_temp = 2000;
......@@ -1224,11 +1223,11 @@ static unsigned long raw_temp_value[4] = { 0 };
static unsigned long raw_temp_bed_value = 0;
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];
#endif
#if HAS_TEMP_1
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
redundant_temperature_raw = raw_temp_value[1];
#else
current_temperature_raw[1] = raw_temp_value[1];
......@@ -1266,7 +1265,7 @@ ISR(TIMER0_COMPB_vect) {
static unsigned char pwm_count = BIT(SOFT_PWM_SCALE);
// Static members for each heater
#ifdef SLOW_PWM_HEATERS
#if ENABLED(SLOW_PWM_HEATERS)
static unsigned char slow_pwm_count = 0;
#define ISR_STATICS(n) \
static unsigned char soft_pwm_ ## n; \
......@@ -1278,7 +1277,7 @@ ISR(TIMER0_COMPB_vect) {
// Statics per heater
ISR_STATICS(0);
#if (HOTENDS > 1) || defined(HEATERS_PARALLEL)
#if (HOTENDS > 1) || ENABLED(HEATERS_PARALLEL)
ISR_STATICS(1);
#if HOTENDS > 2
ISR_STATICS(2);
......@@ -1295,7 +1294,7 @@ ISR(TIMER0_COMPB_vect) {
static unsigned long raw_filwidth_value = 0;
#endif
#ifndef SLOW_PWM_HEATERS
#if DISABLED(SLOW_PWM_HEATERS)
/**
* standard PWM modulation
*/
......@@ -1323,7 +1322,7 @@ ISR(TIMER0_COMPB_vect) {
soft_pwm_BED = soft_pwm_bed;
WRITE_HEATER_BED(soft_pwm_BED > 0 ? 1 : 0);
#endif
#ifdef FAN_SOFT_PWM
#if ENABLED(FAN_SOFT_PWM)
soft_pwm_fan = fanSpeedSoftPwm / 2;
WRITE_FAN(soft_pwm_fan > 0 ? 1 : 0);
#endif
......@@ -1344,7 +1343,7 @@ ISR(TIMER0_COMPB_vect) {
if (soft_pwm_BED < pwm_count) WRITE_HEATER_BED(0);
#endif
#ifdef FAN_SOFT_PWM
#if ENABLED(FAN_SOFT_PWM)
if (soft_pwm_fan < pwm_count) WRITE_FAN(0);
#endif
......@@ -1423,7 +1422,7 @@ ISR(TIMER0_COMPB_vect) {
PWM_OFF_ROUTINE(BED); // BED
#endif
#ifdef FAN_SOFT_PWM
#if ENABLED(FAN_SOFT_PWM)
if (pwm_count == 0) {
soft_pwm_fan = fanSpeedSoftPwm / 2;
WRITE_FAN(soft_pwm_fan > 0 ? 1 : 0);
......@@ -1596,7 +1595,7 @@ ISR(TIMER0_COMPB_vect) {
raw_powconsumption_value = 0;
#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
#define GE0 <=
#else
......@@ -1648,7 +1647,7 @@ ISR(TIMER0_COMPB_vect) {
} // temp_count >= OVERSAMPLENR
#ifdef BABYSTEPPING
#if ENABLED(BABYSTEPPING)
for (uint8_t axis = X_AXIS; axis <= Z_AXIS; axis++) {
int curTodo = babystepsTodo[axis]; //get rid of volatile for performance
......@@ -1664,7 +1663,7 @@ ISR(TIMER0_COMPB_vect) {
#endif //BABYSTEPPING
}
#ifdef PIDTEMP
#if ENABLED(PIDTEMP)
// Apply the scale factors to the PID values
float scalePID_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.
// do not use these routines and variables outside of temperature.cpp
extern int target_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_bed_raw;
#endif
extern int target_temperature_bed;
extern float current_temperature_bed;
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
extern float redundant_temperature;
#endif
......@@ -64,7 +64,7 @@ extern float current_temperature_bed;
extern unsigned char soft_pwm_bed;
#endif
#ifdef PIDTEMP
#if ENABLED(PIDTEMP)
extern float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS];
#define PID_PARAM(param, e) param[e] // use macro to point to array value
float scalePID_i(float i);
......@@ -72,11 +72,12 @@ extern float current_temperature_bed;
float unscalePID_i(float i);
float unscalePID_d(float d);
#endif
#ifdef PIDTEMPBED
#if ENABLED(PIDTEMPBED)
extern float bedKp,bedKi,bedKd;
#endif
#ifdef BABYSTEPPING
#if ENABLED(BABYSTEPPING)
extern volatile int babystepsTodo[3];
#endif
......@@ -92,25 +93,30 @@ extern float current_temperature_bed;
FORCE_INLINE float degHotend(uint8_t hotend) { return current_temperature[HOTEND_ARG]; }
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 rawBedTemp() { return current_temperature_bed_raw; }
#endif
FORCE_INLINE float degTargetHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG]; }
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 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 isCoolingHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG] < current_temperature[HOTEND_ARG]; }
FORCE_INLINE bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; }
#define HOTEND_ROUTINES(NR) \
......@@ -138,7 +144,6 @@ HOTEND_ROUTINES(0);
int getHeaterPower(int heater);
void disable_all_heaters();
void setWatch();
void updatePID();
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 checkExtruderAutoFans();
#ifdef WATCH_TEMP_PERIOD
void start_watching_heater(int e=0);
#endif
FORCE_INLINE void autotempShutdown() {
#ifdef AUTOTEMP
#if ENABLED(AUTOTEMP)
if (autotemp_enabled) {
autotemp_enabled = false;
if (degTargetHotend(active_extruder) > autotemp_min)
......
......@@ -84,7 +84,7 @@ static void lcd_status_screen();
#endif
static void lcd_sdcard_menu();
#ifdef DELTA
#if ENABLED(DELTA)
static void lcd_delta_calibrate_menu();
#endif // DELTA
......@@ -116,7 +116,7 @@ static void lcd_status_screen();
#define ENCODER_FEEDRATE_DEADZONE 10
#if !defined(LCD_I2C_VIKI)
#if DISABLED(LCD_I2C_VIKI)
#ifndef ENCODER_STEPS_PER_MENU_ITEM
#define ENCODER_STEPS_PER_MENU_ITEM 5
#endif
......@@ -138,7 +138,7 @@ static void lcd_status_screen();
/**
* 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 { \
encoderRateMultiplierEnabled = false; \
if (encoderPosition > 0x8000) encoderPosition = 0; \
......@@ -352,7 +352,7 @@ static void lcd_status_screen() {
}
#endif
#ifdef ULTIPANEL
#if ENABLED(ULTIPANEL)
bool current_click = LCD_CLICKED;
......@@ -414,18 +414,20 @@ static void 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();
card.sdprinting = false;
card.closeFile();
autotempShutdown();
cancel_heatup = true;
lcd_setstatus(MSG_PRINT_ABORTED, true);
}
}
#endif
/**
*
......@@ -441,7 +443,7 @@ static void lcd_main_menu() {
}
else {
MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu);
#ifdef DELTA
#if ENABLED(DELTA)
MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu);
#endif // DELTA
}
......@@ -474,7 +476,7 @@ static void lcd_main_menu() {
END_MENU();
}
#if defined(SDSUPPORT) && defined(MENU_ADDAUTOSTART)
#if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
static void lcd_autostart_sd() {
card.autostart_index = 0;
card.setroot();
......@@ -559,7 +561,7 @@ static void lcd_tune_menu() {
END_MENU();
}
#if defined(EASY_LOAD)
#if ENABLED(EASY_LOAD)
static void lcd_extrude(float length, float feedrate) {
current_position[E_AXIS] += length;
#ifdef DELTA
......@@ -585,12 +587,11 @@ static void lcd_tune_menu() {
void _lcd_preheat(int endnum, const float temph, const float tempb, const int fan) {
if (temph > 0) setTargetHotend(temph, endnum);
#if TEMP_SENSOR_BED != 0
setTargetBed(tempb);
#endif
fanSpeed = fan;
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_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
......@@ -811,10 +812,10 @@ static void lcd_prepare_menu() {
//
// Level Bed
//
#ifdef ENABLE_AUTO_BED_LEVELING
#if ENABLED(ENABLE_AUTO_BED_LEVELING)
if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS])
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);
#endif
......@@ -825,7 +826,7 @@ static void lcd_prepare_menu() {
//MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
//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);
if(laser_ttl_modulation == 0) {
WRITE(LASER_PWR_PIN, LOW);
......@@ -870,7 +871,7 @@ static void lcd_prepare_menu() {
//
// Easy Load
//
#if defined(EASY_LOAD)
#if ENABLED(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_PURGE_XMM, lcd_purge);
......@@ -890,14 +891,14 @@ static void lcd_prepare_menu() {
//
// Autostart
//
#if defined(SDSUPPORT) && defined(MENU_ADDAUTOSTART)
#if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd);
#endif
END_MENU();
}
#ifdef DELTA
#if ENABLED(DELTA)
static void lcd_delta_calibrate_menu() {
START_MENU(lcd_main_menu);
......@@ -1113,14 +1114,14 @@ static void lcd_control_temperature_menu() {
// Fan Speed
//
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);
#endif
//
// 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(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);
......@@ -1130,7 +1131,7 @@ static void lcd_control_temperature_menu() {
//
// PID-P, PID-I, PID-D
//
#ifdef PIDTEMP
#if ENABLED(PIDTEMP)
// set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(PID_PARAM(Ki,0));
raw_Kd = unscalePID_d(PID_PARAM(Kd,0));
......@@ -1287,10 +1288,10 @@ static void lcd_control_motion_menu() {
#if EXTRUDERS > 3
MENU_ITEM_EDIT(float51, MSG_E3STEPS, &axis_steps_per_unit[E_AXIS+3], 5, 9999);
#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);
#endif
#ifdef SCARA
#if ENABLED(SCARA)
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);
#endif
......@@ -1329,16 +1330,27 @@ static void lcd_control_volumetric_menu() {
* "Control" > "Contrast" submenu
*
*/
#ifdef HAS_LCD_CONTRAST
#if HAS_LCD_CONTRAST
static void lcd_set_contrast() {
if (encoderPosition != 0) {
#ifdef U8GLIB_LM6059_AF
lcd_contrast += encoderPosition;
lcd_contrast &= 0xFF;
#else
lcd_contrast -= encoderPosition;
lcd_contrast &= 0x3F;
#endif
encoderPosition = 0;
lcdDrawUpdate = 1;
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);
}
#endif // HAS_LCD_CONTRAST
......@@ -1368,24 +1380,25 @@ static void lcd_control_volumetric_menu() {
}
#endif // FWRETRACT
#if SDCARDDETECT == -1
#if ENABLED(SDSUPPORT)
#if SDCARDDETECT == -1
static void lcd_sd_refresh() {
card.initsd();
currentMenuViewOffset = 0;
}
#endif
#endif
static void lcd_sd_updir() {
static void lcd_sd_updir() {
card.updir();
currentMenuViewOffset = 0;
}
}
/**
/**
*
* "Print from SD" submenu
*
*/
void lcd_sdcard_menu() {
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);
......@@ -1418,7 +1431,8 @@ void lcd_sdcard_menu() {
}
}
END_MENU();
}
}
#endif // SDSUPPORT
/**
*
......@@ -1555,7 +1569,9 @@ 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_gcode(const char* pgcode) { enqueuecommands_P(pgcode); }
static void menu_action_function(menuFunc_t func) { (*func)(); }
static void menu_action_sdfile(const char* filename, char* longFilename) {
#if ENABLED(SDSUPPORT)
static void menu_action_sdfile(const char* filename, char* longFilename) {
char cmd[30];
char* c;
sprintf_P(cmd, PSTR("M23 %s"), filename);
......@@ -1563,11 +1579,13 @@ static void menu_action_sdfile(const char* filename, char* longFilename) {
enqueuecommand(cmd);
enqueuecommands_P(PSTR("M24"));
lcd_return_to_status();
}
static void menu_action_sddirectory(const char* filename, char* longFilename) {
}
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_callback_bool(const char* pstr, bool* ptr, menuFunc_t callback) {
menu_action_setting_edit_bool(pstr, ptr);
......@@ -1612,7 +1630,7 @@ void lcd_init() {
#endif // SR_LCD_2W_NL
#endif//!NEWPANEL
#if defined(SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0)
#if ENABLED(SDSUPPORT) && ENABLED(SDCARDDETECT) && (SDCARDDETECT > 0)
pinMode(SDCARDDETECT, INPUT);
WRITE(SDCARDDETECT, HIGH);
lcd_oldcardstatus = IS_SD_INSERTED;
......@@ -1725,7 +1743,7 @@ void lcd_update() {
if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100;
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_MV(" Multiplier: ", encoderMultiplier);
ECHO_MV(" ENCODER_10X_STEPS_PER_SEC: ", ENCODER_10X_STEPS_PER_SEC);
......@@ -1807,7 +1825,7 @@ void lcd_finishstatus(bool persist=false) {
#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; }
#endif
......@@ -1876,7 +1894,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
void lcd_buttons_update() {
#ifdef NEWPANEL
uint8_t newbutton = 0;
#ifdef INVERT_ROTARY_SWITCH
#if ENABLED(INVERT_ROTARY_SWITCH)
if (READ(BTN_EN1) == 0) newbutton |= EN_B;
if (READ(BTN_EN2) == 0) newbutton |= EN_A;
#else
......@@ -1949,7 +1967,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
}
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;
#else
return true;
......
......@@ -3,7 +3,7 @@
#include "Marlin.h"
#ifdef ULTRA_LCD
#if ENABLED(ULTRA_LCD)
int lcd_strlen(char *s);
int lcd_strlen_P(const char *s);
void lcd_update();
......@@ -15,11 +15,11 @@
void lcd_reset_alert_level();
bool lcd_detected(void);
#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
#if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
void dontExpireStatus();
#endif
#if defined(DOGLCD) && LCD_CONTRAST >= 0
#if ENABLED(DOGLCD) && LCD_CONTRAST >= 0
extern int lcd_contrast;
void lcd_setcontrast(uint8_t value);
#endif
......@@ -33,10 +33,10 @@
#define LCD_UPDATE_INTERVAL 100
#define LCD_TIMEOUT_TO_STATUS 15000
#ifdef ULTIPANEL
#if ENABLED(ULTIPANEL)
void lcd_buttons_update();
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
#endif
#else
......@@ -55,7 +55,7 @@
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;
#endif
......@@ -65,17 +65,17 @@
void lcd_ignore_click(bool b=true);
#ifdef NEWPANEL
#if ENABLED(NEWPANEL)
#define EN_C BIT(BLEN_C)
#define EN_B BIT(BLEN_B)
#define EN_A BIT(BLEN_A)
#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 LCD_BACK_CLICKED (buttons&EN_D)
#endif
#ifdef REPRAPWORLD_KEYPAD
#if ENABLED(REPRAPWORLD_KEYPAD)
#define EN_REPRAPWORLD_KEYPAD_F3 (BIT(BLEN_REPRAPWORLD_KEYPAD_F3))
#define EN_REPRAPWORLD_KEYPAD_F2 (BIT(BLEN_REPRAPWORLD_KEYPAD_F2))
#define EN_REPRAPWORLD_KEYPAD_F1 (BIT(BLEN_REPRAPWORLD_KEYPAD_F1))
......
......@@ -19,7 +19,7 @@
// macro name. The mapping is independent of whether the button is directly connected or
// 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
#define BLEN_B 1
#define BLEN_A 0
......@@ -41,7 +41,7 @@
//
// 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)
// button and encoder bit positions within 'buttons'
......@@ -62,7 +62,7 @@
// I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
#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
#if BTN_ENC <= 0
#define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
......@@ -77,7 +77,7 @@
#define LCD_CLICKED (buttons&EN_C)
#endif
#elif defined(REPRAPWORLD_KEYPAD)
#elif ENABLED(REPRAPWORLD_KEYPAD)
// define register bit values, don't change it
#define BLEN_REPRAPWORLD_KEYPAD_F3 0
#define BLEN_REPRAPWORLD_KEYPAD_F2 1
......@@ -104,7 +104,7 @@
//#define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons&EN_REPRAPWORLD_KEYPAD_UP)
//#define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons&EN_REPRAPWORLD_KEYPAD_MIDDLE)
#elif defined(NEWPANEL)
#elif ENABLED(NEWPANEL)
#define LCD_CLICKED (buttons&EN_C)
#if HAS_BTN_BACK
#define LCD_BACK_CLICKED (buttons&EN_D)
......@@ -135,7 +135,7 @@
////////////////////////////////////
// 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
#define LCD_I2C_PIN_BL 3
#define LCD_I2C_PIN_EN 2
......@@ -152,7 +152,7 @@
#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);
#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())
#define LED_A 0x04 //100
#define LED_B 0x02 //010
......@@ -163,30 +163,30 @@
#include <Wire.h>
#include <LiquidTWI2.h>
#define LCD_CLASS LiquidTWI2
#if defined(DETECT_DEVICE)
#if ENABLED(DETECT_DEVICE)
LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
#else
LCD_CLASS lcd(LCD_I2C_ADDRESS);
#endif
#elif defined(LCD_I2C_TYPE_MCP23008)
#elif ENABLED(LCD_I2C_TYPE_MCP23008)
#include <Wire.h>
#include <LiquidTWI2.h>
#define LCD_CLASS LiquidTWI2
#if defined(DETECT_DEVICE)
#if ENABLED(DETECT_DEVICE)
LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
#else
LCD_CLASS lcd(LCD_I2C_ADDRESS);
#endif
#elif defined(LCD_I2C_TYPE_PCA8574)
#elif ENABLED(LCD_I2C_TYPE_PCA8574)
#include <LiquidCrystal_I2C.h>
#define LCD_CLASS LiquidCrystal_I2C
LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT);
// 2 wire Non-latching LCD SR from:
// 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); }
#include <LCD.h>
#include <LiquidCrystal_SR.h>
......@@ -201,7 +201,7 @@
#include "utf_mapper.h"
#ifdef LCD_PROGRESS_BAR
#if ENABLED(LCD_PROGRESS_BAR)
static millis_t progress_bar_ms = 0;
#if PROGRESS_MSG_EXPIRE > 0
static millis_t expire_status_ms = 0;
......@@ -210,11 +210,11 @@
#endif
static void lcd_set_custom_characters(
#ifdef LCD_PROGRESS_BAR
#if ENABLED(LCD_PROGRESS_BAR)
bool progress_bar_set=true
#endif
) {
#ifdef DELTA
#if ENABLED(DELTA)
byte bedTemp[8] =
{
B00000,
......@@ -312,7 +312,7 @@ static void lcd_set_custom_characters(
B00000
}; //thanks Sonny Mounicou
#ifdef LCD_PROGRESS_BAR
#if ENABLED(LCD_PROGRESS_BAR)
static bool char_mode = false;
byte progress[3][8] = { {
B00000,
......@@ -373,28 +373,28 @@ static void lcd_set_custom_characters(
}
static void lcd_implementation_init(
#ifdef LCD_PROGRESS_BAR
#if ENABLED(LCD_PROGRESS_BAR)
bool progress_bar_set=true
#endif
) {
#if defined(LCD_I2C_TYPE_PCF8575)
#if ENABLED(LCD_I2C_TYPE_PCF8575)
lcd.begin(LCD_WIDTH, LCD_HEIGHT);
#ifdef LCD_I2C_PIN_BL
lcd.setBacklightPin(LCD_I2C_PIN_BL, POSITIVE);
lcd.setBacklight(HIGH);
#endif
#elif defined(LCD_I2C_TYPE_MCP23017)
#elif ENABLED(LCD_I2C_TYPE_MCP23017)
lcd.setMCPType(LTI_TYPE_MCP23017);
lcd.begin(LCD_WIDTH, LCD_HEIGHT);
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.begin(LCD_WIDTH, LCD_HEIGHT);
#elif defined(LCD_I2C_TYPE_PCA8574)
#elif ENABLED(LCD_I2C_TYPE_PCA8574)
lcd.init();
lcd.backlight();
......@@ -408,7 +408,7 @@ static void lcd_implementation_init(
#endif
lcd_set_custom_characters(
#ifdef LCD_PROGRESS_BAR
#if ENABLED(LCD_PROGRESS_BAR)
progress_bar_set
#endif
);
......@@ -426,7 +426,7 @@ char lcd_printPGM(const char* str) {
}
char lcd_print(char* str) {
char c, n = 0;;
char c, n = 0;
unsigned char i = 0;
while ((c = str[i++])) n += charset_mapper(c);
return n;
......@@ -530,7 +530,7 @@ static void lcd_implementation_status_screen() {
#if LCD_WIDTH < 20
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
lcd.setCursor(0, 2);
lcd_printPGM(PSTR("SD"));
if (IS_SD_PRINTING)
......@@ -596,7 +596,7 @@ static void lcd_implementation_status_screen() {
lcd.print(itostr3(feedrate_multiplier));
lcd.print('%');
#if LCD_WIDTH > 19 && defined(SDSUPPORT)
#if LCD_WIDTH > 19 && ENABLED(SDSUPPORT)
lcd.setCursor(7, 2);
lcd_printPGM(PSTR("SD"));
......@@ -643,7 +643,7 @@ static void lcd_implementation_status_screen() {
lcd.setCursor(0, LCD_HEIGHT - 1);
#ifdef LCD_PROGRESS_BAR
#if ENABLED(LCD_PROGRESS_BAR)
if (card.isFileOpen()) {
// 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
#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, '>', ' ')
#ifdef LCD_HAS_STATUS_INDICATORS
#if ENABLED(LCD_HAS_STATUS_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
static uint8_t ledsprev = 0;
uint8_t leds = 0;
......@@ -822,17 +822,17 @@ static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const
#endif // LCD_HAS_STATUS_INDICATORS
#ifdef LCD_HAS_SLOW_BUTTONS
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
extern millis_t next_button_update_ms;
static uint8_t lcd_implementation_read_slow_buttons() {
#ifdef LCD_I2C_TYPE_MCP23017
#if ENABLED(LCD_I2C_TYPE_MCP23017)
uint8_t slow_buttons;
// Reading these buttons this is likely to be too slow to call inside interrupt context
// so they are called during normal lcd_update
slow_buttons = lcd.readButtons() << B_I2C_BTN_OFFSET;
#ifdef LCD_I2C_VIKI
#if ENABLED(LCD_I2C_VIKI)
if ((slow_buttons & (B_MI|B_RI)) && millis() < next_button_update_ms) // LCD clicked
slow_buttons &= ~(B_MI|B_RI); // Disable LCD clicked buttons if screen is updated
#endif
......
......@@ -3,7 +3,7 @@
#include "Marlin.h"
#ifdef U8GLIB_ST7920
#if ENABLED(U8GLIB_ST7920)
//set optimization so ARDUINO optimizes this file
#pragma GCC optimize (3)
......
......@@ -3,23 +3,23 @@
#include "language.h"
#ifdef DOGLCD
#if ENABLED(DOGLCD)
#define HARDWARE_CHAR_OUT u8g.print
#else
#define HARDWARE_CHAR_OUT lcd.write
#endif
#if !(defined( SIMULATE_ROMFONT )) && defined( DOGLCD )
#if defined( DISPLAY_CHARSET_ISO10646_1 )
#if DISABLED(SIMULATE_ROMFONT) && ENABLED(DOGLCD)
#if ENABLED(DISPLAY_CHARSET_ISO10646_1)
#define MAPPER_ONE_TO_ONE
#elif defined( DISPLAY_CHARSET_ISO10646_5 )
#elif ENABLED(DISPLAY_CHARSET_ISO10646_5)
#define MAPPER_ONE_TO_ONE
#elif defined( DISPLAY_CHARSET_ISO10646_KANA )
#elif ENABLED(DISPLAY_CHARSET_ISO10646_KANA)
#define MAPPER_ONE_TO_ONE
#endif
#else // SIMULATE_ROMFONT
#if defined( DISPLAY_CHARSET_HD44780_JAPAN )
#if defined( MAPPER_C2C3 )
#if ENABLED(DISPLAY_CHARSET_HD44780_JAPAN)
#if ENABLED(MAPPER_C2C3)
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
0x20,0x3f,0xec,0xed,0x3f,0x5c,0x7c,0x3f,0x22,0x63,0x61,0x7f,0x3f,0x3f,0x52,0xb0, // c2a
......@@ -35,7 +35,7 @@
0x3f,0xee,0x3f,0x3f,0x3f,0x3f,0xef,0xfd,0x3f,0x3f,0x3f,0x3f,0xf5,0x3f,0x3f,0x3f // c3b
// n ö ÷ ü
};
#elif defined( MAPPER_E382E383 )
#elif ENABLED(MAPPER_E382E383)
const PROGMEM uint8_t utf_recode[] =
{ // 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
......@@ -51,12 +51,12 @@
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.");
#endif
#elif defined( DISPLAY_CHARSET_HD44780_WESTERN )
#if defined( MAPPER_C2C3 )
#elif ENABLED(DISPLAY_CHARSET_HD44780_WESTERN)
#if ENABLED(MAPPER_C2C3)
:
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.
......@@ -73,7 +73,7 @@
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
const PROGMEM uint8_t utf_recode[] =
{//0 1 2 3 4 5 6 7 8 9 a b c d e f
......@@ -86,12 +86,12 @@
0x70,0x63,0x54,0x79,0xd8,0x78,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x62,0x8f,0xac,0xad // d19
// 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." );
#endif
#elif defined( DISPLAY_CHARSET_HD44780_CYRILLIC )
#if defined( MAPPER_D0D1 )
#elif ENABLED(DISPLAY_CHARSET_HD44780_CYRILLIC)
#if ENABLED(MAPPER_D0D1)
#define MAPPER_D0D1_MOD
// it is a Russian alphabet translation
// except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё
......@@ -113,9 +113,9 @@
0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7 // Ѫ ѩ Ѫ ѫ Ѭ ѭ Ѯ ѯ
// ш щ ъ ы ь э ю я // 7 Ѱ ѱ Ѳ ѳ Ѵ ѵ Ѷ ѷ
}; // ѻ ѹ Ѻ ѻ Ѽ ѽ Ѿ ѿ
#elif defined( MAPPER_C2C3 )
#elif ENABLED(MAPPER_C2C3)
#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." );
#endif
#else
......@@ -123,12 +123,12 @@
#endif // DISPLAY_CHARSET_HD44780_CYRILLIC
#endif // SIMULATE_ROMFONT
#if defined( MAPPER_NON )
#if ENABLED(MAPPER_NON)
char charset_mapper(char c){
HARDWARE_CHAR_OUT( c );
return 1;
}
#elif defined( MAPPER_C2C3 )
#elif ENABLED(MAPPER_C2C3)
uint8_t utf_hi_char; // UTF-8 high part
bool seen_c2 = false;
char charset_mapper(char c){
......@@ -157,7 +157,7 @@
seen_c2 = false;
return 1;
}
#elif defined( MAPPER_D0D1_MOD )
#elif ENABLED(MAPPER_D0D1_MOD)
uint8_t utf_hi_char; // UTF-8 high part
bool seen_d5 = false;
char charset_mapper(char c){
......@@ -188,7 +188,7 @@
seen_d5 = false;
return 1;
}
#elif defined( MAPPER_D0D1 )
#elif ENABLED(MAPPER_D0D1)
uint8_t utf_hi_char; // UTF-8 high part
bool seen_d5 = false;
char charset_mapper(char c){
......@@ -214,7 +214,7 @@
seen_d5 = false;
return 1;
}
#elif defined( MAPPER_E382E383 )
#elif ENABLED(MAPPER_E382E383)
uint8_t utf_hi_char; // UTF-8 high part
bool seen_e3 = false;
bool seen_82_83 = false;
......
......@@ -19,7 +19,7 @@
#include <math.h>
#include "Marlin.h"
#ifdef ENABLE_AUTO_BED_LEVELING
#if ENABLED(ENABLE_AUTO_BED_LEVELING)
#include "vector_3.h"
vector_3::vector_3() : x(0), y(0), z(0) { }
......
......@@ -19,7 +19,7 @@
#ifndef VECTOR_3_H
#define VECTOR_3_H
#ifdef ENABLE_AUTO_BED_LEVELING
#if ENABLED(ENABLE_AUTO_BED_LEVELING)
class matrix_3x3;
struct vector_3
......
#include "Marlin.h"
#ifdef USE_WATCHDOG
#if ENABLED(USE_WATCHDOG)
#include <avr/wdt.h>
#include "watchdog.h"
......@@ -18,15 +18,15 @@
/// intialise watch dog with a 4 sec interrupt time
void watchdog_init()
{
#ifdef WATCHDOG_RESET_MANUAL
#if ENABLED(WATCHDOG_RESET_MANUAL)
//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.
wdt_reset();
_WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
_WD_CONTROL_REG = _BV(WDIE) | WDTO_4S;
#else
#else
wdt_enable(WDTO_4S);
#endif
#endif
}
/// reset watchdog. MUST be called every 1s after init or avr will reset.
......@@ -40,7 +40,7 @@ void watchdog_reset()
//===========================================================================
// 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) {
ECHO_LM(ER, MSG_WATCHDOG_RESET);
kill(PSTR("ERR:Please Reset")); // kill blocks //16 characters so it fits on a 16x2 display
......
......@@ -3,7 +3,7 @@
#include "Marlin.h"
#ifdef USE_WATCHDOG
#if ENABLED(USE_WATCHDOG)
// initialize watch dog with a 1 sec interrupt time
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..
......
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