Commit 55c929f1 authored by Simone Primarosa's avatar Simone Primarosa

Update pre 4.2.X

parent ba005c3b
/**
* Configuration_adv.h
*
* Advanced settings.
* Only change these if you know exactly what you're doing.
* Some of these settings can damage your printer if improperly set!
*
* Basic settings can be found in Configuration.h
*
*/
#ifndef CONFIGURATION_ADV_H
#define CONFIGURATION_ADV_H
#include "conditionals.h"
#include "Configuration_Overall.h"
#include "Configuration_Overall.h"
#include "pins.h"
#include "Configuration_Overall.h"
#include "language.h"
#include "Configuration_Overall.h"
#include "conditionals.h"
#include "Configuration_Overall.h"
#include "sanitycheck.h"
#endif //CONFIGURATION_ADV_H
...@@ -46,10 +46,10 @@ void idle(bool ignore_stepper_queue = false); ...@@ -46,10 +46,10 @@ void idle(bool ignore_stepper_queue = false);
void manage_inactivity(bool ignore_stepper_queue=false); void manage_inactivity(bool ignore_stepper_queue=false);
#if ENABLED(DUAL_X_CARRIAGE) && HAS_X_ENABLE && HAS_X2_ENABLE #if ENABLED(DUAL_X_CARRIAGE) && HAS(X_ENABLE) && HAS(X2_ENABLE)
#define enable_x() do { X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); } while (0) #define enable_x() do { X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); } while (0)
#define disable_x() do { X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } while (0) #define disable_x() do { X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } while (0)
#elif HAS_X_ENABLE #elif HAS(X_ENABLE)
#define enable_x() X_ENABLE_WRITE( X_ENABLE_ON) #define enable_x() X_ENABLE_WRITE( X_ENABLE_ON)
#define disable_x() { X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } #define disable_x() { X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }
#else #else
...@@ -57,7 +57,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); ...@@ -57,7 +57,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define disable_x() ; #define disable_x() ;
#endif #endif
#if HAS_Y_ENABLE #if HAS(Y_ENABLE)
#if ENABLED(Y_DUAL_STEPPER_DRIVERS) #if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#define enable_y() { Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); } #define enable_y() { Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }
#define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; } #define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
...@@ -70,7 +70,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); ...@@ -70,7 +70,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define disable_y() ; #define disable_y() ;
#endif #endif
#if HAS_Z_ENABLE #if HAS(Z_ENABLE)
#if ENABLED(Z_DUAL_STEPPER_DRIVERS) #if ENABLED(Z_DUAL_STEPPER_DRIVERS)
#define enable_z() { Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); } #define enable_z() { Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }
#define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; } #define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
...@@ -83,7 +83,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); ...@@ -83,7 +83,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define disable_z() ; #define disable_z() ;
#endif #endif
#if HAS_E0_ENABLE #if HAS(E0_ENABLE)
#define enable_e0() E0_ENABLE_WRITE( E_ENABLE_ON) #define enable_e0() E0_ENABLE_WRITE( E_ENABLE_ON)
#define disable_e0() E0_ENABLE_WRITE(!E_ENABLE_ON) #define disable_e0() E0_ENABLE_WRITE(!E_ENABLE_ON)
#else #else
...@@ -91,7 +91,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); ...@@ -91,7 +91,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define disable_e0() /* nothing */ #define disable_e0() /* nothing */
#endif #endif
#if (DRIVER_EXTRUDERS > 1) && HAS_E1_ENABLE #if (DRIVER_EXTRUDERS > 1) && HAS(E1_ENABLE)
#define enable_e1() E1_ENABLE_WRITE( E_ENABLE_ON) #define enable_e1() E1_ENABLE_WRITE( E_ENABLE_ON)
#define disable_e1() E1_ENABLE_WRITE(!E_ENABLE_ON) #define disable_e1() E1_ENABLE_WRITE(!E_ENABLE_ON)
#else #else
...@@ -99,7 +99,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); ...@@ -99,7 +99,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define disable_e1() /* nothing */ #define disable_e1() /* nothing */
#endif #endif
#if (DRIVER_EXTRUDERS > 2) && HAS_E2_ENABLE #if (DRIVER_EXTRUDERS > 2) && HAS(E2_ENABLE)
#define enable_e2() E2_ENABLE_WRITE( E_ENABLE_ON) #define enable_e2() E2_ENABLE_WRITE( E_ENABLE_ON)
#define disable_e2() E2_ENABLE_WRITE(!E_ENABLE_ON) #define disable_e2() E2_ENABLE_WRITE(!E_ENABLE_ON)
#else #else
...@@ -107,7 +107,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); ...@@ -107,7 +107,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define disable_e2() /* nothing */ #define disable_e2() /* nothing */
#endif #endif
#if (DRIVER_EXTRUDERS > 3) && HAS_E3_ENABLE #if (DRIVER_EXTRUDERS > 3) && HAS(E3_ENABLE)
#define enable_e3() E3_ENABLE_WRITE( E_ENABLE_ON) #define enable_e3() E3_ENABLE_WRITE( E_ENABLE_ON)
#define disable_e3() E3_ENABLE_WRITE(!E_ENABLE_ON) #define disable_e3() E3_ENABLE_WRITE(!E_ENABLE_ON)
#else #else
...@@ -138,7 +138,7 @@ void disable_all_steppers(); ...@@ -138,7 +138,7 @@ void disable_all_steppers();
void FlushSerialRequestResend(); void FlushSerialRequestResend();
void ok_to_send(); void ok_to_send();
#if ENABLED(DELTA) #if MECH(DELTA)
float probe_bed(float x, float y); float probe_bed(float x, float y);
void set_delta_constants(); void set_delta_constants();
void adj_tower_delta(int tower); void adj_tower_delta(int tower);
...@@ -166,7 +166,7 @@ void ok_to_send(); ...@@ -166,7 +166,7 @@ void ok_to_send();
extern float delta_radius; extern float delta_radius;
extern float delta_diagonal_rod; extern float delta_diagonal_rod;
#endif #endif
#if ENABLED(SCARA) #if MECH(SCARA)
void calculate_delta(float cartesian[3]); void calculate_delta(float cartesian[3]);
void calculate_SCARA_forward_Transform(float f_scara[3]); void calculate_SCARA_forward_Transform(float f_scara[3]);
#endif #endif
...@@ -237,7 +237,7 @@ extern float home_offset[3]; ...@@ -237,7 +237,7 @@ extern float home_offset[3];
extern int old_color; // old color for system NPR2 extern int old_color; // old color for system NPR2
#endif #endif
#if ENABLED(DELTA) #if MECH(DELTA)
extern float z_probe_offset[3]; extern float z_probe_offset[3];
extern float endstop_adj[3]; extern float endstop_adj[3];
extern float tower_adj[6]; extern float tower_adj[6];
...@@ -248,7 +248,7 @@ extern float home_offset[3]; ...@@ -248,7 +248,7 @@ extern float home_offset[3];
extern float z_endstop_adj; extern float z_endstop_adj;
#endif #endif
#if ENABLED(SCARA) #if MECH(SCARA)
extern float axis_scaling[3]; // Build size scaling extern float axis_scaling[3]; // Build size scaling
#endif #endif
...@@ -273,7 +273,7 @@ extern int fanSpeed; ...@@ -273,7 +273,7 @@ extern int fanSpeed;
#if ENABLED(FAN_SOFT_PWM) #if ENABLED(FAN_SOFT_PWM)
extern unsigned char fanSpeedSoftPwm; extern unsigned char fanSpeedSoftPwm;
#if HAS_CONTROLLERFAN #if HAS(CONTROLLERFAN)
extern unsigned char fanSpeedSoftPwm_controller; extern unsigned char fanSpeedSoftPwm_controller;
#endif #endif
#endif #endif
...@@ -288,7 +288,7 @@ extern int fanSpeed; ...@@ -288,7 +288,7 @@ extern int fanSpeed;
extern int meas_delay_cm; //delay distance extern int meas_delay_cm; //delay distance
#endif #endif
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
extern float power_consumption_meas; //holds the power consumption as accurately measured extern float power_consumption_meas; //holds the power consumption as accurately measured
extern unsigned long power_consumption_hour; //holds the power consumption per hour as accurately measured extern unsigned long power_consumption_hour; //holds the power consumption per hour as accurately measured
extern unsigned long startpower; extern unsigned long startpower;
......
...@@ -54,11 +54,11 @@ ...@@ -54,11 +54,11 @@
#include "Wire.h" #include "Wire.h"
#endif #endif
#if HAS_SERVOS #if HAS(SERVOS)
#include "servo.h" #include "servo.h"
#endif #endif
#if HAS_DIGIPOTSS #if HAS(DIGIPOTSS)
#include <SPI.h> #include <SPI.h>
#endif #endif
...@@ -322,7 +322,7 @@ unsigned long printer_usage_seconds; ...@@ -322,7 +322,7 @@ unsigned long printer_usage_seconds;
int old_color = 99; int old_color = 99;
#endif #endif
#if HAS_SERVO_ENDSTOPS #if HAS(SERVO_ENDSTOPS)
const int servo_endstop_id[] = SERVO_ENDSTOP_IDS; const int servo_endstop_id[] = SERVO_ENDSTOP_IDS;
const int servo_endstop_angle[][2] = {X_ENDSTOP_SERVO_ANGLES, Y_ENDSTOP_SERVO_ANGLES, Z_ENDSTOP_SERVO_ANGLES}; const int servo_endstop_angle[][2] = {X_ENDSTOP_SERVO_ANGLES, Y_ENDSTOP_SERVO_ANGLES, Z_ENDSTOP_SERVO_ANGLES};
#endif #endif
...@@ -348,7 +348,7 @@ unsigned long printer_usage_seconds; ...@@ -348,7 +348,7 @@ unsigned long printer_usage_seconds;
#endif // FWRETRACT #endif // FWRETRACT
#if ENABLED(ULTIPANEL) && HAS_POWER_SWITCH #if ENABLED(ULTIPANEL) && HAS(POWER_SWITCH)
bool powersupply = bool powersupply =
#if ENABLED(PS_DEFAULT_OFF) #if ENABLED(PS_DEFAULT_OFF)
false false
...@@ -358,7 +358,7 @@ unsigned long printer_usage_seconds; ...@@ -358,7 +358,7 @@ unsigned long printer_usage_seconds;
; ;
#endif #endif
#if ENABLED(DELTA) #if MECH(DELTA)
float delta[3] = { 0.0 }; float delta[3] = { 0.0 };
float delta_tmp[3] = { 0.0 }; float delta_tmp[3] = { 0.0 };
float endstop_adj[3] = { 0 }; float endstop_adj[3] = { 0 };
...@@ -409,7 +409,7 @@ unsigned long printer_usage_seconds; ...@@ -409,7 +409,7 @@ unsigned long printer_usage_seconds;
static bool home_all_axis = true; static bool home_all_axis = true;
#endif #endif
#if ENABLED(SCARA) #if MECH(SCARA)
float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND; float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND;
static float delta[3] = { 0 }; static float delta[3] = { 0 };
float axis_scaling[3] = { 1, 1, 1 }; // Build size scaling, default to 1 float axis_scaling[3] = { 1, 1, 1 }; // Build size scaling, default to 1
...@@ -427,7 +427,7 @@ unsigned long printer_usage_seconds; ...@@ -427,7 +427,7 @@ unsigned long printer_usage_seconds;
int meas_delay_cm = MEASUREMENT_DELAY_CM; //distance delay setting int meas_delay_cm = MEASUREMENT_DELAY_CM; //distance delay setting
#endif #endif
#if HAS_FILRUNOUT #if HAS(FILRUNOUT)
static bool filrunoutEnqueued = false; static bool filrunoutEnqueued = false;
bool printing = false; bool printing = false;
#endif #endif
...@@ -450,7 +450,7 @@ unsigned long printer_usage_seconds; ...@@ -450,7 +450,7 @@ unsigned long printer_usage_seconds;
bool IDLE_OOZING_retracted[EXTRUDERS] = ARRAY_BY_EXTRUDERS(false); bool IDLE_OOZING_retracted[EXTRUDERS] = ARRAY_BY_EXTRUDERS(false);
#endif #endif
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
float power_consumption_meas = 0.0; float power_consumption_meas = 0.0;
unsigned long power_consumption_hour; unsigned long power_consumption_hour;
unsigned long startpower = 0; unsigned long startpower = 0;
...@@ -470,11 +470,11 @@ unsigned long printer_usage_seconds; ...@@ -470,11 +470,11 @@ unsigned long printer_usage_seconds;
bool allow_lengthy_extrude_once; // for load/unload bool allow_lengthy_extrude_once; // for load/unload
#endif #endif
#if HAS_SERVOS #if HAS(SERVOS)
Servo servo[NUM_SERVOS]; Servo servo[NUM_SERVOS];
#endif #endif
#if HAS_CHDK #if HAS(CHDK)
unsigned long chdkHigh = 0; unsigned long chdkHigh = 0;
boolean chdkActive = false; boolean chdkActive = false;
#endif #endif
...@@ -579,21 +579,21 @@ bool enqueuecommand(const char *cmd) { ...@@ -579,21 +579,21 @@ bool enqueuecommand(const char *cmd) {
SET_OUTPUT(EXP_VOLTAGE_LEVEL_PIN); SET_OUTPUT(EXP_VOLTAGE_LEVEL_PIN);
WRITE(EXP_VOLTAGE_LEVEL_PIN, UI_VOLTAGE_LEVEL); WRITE(EXP_VOLTAGE_LEVEL_PIN, UI_VOLTAGE_LEVEL);
ExternalDac::begin(); //initialize ExternalDac ExternalDac::begin(); //initialize ExternalDac
#if HAS_BUZZER #if HAS(BUZZER)
buzz(10,10); buzz(10,10);
#endif #endif
} }
#endif #endif
void setup_killpin() { void setup_killpin() {
#if HAS_KILL #if HAS(KILL)
SET_INPUT(KILL_PIN); SET_INPUT(KILL_PIN);
WRITE(KILL_PIN, HIGH); WRITE(KILL_PIN, HIGH);
#endif #endif
} }
void setup_filrunoutpin() { void setup_filrunoutpin() {
#if HAS_FILRUNOUT #if HAS(FILRUNOUT)
pinMode(FILRUNOUT_PIN, INPUT); pinMode(FILRUNOUT_PIN, INPUT);
#if ENABLED(ENDSTOPPULLUP_FIL_RUNOUT) #if ENABLED(ENDSTOPPULLUP_FIL_RUNOUT)
WRITE(FILRUNOUT_PIN, HIGH); WRITE(FILRUNOUT_PIN, HIGH);
...@@ -603,7 +603,7 @@ void setup_filrunoutpin() { ...@@ -603,7 +603,7 @@ void setup_filrunoutpin() {
// Set home pin // Set home pin
void setup_homepin(void) { void setup_homepin(void) {
#if HAS_HOME #if HAS(HOME)
SET_INPUT(HOME_PIN); SET_INPUT(HOME_PIN);
WRITE(HOME_PIN, HIGH); WRITE(HOME_PIN, HIGH);
#endif #endif
...@@ -611,7 +611,7 @@ void setup_homepin(void) { ...@@ -611,7 +611,7 @@ void setup_homepin(void) {
void setup_photpin() { void setup_photpin() {
#if HAS_PHOTOGRAPH #if HAS(PHOTOGRAPH)
OUT_WRITE(PHOTOGRAPH_PIN, LOW); OUT_WRITE(PHOTOGRAPH_PIN, LOW);
#endif #endif
} }
...@@ -624,10 +624,10 @@ void setup_laserbeampin() { ...@@ -624,10 +624,10 @@ void setup_laserbeampin() {
} }
void setup_powerhold() { void setup_powerhold() {
#if HAS_SUICIDE #if HAS(SUICIDE)
OUT_WRITE(SUICIDE_PIN, HIGH); OUT_WRITE(SUICIDE_PIN, HIGH);
#endif #endif
#if HAS_POWER_SWITCH #if HAS(POWER_SWITCH)
#if ENABLED(PS_DEFAULT_OFF) #if ENABLED(PS_DEFAULT_OFF)
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP); OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#else #else
...@@ -637,31 +637,31 @@ void setup_powerhold() { ...@@ -637,31 +637,31 @@ void setup_powerhold() {
} }
void suicide() { void suicide() {
#if HAS_SUICIDE #if HAS(SUICIDE)
OUT_WRITE(SUICIDE_PIN, LOW); OUT_WRITE(SUICIDE_PIN, LOW);
#endif #endif
} }
void servo_init() { void servo_init() {
#if NUM_SERVOS >= 1 && HAS_SERVO_0 #if NUM_SERVOS >= 1 && HAS(SERVO_0)
servo[0].attach(SERVO0_PIN); servo[0].attach(SERVO0_PIN);
servo[0].detach(); // Just set up the pin. We don't have a position yet. Don't move to a random position. servo[0].detach(); // Just set up the pin. We don't have a position yet. Don't move to a random position.
#endif #endif
#if NUM_SERVOS >= 2 && HAS_SERVO_1 #if NUM_SERVOS >= 2 && HAS(SERVO_1)
servo[1].attach(SERVO1_PIN); servo[1].attach(SERVO1_PIN);
servo[1].detach(); servo[1].detach();
#endif #endif
#if NUM_SERVOS >= 3 && HAS_SERVO_2 #if NUM_SERVOS >= 3 && HAS(SERVO_2)
servo[2].attach(SERVO2_PIN); servo[2].attach(SERVO2_PIN);
servo[2].detach(); servo[2].detach();
#endif #endif
#if NUM_SERVOS >= 4 && HAS_SERVO_3 #if NUM_SERVOS >= 4 && HAS(SERVO_3)
servo[3].attach(SERVO3_PIN); servo[3].attach(SERVO3_PIN);
servo[3].detach(); servo[3].detach();
#endif #endif
// Set position of Servo Endstops that are defined // Set position of Servo Endstops that are defined
#if HAS_SERVO_ENDSTOPS #if HAS(SERVO_ENDSTOPS)
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
if (servo_endstop_id[i] >= 0) if (servo_endstop_id[i] >= 0)
servo[servo_endstop_id[i]].move(servo_endstop_angle[i][1]); servo[servo_endstop_id[i]].move(servo_endstop_angle[i][1]);
...@@ -672,7 +672,7 @@ void servo_init() { ...@@ -672,7 +672,7 @@ void servo_init() {
/** /**
* Stepper Reset (RigidBoard, et.al.) * Stepper Reset (RigidBoard, et.al.)
*/ */
#if HAS_STEPPER_RESET #if HAS(STEPPER_RESET)
void disableStepperDrivers() { void disableStepperDrivers() {
pinMode(STEPPER_RESET_PIN, OUTPUT); pinMode(STEPPER_RESET_PIN, OUTPUT);
digitalWrite(STEPPER_RESET_PIN, LOW); // drive it down to hold in reset motor driver chips digitalWrite(STEPPER_RESET_PIN, LOW); // drive it down to hold in reset motor driver chips
...@@ -708,7 +708,7 @@ void setup() { ...@@ -708,7 +708,7 @@ void setup() {
setup_filrunoutpin(); setup_filrunoutpin();
setup_powerhold(); setup_powerhold();
#if HAS_STEPPER_RESET #if HAS(STEPPER_RESET)
disableStepperDrivers(); disableStepperDrivers();
#endif #endif
...@@ -757,7 +757,7 @@ void setup() { ...@@ -757,7 +757,7 @@ void setup() {
setup_laserbeampin(); // Initialize Laserbeam pin setup_laserbeampin(); // Initialize Laserbeam pin
servo_init(); servo_init();
#if HAS_STEPPER_RESET #if HAS(STEPPER_RESET)
enableStepperDrivers(); enableStepperDrivers();
#endif #endif
...@@ -1075,7 +1075,7 @@ static const PROGMEM type array##_P[3] = \ ...@@ -1075,7 +1075,7 @@ static const PROGMEM type array##_P[3] = \
static inline type array(int axis) \ static inline type array(int axis) \
{ return pgm_read_any(&array##_P[axis]); } { return pgm_read_any(&array##_P[axis]); }
#if defined(CARTESIAN) || defined(COREXY) || defined(COREXZ) || defined(SCARA) #if MECH(CARTESIAN) || MECH(COREXY) || MECH(COREXZ) || MECH(SCARA)
XYZ_CONSTS_FROM_CONFIG(float, base_max_pos, MAX_POS); XYZ_CONSTS_FROM_CONFIG(float, base_max_pos, MAX_POS);
XYZ_CONSTS_FROM_CONFIG(float, base_home_pos, HOME_POS); XYZ_CONSTS_FROM_CONFIG(float, base_home_pos, HOME_POS);
XYZ_CONSTS_FROM_CONFIG(float, max_length, MAX_LENGTH); XYZ_CONSTS_FROM_CONFIG(float, max_length, MAX_LENGTH);
...@@ -1149,7 +1149,7 @@ static void set_axis_is_at_home(AxisEnum axis) { ...@@ -1149,7 +1149,7 @@ static void set_axis_is_at_home(AxisEnum axis) {
} }
#endif #endif
#if ENABLED(SCARA) #if MECH(SCARA)
if (axis == X_AXIS || axis == Y_AXIS) { if (axis == X_AXIS || axis == Y_AXIS) {
...@@ -1189,7 +1189,7 @@ static void set_axis_is_at_home(AxisEnum axis) { ...@@ -1189,7 +1189,7 @@ static void set_axis_is_at_home(AxisEnum axis) {
min_pos[axis] = base_min_pos(axis) + home_offset[axis]; min_pos[axis] = base_min_pos(axis) + home_offset[axis];
max_pos[axis] = base_max_pos(axis) + home_offset[axis]; max_pos[axis] = base_max_pos(axis) + home_offset[axis];
} }
#elif ENABLED(DELTA) #elif MECH(DELTA)
current_position[axis] = base_home_pos[axis] + home_offset[axis]; current_position[axis] = base_home_pos[axis] + home_offset[axis];
min_pos[axis] = base_min_pos(axis) + home_offset[axis]; min_pos[axis] = base_min_pos(axis) + home_offset[axis];
max_pos[axis] = base_max_pos[axis] + home_offset[axis]; max_pos[axis] = base_max_pos[axis] + home_offset[axis];
...@@ -1242,7 +1242,7 @@ inline void line_to_destination() { ...@@ -1242,7 +1242,7 @@ inline void line_to_destination() {
inline void sync_plan_position() { inline void sync_plan_position() {
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
} }
#if defined(DELTA) || defined(SCARA) #if MECH(DELTA) || MECH(SCARA)
inline void sync_plan_position_delta() { inline void sync_plan_position_delta() {
calculate_delta(current_position); calculate_delta(current_position);
plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]); plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
...@@ -1269,7 +1269,7 @@ static void clean_up_after_endstop_move() { ...@@ -1269,7 +1269,7 @@ static void clean_up_after_endstop_move() {
refresh_cmd_timeout(); refresh_cmd_timeout();
} }
#if ENABLED(CARTESIAN) || ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(SCARA) #if MECH(CARTESIAN) || MECH(COREXY) || MECH(COREXZ) || MECH(SCARA)
/** /**
* Plan a move to (X, Y, Z) and set the current_position * Plan a move to (X, Y, Z) and set the current_position
...@@ -1404,7 +1404,7 @@ static void clean_up_after_endstop_move() { ...@@ -1404,7 +1404,7 @@ static void clean_up_after_endstop_move() {
ECHO_S(DB); ECHO_S(DB);
print_xyz("deploy_z_probe > current_position", current_position); print_xyz("deploy_z_probe > current_position", current_position);
} }
#if HAS_SERVO_ENDSTOPS #if HAS(SERVO_ENDSTOPS)
// Engage Z Servo endstop if enabled // Engage Z Servo endstop if enabled
if (servo_endstop_id[Z_AXIS] >= 0) servo[servo_endstop_id[Z_AXIS]].move(servo_endstop_angle[Z_AXIS][0]); if (servo_endstop_id[Z_AXIS] >= 0) servo[servo_endstop_id[Z_AXIS]].move(servo_endstop_angle[Z_AXIS][0]);
#endif #endif
...@@ -1415,7 +1415,7 @@ static void clean_up_after_endstop_move() { ...@@ -1415,7 +1415,7 @@ static void clean_up_after_endstop_move() {
ECHO_S(DB); ECHO_S(DB);
print_xyz("stow_z_probe > current_position", current_position); print_xyz("stow_z_probe > current_position", current_position);
} }
#if HAS_SERVO_ENDSTOPS #if HAS(SERVO_ENDSTOPS)
// Retract Z Servo endstop if enabled // Retract Z Servo endstop if enabled
if (servo_endstop_id[Z_AXIS] >= 0) { if (servo_endstop_id[Z_AXIS] >= 0) {
...@@ -1492,7 +1492,7 @@ static void clean_up_after_endstop_move() { ...@@ -1492,7 +1492,7 @@ static void clean_up_after_endstop_move() {
return measured_z; return measured_z;
} }
#if HAS_SERVO_ENDSTOPS && DISABLED(Z_PROBE_SLED) #if HAS(SERVO_ENDSTOPS) && DISABLED(Z_PROBE_SLED)
void raise_z_for_servo() { void raise_z_for_servo() {
float zpos = current_position[Z_AXIS], z_dest = Z_RAISE_BEFORE_PROBING; float zpos = current_position[Z_AXIS], z_dest = Z_RAISE_BEFORE_PROBING;
z_dest += axis_known_position[Z_AXIS] ? zprobe_zoffset : zpos; z_dest += axis_known_position[Z_AXIS] ? zprobe_zoffset : zpos;
...@@ -1537,7 +1537,7 @@ static void clean_up_after_endstop_move() { ...@@ -1537,7 +1537,7 @@ static void clean_up_after_endstop_move() {
} }
#endif #endif
#if HAS_SERVO_ENDSTOPS #if HAS(SERVO_ENDSTOPS)
// Engage Servo endstop if enabled // Engage Servo endstop if enabled
if (axis != Z_AXIS && servo_endstop_id[axis] >= 0) if (axis != Z_AXIS && servo_endstop_id[axis] >= 0)
servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][0]); servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][0]);
...@@ -1637,7 +1637,7 @@ static void clean_up_after_endstop_move() { ...@@ -1637,7 +1637,7 @@ static void clean_up_after_endstop_move() {
else else
#endif #endif
{ {
#if HAS_SERVO_ENDSTOPS #if HAS(SERVO_ENDSTOPS)
// Retract Servo endstop if enabled // Retract Servo endstop if enabled
if (servo_endstop_id[axis] >= 0) { if (servo_endstop_id[axis] >= 0) {
if (debugLevel & DEBUG_INFO) ECHO_LM(DB, "> SERVO_ENDSTOPS > Stow with servo.move()"); if (debugLevel & DEBUG_INFO) ECHO_LM(DB, "> SERVO_ENDSTOPS > Stow with servo.move()");
...@@ -1654,7 +1654,7 @@ static void clean_up_after_endstop_move() { ...@@ -1654,7 +1654,7 @@ static void clean_up_after_endstop_move() {
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS) #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
#endif // CARTESIAN || COREXY || COREXZ || SCARA #endif // CARTESIAN || COREXY || COREXZ || SCARA
#if ENABLED(DELTA) #if MECH(DELTA)
static void homeaxis(AxisEnum axis) { static void homeaxis(AxisEnum axis) {
#define HOMEAXIS_DO(LETTER) \ #define HOMEAXIS_DO(LETTER) \
...@@ -1805,7 +1805,7 @@ static void clean_up_after_endstop_move() { ...@@ -1805,7 +1805,7 @@ static void clean_up_after_endstop_move() {
void deploy_z_probe() { void deploy_z_probe() {
#if HAS_SERVO_ENDSTOPS #if HAS(SERVO_ENDSTOPS)
// Engage Z Servo endstop if enabled // Engage Z Servo endstop if enabled
if (servo_endstop_id[Z_AXIS] >= 0) servo[servo_endstop_id[Z_AXIS]].move(servo_endstop_angle[Z_AXIS][0]); if (servo_endstop_id[Z_AXIS] >= 0) servo[servo_endstop_id[Z_AXIS]].move(servo_endstop_angle[Z_AXIS][0]);
#endif #endif
...@@ -1854,7 +1854,7 @@ static void clean_up_after_endstop_move() { ...@@ -1854,7 +1854,7 @@ static void clean_up_after_endstop_move() {
prepare_move_raw(); prepare_move_raw();
st_synchronize(); st_synchronize();
#if HAS_SERVO_ENDSTOPS #if HAS(SERVO_ENDSTOPS)
// Retract Z Servo endstop if enabled // Retract Z Servo endstop if enabled
if (servo_endstop_id[Z_AXIS] >= 0) if (servo_endstop_id[Z_AXIS] >= 0)
// Change the Z servo angle // Change the Z servo angle
...@@ -2691,7 +2691,7 @@ static void clean_up_after_endstop_move() { ...@@ -2691,7 +2691,7 @@ static void clean_up_after_endstop_move() {
if (retract_zlift > 0.01) { if (retract_zlift > 0.01) {
current_position[Z_AXIS] -= retract_zlift; current_position[Z_AXIS] -= retract_zlift;
#if defined(DELTA) || defined(SCARA) #if MECH(DELTA) || MECH(SCARA)
sync_plan_position_delta(); sync_plan_position_delta();
#else #else
sync_plan_position(); sync_plan_position();
...@@ -2703,7 +2703,7 @@ static void clean_up_after_endstop_move() { ...@@ -2703,7 +2703,7 @@ static void clean_up_after_endstop_move() {
if (retract_zlift > 0.01) { if (retract_zlift > 0.01) {
current_position[Z_AXIS] += retract_zlift; current_position[Z_AXIS] += retract_zlift;
#if defined(DELTA) || defined(SCARA) #if MECH(DELTA) || MECH(SCARA)
sync_plan_position_delta(); sync_plan_position_delta();
#else #else
sync_plan_position(); sync_plan_position();
...@@ -2994,7 +2994,7 @@ inline void gcode_G28() { ...@@ -2994,7 +2994,7 @@ inline void gcode_G28() {
// For auto bed leveling, clear the level matrix // For auto bed leveling, clear the level matrix
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
plan_bed_level_matrix.set_to_identity(); plan_bed_level_matrix.set_to_identity();
#elif defined(DELTA) #elif MECH(DELTA)
reset_bed_level(); reset_bed_level();
#endif #endif
...@@ -3029,7 +3029,7 @@ inline void gcode_G28() { ...@@ -3029,7 +3029,7 @@ inline void gcode_G28() {
} }
#endif #endif
#if ENABLED(DELTA) #if MECH(DELTA)
// A delta can only safely home all axis at the same time // A delta can only safely home all axis at the same time
// all axis have to home at the same time // all axis have to home at the same time
...@@ -3398,14 +3398,14 @@ inline void gcode_G28() { ...@@ -3398,14 +3398,14 @@ inline void gcode_G28() {
#endif // !DELTA #endif // !DELTA
#if ENABLED(SCARA) #if MECH(SCARA)
sync_plan_position_delta(); sync_plan_position_delta();
#endif #endif
clean_up_after_endstop_move(); clean_up_after_endstop_move();
if(come_back) { if(come_back) {
#if ENABLED(DELTA) #if MECH(DELTA)
feedrate = 1.732 * homing_feedrate[X_AXIS]; feedrate = 1.732 * homing_feedrate[X_AXIS];
memcpy(destination, lastpos, sizeof(destination)); memcpy(destination, lastpos, sizeof(destination));
prepare_move(); prepare_move();
...@@ -3798,7 +3798,7 @@ inline void gcode_G28() { ...@@ -3798,7 +3798,7 @@ inline void gcode_G28() {
vector_3 probe_point = vector_3(eqnAMatrix[ind + 0 * abl2], eqnAMatrix[ind + 1 * abl2], eqnBVector[ind]); vector_3 probe_point = vector_3(eqnAMatrix[ind + 0 * abl2], eqnAMatrix[ind + 1 * abl2], eqnBVector[ind]);
probe_point.apply_rotation(inverse_bed_level_matrix); probe_point.apply_rotation(inverse_bed_level_matrix);
current_position[Z_AXIS] = -zprobe_zoffset + (probe_point.z - rot_max_diff) current_position[Z_AXIS] = -zprobe_zoffset + (probe_point.z - rot_max_diff)
#if HAS_SERVO_ENDSTOPS || ENABLED(Z_PROBE_SLED) #if HAS(SERVO_ENDSTOPS) || ENABLED(Z_PROBE_SLED)
+ Z_RAISE_AFTER_PROBING + Z_RAISE_AFTER_PROBING
#endif #endif
; ;
...@@ -3819,7 +3819,7 @@ inline void gcode_G28() { ...@@ -3819,7 +3819,7 @@ inline void gcode_G28() {
* G30: Do a single Z probe at the current XY * G30: Do a single Z probe at the current XY
*/ */
inline void gcode_G30() { inline void gcode_G30() {
#if HAS_SERVO_ENDSTOPS #if HAS(SERVO_ENDSTOPS)
raise_z_for_servo(); raise_z_for_servo();
#endif #endif
deploy_z_probe(); // Engage Z Servo endstop if available deploy_z_probe(); // Engage Z Servo endstop if available
...@@ -3838,7 +3838,7 @@ inline void gcode_G28() { ...@@ -3838,7 +3838,7 @@ inline void gcode_G28() {
clean_up_after_endstop_move(); clean_up_after_endstop_move();
#if HAS_SERVO_ENDSTOPS #if HAS(SERVO_ENDSTOPS)
raise_z_for_servo(); raise_z_for_servo();
#endif #endif
...@@ -3847,7 +3847,7 @@ inline void gcode_G28() { ...@@ -3847,7 +3847,7 @@ inline void gcode_G28() {
#endif // !Z_PROBE_SLED #endif // !Z_PROBE_SLED
#endif // AUTO_BED_LEVELING_FEATURE #endif // AUTO_BED_LEVELING_FEATURE
#if ENABLED(DELTA) && ENABLED(Z_PROBE_ENDSTOP) #if MECH(DELTA) && ENABLED(Z_PROBE_ENDSTOP)
/** /**
* G29: Delta Z-Probe, probes the bed at more points. * G29: Delta Z-Probe, probes the bed at more points.
...@@ -4167,7 +4167,7 @@ inline void gcode_G92() { ...@@ -4167,7 +4167,7 @@ inline void gcode_G92() {
} }
} }
if (didXYZ) { if (didXYZ) {
#if defined(DELTA) || defined(SCARA) #if MECH(DELTA) || MECH(SCARA)
sync_plan_position_delta(); sync_plan_position_delta();
#else #else
sync_plan_position(); sync_plan_position();
...@@ -4253,7 +4253,7 @@ inline void gcode_G92() { ...@@ -4253,7 +4253,7 @@ inline void gcode_G92() {
} }
#endif //LASERBEAM #endif //LASERBEAM
#if HAS_FILRUNOUT #if HAS(FILRUNOUT)
/** /**
* M11: Start printing * M11: Start printing
*/ */
...@@ -4263,7 +4263,7 @@ inline void gcode_G92() { ...@@ -4263,7 +4263,7 @@ inline void gcode_G92() {
ECHO_LM(DB, "Start Printing, pause pin active."); ECHO_LM(DB, "Start Printing, pause pin active.");
ECHO_S(RESUME); ECHO_S(RESUME);
ECHO_E; ECHO_E;
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
startpower = power_consumption_hour; startpower = power_consumption_hour;
#endif #endif
} }
...@@ -4315,7 +4315,7 @@ inline void gcode_M17() { ...@@ -4315,7 +4315,7 @@ inline void gcode_M17() {
inline void gcode_M24() { inline void gcode_M24() {
card.startFileprint(); card.startFileprint();
print_job_start_ms = millis(); print_job_start_ms = millis();
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
startpower = power_consumption_hour; startpower = power_consumption_hour;
#endif #endif
} }
...@@ -4457,7 +4457,7 @@ inline void gcode_M42() { ...@@ -4457,7 +4457,7 @@ inline void gcode_M42() {
} }
} }
#if HAS_FAN #if HAS(FAN)
if (pin_number == FAN_PIN) fanSpeed = pin_status; if (pin_number == FAN_PIN) fanSpeed = pin_status;
#endif #endif
...@@ -4694,7 +4694,7 @@ inline void gcode_M42() { ...@@ -4694,7 +4694,7 @@ inline void gcode_M42() {
#endif // AUTO_BED_LEVELING_FEATURE && Z_PROBE_REPEATABILITY_TEST #endif // AUTO_BED_LEVELING_FEATURE && Z_PROBE_REPEATABILITY_TEST
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
/** /**
* M70 - Power consumption sensor calibration * M70 - Power consumption sensor calibration
...@@ -4722,7 +4722,7 @@ inline void gcode_M42() { ...@@ -4722,7 +4722,7 @@ inline void gcode_M42() {
} }
#endif #endif
#if HAS_POWER_SWITCH #if HAS(POWER_SWITCH)
/** /**
* M80: Turn on Power Supply * M80: Turn on Power Supply
...@@ -4733,7 +4733,7 @@ inline void gcode_M42() { ...@@ -4733,7 +4733,7 @@ inline void gcode_M42() {
// If you have a switch on suicide pin, this is useful // If you have a switch on suicide pin, this is useful
// if you want to start another print with suicide feature after // if you want to start another print with suicide feature after
// a print without suicide... // a print without suicide...
#if HAS_SUICIDE #if HAS(SUICIDE)
OUT_WRITE(SUICIDE_PIN, HIGH); OUT_WRITE(SUICIDE_PIN, HIGH);
#endif #endif
...@@ -4743,7 +4743,7 @@ inline void gcode_M42() { ...@@ -4743,7 +4743,7 @@ inline void gcode_M42() {
lcd_update(); lcd_update();
#endif #endif
} }
#endif // HAS_POWER_SWITCH #endif // HAS(POWER_SWITCH)
/** /**
* M81: Turn off Power, including Power Supply, if there is one. * M81: Turn off Power, including Power Supply, if there is one.
...@@ -4757,14 +4757,14 @@ inline void gcode_M81() { ...@@ -4757,14 +4757,14 @@ inline void gcode_M81() {
finishAndDisableSteppers(); finishAndDisableSteppers();
fanSpeed = 0; fanSpeed = 0;
delay(1000); // Wait 1 second before switching off delay(1000); // Wait 1 second before switching off
#if HAS_SUICIDE #if HAS(SUICIDE)
st_synchronize(); st_synchronize();
suicide(); suicide();
#elif HAS_POWER_SWITCH #elif HAS(POWER_SWITCH)
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP); OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#endif #endif
#ifdef ULTIPANEL #ifdef ULTIPANEL
#if HAS_POWER_SWITCH #if HAS(POWER_SWITCH)
powersupply = false; powersupply = false;
#endif #endif
LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF "."); LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF ".");
...@@ -4863,13 +4863,13 @@ inline void gcode_M104() { ...@@ -4863,13 +4863,13 @@ inline void gcode_M104() {
inline void gcode_M105() { inline void gcode_M105() {
if (setTargetedHotend(105)) return; if (setTargetedHotend(105)) return;
#if HAS_TEMP_0 || HAS_TEMP_BED || defined(HEATER_0_USES_MAX6675) #if HAS(TEMP_0) || HAS(TEMP_BED) || defined(HEATER_0_USES_MAX6675)
ECHO_S(OK); ECHO_S(OK);
#if HAS_TEMP_0 #if HAS(TEMP_0)
ECHO_MV(MSG_T, degHotend(target_extruder), 1); ECHO_MV(MSG_T, degHotend(target_extruder), 1);
ECHO_MV(" /", degTargetHotend(target_extruder), 1); ECHO_MV(" /", degTargetHotend(target_extruder), 1);
#endif #endif
#if HAS_TEMP_BED #if HAS(TEMP_BED)
ECHO_MV(" " MSG_B, degBed(), 1); ECHO_MV(" " MSG_B, degBed(), 1);
ECHO_MV(" /", degTargetBed(), 1); ECHO_MV(" /", degTargetBed(), 1);
#endif #endif
...@@ -4878,7 +4878,7 @@ inline void gcode_M105() { ...@@ -4878,7 +4878,7 @@ inline void gcode_M105() {
ECHO_MV(":", degHotend(e), 1); ECHO_MV(":", degHotend(e), 1);
ECHO_MV(" /", degTargetHotend(e), 1); ECHO_MV(" /", degTargetHotend(e), 1);
} }
#else // !HAS_TEMP_0 && !HAS_TEMP_BED #else // HASNT(TEMP_0) && HASNT(TEMP_BED)
ECHO_LM(ER, MSG_ERR_NO_THERMISTORS); ECHO_LM(ER, MSG_ERR_NO_THERMISTORS);
#endif #endif
...@@ -4897,7 +4897,7 @@ inline void gcode_M105() { ...@@ -4897,7 +4897,7 @@ inline void gcode_M105() {
#endif #endif
#ifdef SHOW_TEMP_ADC_VALUES #ifdef SHOW_TEMP_ADC_VALUES
#if HAS_TEMP_BED #if HAS(TEMP_BED)
ECHO_MV(" ADC B:", degBed(), 1); ECHO_MV(" ADC B:", degBed(), 1);
ECHO_MV("C->", rawBedTemp()/OVERSAMPLENR, 0); ECHO_MV("C->", rawBedTemp()/OVERSAMPLENR, 0);
#endif #endif
...@@ -4910,7 +4910,7 @@ inline void gcode_M105() { ...@@ -4910,7 +4910,7 @@ inline void gcode_M105() {
ECHO_E; ECHO_E;
} }
#if HAS_FAN #if HAS(FAN)
/** /**
* M106: Set Fan Speed * M106: Set Fan Speed
*/ */
...@@ -4921,7 +4921,7 @@ inline void gcode_M105() { ...@@ -4921,7 +4921,7 @@ inline void gcode_M105() {
*/ */
inline void gcode_M107() { fanSpeed = 0; } inline void gcode_M107() { fanSpeed = 0; }
#endif // HAS_FAN #endif // HAS(FAN)
/** /**
* M109: Wait for extruder(s) to reach temperature * M109: Wait for extruder(s) to reach temperature
...@@ -5055,34 +5055,34 @@ inline void gcode_M115() { ...@@ -5055,34 +5055,34 @@ inline void gcode_M115() {
*/ */
inline void gcode_M119() { inline void gcode_M119() {
ECHO_LV(DB, MSG_M119_REPORT); ECHO_LV(DB, MSG_M119_REPORT);
#if HAS_X_MIN #if HAS(X_MIN)
ECHO_EMV(MSG_X_MIN, ((READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); ECHO_EMV(MSG_X_MIN, ((READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
#if HAS_X_MAX #if HAS(X_MAX)
ECHO_EMV(MSG_X_MAX, ((READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); ECHO_EMV(MSG_X_MAX, ((READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
#if HAS_Y_MIN #if HAS(Y_MIN)
ECHO_EMV(MSG_Y_MIN, ((READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); ECHO_EMV(MSG_Y_MIN, ((READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
#if HAS_Y_MAX #if HAS(Y_MAX)
ECHO_EMV(MSG_Y_MAX, ((READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); ECHO_EMV(MSG_Y_MAX, ((READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
#if HAS_Z_MIN #if HAS(Z_MIN)
ECHO_EMV(MSG_Z_MIN, ((READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); ECHO_EMV(MSG_Z_MIN, ((READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
#if HAS_Z_MAX #if HAS(Z_MAX)
ECHO_EMV(MSG_Z_MAX, ((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); ECHO_EMV(MSG_Z_MAX, ((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
#if HAS_Z2_MAX #if HAS(Z2_MAX)
ECHO_EMV(MSG_Z2_MAX, ((READ(Z2_MAX_PIN)^Z2_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); ECHO_EMV(MSG_Z2_MAX, ((READ(Z2_MAX_PIN)^Z2_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
#if HAS_Z_PROBE #if HAS(Z_PROBE)
ECHO_EMV(MSG_Z_PROBE, ((READ(Z_PROBE_PIN)^Z_PROBE_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); ECHO_EMV(MSG_Z_PROBE, ((READ(Z_PROBE_PIN)^Z_PROBE_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
#if HAS_E_MIN #if HAS(E_MIN)
ECHO_EMV(MSG_E_MIN, ((READ(E_MIN_PIN)^E_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); ECHO_EMV(MSG_E_MIN, ((READ(E_MIN_PIN)^E_MIN_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
#if HAS_FILRUNOUT #if HAS(FILRUNOUT)
ECHO_EMV(MSG_FILRUNOUT_PIN, ((READ(FILRUNOUT_PIN)^FILRUNOUT_PIN_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); ECHO_EMV(MSG_FILRUNOUT_PIN, ((READ(FILRUNOUT_PIN)^FILRUNOUT_PIN_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
ECHO_E; ECHO_E;
...@@ -5099,7 +5099,7 @@ inline void gcode_M120() { enable_endstops(true); } ...@@ -5099,7 +5099,7 @@ inline void gcode_M120() { enable_endstops(true); }
inline void gcode_M121() { enable_endstops(false); } inline void gcode_M121() { enable_endstops(false); }
#ifdef BARICUDA #ifdef BARICUDA
#if HAS_HEATER_1 #if HAS(HEATER_1)
/** /**
* M126: Heater 1 valve open * M126: Heater 1 valve open
*/ */
...@@ -5110,7 +5110,7 @@ inline void gcode_M121() { enable_endstops(false); } ...@@ -5110,7 +5110,7 @@ inline void gcode_M121() { enable_endstops(false); }
inline void gcode_M127() { ValvePressure = 0; } inline void gcode_M127() { ValvePressure = 0; }
#endif #endif
#if HAS_HEATER_2 #if HAS(HEATER_2)
/** /**
* M128: Heater 2 valve open * M128: Heater 2 valve open
*/ */
...@@ -5216,7 +5216,7 @@ inline void gcode_M140() { ...@@ -5216,7 +5216,7 @@ inline void gcode_M140() {
#endif // BLINKM #endif // BLINKM
#if HAS_TEMP_BED #if HAS(TEMP_BED)
/** /**
* M190: Sxxx Wait for bed current temp to reach target temp. Waits only when heating * M190: Sxxx Wait for bed current temp to reach target temp. Waits only when heating
* Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling * Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
...@@ -5231,7 +5231,7 @@ inline void gcode_M140() { ...@@ -5231,7 +5231,7 @@ inline void gcode_M140() {
wait_bed(); wait_bed();
} }
#endif // HAS_TEMP_BED #endif // HAS(TEMP_BED)
/** /**
* M200: Set filament diameter and set E axis units to cubic millimetres * M200: Set filament diameter and set E axis units to cubic millimetres
...@@ -5525,16 +5525,16 @@ inline void gcode_M226() { ...@@ -5525,16 +5525,16 @@ inline void gcode_M226() {
} // code_seen('P') } // code_seen('P')
} }
#if HAS_CHDK || HAS_PHOTOGRAPH #if HAS(CHDK) || HAS(PHOTOGRAPH)
/** /**
* M240: Trigger a camera * M240: Trigger a camera
*/ */
inline void gcode_M240() { inline void gcode_M240() {
#if HAS_CHDK #if HAS(CHDK)
OUT_WRITE(CHDK_PIN, HIGH); OUT_WRITE(CHDK_PIN, HIGH);
chdkHigh = millis(); chdkHigh = millis();
chdkActive = true; chdkActive = true;
#elif HAS_PHOTOGRAPH #elif HAS(PHOTOGRAPH)
const uint8_t NUM_PULSES = 16; const uint8_t NUM_PULSES = 16;
const float PULSE_LENGTH = 0.01524; const float PULSE_LENGTH = 0.01524;
for (int i = 0; i < NUM_PULSES; i++) { for (int i = 0; i < NUM_PULSES; i++) {
...@@ -5550,11 +5550,11 @@ inline void gcode_M226() { ...@@ -5550,11 +5550,11 @@ inline void gcode_M226() {
WRITE(PHOTOGRAPH_PIN, LOW); WRITE(PHOTOGRAPH_PIN, LOW);
_delay_ms(PULSE_LENGTH); _delay_ms(PULSE_LENGTH);
} }
#endif // !HAS_CHDK && HAS_PHOTOGRAPH #endif // HASNT(CHDK) && HAS(PHOTOGRAPH)
} }
#endif // HAS_CHDK || PHOTOGRAPH_PIN #endif // HAS(CHDK) || PHOTOGRAPH_PIN
#ifdef HAS_LCD_CONTRAST #ifdef HAS(LCD_CONTRAST)
/** /**
* M250: Read and optionally set the LCD contrast * M250: Read and optionally set the LCD contrast
*/ */
...@@ -5597,7 +5597,7 @@ inline void gcode_M226() { ...@@ -5597,7 +5597,7 @@ inline void gcode_M226() {
} }
#endif // NUM_SERVOS > 0 #endif // NUM_SERVOS > 0
#if HAS_BUZZER #if HAS(BUZZER)
/** /**
* M300: Play beep sound S<frequency Hz> P<duration ms> * M300: Play beep sound S<frequency Hz> P<duration ms>
...@@ -5609,7 +5609,7 @@ inline void gcode_M226() { ...@@ -5609,7 +5609,7 @@ inline void gcode_M226() {
buzz(beepP, beepS); buzz(beepP, beepS);
} }
#endif // HAS_BUZZER #endif // HAS(BUZZER)
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
...@@ -5681,7 +5681,7 @@ inline void gcode_M226() { ...@@ -5681,7 +5681,7 @@ inline void gcode_M226() {
} }
#endif // PIDTEMPBED #endif // PIDTEMPBED
#if HAS_MICROSTEPS #if HAS(MICROSTEPS)
// M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers. // M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
inline void gcode_M350() { inline void gcode_M350() {
if(code_seen('S')) for(int i = 0; i <= 4; i++) microstep_mode(i, code_value()); if(code_seen('S')) for(int i = 0; i <= 4; i++) microstep_mode(i, code_value());
...@@ -5707,7 +5707,7 @@ inline void gcode_M226() { ...@@ -5707,7 +5707,7 @@ inline void gcode_M226() {
} }
microstep_readings(); microstep_readings();
} }
#endif // HAS_MICROSTEPS #endif // HAS(MICROSTEPS)
#ifdef SCARA #ifdef SCARA
bool SCARA_move_to_cal(uint8_t delta_x, uint8_t delta_y) { bool SCARA_move_to_cal(uint8_t delta_x, uint8_t delta_y) {
...@@ -5785,17 +5785,17 @@ inline void gcode_M226() { ...@@ -5785,17 +5785,17 @@ inline void gcode_M226() {
case 0: case 0:
OUT_WRITE(SOL0_PIN, HIGH); OUT_WRITE(SOL0_PIN, HIGH);
break; break;
#if HAS_SOLENOID_1 #if HAS(SOLENOID_1)
case 1: case 1:
OUT_WRITE(SOL1_PIN, HIGH); OUT_WRITE(SOL1_PIN, HIGH);
break; break;
#endif #endif
#if HAS_SOLENOID_2 #if HAS(SOLENOID_2)
case 2: case 2:
OUT_WRITE(SOL2_PIN, HIGH); OUT_WRITE(SOL2_PIN, HIGH);
break; break;
#endif #endif
#if HAS_SOLENOID_3 #if HAS(SOLENOID_3)
case 3: case 3:
OUT_WRITE(SOL3_PIN, HIGH); OUT_WRITE(SOL3_PIN, HIGH);
break; break;
...@@ -5832,13 +5832,13 @@ inline void gcode_M226() { ...@@ -5832,13 +5832,13 @@ inline void gcode_M226() {
*/ */
inline void gcode_M400() { st_synchronize(); } inline void gcode_M400() { st_synchronize(); }
#if ENABLED(AUTO_BED_LEVELING_FEATURE) && DISABLED(Z_PROBE_SLED) && HAS_SERVO_ENDSTOPS #if ENABLED(AUTO_BED_LEVELING_FEATURE) && DISABLED(Z_PROBE_SLED) && HAS(SERVO_ENDSTOPS)
/** /**
* M401: Engage Z Servo endstop if available * M401: Engage Z Servo endstop if available
*/ */
inline void gcode_M401() { inline void gcode_M401() {
#if HAS_SERVO_ENDSTOPS #if HAS(SERVO_ENDSTOPS)
raise_z_for_servo(); raise_z_for_servo();
#endif #endif
deploy_z_probe(); deploy_z_probe();
...@@ -5848,13 +5848,13 @@ inline void gcode_M400() { st_synchronize(); } ...@@ -5848,13 +5848,13 @@ inline void gcode_M400() { st_synchronize(); }
* M402: Retract Z Servo endstop if enabled * M402: Retract Z Servo endstop if enabled
*/ */
inline void gcode_M402() { inline void gcode_M402() {
#if HAS_SERVO_ENDSTOPS #if HAS(SERVO_ENDSTOPS)
raise_z_for_servo(); raise_z_for_servo();
#endif #endif
stow_z_probe(false); stow_z_probe(false);
} }
#endif // AUTO_BED_LEVELING_FEATURE && (HAS_SERVO_ENDSTOPS && !Z_PROBE_SLED) #endif // AUTO_BED_LEVELING_FEATURE && (HAS(SERVO_ENDSTOPS) && !Z_PROBE_SLED)
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
...@@ -5862,7 +5862,7 @@ inline void gcode_M400() { st_synchronize(); } ...@@ -5862,7 +5862,7 @@ inline void gcode_M400() { st_synchronize(); }
* M404: Display or set the nominal filament width (3mm, 1.75mm ) W<3.0> * M404: Display or set the nominal filament width (3mm, 1.75mm ) W<3.0>
*/ */
inline void gcode_M404() { inline void gcode_M404() {
#if HAS_FILWIDTH #if HAS(FILWIDTH)
if (code_seen('D')) { if (code_seen('D')) {
filament_width_nominal = code_value(); filament_width_nominal = code_value();
} }
...@@ -5947,7 +5947,7 @@ inline void gcode_M428() { ...@@ -5947,7 +5947,7 @@ inline void gcode_M428() {
else { else {
ECHO_LM(ER, MSG_ERR_M428_TOO_FAR); ECHO_LM(ER, MSG_ERR_M428_TOO_FAR);
LCD_ALERTMESSAGEPGM("Err: Too far!"); LCD_ALERTMESSAGEPGM("Err: Too far!");
#if HAS_BUZZER #if HAS(BUZZER)
enqueuecommands_P(PSTR("M300 S40 P200")); enqueuecommands_P(PSTR("M300 S40 P200"));
#endif #endif
err = true; err = true;
...@@ -5959,14 +5959,14 @@ inline void gcode_M428() { ...@@ -5959,14 +5959,14 @@ inline void gcode_M428() {
if (!err) { if (!err) {
memcpy(current_position, new_pos, sizeof(new_pos)); memcpy(current_position, new_pos, sizeof(new_pos));
memcpy(home_offset, new_offs, sizeof(new_offs)); memcpy(home_offset, new_offs, sizeof(new_offs));
#if defined(DELTA) || defined(SCARA) #if MECH(DELTA) || MECH(SCARA)
sync_plan_position_delta(); sync_plan_position_delta();
#else #else
sync_plan_position(); sync_plan_position();
#endif #endif
ECHO_LM(DB, "Offset applied."); ECHO_LM(DB, "Offset applied.");
LCD_ALERTMESSAGEPGM("Offset applied."); LCD_ALERTMESSAGEPGM("Offset applied.");
#if HAS_BUZZER #if HAS(BUZZER)
enqueuecommands_P(PSTR("M300 S659 P200\nM300 S698 P200")); enqueuecommands_P(PSTR("M300 S659 P200\nM300 S698 P200"));
#endif #endif
} }
...@@ -6164,7 +6164,7 @@ inline void gcode_M503() { ...@@ -6164,7 +6164,7 @@ inline void gcode_M503() {
line_to_destination(); line_to_destination();
#endif #endif
#if HAS_FILRUNOUT #if HAS(FILRUNOUT)
filrunoutEnqueued = false; filrunoutEnqueued = false;
#endif #endif
...@@ -6224,7 +6224,7 @@ inline void gcode_M503() { ...@@ -6224,7 +6224,7 @@ inline void gcode_M503() {
} }
#endif #endif
#if ENABLED(DELTA) #if MECH(DELTA)
//M666: Set delta endstop and geometry adjustment //M666: Set delta endstop and geometry adjustment
inline void gcode_M666() { inline void gcode_M666() {
if (code_seen('A')) { if (code_seen('A')) {
...@@ -6319,7 +6319,7 @@ inline void gcode_M503() { ...@@ -6319,7 +6319,7 @@ inline void gcode_M503() {
* M907: Set digital trimpot motor current using axis codes X, Y, Z, E, B, S * M907: Set digital trimpot motor current using axis codes X, Y, Z, E, B, S
*/ */
inline void gcode_M907() { inline void gcode_M907() {
#if HAS_DIGIPOTSS #if HAS(DIGIPOTSS)
for (int i=0;i<NUM_AXIS;i++) for (int i=0;i<NUM_AXIS;i++)
if (code_seen(axis_codes[i])) digipot_current(i, code_value()); if (code_seen(axis_codes[i])) digipot_current(i, code_value());
if (code_seen('B')) digipot_current(4, code_value()); if (code_seen('B')) digipot_current(4, code_value());
...@@ -6342,7 +6342,7 @@ inline void gcode_M907() { ...@@ -6342,7 +6342,7 @@ inline void gcode_M907() {
#endif #endif
} }
#if HAS_DIGIPOTSS #if HAS(DIGIPOTSS)
/** /**
* M908: Control digital trimpot directly (M908 P<pin> S<current>) * M908: Control digital trimpot directly (M908 P<pin> S<current>)
*/ */
...@@ -6352,7 +6352,7 @@ inline void gcode_M907() { ...@@ -6352,7 +6352,7 @@ inline void gcode_M907() {
code_seen('S') ? code_value() : 0 code_seen('S') ? code_value() : 0
); );
} }
#endif // HAS_DIGIPOTSS #endif // HAS(DIGIPOTSS)
#if ENABLED(NPR2) #if ENABLED(NPR2)
/** /**
...@@ -6598,7 +6598,7 @@ inline void gcode_T(uint8_t tmp_extruder) { ...@@ -6598,7 +6598,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
#endif // end MKR4 || NPR2 #endif // end MKR4 || NPR2
#endif // end no DUAL_X_CARRIAGE #endif // end no DUAL_X_CARRIAGE
#if defined(DELTA) || defined(SCARA) #if MECH(DELTA) || MECH(SCARA)
sync_plan_position_delta(); sync_plan_position_delta();
#else // NO DELTA #else // NO DELTA
sync_plan_position(); sync_plan_position();
...@@ -6704,7 +6704,7 @@ void process_next_command() { ...@@ -6704,7 +6704,7 @@ void process_next_command() {
#endif // Z_PROBE_SLED #endif // Z_PROBE_SLED
#endif // AUTO_BED_LEVELING_FEATURE #endif // AUTO_BED_LEVELING_FEATURE
#if defined(DELTA) && defined(Z_PROBE_ENDSTOP) #if MECH(DELTA) && defined(Z_PROBE_ENDSTOP)
case 29: // G29 Detailed Z-Probe, probes the bed at more points. case 29: // G29 Detailed Z-Probe, probes the bed at more points.
gcode_G29(); gcode_M114(); break; gcode_G29(); gcode_M114(); break;
case 30: // G30 Delta AutoCalibration case 30: // G30 Delta AutoCalibration
...@@ -6741,7 +6741,7 @@ void process_next_command() { ...@@ -6741,7 +6741,7 @@ void process_next_command() {
gcode_M5(); break; gcode_M5(); break;
#endif //LASERBEAM #endif //LASERBEAM
#if HAS_FILRUNOUT #if HAS(FILRUNOUT)
case 11: //M11 - Start printing case 11: //M11 - Start printing
gcode_M11(); break; gcode_M11(); break;
#endif #endif
...@@ -6794,12 +6794,12 @@ void process_next_command() { ...@@ -6794,12 +6794,12 @@ void process_next_command() {
gcode_M48(); break; gcode_M48(); break;
#endif #endif
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
case 70: // M70 - Power consumption sensor calibration case 70: // M70 - Power consumption sensor calibration
gcode_M70(); break; gcode_M70(); break;
#endif #endif
#if HAS_POWER_SWITCH #if HAS(POWER_SWITCH)
case 80: // M80 - Turn on Power Supply case 80: // M80 - Turn on Power Supply
gcode_M80(); break; gcode_M80(); break;
#endif #endif
...@@ -6822,12 +6822,12 @@ void process_next_command() { ...@@ -6822,12 +6822,12 @@ void process_next_command() {
case 105: // M105 Read current temperature case 105: // M105 Read current temperature
gcode_M105(); return; // "ok" already printed gcode_M105(); return; // "ok" already printed
#if HAS_FAN #if HAS(FAN)
case 106: //M106 Fan On case 106: //M106 Fan On
gcode_M106(); break; gcode_M106(); break;
case 107: //M107 Fan Off case 107: //M107 Fan Off
gcode_M107(); break; gcode_M107(); break;
#endif // HAS_FAN #endif // HAS(FAN)
case 109: // M109 Wait for temperature case 109: // M109 Wait for temperature
gcode_M109(); break; gcode_M109(); break;
...@@ -6861,20 +6861,20 @@ void process_next_command() { ...@@ -6861,20 +6861,20 @@ void process_next_command() {
#ifdef BARICUDA #ifdef BARICUDA
// PWM for HEATER_1_PIN // PWM for HEATER_1_PIN
#if HAS_HEATER_1 #if HAS(HEATER_1)
case 126: // M126 valve open case 126: // M126 valve open
gcode_M126(); break; gcode_M126(); break;
case 127: // M127 valve closed case 127: // M127 valve closed
gcode_M127(); break; gcode_M127(); break;
#endif // HAS_HEATER_1 #endif // HAS(HEATER_1)
// PWM for HEATER_2_PIN // PWM for HEATER_2_PIN
#if HAS_HEATER_2 #if HAS(HEATER_2)
case 128: // M128 valve open case 128: // M128 valve open
gcode_M128(); break; gcode_M128(); break;
case 129: // M129 valve closed case 129: // M129 valve closed
gcode_M129(); break; gcode_M129(); break;
#endif // HAS_HEATER_2 #endif // HAS(HEATER_2)
#endif // BARICUDA #endif // BARICUDA
case 140: // M140 Set bed temp case 140: // M140 Set bed temp
...@@ -6885,7 +6885,7 @@ void process_next_command() { ...@@ -6885,7 +6885,7 @@ void process_next_command() {
gcode_M150(); break; gcode_M150(); break;
#endif //BLINKM #endif //BLINKM
#if HAS_TEMP_BED #if HAS(TEMP_BED)
case 190: // M190 - Wait for bed heater to reach target. case 190: // M190 - Wait for bed heater to reach target.
gcode_M190(); break; gcode_M190(); break;
#endif //TEMP_BED_PIN #endif //TEMP_BED_PIN
...@@ -6929,10 +6929,10 @@ void process_next_command() { ...@@ -6929,10 +6929,10 @@ void process_next_command() {
case 226: // M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required case 226: // M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required
gcode_M226(); break; gcode_M226(); break;
#if HAS_CHDK || HAS_PHOTOGRAPH #if HAS(CHDK) || HAS(PHOTOGRAPH)
case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/ case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
gcode_M240(); break; gcode_M240(); break;
#endif // HAS_CHDK || HAS_PHOTOGRAPH #endif // HAS(CHDK) || HAS(PHOTOGRAPH)
#if defined(DOGLCD) && LCD_CONTRAST >= 0 #if defined(DOGLCD) && LCD_CONTRAST >= 0
case 250: // M250 Set LCD contrast value: C<value> (value 0..63) case 250: // M250 Set LCD contrast value: C<value> (value 0..63)
...@@ -6944,10 +6944,10 @@ void process_next_command() { ...@@ -6944,10 +6944,10 @@ void process_next_command() {
gcode_M280(); break; gcode_M280(); break;
#endif // NUM_SERVOS > 0 #endif // NUM_SERVOS > 0
#if HAS_BUZZER #if HAS(BUZZER)
case 300: // M300 - Play beep tone case 300: // M300 - Play beep tone
gcode_M300(); break; gcode_M300(); break;
#endif // HAS_BUZZER #endif // HAS(BUZZER)
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
case 301: // M301 case 301: // M301
...@@ -6969,12 +6969,12 @@ void process_next_command() { ...@@ -6969,12 +6969,12 @@ void process_next_command() {
gcode_M304(); break; gcode_M304(); break;
#endif // PIDTEMPBED #endif // PIDTEMPBED
#if HAS_MICROSTEPS #if HAS(MICROSTEPS)
case 350: // M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers. case 350: // M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
gcode_M350(); break; gcode_M350(); break;
case 351: // M351 Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low. case 351: // M351 Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low.
gcode_M351(); break; gcode_M351(); break;
#endif // HAS_MICROSTEPS #endif // HAS(MICROSTEPS)
#ifdef SCARA #ifdef SCARA
case 360: // M360 SCARA Theta pos1 case 360: // M360 SCARA Theta pos1
...@@ -7042,7 +7042,7 @@ void process_next_command() { ...@@ -7042,7 +7042,7 @@ void process_next_command() {
gcode_M605(); break; gcode_M605(); break;
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(DELTA) #if ENABLED(AUTO_BED_LEVELING_FEATURE) || MECH(DELTA)
case 666: // M666 Set Z probe offset or set delta endstop and geometry adjustment case 666: // M666 Set Z probe offset or set delta endstop and geometry adjustment
gcode_M666(); break; gcode_M666(); break;
#endif #endif
...@@ -7050,10 +7050,10 @@ void process_next_command() { ...@@ -7050,10 +7050,10 @@ void process_next_command() {
case 907: // M907 Set digital trimpot motor current using axis codes. case 907: // M907 Set digital trimpot motor current using axis codes.
gcode_M907(); break; gcode_M907(); break;
#if HAS_DIGIPOTSS #if HAS(DIGIPOTSS)
case 908: // M908 Control digital trimpot directly. case 908: // M908 Control digital trimpot directly.
gcode_M908(); break; gcode_M908(); break;
#endif // HAS_DIGIPOTSS #endif // HAS(DIGIPOTSS)
#ifdef NPR2 #ifdef NPR2
case 997: // M997 Cxx Move Carter xx gradi case 997: // M997 Cxx Move Carter xx gradi
...@@ -7142,7 +7142,7 @@ void clamp_to_software_endstops(float target[3]) { ...@@ -7142,7 +7142,7 @@ void clamp_to_software_endstops(float target[3]) {
#endif // PREVENT_DANGEROUS_EXTRUDE #endif // PREVENT_DANGEROUS_EXTRUDE
#if ENABLED(DELTA) || ENABLED(SCARA) #if MECH(DELTA) || MECH(SCARA)
inline bool prepare_move_delta(float target[NUM_AXIS]) { inline bool prepare_move_delta(float target[NUM_AXIS]) {
...@@ -7202,7 +7202,7 @@ void clamp_to_software_endstops(float target[3]) { ...@@ -7202,7 +7202,7 @@ void clamp_to_software_endstops(float target[3]) {
#endif // DELTA || SCARA #endif // DELTA || SCARA
#if ENABLED(SCARA) #if MECH(SCARA)
inline bool prepare_move_scara(float target[NUM_AXIS]) { return prepare_move_delta(target); } inline bool prepare_move_scara(float target[NUM_AXIS]) { return prepare_move_delta(target); }
#endif #endif
...@@ -7244,7 +7244,7 @@ void clamp_to_software_endstops(float target[3]) { ...@@ -7244,7 +7244,7 @@ void clamp_to_software_endstops(float target[3]) {
#endif // DUAL_X_CARRIAGE #endif // DUAL_X_CARRIAGE
#if ENABLED(CARTESIAN) || ENABLED(COREXY) || ENABLED(COREXZ) #if MECH(CARTESIAN) || MECH(COREXY) || MECH(COREXZ)
inline bool prepare_move_cartesian() { inline bool prepare_move_cartesian() {
// Do not use feedrate_multiplier for E or Z only moves // Do not use feedrate_multiplier for E or Z only moves
...@@ -7273,9 +7273,9 @@ void prepare_move() { ...@@ -7273,9 +7273,9 @@ void prepare_move() {
prevent_dangerous_extrude(current_position[E_AXIS], destination[E_AXIS]); prevent_dangerous_extrude(current_position[E_AXIS], destination[E_AXIS]);
#endif #endif
#if ENABLED(SCARA) #if MECH(SCARA)
if (!prepare_move_scara(destination)) return; if (!prepare_move_scara(destination)) return;
#elif ENABLED(DELTA) #elif MECH(DELTA)
if (!prepare_move_delta(destination)) return; if (!prepare_move_delta(destination)) return;
#endif #endif
...@@ -7283,7 +7283,7 @@ void prepare_move() { ...@@ -7283,7 +7283,7 @@ void prepare_move() {
if (!prepare_move_dual_x_carriage()) return; if (!prepare_move_dual_x_carriage()) return;
#endif #endif
#if ENABLED(CARTESIAN) || ENABLED(COREXY) || ENABLED(COREXZ) #if MECH(CARTESIAN) || MECH(COREXY) || MECH(COREXZ)
if (!prepare_move_cartesian()) return; if (!prepare_move_cartesian()) return;
#endif #endif
...@@ -7403,7 +7403,7 @@ void plan_arc( ...@@ -7403,7 +7403,7 @@ void plan_arc(
arc_target[E_AXIS] += extruder_per_segment; arc_target[E_AXIS] += extruder_per_segment;
clamp_to_software_endstops(arc_target); clamp_to_software_endstops(arc_target);
#if ENABLED(DELTA) || ENABLED(SCARA) #if MECH(DELTA) || MECH(SCARA)
calculate_delta(arc_target); calculate_delta(arc_target);
adjust_delta(arc_target); adjust_delta(arc_target);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder, active_driver); plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder, active_driver);
...@@ -7413,7 +7413,7 @@ void plan_arc( ...@@ -7413,7 +7413,7 @@ void plan_arc(
} }
// Ensure last segment arrives at target location. // Ensure last segment arrives at target location.
#if ENABLED(DELTA) || ENABLED(SCARA) #if MECH(DELTA) || MECH(SCARA)
calculate_delta(target); calculate_delta(target);
adjust_delta(arc_target); adjust_delta(arc_target);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feed_rate, active_extruder, active_driver); plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feed_rate, active_extruder, active_driver);
...@@ -7427,7 +7427,7 @@ void plan_arc( ...@@ -7427,7 +7427,7 @@ void plan_arc(
set_current_to_destination(); set_current_to_destination();
} }
#if HAS_CONTROLLERFAN #if HAS(CONTROLLERFAN)
void controllerFan() { void controllerFan() {
static millis_t lastMotor = 0; // Last time a motor was turned on static millis_t lastMotor = 0; // Last time a motor was turned on
...@@ -7439,7 +7439,7 @@ void plan_arc( ...@@ -7439,7 +7439,7 @@ void plan_arc(
|| E0_ENABLE_READ == E_ENABLE_ON // If any of the drivers are enabled... || E0_ENABLE_READ == E_ENABLE_ON // If any of the drivers are enabled...
#if EXTRUDERS > 1 #if EXTRUDERS > 1
|| E1_ENABLE_READ == E_ENABLE_ON || E1_ENABLE_READ == E_ENABLE_ON
#if HAS_X2_ENABLE #if HAS(X2_ENABLE)
|| X2_ENABLE_READ == X_ENABLE_ON || X2_ENABLE_READ == X_ENABLE_ON
#endif #endif
#if EXTRUDERS > 2 #if EXTRUDERS > 2
...@@ -7469,9 +7469,9 @@ void plan_arc( ...@@ -7469,9 +7469,9 @@ void plan_arc(
} }
} }
#endif // HAS_CONTROLLERFAN #endif // HAS(CONTROLLERFAN)
#if ENABLED(SCARA) #if MECH(SCARA)
void calculate_SCARA_forward_Transform(float f_scara[3]) { void calculate_SCARA_forward_Transform(float f_scara[3]) {
// Perform forward kinematics, and place results in delta[3] // Perform forward kinematics, and place results in delta[3]
...@@ -7560,7 +7560,7 @@ void plan_arc( ...@@ -7560,7 +7560,7 @@ void plan_arc(
next_status_led_update_ms += 500; // Update every 0.5s next_status_led_update_ms += 500; // Update every 0.5s
for (int8_t cur_hotend = 0; cur_hotend < HOTENDS; ++cur_hotend) for (int8_t cur_hotend = 0; cur_hotend < HOTENDS; ++cur_hotend)
max_temp = max(max(max_temp, degHotend(cur_hotend)), degTargetHotend(cur_hotend)); max_temp = max(max(max_temp, degHotend(cur_hotend)), degTargetHotend(cur_hotend));
#if HAS_TEMP_BED #if HAS(TEMP_BED)
max_temp = max(max(max_temp, degTargetBed()), degBed()); max_temp = max(max(max_temp, degTargetBed()), degBed());
#endif #endif
bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led; bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led;
...@@ -7618,7 +7618,7 @@ void idle(bool ignore_stepper_queue/*=false*/) { ...@@ -7618,7 +7618,7 @@ void idle(bool ignore_stepper_queue/*=false*/) {
*/ */
void manage_inactivity(bool ignore_stepper_queue/*=false*/) { void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
#if HAS_FILRUNOUT #if HAS(FILRUNOUT)
if ((printing || IS_SD_PRINTING ) && (READ(FILRUNOUT_PIN) ^ FILRUNOUT_PIN_INVERTING)) if ((printing || IS_SD_PRINTING ) && (READ(FILRUNOUT_PIN) ^ FILRUNOUT_PIN_INVERTING))
filrunout(); filrunout();
#endif #endif
...@@ -7644,14 +7644,14 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { ...@@ -7644,14 +7644,14 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
#endif #endif
} }
#if HAS_CHDK // Check if pin should be set to LOW after M240 set it to HIGH #if HAS(CHDK) // Check if pin should be set to LOW after M240 set it to HIGH
if (chdkActive && ms > chdkHigh + CHDK_DELAY) { if (chdkActive && ms > chdkHigh + CHDK_DELAY) {
chdkActive = false; chdkActive = false;
WRITE(CHDK_PIN, LOW); WRITE(CHDK_PIN, LOW);
} }
#endif #endif
#if HAS_KILL #if HAS(KILL)
// Check if the kill button was pressed and wait just in case it was an accidental // Check if the kill button was pressed and wait just in case it was an accidental
// key kill key press // key kill key press
...@@ -7669,7 +7669,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { ...@@ -7669,7 +7669,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
if (killCount >= KILL_DELAY) kill(PSTR(MSG_KILLED)); if (killCount >= KILL_DELAY) kill(PSTR(MSG_KILLED));
#endif #endif
#if HAS_HOME #if HAS(HOME)
// Check to see if we have to home, use poor man's debouncer // Check to see if we have to home, use poor man's debouncer
// --------------------------------------------------------- // ---------------------------------------------------------
static int homeDebounceCount = 0; // poor man's debouncing count static int homeDebounceCount = 0; // poor man's debouncing count
...@@ -7686,7 +7686,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { ...@@ -7686,7 +7686,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
} }
#endif #endif
#if HAS_CONTROLLERFAN #if HAS(CONTROLLERFAN)
controllerFan(); // Check if fan should be turned on to cool stepper drivers down controllerFan(); // Check if fan should be turned on to cool stepper drivers down
#endif #endif
...@@ -7809,7 +7809,7 @@ void kill(const char *lcd_msg) { ...@@ -7809,7 +7809,7 @@ void kill(const char *lcd_msg) {
disable_all_heaters(); disable_all_heaters();
disable_all_steppers(); disable_all_steppers();
#if HAS_POWER_SWITCH #if HAS(POWER_SWITCH)
SET_INPUT(PS_ON_PIN); SET_INPUT(PS_ON_PIN);
#endif #endif
...@@ -7823,7 +7823,7 @@ void kill(const char *lcd_msg) { ...@@ -7823,7 +7823,7 @@ void kill(const char *lcd_msg) {
while(1) { /* Intentionally left empty */ } // Wait for reset while(1) { /* Intentionally left empty */ } // Wait for reset
} }
#if HAS_FILRUNOUT #if HAS(FILRUNOUT)
void filrunout() { void filrunout() {
if (!filrunoutEnqueued) { if (!filrunoutEnqueued) {
filrunoutEnqueued = true; filrunoutEnqueued = true;
......
#ifndef BOARDS_H
#define BOARDS_H
#define BOARD_UNKNOWN -1
#define BOARD_GEN7_CUSTOM 10 // Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics"
#define BOARD_GEN7_12 11 // Gen7 v1.1, v1.2
#define BOARD_GEN7_13 12 // Gen7 v1.3
#define BOARD_GEN7_14 13 // Gen7 v1.4
#define BOARD_CHEAPTRONIC 2 // Cheaptronic v1.0
#define BOARD_SETHI 20 // Sethi 3D_1
#define BOARD_ELEFU_3 21 // Elefu Ra Board (v3)
#define BOARD_GEN3_MONOLITHIC 22 // Gen3 Monolithic Electronics
#define BOARD_RAMPS_OLD 3 // MEGA/RAMPS up to 1.2
#define BOARD_RAMPS_13_EFB 33 // RAMPS 1.3 / 1.4 (Power outputs: Hotend, Fan, Bed)
#define BOARD_RAMPS_13_EEB 34 // RAMPS 1.3 / 1.4 (Power outputs: Hotend0, Hotend1, Bed)
#define BOARD_RAMPS_13_EFF 35 // RAMPS 1.3 / 1.4 (Power outputs: Hotend, Fan, Fan)
#define BOARD_RAMPS_13_EEF 36 // RAMPS 1.3 / 1.4 (Power outputs: Hotend0, Hotend1, Fan)
#define BOARD_RAMPS_13_EEE 37 // RAMPS 1.3 / 1.4 (Power outputs: Hotend0, Hotend1, Hotend2)
#define BOARD_RAMBO 301 // Rambo
#define BOARD_MINIRAMBO 302 // Mini-Rambo
#define BOARD_DUEMILANOVE_328P 4 // Duemilanove w/ ATMega328P pin assignments
#define BOARD_RADDS 402 // RADDS
#define BOARD_RAMPS_FDV1 403 // RAMPS-FD V1
#define BOARD_RAMPS_FDV2 404 // RAMPS-FD V2
#define BOARD_RAMPS4DUE 433 // RAMPS4DUE with AndrewBCN's RAMPS mods (http://forums.reprap.org/read.php?219,479626,page=1)
#define BOARD_GEN6 5 // Gen6
#define BOARD_GEN6_DELUXE 51 // Gen6 deluxe
#define BOARD_ALLIGATOR 502 // ALLIGATOR R2 ARM 32
#define BOARD_SANGUINOLOLU_11 6 // Sanguinololu < 1.2
#define BOARD_SANGUINOLOLU_12 62 // Sanguinololu 1.2 and above
#define BOARD_MELZI 63 // Melzi
#define BOARD_STB_11 64 // STB V1.1
#define BOARD_AZTEEG_X1 65 // Azteeg X1
#define BOARD_MELZI_MAKR3D 66 // Melzi with ATmega1284 (MaKr3d version)
#define BOARD_AZTEEG_X3 67 // Azteeg X3
#define BOARD_AZTEEG_X3_PRO 68 // Azteeg X3 Pro
#define BOARD_ULTIMAKER 7 // Ultimaker
#define BOARD_MEGATRONICS 70 // Megatronics
#define BOARD_MEGATRONICS_2 701 // Megatronics v2.0
#define BOARD_MINITRONICS 702 // Minitronics v1.0
#define BOARD_MEGATRONICS_3 703 // Megatronics v3.0
#define BOARD_ULTIMAKER_OLD 71 // Ultimaker (Older electronics. Pre 1.5.4. This is rare)
#define BOARD_ULTIMAIN_2 72 // Ultimainboard 2.x (Uses TEMP_SENSOR 20)
#define BOARD_3DRAG 77 // 3Drag Controller
#define BOARD_K8200 78 // Vellemann K8200 Controller (derived from 3Drag Controller)
#define BOARD_TEENSYLU 8 // Teensylu
#define BOARD_RUMBA 80 // Rumba
#define BOARD_PRINTRBOARD 81 // Printrboard (AT90USB1286)
#define BOARD_BRAINWAVE 82 // Brainwave (AT90USB646)
#define BOARD_SAV_MKI 83 // SAV Mk-I (AT90USB1286)
#define BOARD_TEENSY2 84 // Teensy++2.0 (AT90USB1286)
#define BOARD_5DPRINT 88 // 5DPrint D8 Driver Board
#define BOARD_GEN3_PLUS 9 // Gen3+
#define BOARD_OMCA_A 90 // Alpha OMCA board
#define BOARD_OMCA 91 // Final OMCA board
#define BOARD_LEAPFROG 999 // Leapfrog
#define BOARD_99 99 // This is in pins.h but...?
#define MB(board) (MOTHERBOARD==BOARD_##board)
#endif //__BOARDS_H
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include "buzzer.h" #include "buzzer.h"
#include "ultralcd.h" #include "ultralcd.h"
#if HAS_BUZZER #if HAS(BUZZER)
void buzz(long duration, uint16_t freq) { void buzz(long duration, uint16_t freq) {
if (freq > 0) { if (freq > 0) {
#if ENABLED(LCD_USE_I2C_BUZZER) #if ENABLED(LCD_USE_I2C_BUZZER)
......
#ifndef BUZZER_H #ifndef BUZZER_H
#define BUZZER_H #define BUZZER_H
#if HAS_BUZZER #if HAS(BUZZER)
void buzz(long duration, uint16_t freq); void buzz(long duration, uint16_t freq);
#else #else
FORCE_INLINE void buzz(long duration, uint16_t freq) {} FORCE_INLINE void buzz(long duration, uint16_t freq) {}
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
*/ */
#ifndef CONDITIONALS_H #ifndef CONDITIONALS_H
#define CONDITIONALS_H #define CONDITIONALS_H
#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
#if ENABLED(MAKRPANEL) #if ENABLED(MAKRPANEL)
#define DOGLCD #define DOGLCD
...@@ -307,7 +306,7 @@ ...@@ -307,7 +306,7 @@
/** /**
* SCARA * SCARA
*/ */
#if ENABLED(SCARA) #if MECH(SCARA)
#undef SLOWDOWN #undef SLOWDOWN
#define QUICK_HOME //SCARA needs Quickhome #define QUICK_HOME //SCARA needs Quickhome
#endif #endif
...@@ -315,7 +314,7 @@ ...@@ -315,7 +314,7 @@
/** /**
* DELTA * DELTA
*/ */
#if ENABLED(DELTA) #if MECH(DELTA)
#undef SLOWDOWN //DELTA not needs SLOWDOWN #undef SLOWDOWN //DELTA not needs SLOWDOWN
#define AUTOLEVEL_GRID_MULTI 1/AUTOLEVEL_GRID #define AUTOLEVEL_GRID_MULTI 1/AUTOLEVEL_GRID
// DELTA must have same valour for 3 axis endstop hits // DELTA must have same valour for 3 axis endstop hits
...@@ -625,6 +624,9 @@ ...@@ -625,6 +624,9 @@
#define HAS_E1E3 (PIN_EXISTS(E1E3_CHOICE)) #define HAS_E1E3 (PIN_EXISTS(E1E3_CHOICE))
#define HAS_BTN_BACK (PIN_EXISTS(BTN_BACK)) #define HAS_BTN_BACK (PIN_EXISTS(BTN_BACK))
#define HAS_DIGIPOTSS (DIGIPOTSS_PIN >= 0)
/** /**
* Shorthand for filament sensor and power sensor for ultralcd.cpp, dogm_lcd_implementation.h, ultralcd_implementation_hitachi_HD44780.h * Shorthand for filament sensor and power sensor for ultralcd.cpp, dogm_lcd_implementation.h, ultralcd_implementation_hitachi_HD44780.h
*/ */
......
#ifndef CONFIGURATION_H #ifndef CONFIGURATION_H
#define CONFIGURATION_H #define CONFIGURATION_H
#include "boards.h"
#include "mechanism.h"
#include "macros.h" #include "macros.h"
#include "default_version.h" #include "default_version.h"
#include "configuration_overall.h"
/* /*
* This configuration file contains basic settings. * This configuration file contains basic settings.
...@@ -243,15 +240,15 @@ ...@@ -243,15 +240,15 @@
/*********************************************************************** /***********************************************************************
********************** Do not touch this section ********************** ********************** Do not touch this section **********************
***********************************************************************/ ***********************************************************************/
#if MECHANISM(MECH_CARTESIAN) #if MECH(CARTESIAN)
#include "configuration_cartesian.h" #include "configuration_cartesian.h"
#elif MECHANISM(MECH_COREXY) #elif MECH(COREXY)
#include "configuration_core.h" #include "configuration_core.h"
#elif MECHANISM(MECH_COREXZ) #elif MECH(COREXZ)
#include "configuration_core.h" #include "configuration_core.h"
#elif MECHANISM(MECH_DELTA) #elif MECH(DELTA)
#include "configuration_delta.h" #include "configuration_delta.h"
#elif MECHANISM(MECH_SCARA) #elif MECH(SCARA)
#include "configuration_scara.h" #include "configuration_scara.h"
#endif #endif
......
...@@ -166,7 +166,7 @@ void Config_StoreSettings() { ...@@ -166,7 +166,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, hotend_offset); EEPROM_WRITE_VAR(i, hotend_offset);
#endif #endif
#if ENABLED(DELTA) #if MECH(DELTA)
EEPROM_WRITE_VAR(i, endstop_adj); EEPROM_WRITE_VAR(i, endstop_adj);
EEPROM_WRITE_VAR(i, delta_radius); EEPROM_WRITE_VAR(i, delta_radius);
EEPROM_WRITE_VAR(i, delta_diagonal_rod); EEPROM_WRITE_VAR(i, delta_diagonal_rod);
...@@ -208,12 +208,12 @@ void Config_StoreSettings() { ...@@ -208,12 +208,12 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, bedKd); EEPROM_WRITE_VAR(i, bedKd);
#endif #endif
#if DISABLED(HAS_LCD_CONTRAST) #if HASNT(LCD_CONTRAST)
const int lcd_contrast = 32; const int lcd_contrast = 32;
#endif #endif
EEPROM_WRITE_VAR(i, lcd_contrast); EEPROM_WRITE_VAR(i, lcd_contrast);
#if ENABLED(SCARA) #if MECH(SCARA)
EEPROM_WRITE_VAR(i, axis_scaling); // 3 floats EEPROM_WRITE_VAR(i, axis_scaling); // 3 floats
#endif #endif
...@@ -303,7 +303,7 @@ void Config_RetrieveSettings() { ...@@ -303,7 +303,7 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, hotend_offset); EEPROM_READ_VAR(i, hotend_offset);
#endif #endif
#if ENABLED(DELTA) #if MECH(DELTA)
EEPROM_READ_VAR(i, endstop_adj); EEPROM_READ_VAR(i, endstop_adj);
EEPROM_READ_VAR(i, delta_radius); EEPROM_READ_VAR(i, delta_radius);
EEPROM_READ_VAR(i, delta_diagonal_rod); EEPROM_READ_VAR(i, delta_diagonal_rod);
...@@ -345,13 +345,13 @@ void Config_RetrieveSettings() { ...@@ -345,13 +345,13 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, bedKd); EEPROM_READ_VAR(i, bedKd);
#endif #endif
#if DISABLED(HAS_LCD_CONTRAST) #if HASNT(LCD_CONTRAST)
int lcd_contrast; int lcd_contrast;
#endif #endif
EEPROM_READ_VAR(i, lcd_contrast); EEPROM_READ_VAR(i, lcd_contrast);
#if ENABLED(SCARA) #if MECH(SCARA)
EEPROM_READ_VAR(i, axis_scaling); // 3 floats EEPROM_READ_VAR(i, axis_scaling); // 3 floats
#endif #endif
...@@ -469,7 +469,7 @@ void Config_ResetDefault() { ...@@ -469,7 +469,7 @@ void Config_ResetDefault() {
} }
} }
#if ENABLED(SCARA) #if MECH(SCARA)
for (int8_t i = 0; i < NUM_AXIS; i++) { for (int8_t i = 0; i < NUM_AXIS; i++) {
if (i < COUNT(axis_scaling)) if (i < COUNT(axis_scaling))
axis_scaling[i] = 1; axis_scaling[i] = 1;
...@@ -490,11 +490,11 @@ void Config_ResetDefault() { ...@@ -490,11 +490,11 @@ void Config_ResetDefault() {
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER; zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
#elif !defined(DELTA) #elif !MECH(DELTA)
zprobe_zoffset = 0; zprobe_zoffset = 0;
#endif #endif
#if ENABLED(DELTA) #if MECH(DELTA)
delta_radius = DEFAULT_DELTA_RADIUS; delta_radius = DEFAULT_DELTA_RADIUS;
delta_diagonal_rod = DEFAULT_DELTA_DIAGONAL_ROD; delta_diagonal_rod = DEFAULT_DELTA_DIAGONAL_ROD;
endstop_adj[0] = TOWER_A_ENDSTOP_ADJ; endstop_adj[0] = TOWER_A_ENDSTOP_ADJ;
...@@ -526,7 +526,7 @@ void Config_ResetDefault() { ...@@ -526,7 +526,7 @@ void Config_ResetDefault() {
gumPreheatFanSpeed = GUM_PREHEAT_FAN_SPEED; gumPreheatFanSpeed = GUM_PREHEAT_FAN_SPEED;
#endif #endif
#if ENABLED(HAS_LCD_CONTRAST) #if HAS(LCD_CONTRAST)
lcd_contrast = DEFAULT_LCD_CONTRAST; lcd_contrast = DEFAULT_LCD_CONTRAST;
#endif #endif
...@@ -598,7 +598,7 @@ void Config_ResetDefault() { ...@@ -598,7 +598,7 @@ void Config_ResetDefault() {
} }
#endif //EXTRUDERS > 1 #endif //EXTRUDERS > 1
#if ENABLED(SCARA) #if MECH(SCARA)
if (!forReplay) { if (!forReplay) {
ECHO_LM(DB, "Scaling factors:"); ECHO_LM(DB, "Scaling factors:");
} }
...@@ -682,7 +682,7 @@ void Config_ResetDefault() { ...@@ -682,7 +682,7 @@ void Config_ResetDefault() {
} }
#endif //HOTENDS > 1 #endif //HOTENDS > 1
#if ENABLED(DELTA) #if MECH(DELTA)
if (!forReplay) { if (!forReplay) {
ECHO_LM(DB, "Delta Geometry adjustment:"); ECHO_LM(DB, "Delta Geometry adjustment:");
} }
...@@ -819,7 +819,7 @@ void Config_ResetDefault() { ...@@ -819,7 +819,7 @@ void Config_ResetDefault() {
void ConfigSD_PrintSettings(bool forReplay) { void ConfigSD_PrintSettings(bool forReplay) {
// Always have this function, even with SD_SETTINGS disabled, the current values will be shown // Always have this function, even with SD_SETTINGS disabled, the current values will be shown
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
if (!forReplay) { if (!forReplay) {
ECHO_LM(DB, "Watt/h consumed:"); ECHO_LM(DB, "Watt/h consumed:");
} }
...@@ -843,7 +843,7 @@ void Config_ResetDefault() { ...@@ -843,7 +843,7 @@ void Config_ResetDefault() {
* *
*/ */
void ConfigSD_ResetDefault() { void ConfigSD_ResetDefault() {
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
power_consumption_hour = 0; power_consumption_hour = 0;
#endif #endif
printer_usage_seconds = 0; printer_usage_seconds = 0;
...@@ -859,7 +859,7 @@ void ConfigSD_ResetDefault() { ...@@ -859,7 +859,7 @@ void ConfigSD_ResetDefault() {
card.setroot(true); card.setroot(true);
card.openFile(CFG_SD_FILE, false, true, false); card.openFile(CFG_SD_FILE, false, true, false);
char buff[CFG_SD_MAX_VALUE_LEN]; char buff[CFG_SD_MAX_VALUE_LEN];
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
ltoa(power_consumption_hour,buff,10); ltoa(power_consumption_hour,buff,10);
card.unparseKeyLine(cfgSD_KEY[SD_CFG_PWR], buff); card.unparseKeyLine(cfgSD_KEY[SD_CFG_PWR], buff);
#endif #endif
...@@ -890,7 +890,7 @@ void ConfigSD_ResetDefault() { ...@@ -890,7 +890,7 @@ void ConfigSD_ResetDefault() {
k_idx = ConfigSD_KeyIndex(key); k_idx = ConfigSD_KeyIndex(key);
if(k_idx == -1) continue; //unknow key ignore it if(k_idx == -1) continue; //unknow key ignore it
switch(k_idx) { switch(k_idx) {
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
case SD_CFG_PWR: { case SD_CFG_PWR: {
if(addValue) power_consumption_hour += (unsigned long)atol(value); if(addValue) power_consumption_hour += (unsigned long)atol(value);
else power_consumption_hour = (unsigned long)atol(value); else power_consumption_hour = (unsigned long)atol(value);
......
...@@ -24,14 +24,14 @@ void ConfigSD_ResetDefault(); ...@@ -24,14 +24,14 @@ void ConfigSD_ResetDefault();
#if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS) #if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS)
static const char *cfgSD_KEY[] = { //Keep this in lexicographical order for better search performance(O(Nlog2(N)) insted of O(N*N)) (if you don't keep this sorted, the algorithm for find the key index won't work, keep attention.) static const char *cfgSD_KEY[] = { //Keep this in lexicographical order for better search performance(O(Nlog2(N)) insted of O(N*N)) (if you don't keep this sorted, the algorithm for find the key index won't work, keep attention.)
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
"PWR", "PWR",
#endif #endif
"TME", "TME",
}; };
enum cfgSD_ENUM { //This need to be in the same order as cfgSD_KEY enum cfgSD_ENUM { //This need to be in the same order as cfgSD_KEY
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
SD_CFG_PWR, SD_CFG_PWR,
#endif #endif
SD_CFG_TME, SD_CFG_TME,
......
...@@ -305,7 +305,7 @@ static void lcd_implementation_status_screen() { ...@@ -305,7 +305,7 @@ static void lcd_implementation_status_screen() {
u8g.setPrintPos(80,48); u8g.setPrintPos(80,48);
if (print_job_start_ms != 0) { if (print_job_start_ms != 0) {
#if HAS_LCD_POWER_SENSOR #if HAS(LCD_POWER_SENSOR)
if (millis() < print_millis + 1000) { if (millis() < print_millis + 1000) {
uint16_t time = (millis() - print_job_start_ms) / 60000; uint16_t time = (millis() - print_job_start_ms) / 60000;
lcd_print(itostr2(time/60)); lcd_print(itostr2(time/60));
...@@ -337,7 +337,7 @@ static void lcd_implementation_status_screen() { ...@@ -337,7 +337,7 @@ static void lcd_implementation_status_screen() {
// Fan // Fan
lcd_setFont(FONT_STATUSMENU); lcd_setFont(FONT_STATUSMENU);
u8g.setPrintPos(104,27); u8g.setPrintPos(104,27);
#if HAS_FAN #if HAS(FAN)
int per = ((fanSpeed + 1) * 100) / 256; int per = ((fanSpeed + 1) * 100) / 256;
if (per) { if (per) {
lcd_print(itostr3(per)); lcd_print(itostr3(per));
...@@ -405,12 +405,12 @@ static void lcd_implementation_status_screen() { ...@@ -405,12 +405,12 @@ static void lcd_implementation_status_screen() {
u8g.setPrintPos(0,63); u8g.setPrintPos(0,63);
#endif #endif
#if HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR #if HAS(LCD_FILAMENT_SENSOR) || HAS(LCD_POWER_SENSOR)
if (millis() < previous_lcd_status_ms + 5000) { //Display both Status message line and Filament display on the last line if (millis() < previous_lcd_status_ms + 5000) { //Display both Status message line and Filament display on the last line
lcd_print(lcd_status_message); lcd_print(lcd_status_message);
} }
#if HAS_LCD_POWER_SENSOR #if HAS(LCD_POWER_SENSOR)
#if HAS_LCD_FILAMENT_SENSOR #if HAS(LCD_FILAMENT_SENSOR)
else if (millis() < previous_lcd_status_ms + 10000) else if (millis() < previous_lcd_status_ms + 10000)
#else #else
else else
...@@ -423,7 +423,7 @@ static void lcd_implementation_status_screen() { ...@@ -423,7 +423,7 @@ static void lcd_implementation_status_screen() {
lcd_printPGM(PSTR("Wh")); lcd_printPGM(PSTR("Wh"));
} }
#endif #endif
#if HAS_LCD_FILAMENT_SENSOR #if HAS(LCD_FILAMENT_SENSOR)
else { else {
lcd_printPGM(PSTR("dia:")); lcd_printPGM(PSTR("dia:"));
lcd_print(ftostr12ns(filament_width_meas)); lcd_print(ftostr12ns(filament_width_meas));
......
...@@ -40,15 +40,15 @@ void FirmwareTest() ...@@ -40,15 +40,15 @@ void FirmwareTest()
ECHO_M(MSG_FWTEST_INVERT); ECHO_M(MSG_FWTEST_INVERT);
ECHO_M("#define X_MIN_ENDSTOP_LOGIC "); ECHO_M("#define X_MIN_ENDSTOP_LOGIC ");
ECHO_M(MSG_FWTEST_INTO); ECHO_M(MSG_FWTEST_INTO);
#if ENABLED(CARTESIAN) #if MECH(CARTESIAN)
ECHO_EM("Configuration_Cartesian.h"); ECHO_EM("Configuration_Cartesian.h");
#elif ENABLED(COREXY) #elif MECH(COREXY)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(DELTA) #elif MECH(DELTA)
ECHO_EM("Configuration_Delta.h"); ECHO_EM("Configuration_Delta.h");
#elif ENABLED(SCARA) #elif MECH(SCARA)
ECHO_EM("Configuration_Scara.h"); ECHO_EM("Configuration_Scara.h");
#endif #endif
return; return;
...@@ -82,15 +82,15 @@ void FirmwareTest() ...@@ -82,15 +82,15 @@ void FirmwareTest()
ECHO_M(MSG_FWTEST_INVERT); ECHO_M(MSG_FWTEST_INVERT);
ECHO_M("#define X_MAX_ENDSTOP_LOGIC "); ECHO_M("#define X_MAX_ENDSTOP_LOGIC ");
ECHO_M(MSG_FWTEST_INTO); ECHO_M(MSG_FWTEST_INTO);
#if ENABLED(CARTESIAN) #if MECH(CARTESIAN)
ECHO_EM("Configuration_Cartesian.h"); ECHO_EM("Configuration_Cartesian.h");
#elif ENABLED(COREXY) #elif MECH(COREXY)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(DELTA) #elif MECH(DELTA)
ECHO_EM("Configuration_Delta.h"); ECHO_EM("Configuration_Delta.h");
#elif ENABLED(SCARA) #elif MECH(SCARA)
ECHO_EM("Configuration_Scara.h"); ECHO_EM("Configuration_Scara.h");
#endif #endif
return; return;
...@@ -138,15 +138,15 @@ void FirmwareTest() ...@@ -138,15 +138,15 @@ void FirmwareTest()
ECHO_M(MSG_FWTEST_INVERT); ECHO_M(MSG_FWTEST_INVERT);
ECHO_M("#define Y_MIN_ENDSTOP_LOGIC "); ECHO_M("#define Y_MIN_ENDSTOP_LOGIC ");
ECHO_M(MSG_FWTEST_INTO); ECHO_M(MSG_FWTEST_INTO);
#if ENABLED(CARTESIAN) #if MECH(CARTESIAN)
ECHO_EM("Configuration_Cartesian.h"); ECHO_EM("Configuration_Cartesian.h");
#elif ENABLED(COREXY) #elif MECH(COREXY)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(DELTA) #elif MECH(DELTA)
ECHO_EM("Configuration_Delta.h"); ECHO_EM("Configuration_Delta.h");
#elif ENABLED(SCARA) #elif MECH(SCARA)
ECHO_EM("Configuration_Scara.h"); ECHO_EM("Configuration_Scara.h");
#endif #endif
return; return;
...@@ -180,15 +180,15 @@ void FirmwareTest() ...@@ -180,15 +180,15 @@ void FirmwareTest()
ECHO_M(MSG_FWTEST_INVERT); ECHO_M(MSG_FWTEST_INVERT);
ECHO_M("#define Y_MAX_ENDSTOP_LOGIC "); ECHO_M("#define Y_MAX_ENDSTOP_LOGIC ");
ECHO_M(MSG_FWTEST_INTO); ECHO_M(MSG_FWTEST_INTO);
#if ENABLED(CARTESIAN) #if MECH(CARTESIAN)
ECHO_EM("Configuration_Cartesian.h"); ECHO_EM("Configuration_Cartesian.h");
#elif ENABLED(COREXY) #elif MECH(COREXY)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(DELTA) #elif MECH(DELTA)
ECHO_EM("Configuration_Delta.h"); ECHO_EM("Configuration_Delta.h");
#elif ENABLED(SCARA) #elif MECH(SCARA)
ECHO_EM("Configuration_Scara.h"); ECHO_EM("Configuration_Scara.h");
#endif #endif
return; return;
...@@ -236,15 +236,15 @@ void FirmwareTest() ...@@ -236,15 +236,15 @@ void FirmwareTest()
ECHO_M(MSG_FWTEST_INVERT); ECHO_M(MSG_FWTEST_INVERT);
ECHO_M("#define Z_MIN_ENDSTOP_LOGIC "); ECHO_M("#define Z_MIN_ENDSTOP_LOGIC ");
ECHO_M(MSG_FWTEST_INTO); ECHO_M(MSG_FWTEST_INTO);
#if ENABLED(CARTESIAN) #if MECH(CARTESIAN)
ECHO_EM("Configuration_Cartesian.h"); ECHO_EM("Configuration_Cartesian.h");
#elif ENABLED(COREXY) #elif MECH(COREXY)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(DELTA) #elif MECH(DELTA)
ECHO_EM("Configuration_Delta.h"); ECHO_EM("Configuration_Delta.h");
#elif ENABLED(SCARA) #elif MECH(SCARA)
ECHO_EM("Configuration_Scara.h"); ECHO_EM("Configuration_Scara.h");
#endif #endif
return; return;
...@@ -278,15 +278,15 @@ void FirmwareTest() ...@@ -278,15 +278,15 @@ void FirmwareTest()
ECHO_M(MSG_FWTEST_INVERT); ECHO_M(MSG_FWTEST_INVERT);
ECHO_M("#define Z_MAX_ENDSTOP_LOGIC "); ECHO_M("#define Z_MAX_ENDSTOP_LOGIC ");
ECHO_M(MSG_FWTEST_INTO); ECHO_M(MSG_FWTEST_INTO);
#if ENABLED(CARTESIAN) #if MECH(CARTESIAN)
ECHO_EM("Configuration_Cartesian.h"); ECHO_EM("Configuration_Cartesian.h");
#elif ENABLED(COREXY) #elif MECH(COREXY)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(DELTA) #elif MECH(DELTA)
ECHO_EM("Configuration_Delta.h"); ECHO_EM("Configuration_Delta.h");
#elif ENABLED(SCARA) #elif MECH(SCARA)
ECHO_EM("Configuration_Scara.h"); ECHO_EM("Configuration_Scara.h");
#endif #endif
return; return;
...@@ -325,7 +325,7 @@ void FirmwareTest() ...@@ -325,7 +325,7 @@ void FirmwareTest()
ECHO_EM(" "); ECHO_EM(" ");
} }
#if HAS_POWER_SWITCH #if HAS(POWER_SWITCH)
SET_OUTPUT(PS_ON_PIN); SET_OUTPUT(PS_ON_PIN);
WRITE(PS_ON_PIN, PS_ON_AWAKE); WRITE(PS_ON_PIN, PS_ON_AWAKE);
#endif #endif
...@@ -364,15 +364,15 @@ void FirmwareTest() ...@@ -364,15 +364,15 @@ void FirmwareTest()
ECHO_M(MSG_FWTEST_INVERT); ECHO_M(MSG_FWTEST_INVERT);
ECHO_M("#define INVERT_X_DIR "); ECHO_M("#define INVERT_X_DIR ");
ECHO_M(MSG_FWTEST_INTO); ECHO_M(MSG_FWTEST_INTO);
#if ENABLED(CARTESIAN) #if MECH(CARTESIAN)
ECHO_EM("Configuration_Cartesian.h"); ECHO_EM("Configuration_Cartesian.h");
#elif ENABLED(COREXY) #elif MECH(COREXY)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(DELTA) #elif MECH(DELTA)
ECHO_EM("Configuration_Delta.h"); ECHO_EM("Configuration_Delta.h");
#elif ENABLED(SCARA) #elif MECH(SCARA)
ECHO_EM("Configuration_Scara.h"); ECHO_EM("Configuration_Scara.h");
#endif #endif
return; return;
...@@ -397,15 +397,15 @@ void FirmwareTest() ...@@ -397,15 +397,15 @@ void FirmwareTest()
ECHO_M(MSG_FWTEST_INVERT); ECHO_M(MSG_FWTEST_INVERT);
ECHO_M("#define INVERT_Y_DIR "); ECHO_M("#define INVERT_Y_DIR ");
ECHO_M(MSG_FWTEST_INTO); ECHO_M(MSG_FWTEST_INTO);
#if ENABLED(CARTESIAN) #if MECH(CARTESIAN)
ECHO_EM("Configuration_Cartesian.h"); ECHO_EM("Configuration_Cartesian.h");
#elif ENABLED(COREXY) #elif MECH(COREXY)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(DELTA) #elif MECH(DELTA)
ECHO_EM("Configuration_Delta.h"); ECHO_EM("Configuration_Delta.h");
#elif ENABLED(SCARA) #elif MECH(SCARA)
ECHO_EM("Configuration_Scara.h"); ECHO_EM("Configuration_Scara.h");
#endif #endif
return; return;
...@@ -430,15 +430,15 @@ void FirmwareTest() ...@@ -430,15 +430,15 @@ void FirmwareTest()
ECHO_M(MSG_FWTEST_INVERT); ECHO_M(MSG_FWTEST_INVERT);
ECHO_M("#define INVERT_Z_DIR "); ECHO_M("#define INVERT_Z_DIR ");
ECHO_M(MSG_FWTEST_INTO); ECHO_M(MSG_FWTEST_INTO);
#if ENABLED(CARTESIAN) #if MECH(CARTESIAN)
ECHO_EM("Configuration_Cartesian.h"); ECHO_EM("Configuration_Cartesian.h");
#elif ENABLED(COREXY) #elif MECH(COREXY)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
ECHO_EM("Configuration_Core.h"); ECHO_EM("Configuration_Core.h");
#elif ENABLED(DELTA) #elif MECH(DELTA)
ECHO_EM("Configuration_Delta.h"); ECHO_EM("Configuration_Delta.h");
#elif ENABLED(SCARA) #elif MECH(SCARA)
ECHO_EM("Configuration_Scara.h"); ECHO_EM("Configuration_Scara.h");
#endif #endif
return; return;
......
...@@ -27,4 +27,87 @@ ...@@ -27,4 +27,87 @@
#define COUNT(a) (sizeof(a)/sizeof(*a)) #define COUNT(a) (sizeof(a)/sizeof(*a))
#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
#define HAS(FE) (HAS_##FE)
#define HASNT(FE) (!(HAS_##FE))
// Macros for board type
#define BOARD_UNKNOWN -1
#define BOARD_GEN7_CUSTOM 10 // Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics"
#define BOARD_GEN7_12 11 // Gen7 v1.1, v1.2
#define BOARD_GEN7_13 12 // Gen7 v1.3
#define BOARD_GEN7_14 13 // Gen7 v1.4
#define BOARD_CHEAPTRONIC 2 // Cheaptronic v1.0
#define BOARD_SETHI 20 // Sethi 3D_1
#define BOARD_ELEFU_3 21 // Elefu Ra Board (v3)
#define BOARD_GEN3_MONOLITHIC 22 // Gen3 Monolithic Electronics
#define BOARD_RAMPS_OLD 3 // MEGA/RAMPS up to 1.2
#define BOARD_RAMPS_13_EFB 33 // RAMPS 1.3 / 1.4 (Power outputs: Hotend, Fan, Bed)
#define BOARD_RAMPS_13_EEB 34 // RAMPS 1.3 / 1.4 (Power outputs: Hotend0, Hotend1, Bed)
#define BOARD_RAMPS_13_EFF 35 // RAMPS 1.3 / 1.4 (Power outputs: Hotend, Fan, Fan)
#define BOARD_RAMPS_13_EEF 36 // RAMPS 1.3 / 1.4 (Power outputs: Hotend0, Hotend1, Fan)
#define BOARD_RAMPS_13_EEE 37 // RAMPS 1.3 / 1.4 (Power outputs: Hotend0, Hotend1, Hotend2)
#define BOARD_RAMBO 301 // Rambo
#define BOARD_MINIRAMBO 302 // Mini-Rambo
#define BOARD_DUEMILANOVE_328P 4 // Duemilanove w/ ATMega328P pin assignments
#define BOARD_RADDS 402 // RADDS
#define BOARD_RAMPS_FDV1 403 // RAMPS-FD V1
#define BOARD_RAMPS_FDV2 404 // RAMPS-FD V2
#define BOARD_RAMPS4DUE 433 // RAMPS4DUE with AndrewBCN's RAMPS mods (http://forums.reprap.org/read.php?219,479626,page=1)
#define BOARD_GEN6 5 // Gen6
#define BOARD_GEN6_DELUXE 51 // Gen6 deluxe
#define BOARD_ALLIGATOR 502 // ALLIGATOR R2 ARM 32
#define BOARD_SANGUINOLOLU_11 6 // Sanguinololu < 1.2
#define BOARD_SANGUINOLOLU_12 62 // Sanguinololu 1.2 and above
#define BOARD_MELZI 63 // Melzi
#define BOARD_STB_11 64 // STB V1.1
#define BOARD_AZTEEG_X1 65 // Azteeg X1
#define BOARD_MELZI_MAKR3D 66 // Melzi with ATmega1284 (MaKr3d version)
#define BOARD_AZTEEG_X3 67 // Azteeg X3
#define BOARD_AZTEEG_X3_PRO 68 // Azteeg X3 Pro
#define BOARD_ULTIMAKER 7 // Ultimaker
#define BOARD_MEGATRONICS 70 // Megatronics
#define BOARD_MEGATRONICS_2 701 // Megatronics v2.0
#define BOARD_MINITRONICS 702 // Minitronics v1.0
#define BOARD_MEGATRONICS_3 703 // Megatronics v3.0
#define BOARD_ULTIMAKER_OLD 71 // Ultimaker (Older electronics. Pre 1.5.4. This is rare)
#define BOARD_ULTIMAIN_2 72 // Ultimainboard 2.x (Uses TEMP_SENSOR 20)
#define BOARD_3DRAG 77 // 3Drag Controller
#define BOARD_K8200 78 // Vellemann K8200 Controller (derived from 3Drag Controller)
#define BOARD_TEENSYLU 8 // Teensylu
#define BOARD_RUMBA 80 // Rumba
#define BOARD_PRINTRBOARD 81 // Printrboard (AT90USB1286)
#define BOARD_BRAINWAVE 82 // Brainwave (AT90USB646)
#define BOARD_SAV_MKI 83 // SAV Mk-I (AT90USB1286)
#define BOARD_TEENSY2 84 // Teensy++2.0 (AT90USB1286)
#define BOARD_5DPRINT 88 // 5DPrint D8 Driver Board
#define BOARD_GEN3_PLUS 9 // Gen3+
#define BOARD_OMCA_A 90 // Alpha OMCA board
#define BOARD_OMCA 91 // Final OMCA board
#define BOARD_LEAPFROG 999 // Leapfrog
#define BOARD_99 99 // This is in pins.h but...?
#define MB(board) (MOTHERBOARD==BOARD_##board)
//Macros for mechanics
#define MECH_UNKNOWN -1
#define MECH_CARTESIAN 0
#define MECH_COREXY 1
#define MECH_COREXZ 2
#define MECH_DELTA 3
#define MECH_SCARA 4
#define MECH(mechanism) (MEACHANISM == BOARD_##mechanism)
#endif //__MACROS_H #endif //__MACROS_H
#ifndef MECHANISM_H
#define MECHANISM_H
#define MECH_UNKNOWN -1
#define MECH_CARTESIAN 0
#define MECH_COREXY 1
#define MECH_COREXZ 2
#define MECH_DELTA 3
#define MECH_SCARA 4
//Keept for legacy support
#define CARTESIAN MECH_CARTESIAN
#define COREXY MECH_COREXY
#define COREXZ MECH_COREXZ
#define DELTA MECH_DELTA
#define SCARA MECH_SCARA
#define MECHANISM MECH_UNKNOWN
#define MECH_TYPE(mechanism) (MEACHANISM == mechanism)
#endif //__MECHANISM_H
...@@ -5353,6 +5353,4 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a ...@@ -5353,6 +5353,4 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
analogInputToDigitalPin(TEMP_BED_PIN) \ analogInputToDigitalPin(TEMP_BED_PIN) \
} }
#define HAS_DIGIPOTSS (DIGIPOTSS_PIN >= 0)
#endif //__PINS_H #endif //__PINS_H
...@@ -428,7 +428,7 @@ void check_axes_activity() { ...@@ -428,7 +428,7 @@ void check_axes_activity() {
disable_e3(); disable_e3();
} }
#if HAS_FAN #if HAS(FAN)
#ifdef FAN_KICKSTART_TIME #ifdef FAN_KICKSTART_TIME
static millis_t fan_kick_end; static millis_t fan_kick_end;
if (tail_fan_speed) { if (tail_fan_speed) {
...@@ -454,17 +454,17 @@ void check_axes_activity() { ...@@ -454,17 +454,17 @@ void check_axes_activity() {
#else #else
analogWrite(FAN_PIN, CALC_FAN_SPEED); analogWrite(FAN_PIN, CALC_FAN_SPEED);
#endif // FAN_SOFT_PWM #endif // FAN_SOFT_PWM
#endif // HAS_FAN #endif // HAS(FAN)
#if ENABLED(AUTOTEMP) #if ENABLED(AUTOTEMP)
getHighESpeed(); getHighESpeed();
#endif #endif
#if ENABLED(BARICUDA) #if ENABLED(BARICUDA)
#if HAS_HEATER_1 #if HAS(HEATER_1)
analogWrite(HEATER_1_PIN,tail_valve_pressure); analogWrite(HEATER_1_PIN,tail_valve_pressure);
#endif #endif
#if HAS_HEATER_2 #if HAS(HEATER_2)
analogWrite(HEATER_2_PIN,tail_e_to_p_pressure); analogWrite(HEATER_2_PIN,tail_e_to_p_pressure);
#endif #endif
#endif #endif
...@@ -521,10 +521,10 @@ float junction_deviation = 0.1; ...@@ -521,10 +521,10 @@ float junction_deviation = 0.1;
dy = target[Y_AXIS] - position[Y_AXIS], dy = target[Y_AXIS] - position[Y_AXIS],
dz = target[Z_AXIS] - position[Z_AXIS], dz = target[Z_AXIS] - position[Z_AXIS],
de = target[E_AXIS] - position[E_AXIS]; de = target[E_AXIS] - position[E_AXIS];
#if ENABLED(COREXY) #if MECH(COREXY)
float da = dx + COREX_YZ_FACTOR * dy; float da = dx + COREX_YZ_FACTOR * dy;
float db = dx - COREX_YZ_FACTOR * dy; float db = dx - COREX_YZ_FACTOR * dy;
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
float da = dx + COREX_YZ_FACTOR * dz; float da = dx + COREX_YZ_FACTOR * dz;
float dc = dx - COREX_YZ_FACTOR * dz; float dc = dx - COREX_YZ_FACTOR * dz;
#endif #endif
...@@ -566,13 +566,13 @@ float junction_deviation = 0.1; ...@@ -566,13 +566,13 @@ float junction_deviation = 0.1;
block->busy = false; block->busy = false;
// Number of steps for each axis // Number of steps for each axis
#if ENABLED(COREXY) #if MECH(COREXY)
// corexy planning // corexy planning
// these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html // these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
block->steps[A_AXIS] = labs(da); block->steps[A_AXIS] = labs(da);
block->steps[B_AXIS] = labs(db); block->steps[B_AXIS] = labs(db);
block->steps[Z_AXIS] = labs(dz); block->steps[Z_AXIS] = labs(dz);
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
// corexz planning // corexz planning
block->steps[A_AXIS] = labs(da); block->steps[A_AXIS] = labs(da);
block->steps[Y_AXIS] = labs(dy); block->steps[Y_AXIS] = labs(dy);
...@@ -606,13 +606,13 @@ float junction_deviation = 0.1; ...@@ -606,13 +606,13 @@ float junction_deviation = 0.1;
// Compute direction bits for this block // Compute direction bits for this block
uint8_t dirb = 0; uint8_t dirb = 0;
#if ENABLED(COREXY) #if MECH(COREXY)
if (dx < 0) dirb |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis if (dx < 0) dirb |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) dirb |= BIT(Y_HEAD); // ...and Y if (dy < 0) dirb |= BIT(Y_HEAD); // ...and Y
if (dz < 0) dirb |= BIT(Z_AXIS); if (dz < 0) dirb |= BIT(Z_AXIS);
if (da < 0) dirb |= BIT(A_AXIS); // Motor A direction if (da < 0) dirb |= BIT(A_AXIS); // Motor A direction
if (db < 0) dirb |= BIT(B_AXIS); // Motor B direction if (db < 0) dirb |= BIT(B_AXIS); // Motor B direction
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
if (dx < 0) dirb |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis if (dx < 0) dirb |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) dirb |= BIT(Y_AXIS); if (dy < 0) dirb |= BIT(Y_AXIS);
if (dz < 0) dirb |= BIT(Z_HEAD); // ...and Z if (dz < 0) dirb |= BIT(Z_HEAD); // ...and Z
...@@ -629,7 +629,7 @@ float junction_deviation = 0.1; ...@@ -629,7 +629,7 @@ float junction_deviation = 0.1;
block->active_driver = driver; block->active_driver = driver;
// Enable active axes // Enable active axes
#if ENABLED(COREXY) #if MECH(COREXY)
if (block->steps[A_AXIS] || block->steps[B_AXIS]) { if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
enable_x(); enable_x();
enable_y(); enable_y();
...@@ -637,7 +637,7 @@ float junction_deviation = 0.1; ...@@ -637,7 +637,7 @@ float junction_deviation = 0.1;
#if DISABLED(Z_LATE_ENABLE) #if DISABLED(Z_LATE_ENABLE)
if (block->steps[Z_AXIS]) enable_z(); if (block->steps[Z_AXIS]) enable_z();
#endif #endif
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
if (block->steps[A_AXIS] || block->steps[C_AXIS]) { if (block->steps[A_AXIS] || block->steps[C_AXIS]) {
enable_x(); enable_x();
enable_z(); enable_z();
...@@ -747,14 +747,14 @@ float junction_deviation = 0.1; ...@@ -747,14 +747,14 @@ float junction_deviation = 0.1;
* So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head. * So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
* Having the real displacement of the head, we can calculate the total movement length and apply the desired speed. * Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
*/ */
#if ENABLED(COREXY) #if MECH(COREXY)
float delta_mm[6]; float delta_mm[6];
delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS]; delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
delta_mm[Y_HEAD] = dy / axis_steps_per_unit[B_AXIS]; delta_mm[Y_HEAD] = dy / axis_steps_per_unit[B_AXIS];
delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS]; delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
delta_mm[A_AXIS] = da / axis_steps_per_unit[A_AXIS]; delta_mm[A_AXIS] = da / axis_steps_per_unit[A_AXIS];
delta_mm[B_AXIS] = db / axis_steps_per_unit[B_AXIS]; delta_mm[B_AXIS] = db / axis_steps_per_unit[B_AXIS];
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
float delta_mm[6]; float delta_mm[6];
delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS]; delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS]; delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
...@@ -774,9 +774,9 @@ float junction_deviation = 0.1; ...@@ -774,9 +774,9 @@ float junction_deviation = 0.1;
} }
else { else {
block->millimeters = sqrt( block->millimeters = sqrt(
#if ENABLED(COREXY) #if MECH(COREXY)
square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD]) + square(delta_mm[Z_AXIS]) square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD]) + square(delta_mm[Z_AXIS])
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
square(delta_mm[X_HEAD]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_HEAD]) square(delta_mm[X_HEAD]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_HEAD])
#else #else
square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS]) square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS])
......
...@@ -35,13 +35,13 @@ ...@@ -35,13 +35,13 @@
* Babystepping * Babystepping
*/ */
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#if ENABLED(COREXY) && ENABLED(BABYSTEP_XY) #if MECH(COREXY) && ENABLED(BABYSTEP_XY)
#error BABYSTEPPING only implemented for Z axis on CoreXY. #error BABYSTEPPING only implemented for Z axis on CoreXY.
#endif #endif
#if ENABLED(SCARA) #if MECH(SCARA)
#error BABYSTEPPING is not implemented for SCARA yet. #error BABYSTEPPING is not implemented for SCARA yet.
#endif #endif
#if ENABLED(DELTA) && ENABLED(BABYSTEP_XY) #if MECH(DELTA) && ENABLED(BABYSTEP_XY)
#error BABYSTEPPING only implemented for Z axis on deltabots. #error BABYSTEPPING only implemented for Z axis on deltabots.
#endif #endif
#endif #endif
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
/** /**
* Servo deactivation depends on servo endstops * Servo deactivation depends on servo endstops
*/ */
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) && !HAS_SERVO_ENDSTOPS #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) && HASNT(SERVO_ENDSTOPS)
#error At least one of the ?_ENDSTOP_SERVO_NR is required for DEACTIVATE_SERVOS_AFTER_MOVE. #error At least one of the ?_ENDSTOP_SERVO_NR is required for DEACTIVATE_SERVOS_AFTER_MOVE.
#endif #endif
...@@ -215,7 +215,7 @@ ...@@ -215,7 +215,7 @@
/** /**
* Delta & Z_PROBE_ENDSTOP * Delta & Z_PROBE_ENDSTOP
*/ */
#if ENABLED(DELTA) && ENABLED(Z_PROBE_ENDSTOP) #if MECH(DELTA) && ENABLED(Z_PROBE_ENDSTOP)
#ifndef Z_PROBE_PIN #ifndef Z_PROBE_PIN
#error You must have a Z_PROBE_PIN defined in your pins2tool.h file if you enable Z_PROBE_ENDSTOP #error You must have a Z_PROBE_PIN defined in your pins2tool.h file if you enable Z_PROBE_ENDSTOP
#endif #endif
...@@ -228,10 +228,10 @@ ...@@ -228,10 +228,10 @@
* Dual X Carriage requirements * Dual X Carriage requirements
*/ */
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
#if EXTRUDERS == 1 || ENABLED(COREXY) \ #if EXTRUDERS == 1 || MECH(COREXY) \
|| !HAS_X2_ENABLE || !HAS_X2_STEP || !HAS_X2_DIR \ || HASNT(X2_ENABLE) || HASNT(X2_STEP) || HASNT(X2_DIR) \
|| !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS) \ || !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS) \
|| !HAS_X_MAX || HASNT(X_MAX)
#error Missing or invalid definitions for DUAL_X_CARRIAGE mode. #error Missing or invalid definitions for DUAL_X_CARRIAGE mode.
#endif #endif
#if X_HOME_DIR != -1 || X2_HOME_DIR != 1 #if X_HOME_DIR != -1 || X2_HOME_DIR != 1
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
/** /**
* Make sure auto fan pins don't conflict with the fan pin * Make sure auto fan pins don't conflict with the fan pin
*/ */
#if HAS_AUTO_FAN && HAS_FAN #if HAS(AUTO_FAN) && HAS(FAN)
#if EXTRUDER_0_AUTO_FAN_PIN == FAN_PIN #if EXTRUDER_0_AUTO_FAN_PIN == FAN_PIN
#error You cannot set EXTRUDER_0_AUTO_FAN_PIN equal to FAN_PIN. #error You cannot set EXTRUDER_0_AUTO_FAN_PIN equal to FAN_PIN.
#elif EXTRUDER_1_AUTO_FAN_PIN == FAN_PIN #elif EXTRUDER_1_AUTO_FAN_PIN == FAN_PIN
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
#endif #endif
#endif #endif
#if HAS_FAN && CONTROLLERFAN_PIN == FAN_PIN #if HAS(FAN) && CONTROLLERFAN_PIN == FAN_PIN
#error You cannot set CONTROLLERFAN_PIN equal to FAN_PIN. #error You cannot set CONTROLLERFAN_PIN equal to FAN_PIN.
#endif #endif
...@@ -262,19 +262,19 @@ ...@@ -262,19 +262,19 @@
* Test required HEATER defines * Test required HEATER defines
*/ */
#if HOTENDS > 3 #if HOTENDS > 3
#if !HAS_HEATER_3 #if HASNT(HEATER_3)
#error HEATER_3_PIN not defined for this board #error HEATER_3_PIN not defined for this board
#endif #endif
#elif HOTENDS > 2 #elif HOTENDS > 2
#if !HAS_HEATER_2 #if HASNT(HEATER_2)
#error HEATER_2_PIN not defined for this board #error HEATER_2_PIN not defined for this board
#endif #endif
#elif HOTENDS > 1 || defined(HEATERS_PARALLEL) #elif HOTENDS > 1 || defined(HEATERS_PARALLEL)
#if !HAS_HEATER_1 #if HASNT(HEATER_1)
#error HEATER_1_PIN not defined for this board #error HEATER_1_PIN not defined for this board
#endif #endif
#elif HOTENDS > 0 #elif HOTENDS > 0
#if !HAS_HEATER_0 #if HASNT(HEATER_0)
#error HEATER_0_PIN not defined for this board #error HEATER_0_PIN not defined for this board
#endif #endif
#endif #endif
...@@ -306,7 +306,7 @@ ...@@ -306,7 +306,7 @@
#error PROBE_SERVO_DEACTIVATION_DELAY has been replaced with DEACTIVATE_SERVOS_AFTER_MOVE and SERVO_DEACTIVATION_DELAY. #error PROBE_SERVO_DEACTIVATION_DELAY has been replaced with DEACTIVATE_SERVOS_AFTER_MOVE and SERVO_DEACTIVATION_DELAY.
#endif #endif
#if ENABLED(COREXZ) && ENABLED(Z_LATE_ENABLE) #if MECH(COREXZ) && ENABLED(Z_LATE_ENABLE)
#error "Z_LATE_ENABLE can't be used with COREXZ." #error "Z_LATE_ENABLE can't be used with COREXZ."
#endif #endif
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
*/ */
#include "Configuration.h" #include "Configuration.h"
#if HAS_SERVOS #if HAS(SERVOS)
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include <Arduino.h> #include <Arduino.h>
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "language.h" #include "language.h"
#include "cardreader.h" #include "cardreader.h"
#include "speed_lookuptable.h" #include "speed_lookuptable.h"
#if HAS_DIGIPOTSS #if HAS(DIGIPOTSS)
#include <SPI.h> #include <SPI.h>
#endif #endif
...@@ -329,12 +329,12 @@ inline void update_endstops() { ...@@ -329,12 +329,12 @@ inline void update_endstops() {
step_events_completed = current_block->step_event_count; \ step_events_completed = current_block->step_event_count; \
} }
#if ENABLED(COREXY) #if MECH(COREXY)
// Head direction in -X axis for CoreXY bots. // Head direction in -X axis for CoreXY bots.
// If DeltaX == -DeltaY, the movement is only in Y axis // If DeltaX == -DeltaY, the movement is only in Y axis
if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) { if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) {
if (TEST(out_bits, X_HEAD)) if (TEST(out_bits, X_HEAD))
#elif ENABLED(COREXZ) #elif MECH(COREXZ)
// Head direction in -X axis for CoreXZ bots. // Head direction in -X axis for CoreXZ bots.
// If DeltaX == -DeltaZ, the movement is only in Z axis // If DeltaX == -DeltaZ, the movement is only in Z axis
if ((current_block->steps[A_AXIS] != current_block->steps[C_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, C_AXIS))) { if ((current_block->steps[A_AXIS] != current_block->steps[C_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, C_AXIS))) {
...@@ -348,7 +348,7 @@ inline void update_endstops() { ...@@ -348,7 +348,7 @@ inline void update_endstops() {
if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) || (current_block->active_extruder != 0 && X2_HOME_DIR == -1)) if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) || (current_block->active_extruder != 0 && X2_HOME_DIR == -1))
#endif #endif
{ {
#if HAS_X_MIN #if HAS(X_MIN)
UPDATE_ENDSTOP(X, MIN); UPDATE_ENDSTOP(X, MIN);
#endif #endif
} }
...@@ -359,16 +359,16 @@ inline void update_endstops() { ...@@ -359,16 +359,16 @@ inline void update_endstops() {
if ((current_block->active_extruder == 0 && X_HOME_DIR == 1) || (current_block->active_extruder != 0 && X2_HOME_DIR == 1)) if ((current_block->active_extruder == 0 && X_HOME_DIR == 1) || (current_block->active_extruder != 0 && X2_HOME_DIR == 1))
#endif #endif
{ {
#if HAS_X_MAX #if HAS(X_MAX)
UPDATE_ENDSTOP(X, MAX); UPDATE_ENDSTOP(X, MAX);
#endif #endif
} }
} }
#if ENABLED(COREXY) || ENABLED(COREXZ) #if MECH(COREXY) || MECH(COREXZ)
} }
#endif #endif
#if ENABLED(COREXY) #if MECH(COREXY)
// Head direction in -Y axis for CoreXY bots. // Head direction in -Y axis for CoreXY bots.
// If DeltaX == DeltaY, the movement is only in X axis // If DeltaX == DeltaY, the movement is only in X axis
if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS))) { if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS))) {
...@@ -377,20 +377,20 @@ inline void update_endstops() { ...@@ -377,20 +377,20 @@ inline void update_endstops() {
if (TEST(out_bits, Y_AXIS)) // -direction if (TEST(out_bits, Y_AXIS)) // -direction
#endif #endif
{ // -direction { // -direction
#if HAS_Y_MIN #if HAS(Y_MIN)
UPDATE_ENDSTOP(Y, MIN); UPDATE_ENDSTOP(Y, MIN);
#endif #endif
} }
else { // +direction else { // +direction
#if HAS_Y_MAX #if HAS(Y_MAX)
UPDATE_ENDSTOP(Y, MAX); UPDATE_ENDSTOP(Y, MAX);
#endif #endif
} }
#if ENABLED(COREXY) #if MECH(COREXY)
} }
#endif #endif
#if ENABLED(COREXZ) #if MECH(COREXZ)
// Head direction in -Z axis for CoreXZ bots. // Head direction in -Z axis for CoreXZ bots.
// If DeltaX == DeltaZ, the movement is only in X axis // If DeltaX == DeltaZ, the movement is only in X axis
if ((current_block->steps[A_AXIS] != current_block->steps[C_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, C_AXIS))) { if ((current_block->steps[A_AXIS] != current_block->steps[C_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, C_AXIS))) {
...@@ -399,11 +399,11 @@ inline void update_endstops() { ...@@ -399,11 +399,11 @@ inline void update_endstops() {
if (TEST(out_bits, Z_AXIS)) if (TEST(out_bits, Z_AXIS))
#endif #endif
{ // z -direction { // z -direction
#if HAS_Z_MIN #if HAS(Z_MIN)
#if ENABLED(Z_DUAL_ENDSTOPS) #if ENABLED(Z_DUAL_ENDSTOPS)
SET_ENDSTOP_BIT(Z, MIN); SET_ENDSTOP_BIT(Z, MIN);
#if HAS_Z2_MIN #if HAS(Z2_MIN)
SET_ENDSTOP_BIT(Z2, MIN); SET_ENDSTOP_BIT(Z2, MIN);
#else #else
COPY_BIT(current_endstop_bits, Z_MIN, Z2_MIN); COPY_BIT(current_endstop_bits, Z_MIN, Z2_MIN);
...@@ -434,12 +434,12 @@ inline void update_endstops() { ...@@ -434,12 +434,12 @@ inline void update_endstops() {
#endif #endif
} }
else { // z +direction else { // z +direction
#if HAS_Z_MAX #if HAS(Z_MAX)
#if ENABLED(Z_DUAL_ENDSTOPS) #if ENABLED(Z_DUAL_ENDSTOPS)
SET_ENDSTOP_BIT(Z, MAX); SET_ENDSTOP_BIT(Z, MAX);
#if HAS_Z2_MAX #if HAS(Z2_MAX)
SET_ENDSTOP_BIT(Z2, MAX); SET_ENDSTOP_BIT(Z2, MAX);
#else #else
COPY_BIT(current_endstop_bits, Z_MAX, Z2_MAX); COPY_BIT(current_endstop_bits, Z_MAX, Z2_MAX);
...@@ -461,7 +461,7 @@ inline void update_endstops() { ...@@ -461,7 +461,7 @@ inline void update_endstops() {
#endif // !Z_DUAL_ENDSTOPS #endif // !Z_DUAL_ENDSTOPS
#endif // Z_MAX_PIN #endif // Z_MAX_PIN
} }
#if ENABLED(COREXZ) #if MECH(COREXZ)
} }
#endif #endif
old_endstop_bits = current_endstop_bits; old_endstop_bits = current_endstop_bits;
...@@ -852,162 +852,162 @@ void st_init() { ...@@ -852,162 +852,162 @@ void st_init() {
#endif #endif
// Initialize Dir Pins // Initialize Dir Pins
#if HAS_X_DIR #if HAS(X_DIR)
X_DIR_INIT; X_DIR_INIT;
#endif #endif
#if HAS_X2_DIR #if HAS(X2_DIR)
X2_DIR_INIT; X2_DIR_INIT;
#endif #endif
#if HAS_Y_DIR #if HAS(Y_DIR)
Y_DIR_INIT; Y_DIR_INIT;
#if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_DIR #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS(Y2_DIR)
Y2_DIR_INIT; Y2_DIR_INIT;
#endif #endif
#endif #endif
#if HAS_Z_DIR #if HAS(Z_DIR)
Z_DIR_INIT; Z_DIR_INIT;
#if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_DIR #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS(Z2_DIR)
Z2_DIR_INIT; Z2_DIR_INIT;
#endif #endif
#endif #endif
#if HAS_E0_DIR #if HAS(E0_DIR)
E0_DIR_INIT; E0_DIR_INIT;
#endif #endif
#if HAS_E1_DIR #if HAS(E1_DIR)
E1_DIR_INIT; E1_DIR_INIT;
#endif #endif
#if HAS_E2_DIR #if HAS(E2_DIR)
E2_DIR_INIT; E2_DIR_INIT;
#endif #endif
#if HAS_E3_DIR #if HAS(E3_DIR)
E3_DIR_INIT; E3_DIR_INIT;
#endif #endif
//Initialize Enable Pins - steppers default to disabled. //Initialize Enable Pins - steppers default to disabled.
#if HAS_X_ENABLE #if HAS(X_ENABLE)
X_ENABLE_INIT; X_ENABLE_INIT;
if (!X_ENABLE_ON) X_ENABLE_WRITE(HIGH); if (!X_ENABLE_ON) X_ENABLE_WRITE(HIGH);
#endif #endif
#if HAS_X2_ENABLE #if HAS(X2_ENABLE)
X2_ENABLE_INIT; X2_ENABLE_INIT;
if (!X_ENABLE_ON) X2_ENABLE_WRITE(HIGH); if (!X_ENABLE_ON) X2_ENABLE_WRITE(HIGH);
#endif #endif
#if HAS_Y_ENABLE #if HAS(Y_ENABLE)
Y_ENABLE_INIT; Y_ENABLE_INIT;
if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH); if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH);
#if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS(Y2_ENABLE)
Y2_ENABLE_INIT; Y2_ENABLE_INIT;
if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH); if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH);
#endif #endif
#endif #endif
#if HAS_Z_ENABLE #if HAS(Z_ENABLE)
Z_ENABLE_INIT; Z_ENABLE_INIT;
if (!Z_ENABLE_ON) Z_ENABLE_WRITE(HIGH); if (!Z_ENABLE_ON) Z_ENABLE_WRITE(HIGH);
#if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_ENABLE #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS(Z2_ENABLE)
Z2_ENABLE_INIT; Z2_ENABLE_INIT;
if (!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH); if (!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH);
#endif #endif
#endif #endif
#if HAS_E0_ENABLE #if HAS(E0_ENABLE)
E0_ENABLE_INIT; E0_ENABLE_INIT;
if (!E_ENABLE_ON) E0_ENABLE_WRITE(HIGH); if (!E_ENABLE_ON) E0_ENABLE_WRITE(HIGH);
#endif #endif
#if HAS_E1_ENABLE #if HAS(E1_ENABLE)
E1_ENABLE_INIT; E1_ENABLE_INIT;
if (!E_ENABLE_ON) E1_ENABLE_WRITE(HIGH); if (!E_ENABLE_ON) E1_ENABLE_WRITE(HIGH);
#endif #endif
#if HAS_E2_ENABLE #if HAS(E2_ENABLE)
E2_ENABLE_INIT; E2_ENABLE_INIT;
if (!E_ENABLE_ON) E2_ENABLE_WRITE(HIGH); if (!E_ENABLE_ON) E2_ENABLE_WRITE(HIGH);
#endif #endif
#if HAS_E3_ENABLE #if HAS(E3_ENABLE)
E3_ENABLE_INIT; E3_ENABLE_INIT;
if (!E_ENABLE_ON) E3_ENABLE_WRITE(HIGH); if (!E_ENABLE_ON) E3_ENABLE_WRITE(HIGH);
#endif #endif
//Choice E0-E1 or E0-E2 or E1-E3 pin //Choice E0-E1 or E0-E2 or E1-E3 pin
#if HAS_E0E1 #if HAS(E0E1)
OUT_WRITE(E0E1_CHOICE_PIN, LOW); OUT_WRITE(E0E1_CHOICE_PIN, LOW);
#endif #endif
#if HAS_E0E2 #if HAS(E0E2)
OUT_WRITE(E0E2_CHOICE_PIN, LOW); OUT_WRITE(E0E2_CHOICE_PIN, LOW);
#endif #endif
#if HAS_E0E3 #if HAS(E0E3)
OUT_WRITE(E0E3_CHOICE_PIN, LOW); OUT_WRITE(E0E3_CHOICE_PIN, LOW);
#endif #endif
#if HAS_E1E3 #if HAS(E1E3)
OUT_WRITE(E1E3_CHOICE_PIN, LOW); OUT_WRITE(E1E3_CHOICE_PIN, LOW);
#endif #endif
//endstops and pullups //endstops and pullups
#if HAS_X_MIN #if HAS(X_MIN)
SET_INPUT(X_MIN_PIN); SET_INPUT(X_MIN_PIN);
#if ENABLED(ENDSTOPPULLUP_XMIN) #if ENABLED(ENDSTOPPULLUP_XMIN)
WRITE(X_MIN_PIN,HIGH); WRITE(X_MIN_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Y_MIN #if HAS(Y_MIN)
SET_INPUT(Y_MIN_PIN); SET_INPUT(Y_MIN_PIN);
#if ENABLED(ENDSTOPPULLUP_YMIN) #if ENABLED(ENDSTOPPULLUP_YMIN)
WRITE(Y_MIN_PIN,HIGH); WRITE(Y_MIN_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Z_MIN #if HAS(Z_MIN)
SET_INPUT(Z_MIN_PIN); SET_INPUT(Z_MIN_PIN);
#if ENABLED(ENDSTOPPULLUP_ZMIN) #if ENABLED(ENDSTOPPULLUP_ZMIN)
WRITE(Z_MIN_PIN,HIGH); WRITE(Z_MIN_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Z2_MIN #if HAS(Z2_MIN)
SET_INPUT(Z2_MIN_PIN); SET_INPUT(Z2_MIN_PIN);
#if ENABLED(ENDSTOPPULLUP_Z2MIN) #if ENABLED(ENDSTOPPULLUP_Z2MIN)
WRITE(Z2_MIN_PIN,HIGH); WRITE(Z2_MIN_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_E_MIN #if HAS(E_MIN)
SET_INPUT(E_MIN_PIN); SET_INPUT(E_MIN_PIN);
#if ENABLED(ENDSTOPPULLUP_EMIN) #if ENABLED(ENDSTOPPULLUP_EMIN)
WRITE(E_MIN_PIN, HIGH); WRITE(E_MIN_PIN, HIGH);
#endif #endif
#endif #endif
#if HAS_X_MAX #if HAS(X_MAX)
SET_INPUT(X_MAX_PIN); SET_INPUT(X_MAX_PIN);
#if ENABLED(ENDSTOPPULLUP_XMAX) #if ENABLED(ENDSTOPPULLUP_XMAX)
WRITE(X_MAX_PIN,HIGH); WRITE(X_MAX_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Y_MAX #if HAS(Y_MAX)
SET_INPUT(Y_MAX_PIN); SET_INPUT(Y_MAX_PIN);
#if ENABLED(ENDSTOPPULLUP_YMAX) #if ENABLED(ENDSTOPPULLUP_YMAX)
WRITE(Y_MAX_PIN,HIGH); WRITE(Y_MAX_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Z_MAX #if HAS(Z_MAX)
SET_INPUT(Z_MAX_PIN); SET_INPUT(Z_MAX_PIN);
#if ENABLED(ENDSTOPPULLUP_ZMAX) #if ENABLED(ENDSTOPPULLUP_ZMAX)
WRITE(Z_MAX_PIN,HIGH); WRITE(Z_MAX_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Z2_MAX #if HAS(Z2_MAX)
SET_INPUT(Z2_MAX_PIN); SET_INPUT(Z2_MAX_PIN);
#if ENABLED(ENDSTOPPULLUP_Z2MAX) #if ENABLED(ENDSTOPPULLUP_Z2MAX)
WRITE(Z2_MAX_PIN,HIGH); WRITE(Z2_MAX_PIN,HIGH);
#endif #endif
#endif #endif
#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. #if HAS(Z_PROBE) && ENABLED(Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
SET_INPUT(Z_PROBE_PIN); SET_INPUT(Z_PROBE_PIN);
#if ENABLED(ENDSTOPPULLUP_ZPROBE) #if ENABLED(ENDSTOPPULLUP_ZPROBE)
WRITE(Z_PROBE_PIN,HIGH); WRITE(Z_PROBE_PIN,HIGH);
...@@ -1026,36 +1026,36 @@ void st_init() { ...@@ -1026,36 +1026,36 @@ void st_init() {
#define E_AXIS_INIT(NUM) AXIS_INIT(e## NUM, E## NUM, E) #define E_AXIS_INIT(NUM) AXIS_INIT(e## NUM, E## NUM, E)
// Initialize Step Pins // Initialize Step Pins
#if HAS_X_STEP #if HAS(X_STEP)
AXIS_INIT(x, X, X); AXIS_INIT(x, X, X);
#endif #endif
#if HAS_X2_STEP #if HAS(X2_STEP)
AXIS_INIT(x, X2, X); AXIS_INIT(x, X2, X);
#endif #endif
#if HAS_Y_STEP #if HAS(Y_STEP)
#if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_STEP #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS(Y2_STEP)
Y2_STEP_INIT; Y2_STEP_INIT;
Y2_STEP_WRITE(INVERT_Y_STEP_PIN); Y2_STEP_WRITE(INVERT_Y_STEP_PIN);
#endif #endif
AXIS_INIT(y, Y, Y); AXIS_INIT(y, Y, Y);
#endif #endif
#if HAS_Z_STEP #if HAS(Z_STEP)
#if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_STEP #if ENABLED(Z_DUAL_STEPPER_DRIVERS) && HAS(Z2_STEP)
Z2_STEP_INIT; Z2_STEP_INIT;
Z2_STEP_WRITE(INVERT_Z_STEP_PIN); Z2_STEP_WRITE(INVERT_Z_STEP_PIN);
#endif #endif
AXIS_INIT(z, Z, Z); AXIS_INIT(z, Z, Z);
#endif #endif
#if HAS_E0_STEP #if HAS(E0_STEP)
E_AXIS_INIT(0); E_AXIS_INIT(0);
#endif #endif
#if HAS_E1_STEP #if HAS(E1_STEP)
E_AXIS_INIT(1); E_AXIS_INIT(1);
#endif #endif
#if HAS_E2_STEP #if HAS(E2_STEP)
E_AXIS_INIT(2); E_AXIS_INIT(2);
#endif #endif
#if HAS_E3_STEP #if HAS(E3_STEP)
E_AXIS_INIT(3); E_AXIS_INIT(3);
#endif #endif
...@@ -1230,7 +1230,7 @@ void quickStop() { ...@@ -1230,7 +1230,7 @@ void quickStop() {
// From Arduino DigitalPotControl example // From Arduino DigitalPotControl example
void digitalPotWrite(int address, int value) { void digitalPotWrite(int address, int value) {
#if HAS_DIGIPOTSS #if HAS(DIGIPOTSS)
digitalWrite(DIGIPOTSS_PIN,LOW); // take the SS pin low to select the chip digitalWrite(DIGIPOTSS_PIN,LOW); // take the SS pin low to select the chip
SPI.transfer(address); // send in the address and value via SPI: SPI.transfer(address); // send in the address and value via SPI:
SPI.transfer(value); SPI.transfer(value);
...@@ -1241,7 +1241,7 @@ void digitalPotWrite(int address, int value) { ...@@ -1241,7 +1241,7 @@ void digitalPotWrite(int address, int value) {
// Initialize Digipot Motor Current // Initialize Digipot Motor Current
void digipot_init() { void digipot_init() {
#if HAS_DIGIPOTSS #if HAS(DIGIPOTSS)
const uint8_t digipot_motor_current[] = DIGIPOT_MOTOR_CURRENT; const uint8_t digipot_motor_current[] = DIGIPOT_MOTOR_CURRENT;
SPI.begin(); SPI.begin();
...@@ -1273,7 +1273,7 @@ void digipot_init() { ...@@ -1273,7 +1273,7 @@ void digipot_init() {
} }
void digipot_current(uint8_t driver, int current) { void digipot_current(uint8_t driver, int current) {
#if HAS_DIGIPOTSS #if HAS(DIGIPOTSS)
const uint8_t digipot_ch[] = DIGIPOT_CHANNELS; const uint8_t digipot_ch[] = DIGIPOT_CHANNELS;
digitalPotWrite(digipot_ch[driver], current); digitalPotWrite(digipot_ch[driver], current);
#endif #endif
...@@ -1287,12 +1287,12 @@ void digipot_current(uint8_t driver, int current) { ...@@ -1287,12 +1287,12 @@ void digipot_current(uint8_t driver, int current) {
} }
void microstep_init() { void microstep_init() {
#if HAS_MICROSTEPS_E1 #if HAS(MICROSTEPS_E1)
pinMode(E1_MS1_PIN,OUTPUT); pinMode(E1_MS1_PIN,OUTPUT);
pinMode(E1_MS2_PIN,OUTPUT); pinMode(E1_MS2_PIN,OUTPUT);
#endif #endif
#if HAS_MICROSTEPS #if HAS(MICROSTEPS)
pinMode(X_MS1_PIN,OUTPUT); pinMode(X_MS1_PIN,OUTPUT);
pinMode(X_MS2_PIN,OUTPUT); pinMode(X_MS2_PIN,OUTPUT);
pinMode(Y_MS1_PIN,OUTPUT); pinMode(Y_MS1_PIN,OUTPUT);
...@@ -1313,7 +1313,7 @@ void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2) { ...@@ -1313,7 +1313,7 @@ void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2) {
case 1: digitalWrite(Y_MS1_PIN, ms1); break; case 1: digitalWrite(Y_MS1_PIN, ms1); break;
case 2: digitalWrite(Z_MS1_PIN, ms1); break; case 2: digitalWrite(Z_MS1_PIN, ms1); break;
case 3: digitalWrite(E0_MS1_PIN, ms1); break; case 3: digitalWrite(E0_MS1_PIN, ms1); break;
#if HAS_MICROSTEPS_E1 #if HAS(MICROSTEPS_E1)
case 4: digitalWrite(E1_MS1_PIN, ms1); break; case 4: digitalWrite(E1_MS1_PIN, ms1); break;
#endif #endif
} }
...@@ -1355,7 +1355,7 @@ void microstep_readings() { ...@@ -1355,7 +1355,7 @@ void microstep_readings() {
ECHO_SM(DB, MSG_MICROSTEP_E0); ECHO_SM(DB, MSG_MICROSTEP_E0);
ECHO_V(digitalRead(E0_MS1_PIN)); ECHO_V(digitalRead(E0_MS1_PIN));
ECHO_EV(digitalRead(E0_MS2_PIN)); ECHO_EV(digitalRead(E0_MS2_PIN));
#if HAS_MICROSTEPS_E1 #if HAS(MICROSTEPS_E1)
ECHO_SM(DB, MSG_MICROSTEP_E1); ECHO_SM(DB, MSG_MICROSTEP_E1);
ECHO_V(digitalRead(E1_MS1_PIN)); ECHO_V(digitalRead(E1_MS1_PIN));
ECHO_EV(digitalRead(E1_MS2_PIN)); ECHO_EV(digitalRead(E1_MS2_PIN));
......
...@@ -61,10 +61,10 @@ float current_temperature_bed = 0.0; ...@@ -61,10 +61,10 @@ float current_temperature_bed = 0.0;
#if ENABLED(FAN_SOFT_PWM) #if ENABLED(FAN_SOFT_PWM)
unsigned char fanSpeedSoftPwm = 0; unsigned char fanSpeedSoftPwm = 0;
#if HAS_AUTO_FAN #if HAS(AUTO_FAN)
unsigned char fanSpeedSoftPwm_auto = EXTRUDER_AUTO_FAN_MIN_SPEED; unsigned char fanSpeedSoftPwm_auto = EXTRUDER_AUTO_FAN_MIN_SPEED;
#endif #endif
#if HAS_CONTROLLERFAN #if HAS(CONTROLLERFAN)
unsigned char fanSpeedSoftPwm_controller = CONTROLLERFAN_MIN_SPEED; unsigned char fanSpeedSoftPwm_controller = CONTROLLERFAN_MIN_SPEED;
#endif #endif
#endif #endif
...@@ -91,7 +91,7 @@ unsigned char soft_pwm_bed; ...@@ -91,7 +91,7 @@ unsigned char soft_pwm_bed;
static millis_t thermal_runaway_bed_timer; static millis_t thermal_runaway_bed_timer;
#endif #endif
#endif #endif
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
int current_raw_powconsumption = 0; //Holds measured power consumption int current_raw_powconsumption = 0; //Holds measured power consumption
static unsigned long raw_powconsumption_value = 0; static unsigned long raw_powconsumption_value = 0;
#endif #endif
...@@ -134,14 +134,14 @@ static unsigned char soft_pwm[HOTENDS]; ...@@ -134,14 +134,14 @@ static unsigned char soft_pwm[HOTENDS];
#if ENABLED(FAN_SOFT_PWM) #if ENABLED(FAN_SOFT_PWM)
static unsigned char soft_pwm_fan; static unsigned char soft_pwm_fan;
#if HAS_AUTO_FAN #if HAS(AUTO_FAN)
static unsigned char soft_pwm_fan_auto; static unsigned char soft_pwm_fan_auto;
#endif #endif
#if HAS_CONTROLLERFAN #if HAS(CONTROLLERFAN)
static unsigned char soft_pwm_fan_controller = 0; static unsigned char soft_pwm_fan_controller = 0;
#endif #endif
#endif #endif
#if HAS_AUTO_FAN #if HAS(AUTO_FAN)
static millis_t next_auto_fan_check_ms; static millis_t next_auto_fan_check_ms;
#endif #endif
...@@ -208,12 +208,12 @@ static void updateTemperaturesFromRawValues(); ...@@ -208,12 +208,12 @@ static void updateTemperaturesFromRawValues();
float Kp_temp, Ki_temp, Kd_temp; float Kp_temp, Ki_temp, Kd_temp;
float max = 0, min = 10000; float max = 0, min = 10000;
#if HAS_AUTO_FAN #if HAS(AUTO_FAN)
millis_t next_auto_fan_check_ms = temp_ms + 2500; millis_t next_auto_fan_check_ms = temp_ms + 2500;
#endif #endif
if (hotend >= HOTENDS if (hotend >= HOTENDS
#if !HAS_TEMP_BED #if HASNT(TEMP_BED)
|| hotend < 0 || hotend < 0
#endif #endif
) { ) {
...@@ -251,7 +251,7 @@ static void updateTemperaturesFromRawValues(); ...@@ -251,7 +251,7 @@ static void updateTemperaturesFromRawValues();
max = max(max, input); max = max(max, input);
min = min(min, input); min = min(min, input);
#if HAS_AUTO_FAN #if HAS(AUTO_FAN)
if (ms > next_auto_fan_check_ms) { if (ms > next_auto_fan_check_ms) {
checkExtruderAutoFans(); checkExtruderAutoFans();
next_auto_fan_check_ms = ms + 2500; next_auto_fan_check_ms = ms + 2500;
...@@ -383,7 +383,7 @@ int getHeaterPower(int heater) { ...@@ -383,7 +383,7 @@ int getHeaterPower(int heater) {
return heater < 0 ? soft_pwm_bed : soft_pwm[heater]; return heater < 0 ? soft_pwm_bed : soft_pwm[heater];
} }
#if HAS_AUTO_FAN #if HAS(AUTO_FAN)
void setExtruderAutoFanState(int pin, bool state) { void setExtruderAutoFanState(int pin, bool state) {
unsigned char newFanSpeed = (state != 0) ? EXTRUDER_AUTO_FAN_SPEED : EXTRUDER_AUTO_FAN_MIN_SPEED; unsigned char newFanSpeed = (state != 0) ? EXTRUDER_AUTO_FAN_SPEED : EXTRUDER_AUTO_FAN_MIN_SPEED;
...@@ -400,11 +400,11 @@ void checkExtruderAutoFans() { ...@@ -400,11 +400,11 @@ void checkExtruderAutoFans() {
uint8_t fanState = 0; uint8_t fanState = 0;
// which fan pins need to be turned on? // which fan pins need to be turned on?
#if HAS_AUTO_FAN_0 #if HAS(AUTO_FAN_0)
if (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE) if (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE)
fanState |= 1; fanState |= 1;
#endif #endif
#if HAS_AUTO_FAN_1 #if HAS(AUTO_FAN_1)
if (current_temperature[1] > EXTRUDER_AUTO_FAN_TEMPERATURE) if (current_temperature[1] > EXTRUDER_AUTO_FAN_TEMPERATURE)
{ {
if (EXTRUDER_1_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) if (EXTRUDER_1_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN)
...@@ -413,7 +413,7 @@ void checkExtruderAutoFans() { ...@@ -413,7 +413,7 @@ void checkExtruderAutoFans() {
fanState |= 2; fanState |= 2;
} }
#endif #endif
#if HAS_AUTO_FAN_2 #if HAS(AUTO_FAN_2)
if (current_temperature[2] > EXTRUDER_AUTO_FAN_TEMPERATURE) if (current_temperature[2] > EXTRUDER_AUTO_FAN_TEMPERATURE)
{ {
if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN)
...@@ -424,7 +424,7 @@ void checkExtruderAutoFans() { ...@@ -424,7 +424,7 @@ void checkExtruderAutoFans() {
fanState |= 4; fanState |= 4;
} }
#endif #endif
#if HAS_AUTO_FAN_3 #if HAS(AUTO_FAN_3)
if (current_temperature[3] > EXTRUDER_AUTO_FAN_TEMPERATURE) if (current_temperature[3] > EXTRUDER_AUTO_FAN_TEMPERATURE)
{ {
if (EXTRUDER_3_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) if (EXTRUDER_3_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN)
...@@ -439,19 +439,19 @@ void checkExtruderAutoFans() { ...@@ -439,19 +439,19 @@ void checkExtruderAutoFans() {
#endif #endif
// update extruder auto fan states // update extruder auto fan states
#if HAS_AUTO_FAN_0 #if HAS(AUTO_FAN_0)
setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, (fanState & 1) != 0); setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, (fanState & 1) != 0);
#endif #endif
#if HAS_AUTO_FAN_1 #if HAS(AUTO_FAN_1)
if (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) if (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN)
setExtruderAutoFanState(EXTRUDER_1_AUTO_FAN_PIN, (fanState & 2) != 0); setExtruderAutoFanState(EXTRUDER_1_AUTO_FAN_PIN, (fanState & 2) != 0);
#endif #endif
#if HAS_AUTO_FAN_2 #if HAS(AUTO_FAN_2)
if (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN if (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN
&& EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN)
setExtruderAutoFanState(EXTRUDER_2_AUTO_FAN_PIN, (fanState & 4) != 0); setExtruderAutoFanState(EXTRUDER_2_AUTO_FAN_PIN, (fanState & 4) != 0);
#endif #endif
#if HAS_AUTO_FAN_3 #if HAS(AUTO_FAN_3)
if (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN if (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN
&& EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN && EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN
&& EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_2_AUTO_FAN_PIN)
...@@ -459,7 +459,7 @@ void checkExtruderAutoFans() { ...@@ -459,7 +459,7 @@ void checkExtruderAutoFans() {
#endif #endif
} }
#endif // HAS_AUTO_FAN #endif // HAS(AUTO_FAN)
// //
// Temperature Error Handlers // Temperature Error Handlers
...@@ -607,7 +607,7 @@ void manage_heater() { ...@@ -607,7 +607,7 @@ void manage_heater() {
if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0); if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
#endif #endif
#if ENABLED(THERMAL_PROTECTION_HOTENDS) || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN #if ENABLED(THERMAL_PROTECTION_HOTENDS) || DISABLED(PIDTEMPBED) || HAS(AUTO_FAN)
millis_t ms = millis(); millis_t ms = millis();
#endif #endif
...@@ -649,7 +649,7 @@ void manage_heater() { ...@@ -649,7 +649,7 @@ void manage_heater() {
} // Hotends Loop } // Hotends Loop
#if HAS_AUTO_FAN #if HAS(AUTO_FAN)
if (ms > next_auto_fan_check_ms) { // only need to check fan state very infrequently if (ms > next_auto_fan_check_ms) { // only need to check fan state very infrequently
checkExtruderAutoFans(); checkExtruderAutoFans();
next_auto_fan_check_ms = ms + 2500; next_auto_fan_check_ms = ms + 2500;
...@@ -798,10 +798,10 @@ static void updateTemperaturesFromRawValues() { ...@@ -798,10 +798,10 @@ static void updateTemperaturesFromRawValues() {
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
redundant_temperature = analog2temp(redundant_temperature_raw, 1); redundant_temperature = analog2temp(redundant_temperature_raw, 1);
#endif #endif
#if HAS_FILAMENT_SENSOR #if HAS(FILAMENT_SENSOR)
filament_width_meas = analog2widthFil(); filament_width_meas = analog2widthFil();
#endif #endif
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
static float watt_overflow = 0.0; static float watt_overflow = 0.0;
power_consumption_meas = analog2power(); power_consumption_meas = analog2power();
/*ECHO_MV("raw:", raw_analog2voltage(), 5); /*ECHO_MV("raw:", raw_analog2voltage(), 5);
...@@ -833,7 +833,7 @@ static void updateTemperaturesFromRawValues() { ...@@ -833,7 +833,7 @@ static void updateTemperaturesFromRawValues() {
} }
#if HAS_FILAMENT_SENSOR #if HAS(FILAMENT_SENSOR)
// Convert raw Filament Width to millimeters // Convert raw Filament Width to millimeters
float analog2widthFil() { float analog2widthFil() {
...@@ -851,7 +851,7 @@ static void updateTemperaturesFromRawValues() { ...@@ -851,7 +851,7 @@ static void updateTemperaturesFromRawValues() {
#endif #endif
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
// Convert raw Power Consumption to watt // Convert raw Power Consumption to watt
float raw_analog2voltage() { float raw_analog2voltage() {
return (5.0 * current_raw_powconsumption) / (1023 * OVERSAMPLENR); return (5.0 * current_raw_powconsumption) / (1023 * OVERSAMPLENR);
...@@ -908,22 +908,22 @@ void tp_init() { ...@@ -908,22 +908,22 @@ void tp_init() {
#endif // PIDTEMPBED #endif // PIDTEMPBED
} }
#if HAS_HEATER_0 #if HAS(HEATER_0)
SET_OUTPUT(HEATER_0_PIN); SET_OUTPUT(HEATER_0_PIN);
#endif #endif
#if HAS_HEATER_1 #if HAS(HEATER_1)
SET_OUTPUT(HEATER_1_PIN); SET_OUTPUT(HEATER_1_PIN);
#endif #endif
#if HAS_HEATER_2 #if HAS(HEATER_2)
SET_OUTPUT(HEATER_2_PIN); SET_OUTPUT(HEATER_2_PIN);
#endif #endif
#if HAS_HEATER_3 #if HAS(HEATER_3)
SET_OUTPUT(HEATER_3_PIN); SET_OUTPUT(HEATER_3_PIN);
#endif #endif
#if HAS_HEATER_BED #if HAS(HEATER_BED)
SET_OUTPUT(HEATER_BED_PIN); SET_OUTPUT(HEATER_BED_PIN);
#endif #endif
#if HAS_FAN #if HAS(FAN)
SET_OUTPUT(FAN_PIN); SET_OUTPUT(FAN_PIN);
#if ENABLED(FAST_PWM_FAN) #if ENABLED(FAST_PWM_FAN)
setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
...@@ -960,26 +960,26 @@ void tp_init() { ...@@ -960,26 +960,26 @@ void tp_init() {
#ifdef DIDR2 #ifdef DIDR2
DIDR2 = 0; DIDR2 = 0;
#endif #endif
#if HAS_TEMP_0 #if HAS(TEMP_0)
ANALOG_SELECT(TEMP_0_PIN); ANALOG_SELECT(TEMP_0_PIN);
#endif #endif
#if HAS_TEMP_1 #if HAS(TEMP_1)
ANALOG_SELECT(TEMP_1_PIN); ANALOG_SELECT(TEMP_1_PIN);
#endif #endif
#if HAS_TEMP_2 #if HAS(TEMP_2)
ANALOG_SELECT(TEMP_2_PIN); ANALOG_SELECT(TEMP_2_PIN);
#endif #endif
#if HAS_TEMP_3 #if HAS(TEMP_3)
ANALOG_SELECT(TEMP_3_PIN); ANALOG_SELECT(TEMP_3_PIN);
#endif #endif
#if HAS_TEMP_BED #if HAS(TEMP_BED)
ANALOG_SELECT(TEMP_BED_PIN); ANALOG_SELECT(TEMP_BED_PIN);
#endif #endif
#if HAS_FILAMENT_SENSOR #if HAS(FILAMENT_SENSOR)
ANALOG_SELECT(FILWIDTH_PIN); ANALOG_SELECT(FILWIDTH_PIN);
#endif #endif
#if HAS_CONTROLLERFAN #if HAS(CONTROLLERFAN)
SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
#if ENABLED(FAST_PWM_FAN) #if ENABLED(FAST_PWM_FAN)
setPwmFrequency(CONTROLLERFAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 setPwmFrequency(CONTROLLERFAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
...@@ -989,25 +989,25 @@ void tp_init() { ...@@ -989,25 +989,25 @@ void tp_init() {
#endif #endif
#endif #endif
#if HAS_AUTO_FAN_0 #if HAS(AUTO_FAN_0)
SET_OUTPUT(EXTRUDER_0_AUTO_FAN_PIN); SET_OUTPUT(EXTRUDER_0_AUTO_FAN_PIN);
#if ENABLED(FAST_PWM_FAN) #if ENABLED(FAST_PWM_FAN)
setPwmFrequency(EXTRUDER_0_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 setPwmFrequency(EXTRUDER_0_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
#endif #endif
#endif #endif
#if HAS_AUTO_FAN_1 && (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) #if HAS(AUTO_FAN_1) && (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN)
SET_OUTPUT(EXTRUDER_1_AUTO_FAN_PIN); SET_OUTPUT(EXTRUDER_1_AUTO_FAN_PIN);
#if ENABLED(FAST_PWM_FAN) #if ENABLED(FAST_PWM_FAN)
setPwmFrequency(EXTRUDER_1_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 setPwmFrequency(EXTRUDER_1_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
#endif #endif
#endif #endif
#if HAS_AUTO_FAN_2 && (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) && (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN) #if HAS(AUTO_FAN_2) && (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) && (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN)
SET_OUTPUT(EXTRUDER_2_AUTO_FAN_PIN); SET_OUTPUT(EXTRUDER_2_AUTO_FAN_PIN);
#if ENABLED(FAST_PWM_FAN) #if ENABLED(FAST_PWM_FAN)
setPwmFrequency(EXTRUDER_2_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 setPwmFrequency(EXTRUDER_2_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
#endif #endif
#endif #endif
#if HAS_AUTO_FAN_3 && (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) && (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN) && (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_2_AUTO_FAN_PIN) #if HAS(AUTO_FAN_3) && (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) && (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN) && (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_2_AUTO_FAN_PIN)
SET_OUTPUT(EXTRUDER_3_AUTO_FAN_PIN); SET_OUTPUT(EXTRUDER_3_AUTO_FAN_PIN);
#if ENABLED(FAST_PWM_FAN) #if ENABLED(FAST_PWM_FAN)
setPwmFrequency(EXTRUDER_3_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 setPwmFrequency(EXTRUDER_3_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
...@@ -1015,12 +1015,12 @@ void tp_init() { ...@@ -1015,12 +1015,12 @@ void tp_init() {
#endif #endif
#if ENABLED(FAN_SOFT_PWM) #if ENABLED(FAN_SOFT_PWM)
#if HAS_AUTO_FAN #if HAS(AUTO_FAN)
soft_pwm_fan_auto = fanSpeedSoftPwm_auto / 2; soft_pwm_fan_auto = fanSpeedSoftPwm_auto / 2;
#endif #endif
#endif #endif
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
ANALOG_SELECT(POWER_CONSUMPTION_PIN); ANALOG_SELECT(POWER_CONSUMPTION_PIN);
#endif #endif
...@@ -1195,28 +1195,28 @@ void disable_all_heaters() { ...@@ -1195,28 +1195,28 @@ void disable_all_heaters() {
WRITE_HEATER_ ## NR (LOW); \ WRITE_HEATER_ ## NR (LOW); \
} }
#if HAS_TEMP_0 #if HAS(TEMP_0)
target_temperature[0] = 0; target_temperature[0] = 0;
soft_pwm[0] = 0; soft_pwm[0] = 0;
WRITE_HEATER_0P(LOW); // Should HEATERS_PARALLEL apply here? Then change to DISABLE_HEATER(0) WRITE_HEATER_0P(LOW); // Should HEATERS_PARALLEL apply here? Then change to DISABLE_HEATER(0)
#endif #endif
#if HOTENDS > 1 && HAS_TEMP_1 #if HOTENDS > 1 && HAS(TEMP_1)
DISABLE_HEATER(1); DISABLE_HEATER(1);
#endif #endif
#if HOTENDS > 2 && HAS_TEMP_2 #if HOTENDS > 2 && HAS(TEMP_2)
DISABLE_HEATER(2); DISABLE_HEATER(2);
#endif #endif
#if HOTENDS > 3 && HAS_TEMP_3 #if HOTENDS > 3 && HAS(TEMP_3)
DISABLE_HEATER(3); DISABLE_HEATER(3);
#endif #endif
#if HAS_TEMP_BED #if HAS(TEMP_BED)
target_temperature_bed = 0; target_temperature_bed = 0;
soft_pwm_bed = 0; soft_pwm_bed = 0;
#if HAS_HEATER_BED #if HAS(HEATER_BED)
WRITE_HEATER_BED(LOW); WRITE_HEATER_BED(LOW);
#endif #endif
#endif #endif
...@@ -1305,25 +1305,25 @@ static unsigned long raw_temp_value[4] = { 0 }; ...@@ -1305,25 +1305,25 @@ static unsigned long raw_temp_value[4] = { 0 };
static unsigned long raw_temp_bed_value = 0; static unsigned long raw_temp_bed_value = 0;
static void set_current_temp_raw() { static void set_current_temp_raw() {
#if HAS_TEMP_0 && DISABLED(HEATER_0_USES_MAX6675) #if HAS(TEMP_0) && DISABLED(HEATER_0_USES_MAX6675)
current_temperature_raw[0] = raw_temp_value[0]; current_temperature_raw[0] = raw_temp_value[0];
#endif #endif
#if HAS_TEMP_1 #if HAS(TEMP_1)
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
redundant_temperature_raw = raw_temp_value[1]; redundant_temperature_raw = raw_temp_value[1];
#else #else
current_temperature_raw[1] = raw_temp_value[1]; current_temperature_raw[1] = raw_temp_value[1];
#endif #endif
#if HAS_TEMP_2 #if HAS(TEMP_2)
current_temperature_raw[2] = raw_temp_value[2]; current_temperature_raw[2] = raw_temp_value[2];
#if HAS_TEMP_3 #if HAS(TEMP_3)
current_temperature_raw[3] = raw_temp_value[3]; current_temperature_raw[3] = raw_temp_value[3];
#endif #endif
#endif #endif
#endif #endif
current_temperature_bed_raw = raw_temp_bed_value; current_temperature_bed_raw = raw_temp_bed_value;
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
current_raw_powconsumption = raw_powconsumption_value; current_raw_powconsumption = raw_powconsumption_value;
#endif #endif
temp_meas_ready = true; temp_meas_ready = true;
...@@ -1363,11 +1363,11 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1363,11 +1363,11 @@ ISR(TIMER0_COMPB_vect) {
#endif #endif
#endif #endif
#endif #endif
#if HAS_HEATER_BED #if HAS(HEATER_BED)
ISR_STATICS(BED); ISR_STATICS(BED);
#endif #endif
#if HAS_FILAMENT_SENSOR #if HAS(FILAMENT_SENSOR)
static unsigned long raw_filwidth_value = 0; static unsigned long raw_filwidth_value = 0;
#endif #endif
...@@ -1395,30 +1395,30 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1395,30 +1395,30 @@ ISR(TIMER0_COMPB_vect) {
#endif #endif
#endif #endif
#if HAS_HEATER_BED #if HAS(HEATER_BED)
soft_pwm_BED = soft_pwm_bed; soft_pwm_BED = soft_pwm_bed;
WRITE_HEATER_BED(soft_pwm_BED > 0 ? 1 : 0); WRITE_HEATER_BED(soft_pwm_BED > 0 ? 1 : 0);
#endif #endif
#if ENABLED(FAN_SOFT_PWM) #if ENABLED(FAN_SOFT_PWM)
soft_pwm_fan = fanSpeedSoftPwm / 2; soft_pwm_fan = fanSpeedSoftPwm / 2;
#if HAS_CONTROLLERFAN #if HAS(CONTROLLERFAN)
soft_pwm_fan_controller = fanSpeedSoftPwm_controller / 2; soft_pwm_fan_controller = fanSpeedSoftPwm_controller / 2;
WRITE(CONTROLLERFAN_PIN, soft_pwm_fan_controller > 0 ? 1 : 0); WRITE(CONTROLLERFAN_PIN, soft_pwm_fan_controller > 0 ? 1 : 0);
#endif #endif
WRITE_FAN(soft_pwm_fan > 0 ? 1 : 0); WRITE_FAN(soft_pwm_fan > 0 ? 1 : 0);
#if HAS_AUTO_FAN #if HAS(AUTO_FAN)
soft_pwm_fan_auto = fanSpeedSoftPwm_auto / 2; soft_pwm_fan_auto = fanSpeedSoftPwm_auto / 2;
#endif #endif
#if HAS_AUTO_FAN_0 #if HAS(AUTO_FAN_0)
WRITE(EXTRUDER_0_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0); WRITE(EXTRUDER_0_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0);
#endif #endif
#if HAS_AUTO_FAN_1 #if HAS(AUTO_FAN_1)
WRITE(EXTRUDER_1_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0); WRITE(EXTRUDER_1_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0);
#endif #endif
#if HAS_AUTO_FAN_2 #if HAS(AUTO_FAN_2)
WRITE(EXTRUDER_2_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0); WRITE(EXTRUDER_2_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0);
#endif #endif
#if HAS_AUTO_FAN_3 #if HAS(AUTO_FAN_3)
WRITE(EXTRUDER_3_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0); WRITE(EXTRUDER_3_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0);
#endif #endif
#endif #endif
...@@ -1435,27 +1435,27 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1435,27 +1435,27 @@ ISR(TIMER0_COMPB_vect) {
#endif #endif
#endif #endif
#if HAS_HEATER_BED #if HAS(HEATER_BED)
if (soft_pwm_BED < pwm_count) WRITE_HEATER_BED(0); if (soft_pwm_BED < pwm_count) WRITE_HEATER_BED(0);
#endif #endif
#if ENABLED(FAN_SOFT_PWM) #if ENABLED(FAN_SOFT_PWM)
if (soft_pwm_fan < pwm_count) WRITE_FAN(0); if (soft_pwm_fan < pwm_count) WRITE_FAN(0);
#if HAS_CONTROLLERFAN #if HAS(CONTROLLERFAN)
if (soft_pwm_fan_controller < pwm_count) WRITE(CONTROLLERFAN_PIN, 0); if (soft_pwm_fan_controller < pwm_count) WRITE(CONTROLLERFAN_PIN, 0);
#endif #endif
#if HAS_AUTO_FAN #if HAS(AUTO_FAN)
if (soft_pwm_fan_auto < pwm_count) { if (soft_pwm_fan_auto < pwm_count) {
#if HAS_AUTO_FAN_0 #if HAS(AUTO_FAN_0)
WRITE(EXTRUDER_0_AUTO_FAN_PIN, 0); WRITE(EXTRUDER_0_AUTO_FAN_PIN, 0);
#endif #endif
#if HAS_AUTO_FAN_1 #if HAS(AUTO_FAN_1)
WRITE(EXTRUDER_1_AUTO_FAN_PIN, 0); WRITE(EXTRUDER_1_AUTO_FAN_PIN, 0);
#endif #endif
#if HAS_AUTO_FAN_2 #if HAS(AUTO_FAN_2)
WRITE(EXTRUDER_2_AUTO_FAN_PIN, 0); WRITE(EXTRUDER_2_AUTO_FAN_PIN, 0);
#endif #endif
#if HAS_AUTO_FAN_3 #if HAS(AUTO_FAN_3)
WRITE(EXTRUDER_3_AUTO_FAN_PIN, 0); WRITE(EXTRUDER_3_AUTO_FAN_PIN, 0);
#endif #endif
} }
...@@ -1515,7 +1515,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1515,7 +1515,7 @@ ISR(TIMER0_COMPB_vect) {
#endif #endif
#endif #endif
#endif #endif
#if HAS_HEATER_BED #if HAS(HEATER_BED)
_SLOW_PWM_ROUTINE(BED, soft_pwm_bed); // BED _SLOW_PWM_ROUTINE(BED, soft_pwm_bed); // BED
#endif #endif
...@@ -1531,7 +1531,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1531,7 +1531,7 @@ ISR(TIMER0_COMPB_vect) {
#endif #endif
#endif #endif
#endif #endif
#if HAS_HEATER_BED #if HAS(HEATER_BED)
PWM_OFF_ROUTINE(BED); // BED PWM_OFF_ROUTINE(BED); // BED
#endif #endif
...@@ -1539,42 +1539,42 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1539,42 +1539,42 @@ ISR(TIMER0_COMPB_vect) {
if (pwm_count == 0) { if (pwm_count == 0) {
soft_pwm_fan = fanSpeedSoftPwm / 2; soft_pwm_fan = fanSpeedSoftPwm / 2;
WRITE_FAN(soft_pwm_fan > 0 ? 1 : 0); WRITE_FAN(soft_pwm_fan > 0 ? 1 : 0);
#if HAS_CONTROLLERFAN #if HAS(CONTROLLERFAN)
soft_pwm_fan_controller = fanSpeedSoftPwm_controller / 2; soft_pwm_fan_controller = fanSpeedSoftPwm_controller / 2;
WRITE(CONTROLLERFAN_PIN, soft_pwm_fan_controller > 0 ? 1 : 0); WRITE(CONTROLLERFAN_PIN, soft_pwm_fan_controller > 0 ? 1 : 0);
#endif #endif
#if HAS_AUTO_FAN #if HAS(AUTO_FAN)
soft_pwm_fan_auto = fanSpeedSoftPwm_auto / 2; soft_pwm_fan_auto = fanSpeedSoftPwm_auto / 2;
#endif #endif
#if HAS_AUTO_FAN_0 #if HAS(AUTO_FAN_0)
WRITE(EXTRUDER_0_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0); WRITE(EXTRUDER_0_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0);
#endif #endif
#if HAS_AUTO_FAN_1 #if HAS(AUTO_FAN_1)
WRITE(EXTRUDER_1_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0); WRITE(EXTRUDER_1_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0);
#endif #endif
#if HAS_AUTO_FAN_2 #if HAS(AUTO_FAN_2)
WRITE(EXTRUDER_2_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0); WRITE(EXTRUDER_2_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0);
#endif #endif
#if HAS_AUTO_FAN_3 #if HAS(AUTO_FAN_3)
WRITE(EXTRUDER_3_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0); WRITE(EXTRUDER_3_AUTO_FAN_PIN, soft_pwm_fan_auto > 0 ? 1 : 0);
#endif #endif
} }
if (soft_pwm_fan < pwm_count) WRITE_FAN(0); if (soft_pwm_fan < pwm_count) WRITE_FAN(0);
#if HAS_CONTROLLERFAN #if HAS(CONTROLLERFAN)
if (soft_pwm_fan_controller < pwm_count) WRITE(CONTROLLERFAN_PIN, 0); if (soft_pwm_fan_controller < pwm_count) WRITE(CONTROLLERFAN_PIN, 0);
#endif #endif
#if HAS_AUTO_FAN #if HAS(AUTO_FAN)
if (soft_pwm_fan_auto < pwm_count) { if (soft_pwm_fan_auto < pwm_count) {
#if HAS_AUTO_FAN_0 #if HAS(AUTO_FAN_0)
WRITE(EXTRUDER_0_AUTO_FAN_PIN, 0); WRITE(EXTRUDER_0_AUTO_FAN_PIN, 0);
#endif #endif
#if HAS_AUTO_FAN_1 #if HAS(AUTO_FAN_1)
WRITE(EXTRUDER_1_AUTO_FAN_PIN, 0); WRITE(EXTRUDER_1_AUTO_FAN_PIN, 0);
#endif #endif
#if HAS_AUTO_FAN_2 #if HAS(AUTO_FAN_2)
WRITE(EXTRUDER_2_AUTO_FAN_PIN, 0); WRITE(EXTRUDER_2_AUTO_FAN_PIN, 0);
#endif #endif
#if HAS_AUTO_FAN_3 #if HAS(AUTO_FAN_3)
WRITE(EXTRUDER_3_AUTO_FAN_PIN, 0); WRITE(EXTRUDER_3_AUTO_FAN_PIN, 0);
#endif #endif
} }
...@@ -1600,7 +1600,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1600,7 +1600,7 @@ ISR(TIMER0_COMPB_vect) {
#endif #endif
#endif #endif
#endif #endif
#if HAS_HEATER_BED #if HAS(HEATER_BED)
if (state_timer_heater_BED > 0) state_timer_heater_BED--; if (state_timer_heater_BED > 0) state_timer_heater_BED--;
#endif #endif
} // (pwm_count % 64) == 0 } // (pwm_count % 64) == 0
...@@ -1618,84 +1618,84 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1618,84 +1618,84 @@ ISR(TIMER0_COMPB_vect) {
switch(temp_state) { switch(temp_state) {
case PrepareTemp_0: case PrepareTemp_0:
#if HAS_TEMP_0 #if HAS(TEMP_0)
START_ADC(TEMP_0_PIN); START_ADC(TEMP_0_PIN);
#endif #endif
lcd_buttons_update(); lcd_buttons_update();
temp_state = MeasureTemp_0; temp_state = MeasureTemp_0;
break; break;
case MeasureTemp_0: case MeasureTemp_0:
#if HAS_TEMP_0 #if HAS(TEMP_0)
raw_temp_value[0] += ADC; raw_temp_value[0] += ADC;
#endif #endif
temp_state = PrepareTemp_BED; temp_state = PrepareTemp_BED;
break; break;
case PrepareTemp_BED: case PrepareTemp_BED:
#if HAS_TEMP_BED #if HAS(TEMP_BED)
START_ADC(TEMP_BED_PIN); START_ADC(TEMP_BED_PIN);
#endif #endif
lcd_buttons_update(); lcd_buttons_update();
temp_state = MeasureTemp_BED; temp_state = MeasureTemp_BED;
break; break;
case MeasureTemp_BED: case MeasureTemp_BED:
#if HAS_TEMP_BED #if HAS(TEMP_BED)
raw_temp_bed_value += ADC; raw_temp_bed_value += ADC;
#endif #endif
temp_state = PrepareTemp_1; temp_state = PrepareTemp_1;
break; break;
case PrepareTemp_1: case PrepareTemp_1:
#if HAS_TEMP_1 #if HAS(TEMP_1)
START_ADC(TEMP_1_PIN); START_ADC(TEMP_1_PIN);
#endif #endif
lcd_buttons_update(); lcd_buttons_update();
temp_state = MeasureTemp_1; temp_state = MeasureTemp_1;
break; break;
case MeasureTemp_1: case MeasureTemp_1:
#if HAS_TEMP_1 #if HAS(TEMP_1)
raw_temp_value[1] += ADC; raw_temp_value[1] += ADC;
#endif #endif
temp_state = PrepareTemp_2; temp_state = PrepareTemp_2;
break; break;
case PrepareTemp_2: case PrepareTemp_2:
#if HAS_TEMP_2 #if HAS(TEMP_2)
START_ADC(TEMP_2_PIN); START_ADC(TEMP_2_PIN);
#endif #endif
lcd_buttons_update(); lcd_buttons_update();
temp_state = MeasureTemp_2; temp_state = MeasureTemp_2;
break; break;
case MeasureTemp_2: case MeasureTemp_2:
#if HAS_TEMP_2 #if HAS(TEMP_2)
raw_temp_value[2] += ADC; raw_temp_value[2] += ADC;
#endif #endif
temp_state = PrepareTemp_3; temp_state = PrepareTemp_3;
break; break;
case PrepareTemp_3: case PrepareTemp_3:
#if HAS_TEMP_3 #if HAS(TEMP_3)
START_ADC(TEMP_3_PIN); START_ADC(TEMP_3_PIN);
#endif #endif
lcd_buttons_update(); lcd_buttons_update();
temp_state = MeasureTemp_3; temp_state = MeasureTemp_3;
break; break;
case MeasureTemp_3: case MeasureTemp_3:
#if HAS_TEMP_3 #if HAS(TEMP_3)
raw_temp_value[3] += ADC; raw_temp_value[3] += ADC;
#endif #endif
temp_state = Prepare_FILWIDTH; temp_state = Prepare_FILWIDTH;
break; break;
case Prepare_FILWIDTH: case Prepare_FILWIDTH:
#if HAS_FILAMENT_SENSOR #if HAS(FILAMENT_SENSOR)
START_ADC(FILWIDTH_PIN); START_ADC(FILWIDTH_PIN);
#endif #endif
lcd_buttons_update(); lcd_buttons_update();
temp_state = Measure_FILWIDTH; temp_state = Measure_FILWIDTH;
break; break;
case Measure_FILWIDTH: case Measure_FILWIDTH:
#if HAS_FILAMENT_SENSOR #if HAS(FILAMENT_SENSOR)
// raw_filwidth_value += ADC; //remove to use an IIR filter approach // raw_filwidth_value += ADC; //remove to use an IIR filter approach
if (ADC > 102) { //check that ADC is reading a voltage > 0.5 volts, otherwise don't take in the data. if (ADC > 102) { //check that ADC is reading a voltage > 0.5 volts, otherwise don't take in the data.
raw_filwidth_value -= (raw_filwidth_value>>7); //multiply raw_filwidth_value by 127/128 raw_filwidth_value -= (raw_filwidth_value>>7); //multiply raw_filwidth_value by 127/128
...@@ -1706,14 +1706,14 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1706,14 +1706,14 @@ ISR(TIMER0_COMPB_vect) {
break; break;
case Prepare_POWCONSUMPTION: case Prepare_POWCONSUMPTION:
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
START_ADC(POWER_CONSUMPTION_PIN); START_ADC(POWER_CONSUMPTION_PIN);
#endif #endif
lcd_buttons_update(); lcd_buttons_update();
temp_state = Measure_POWCONSUMPTION; temp_state = Measure_POWCONSUMPTION;
break; break;
case Measure_POWCONSUMPTION: case Measure_POWCONSUMPTION:
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
raw_powconsumption_value += ADC; raw_powconsumption_value += ADC;
#endif #endif
temp_state = PrepareTemp_0; temp_state = PrepareTemp_0;
...@@ -1734,7 +1734,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1734,7 +1734,7 @@ ISR(TIMER0_COMPB_vect) {
if (!temp_meas_ready) set_current_temp_raw(); if (!temp_meas_ready) set_current_temp_raw();
// Filament Sensor - can be read any time since IIR filtering is used // Filament Sensor - can be read any time since IIR filtering is used
#if HAS_FILAMENT_SENSOR #if HAS(FILAMENT_SENSOR)
current_raw_filwidth = raw_filwidth_value >> 10; // Divide to get to 0-16384 range since we used 1/128 IIR filter approach current_raw_filwidth = raw_filwidth_value >> 10; // Divide to get to 0-16384 range since we used 1/128 IIR filter approach
#endif #endif
...@@ -1742,11 +1742,11 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1742,11 +1742,11 @@ ISR(TIMER0_COMPB_vect) {
for (int i = 0; i < 4; i++) raw_temp_value[i] = 0; for (int i = 0; i < 4; i++) raw_temp_value[i] = 0;
raw_temp_bed_value = 0; raw_temp_bed_value = 0;
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
raw_powconsumption_value = 0; raw_powconsumption_value = 0;
#endif #endif
#if HAS_TEMP_0 && DISABLED(HEATER_0_USES_MAX6675) #if HAS(TEMP_0) && DISABLED(HEATER_0_USES_MAX6675)
#if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP #if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP
#define GE0 <= #define GE0 <=
#else #else
...@@ -1756,7 +1756,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1756,7 +1756,7 @@ ISR(TIMER0_COMPB_vect) {
if (minttemp_raw[0] GE0 current_temperature_raw[0]) min_temp_error(0); if (minttemp_raw[0] GE0 current_temperature_raw[0]) min_temp_error(0);
#endif #endif
#if HAS_TEMP_1 && HOTENDS > 1 #if HAS(TEMP_1) && HOTENDS > 1
#if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP #if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP
#define GE1 <= #define GE1 <=
#else #else
...@@ -1766,7 +1766,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1766,7 +1766,7 @@ ISR(TIMER0_COMPB_vect) {
if (minttemp_raw[1] GE1 current_temperature_raw[1]) min_temp_error(1); if (minttemp_raw[1] GE1 current_temperature_raw[1]) min_temp_error(1);
#endif // TEMP_SENSOR_1 #endif // TEMP_SENSOR_1
#if HAS_TEMP_2 && HOTENDS > 2 #if HAS(TEMP_2) && HOTENDS > 2
#if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP #if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP
#define GE2 <= #define GE2 <=
#else #else
...@@ -1776,7 +1776,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1776,7 +1776,7 @@ ISR(TIMER0_COMPB_vect) {
if (minttemp_raw[2] GE2 current_temperature_raw[2]) min_temp_error(2); if (minttemp_raw[2] GE2 current_temperature_raw[2]) min_temp_error(2);
#endif // TEMP_SENSOR_2 #endif // TEMP_SENSOR_2
#if HAS_TEMP_3 && HOTENDS > 3 #if HAS(TEMP_3) && HOTENDS > 3
#if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP #if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP
#define GE3 <= #define GE3 <=
#else #else
...@@ -1786,7 +1786,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1786,7 +1786,7 @@ ISR(TIMER0_COMPB_vect) {
if (minttemp_raw[3] GE3 current_temperature_raw[3]) min_temp_error(3); if (minttemp_raw[3] GE3 current_temperature_raw[3]) min_temp_error(3);
#endif // TEMP_SENSOR_3 #endif // TEMP_SENSOR_3
#if HAS_TEMP_BED #if HAS(TEMP_BED)
#if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP #if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
#define GEBED <= #define GEBED <=
#else #else
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
void tp_init(); //initialize the heating void tp_init(); //initialize the heating
void manage_heater(); //it is critical that this is called periodically. void manage_heater(); //it is critical that this is called periodically.
#if HAS_FILAMENT_SENSOR #if HAS(FILAMENT_SENSOR)
// For converting raw Filament Width to milimeters // For converting raw Filament Width to milimeters
float analog2widthFil(); float analog2widthFil();
...@@ -37,7 +37,7 @@ void manage_heater(); //it is critical that this is called periodically. ...@@ -37,7 +37,7 @@ void manage_heater(); //it is critical that this is called periodically.
int widthFil_to_size_ratio(); int widthFil_to_size_ratio();
#endif #endif
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
// For converting raw Power Consumption to watt // For converting raw Power Consumption to watt
float analog2voltage(); float analog2voltage();
float analog2current(); float analog2current();
...@@ -61,7 +61,7 @@ extern float current_temperature_bed; ...@@ -61,7 +61,7 @@ extern float current_temperature_bed;
extern float redundant_temperature; extern float redundant_temperature;
#endif #endif
#if HAS_CONTROLLERFAN #if HAS(CONTROLLERFAN)
extern unsigned char soft_pwm_bed; extern unsigned char soft_pwm_bed;
#endif #endif
......
...@@ -29,11 +29,11 @@ int gumPreheatHotendTemp; ...@@ -29,11 +29,11 @@ int gumPreheatHotendTemp;
int gumPreheatHPBTemp; int gumPreheatHPBTemp;
int gumPreheatFanSpeed; int gumPreheatFanSpeed;
#if HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR #if HAS(LCD_FILAMENT_SENSOR) || HAS(LCD_POWER_SENSOR)
millis_t previous_lcd_status_ms = 0; millis_t previous_lcd_status_ms = 0;
#endif #endif
#if HAS_LCD_POWER_SENSOR #if HAS(LCD_POWER_SENSOR)
millis_t print_millis = 0; millis_t print_millis = 0;
#endif #endif
...@@ -56,7 +56,7 @@ static void lcd_status_screen(); ...@@ -56,7 +56,7 @@ static void lcd_status_screen();
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
#if HAS_POWER_SWITCH #if HAS(POWER_SWITCH)
extern bool powersupply; extern bool powersupply;
#endif #endif
static float manual_feedrate[] = MANUAL_FEEDRATE; static float manual_feedrate[] = MANUAL_FEEDRATE;
...@@ -74,7 +74,7 @@ static void lcd_status_screen(); ...@@ -74,7 +74,7 @@ static void lcd_status_screen();
static void lcd_control_temperature_preheat_gum_settings_menu(); static void lcd_control_temperature_preheat_gum_settings_menu();
static void lcd_control_motion_menu(); static void lcd_control_motion_menu();
static void lcd_control_volumetric_menu(); static void lcd_control_volumetric_menu();
#if ENABLED(HAS_LCD_CONTRAST) #if HAS(LCD_CONTRAST)
static void lcd_set_contrast(); static void lcd_set_contrast();
#endif #endif
#if ENABLED(FWRETRACT) #if ENABLED(FWRETRACT)
...@@ -82,7 +82,7 @@ static void lcd_status_screen(); ...@@ -82,7 +82,7 @@ static void lcd_status_screen();
#endif #endif
static void lcd_sdcard_menu(); static void lcd_sdcard_menu();
#if ENABLED(DELTA) #if MECH(DELTA)
static void lcd_delta_calibrate_menu(); static void lcd_delta_calibrate_menu();
#elif DISABLED(DELTA) && DISABLED(Z_SAFE_HOMING) && Z_HOME_DIR < 0 #elif DISABLED(DELTA) && DISABLED(Z_SAFE_HOMING) && Z_HOME_DIR < 0
static void lcd_level_bed(); static void lcd_level_bed();
...@@ -338,12 +338,12 @@ static void lcd_status_screen() { ...@@ -338,12 +338,12 @@ static void lcd_status_screen() {
lcd_implementation_status_screen(); lcd_implementation_status_screen();
#if HAS_LCD_POWER_SENSOR #if HAS(LCD_POWER_SENSOR)
if (millis() > print_millis + 2000) print_millis = millis(); if (millis() > print_millis + 2000) print_millis = millis();
#endif #endif
#if HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR #if HAS(LCD_FILAMENT_SENSOR) || HAS(LCD_POWER_SENSOR)
#if HAS_LCD_FILAMENT_SENSOR && HAS_LCD_POWER_SENSOR #if HAS(LCD_FILAMENT_SENSOR) && HAS(LCD_POWER_SENSOR)
if (millis() > previous_lcd_status_ms + 15000) if (millis() > previous_lcd_status_ms + 15000)
#else #else
if (millis() > previous_lcd_status_ms + 10000) if (millis() > previous_lcd_status_ms + 10000)
...@@ -378,7 +378,7 @@ static void lcd_status_screen() { ...@@ -378,7 +378,7 @@ static void lcd_status_screen() {
currentMenu == lcd_status_screen currentMenu == lcd_status_screen
#endif #endif
); );
#if HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR #if HAS(LCD_FILAMENT_SENSOR) || HAS(LCD_POWER_SENSOR)
previous_lcd_status_ms = millis(); // get status message to show up for a while previous_lcd_status_ms = millis(); // get status message to show up for a while
#endif #endif
} }
...@@ -444,7 +444,7 @@ static void lcd_main_menu() { ...@@ -444,7 +444,7 @@ static void lcd_main_menu() {
} }
else { else {
MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu); MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu);
#if ENABLED(DELTA) #if MECH(DELTA)
MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu); MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu);
#endif // DELTA #endif // DELTA
} }
...@@ -529,7 +529,7 @@ void lcd_set_home_offsets() { ...@@ -529,7 +529,7 @@ void lcd_set_home_offsets() {
#endif // BABYSTEPPING #endif // BABYSTEPPING
static void lcd_tune_fixstep() { static void lcd_tune_fixstep() {
#if ENABLED(DELTA) #if MECH(DELTA)
enqueuecommands_P(PSTR("G28 B")); enqueuecommands_P(PSTR("G28 B"));
#else #else
enqueuecommands_P(PSTR("G28 X Y B")); enqueuecommands_P(PSTR("G28 X Y B"));
...@@ -592,7 +592,7 @@ static void lcd_tune_menu() { ...@@ -592,7 +592,7 @@ static void lcd_tune_menu() {
#if ENABLED(EASY_LOAD) #if ENABLED(EASY_LOAD)
static void lcd_extrude(float length, float feedrate) { static void lcd_extrude(float length, float feedrate) {
current_position[E_AXIS] += length; current_position[E_AXIS] += length;
#if ENABLED(DELTA) #if MECH(DELTA)
calculate_delta(current_position); calculate_delta(current_position);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], feedrate, active_extruder, active_driver); plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], feedrate, active_extruder, active_driver);
#else #else
...@@ -892,7 +892,7 @@ static void lcd_prepare_temperature_menu() { ...@@ -892,7 +892,7 @@ static void lcd_prepare_temperature_menu() {
END_MENU(); END_MENU();
} }
#if ENABLED(DELTA) #if MECH(DELTA)
static void lcd_delta_calibrate_menu() { static void lcd_delta_calibrate_menu() {
START_MENU(lcd_main_menu); START_MENU(lcd_main_menu);
...@@ -908,7 +908,7 @@ static void lcd_prepare_temperature_menu() { ...@@ -908,7 +908,7 @@ static void lcd_prepare_temperature_menu() {
#endif // DELTA #endif // DELTA
inline void line_to_current(float feedrate) { inline void line_to_current(float feedrate) {
#if ENABLED(DELTA) #if MECH(DELTA)
calculate_delta(current_position); calculate_delta(current_position);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder, active_driver); plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], feedrate/60, active_extruder, active_driver);
#else #else
...@@ -1015,7 +1015,7 @@ static void lcd_control_menu() { ...@@ -1015,7 +1015,7 @@ static void lcd_control_menu() {
MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu); MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
MENU_ITEM(submenu, MSG_FILAMENT, lcd_control_volumetric_menu); MENU_ITEM(submenu, MSG_FILAMENT, lcd_control_volumetric_menu);
#if ENABLED(HAS_LCD_CONTRAST) #if HAS(LCD_CONTRAST)
//MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63); //MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63);
MENU_ITEM(submenu, MSG_CONTRAST, lcd_set_contrast); MENU_ITEM(submenu, MSG_CONTRAST, lcd_set_contrast);
#endif #endif
...@@ -1026,7 +1026,7 @@ static void lcd_control_menu() { ...@@ -1026,7 +1026,7 @@ static void lcd_control_menu() {
// //
// Switch power on/off // Switch power on/off
// //
#if HAS_POWER_SWITCH #if HAS(POWER_SWITCH)
if (powersupply) if (powersupply)
MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81")); MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81"));
else else
...@@ -1059,7 +1059,7 @@ static void lcd_stats_menu() { ...@@ -1059,7 +1059,7 @@ static void lcd_stats_menu() {
int day = printer_usage_seconds / 60 / 60 / 24, hours = (printer_usage_seconds / 60 / 60) % 24, minutes = (printer_usage_seconds / 60) % 60; int day = printer_usage_seconds / 60 / 60 / 24, hours = (printer_usage_seconds / 60 / 60) % 24, minutes = (printer_usage_seconds / 60) % 60;
sprintf_P(row, PSTR(MSG_ONFOR " %id %ih %im"), day, hours, minutes); sprintf_P(row, PSTR(MSG_ONFOR " %id %ih %im"), day, hours, minutes);
LCD_Printpos(0, 0); lcd_print(row); LCD_Printpos(0, 0); lcd_print(row);
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS(POWER_CONSUMPTION_SENSOR)
sprintf_P(row, PSTR(MSG_PWRCONSUMED " %iWh"), power_consumption_hour); sprintf_P(row, PSTR(MSG_PWRCONSUMED " %iWh"), power_consumption_hour);
LCD_Printpos(0, 1); lcd_print(row); LCD_Printpos(0, 1); lcd_print(row);
#endif #endif
...@@ -1309,7 +1309,7 @@ static void lcd_control_motion_menu() { ...@@ -1309,7 +1309,7 @@ static void lcd_control_motion_menu() {
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &abort_on_endstop_hit); MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &abort_on_endstop_hit);
#endif #endif
#if ENABLED(SCARA) #if MECH(SCARA)
MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS],0.5,2); MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS],0.5,2);
MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS],0.5,2); MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS],0.5,2);
#endif #endif
...@@ -1348,7 +1348,7 @@ static void lcd_control_volumetric_menu() { ...@@ -1348,7 +1348,7 @@ static void lcd_control_volumetric_menu() {
* "Control" > "Contrast" submenu * "Control" > "Contrast" submenu
* *
*/ */
#if ENABLED(HAS_LCD_CONTRAST) #if HAS(LCD_CONTRAST)
static void lcd_set_contrast() { static void lcd_set_contrast() {
if (encoderPosition != 0) { if (encoderPosition != 0) {
#if ENABLED(U8GLIB_LM6059_AF) #if ENABLED(U8GLIB_LM6059_AF)
...@@ -1371,7 +1371,7 @@ static void lcd_control_volumetric_menu() { ...@@ -1371,7 +1371,7 @@ static void lcd_control_volumetric_menu() {
} }
if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu); if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu);
} }
#endif // HAS_LCD_CONTRAST #endif // HAS(LCD_CONTRAST)
/** /**
* *
...@@ -1829,7 +1829,7 @@ void lcd_update() { ...@@ -1829,7 +1829,7 @@ void lcd_update() {
(*currentMenu)(); (*currentMenu)();
#endif #endif
#if ENABLED(LCD_HAS_STATUS_INDICATORS) #if ENABLED(LCD_HAS_STATUS_INDICATORS))
lcd_implementation_update_indicators(); lcd_implementation_update_indicators();
#endif #endif
...@@ -1868,7 +1868,7 @@ void lcd_finishstatus(bool persist=false) { ...@@ -1868,7 +1868,7 @@ void lcd_finishstatus(bool persist=false) {
#endif #endif
lcdDrawUpdate = 2; lcdDrawUpdate = 2;
#if HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR #if HAS(LCD_FILAMENT_SENSOR) || HAS(LCD_POWER_SENSOR)
previous_lcd_status_ms = millis(); //get status message to show up for a while previous_lcd_status_ms = millis(); //get status message to show up for a while
#endif #endif
} }
...@@ -1914,7 +1914,7 @@ void lcd_setalertstatuspgm(const char* message) { ...@@ -1914,7 +1914,7 @@ void lcd_setalertstatuspgm(const char* message) {
void lcd_reset_alert_level() { lcd_status_message_level = 0; } void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#if ENABLED(HAS_LCD_CONTRAST) #if HAS(LCD_CONTRAST)
void lcd_setcontrast(uint8_t value) { void lcd_setcontrast(uint8_t value) {
lcd_contrast = value & 0x3F; lcd_contrast = value & 0x3F;
u8g.setContrast(lcd_contrast); u8g.setContrast(lcd_contrast);
...@@ -2432,15 +2432,15 @@ void setpageInfo() { ...@@ -2432,15 +2432,15 @@ void setpageInfo() {
PageInfo = true; PageInfo = true;
#if HAS_TEMP_0 #if HAS(TEMP_0)
Hend0.setPic(7); Hend0.setPic(7);
#endif #endif
#if HAS_TEMP_1 #if HAS(TEMP_1)
Hend1.setPic(7); Hend1.setPic(7);
#endif #endif
#if HAS_TEMP_1 #if HAS(TEMP_1)
Hend2.setPic(7); Hend2.setPic(7);
#elif HAS_TEMP_BED #elif HAS(TEMP_BED)
Hotend21.setText("BED"); Hotend21.setText("BED");
Hend2.setPic(8); Hend2.setPic(8);
#endif #endif
...@@ -2481,7 +2481,7 @@ void hotPopCallback(void *ptr) { ...@@ -2481,7 +2481,7 @@ void hotPopCallback(void *ptr) {
sendCommand("page 2"); sendCommand("page 2");
} }
#if HAS_TEMP_2 #if HAS(TEMP_2)
if (ptr == &hot2) { if (ptr == &hot2) {
if (degTargetHotend(2) != 0) { if (degTargetHotend(2) != 0) {
itoa(degTargetHotend(2), buffer, 10); itoa(degTargetHotend(2), buffer, 10);
...@@ -2489,7 +2489,7 @@ void hotPopCallback(void *ptr) { ...@@ -2489,7 +2489,7 @@ void hotPopCallback(void *ptr) {
set1.setText("M104 T2 S"); set1.setText("M104 T2 S");
sendCommand("page 2"); sendCommand("page 2");
} }
#elif HAS_TEMP_BED #elif HAS(TEMP_BED)
if (ptr == &hot2) { if (ptr == &hot2) {
if (degTargetBed() != 0) { if (degTargetBed() != 0) {
itoa(degTargetBed(), buffer, 10); itoa(degTargetBed(), buffer, 10);
...@@ -2549,13 +2549,13 @@ void lcd_init() { ...@@ -2549,13 +2549,13 @@ void lcd_init() {
} }
else { else {
ECHO_LM(DB, "Nextion LCD connected!"); ECHO_LM(DB, "Nextion LCD connected!");
#if HAS_TEMP_0 #if HAS(TEMP_0)
hot0.attachPop(hotPopCallback, &hot0); hot0.attachPop(hotPopCallback, &hot0);
#endif #endif
#if HAS_TEMP_1 #if HAS(TEMP_1)
hot1.attachPop(hotPopCallback, &hot1); hot1.attachPop(hotPopCallback, &hot1);
#endif #endif
#if HAS_TEMP_2 || HAS_TEMP_BED #if HAS(TEMP_2) || HAS(TEMP_BED)
hot2.attachPop(hotPopCallback, &hot2); hot2.attachPop(hotPopCallback, &hot2);
#endif #endif
Menu.attachPop(setpagePopCallback, &Menu); Menu.attachPop(setpagePopCallback, &Menu);
...@@ -2665,15 +2665,15 @@ void lcd_update() { ...@@ -2665,15 +2665,15 @@ void lcd_update() {
if (fanSpeed > 0) setFan(); if (fanSpeed > 0) setFan();
#if HAS_TEMP_0 #if HAS(TEMP_0)
temptoLCD(0, degHotend(0), degTargetHotend(0)); temptoLCD(0, degHotend(0), degTargetHotend(0));
#endif #endif
#if HAS_TEMP_1 #if HAS(TEMP_1)
temptoLCD(1, degHotend(1), degTargetHotend(1)); temptoLCD(1, degHotend(1), degTargetHotend(1));
#endif #endif
#if HAS_TEMP_2 #if HAS(TEMP_2)
temptoLCD(2, degHotend(2), degTargetHotend(2)); temptoLCD(2, degHotend(2), degTargetHotend(2));
#elif HAS_TEMP_BED #elif HAS(TEMP_BED)
temptoLCD(2, degBed(), degTargetBed()); temptoLCD(2, degBed(), degTargetBed());
#endif #endif
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
extern bool cancel_heatup; extern bool cancel_heatup;
#if HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR #if HAS(LCD_FILAMENT_SENSOR) || HAS(LCD_POWER_SENSOR)
extern millis_t previous_lcd_status_ms; extern millis_t previous_lcd_status_ms;
#endif #endif
void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#define EN_C BIT(BLEN_C) #define EN_C BIT(BLEN_C)
#endif #endif
#if HAS_BTN_BACK #if HAS(BTN_BACK)
#define BLEN_D 3 #define BLEN_D 3
#define EN_D BIT(BLEN_D) #define EN_D BIT(BLEN_D)
#endif #endif
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
#elif ENABLED(NEWPANEL) #elif ENABLED(NEWPANEL)
#define LCD_CLICKED (buttons&EN_C) #define LCD_CLICKED (buttons&EN_C)
#if HAS_BTN_BACK #if HAS(BTN_BACK)
#define LCD_BACK_CLICKED (buttons&EN_D) #define LCD_BACK_CLICKED (buttons&EN_D)
#endif #endif
...@@ -214,7 +214,7 @@ static void lcd_set_custom_characters( ...@@ -214,7 +214,7 @@ static void lcd_set_custom_characters(
bool progress_bar_set=true bool progress_bar_set=true
#endif #endif
) { ) {
#if ENABLED(DELTA) #if MECH(DELTA)
byte bedTemp[8] = byte bedTemp[8] =
{ {
B00000, B00000,
...@@ -613,7 +613,7 @@ static void lcd_implementation_status_screen() { ...@@ -613,7 +613,7 @@ static void lcd_implementation_status_screen() {
lcd.setCursor(LCD_WIDTH - 6, 2); lcd.setCursor(LCD_WIDTH - 6, 2);
if(print_job_start_ms != 0) { if(print_job_start_ms != 0) {
#if HAS_LCD_POWER_SENSOR #if HAS(LCD_POWER_SENSOR)
if (millis() < print_millis + 1000) { if (millis() < print_millis + 1000) {
lcd.print(LCD_STR_CLOCK[0]); lcd.print(LCD_STR_CLOCK[0]);
uint16_t time = millis()/60000 - print_job_start_ms/60000; uint16_t time = millis()/60000 - print_job_start_ms/60000;
...@@ -671,12 +671,12 @@ static void lcd_implementation_status_screen() { ...@@ -671,12 +671,12 @@ static void lcd_implementation_status_screen() {
#endif // ENABLED(LCD_PROGRESS_BAR) #endif // ENABLED(LCD_PROGRESS_BAR)
//Display both Status message line and Filament display on the last line //Display both Status message line and Filament display on the last line
#if HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR #if HAS(LCD_FILAMENT_SENSOR) || HAS(LCD_POWER_SENSOR)
if (millis() >= previous_lcd_status_ms + 5000) { if (millis() >= previous_lcd_status_ms + 5000) {
lcd_print(lcd_status_message); lcd_print(lcd_status_message);
} }
#if HAS_LCD_POWER_SENSOR #if HAS(LCD_POWER_SENSOR)
#if HAS_LCD_FILAMENT_SENSOR #if HAS(LCD_FILAMENT_SENSOR)
else if (millis() < message_millis + 10000) else if (millis() < message_millis + 10000)
#else #else
else else
...@@ -689,7 +689,7 @@ static void lcd_implementation_status_screen() { ...@@ -689,7 +689,7 @@ static void lcd_implementation_status_screen() {
lcd_printPGM(PSTR("Wh")); lcd_printPGM(PSTR("Wh"));
} }
#endif #endif
#if HAS_LCD_FILAMENT_SENSOR #if HAS(LCD_FILAMENT_SENSOR)
else { else {
lcd_printPGM(PSTR("Dia ")); lcd_printPGM(PSTR("Dia "));
lcd.print(ftostr12ns(filament_width_meas)); lcd.print(ftostr12ns(filament_width_meas));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment