Apply all changes from latest Marlin_V1
Diffed and merged, preserving my updates
This commit is contained in:
@ -29,7 +29,7 @@
|
||||
#include "language.h"
|
||||
#include "cardreader.h"
|
||||
#include "speed_lookuptable.h"
|
||||
#if DIGIPOTSS_PIN > -1
|
||||
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
|
||||
#include <SPI.h>
|
||||
#endif
|
||||
|
||||
@ -353,7 +353,7 @@ ISR(TIMER1_COMPA_vect)
|
||||
count_direction[X_AXIS]=-1;
|
||||
CHECK_ENDSTOPS
|
||||
{
|
||||
#if X_MIN_PIN > -1
|
||||
#if defined(X_MIN_PIN) && X_MIN_PIN > -1
|
||||
bool x_min_endstop=(READ(X_MIN_PIN) != X_ENDSTOPS_INVERTING);
|
||||
if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0)) {
|
||||
endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
|
||||
@ -372,7 +372,7 @@ ISR(TIMER1_COMPA_vect)
|
||||
count_direction[X_AXIS]=1;
|
||||
CHECK_ENDSTOPS
|
||||
{
|
||||
#if X_MAX_PIN > -1
|
||||
#if defined(X_MAX_PIN) && X_MAX_PIN > -1
|
||||
bool x_max_endstop=(READ(X_MAX_PIN) != X_ENDSTOPS_INVERTING);
|
||||
if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0)){
|
||||
endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
|
||||
@ -391,7 +391,7 @@ ISR(TIMER1_COMPA_vect)
|
||||
count_direction[Y_AXIS]=-1;
|
||||
CHECK_ENDSTOPS
|
||||
{
|
||||
#if Y_MIN_PIN > -1
|
||||
#if defined(Y_MIN_PIN) && Y_MIN_PIN > -1
|
||||
bool y_min_endstop=(READ(Y_MIN_PIN) != Y_ENDSTOPS_INVERTING);
|
||||
if(y_min_endstop && old_y_min_endstop && (current_block->steps_y > 0)) {
|
||||
endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
|
||||
@ -409,7 +409,7 @@ ISR(TIMER1_COMPA_vect)
|
||||
count_direction[Y_AXIS]=1;
|
||||
CHECK_ENDSTOPS
|
||||
{
|
||||
#if Y_MAX_PIN > -1
|
||||
#if defined(Y_MAX_PIN) && Y_MAX_PIN > -1
|
||||
bool y_max_endstop=(READ(Y_MAX_PIN) != Y_ENDSTOPS_INVERTING);
|
||||
if(y_max_endstop && old_y_max_endstop && (current_block->steps_y > 0)){
|
||||
endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
|
||||
@ -452,7 +452,7 @@ ISR(TIMER1_COMPA_vect)
|
||||
count_direction[Z_AXIS]=-1;
|
||||
CHECK_ENDSTOPS
|
||||
{
|
||||
#if Z_MIN_PIN > -1
|
||||
#if defined(Z_MIN_PIN) && Z_MIN_PIN > -1
|
||||
bool z_min_endstop=(READ(Z_MIN_PIN) != Z_ENDSTOPS_INVERTING);
|
||||
if(z_min_endstop && old_z_min_endstop && (current_block->steps_z > 0)) {
|
||||
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
|
||||
@ -473,7 +473,7 @@ ISR(TIMER1_COMPA_vect)
|
||||
count_direction[Z_AXIS]=1;
|
||||
CHECK_ENDSTOPS
|
||||
{
|
||||
#if Z_MAX_PIN > -1
|
||||
#if defined(Z_MAX_PIN) && Z_MAX_PIN > -1
|
||||
bool z_max_endstop=(READ(Z_MAX_PIN) != Z_ENDSTOPS_INVERTING);
|
||||
if(z_max_endstop && old_z_max_endstop && (current_block->steps_z > 0)) {
|
||||
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
|
||||
@ -743,20 +743,20 @@ void st_init()
|
||||
microstep_init(); //Initialize Microstepping Pins
|
||||
|
||||
//Initialize Dir Pins
|
||||
#if X_DIR_PIN > -1
|
||||
#if defined(X_DIR_PIN) && X_DIR_PIN > -1
|
||||
SET_OUTPUT(X_DIR_PIN);
|
||||
#endif
|
||||
#if Y_DIR_PIN > -1
|
||||
#if defined(Y_DIR_PIN) && Y_DIR_PIN > -1
|
||||
SET_OUTPUT(Y_DIR_PIN);
|
||||
#endif
|
||||
#if Z_DIR_PIN > -1
|
||||
#if defined(Z_DIR_PIN) && Z_DIR_PIN > -1
|
||||
SET_OUTPUT(Z_DIR_PIN);
|
||||
|
||||
#if defined(Z_DUAL_STEPPER_DRIVERS) && (Z2_DIR_PIN > -1)
|
||||
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_DIR_PIN) && (Z2_DIR_PIN > -1)
|
||||
SET_OUTPUT(Z2_DIR_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if E0_DIR_PIN > -1
|
||||
#if defined(E0_DIR_PIN) && E0_DIR_PIN > -1
|
||||
SET_OUTPUT(E0_DIR_PIN);
|
||||
#endif
|
||||
#if defined(E1_DIR_PIN) && (E1_DIR_PIN > -1)
|
||||
@ -768,24 +768,24 @@ void st_init()
|
||||
|
||||
//Initialize Enable Pins - steppers default to disabled.
|
||||
|
||||
#if (X_ENABLE_PIN > -1)
|
||||
#if defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1
|
||||
SET_OUTPUT(X_ENABLE_PIN);
|
||||
if(!X_ENABLE_ON) WRITE(X_ENABLE_PIN,HIGH);
|
||||
#endif
|
||||
#if (Y_ENABLE_PIN > -1)
|
||||
#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
|
||||
SET_OUTPUT(Y_ENABLE_PIN);
|
||||
if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH);
|
||||
#endif
|
||||
#if (Z_ENABLE_PIN > -1)
|
||||
#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
|
||||
SET_OUTPUT(Z_ENABLE_PIN);
|
||||
if(!Z_ENABLE_ON) WRITE(Z_ENABLE_PIN,HIGH);
|
||||
|
||||
#if defined(Z_DUAL_STEPPER_DRIVERS) && (Z2_ENABLE_PIN > -1)
|
||||
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_ENABLE_PIN) && (Z2_ENABLE_PIN > -1)
|
||||
SET_OUTPUT(Z2_ENABLE_PIN);
|
||||
if(!Z_ENABLE_ON) WRITE(Z2_ENABLE_PIN,HIGH);
|
||||
#endif
|
||||
#endif
|
||||
#if (E0_ENABLE_PIN > -1)
|
||||
#if defined(E0_ENABLE_PIN) && (E0_ENABLE_PIN > -1)
|
||||
SET_OUTPUT(E0_ENABLE_PIN);
|
||||
if(!E_ENABLE_ON) WRITE(E0_ENABLE_PIN,HIGH);
|
||||
#endif
|
||||
@ -800,42 +800,42 @@ void st_init()
|
||||
|
||||
//endstops and pullups
|
||||
|
||||
#if X_MIN_PIN > -1
|
||||
#if defined(X_MIN_PIN) && X_MIN_PIN > -1
|
||||
SET_INPUT(X_MIN_PIN);
|
||||
#ifdef ENDSTOPPULLUP_XMIN
|
||||
WRITE(X_MIN_PIN,HIGH);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if Y_MIN_PIN > -1
|
||||
#if defined(Y_MIN_PIN) && Y_MIN_PIN > -1
|
||||
SET_INPUT(Y_MIN_PIN);
|
||||
#ifdef ENDSTOPPULLUP_YMIN
|
||||
WRITE(Y_MIN_PIN,HIGH);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if Z_MIN_PIN > -1
|
||||
#if defined(Z_MIN_PIN) && Z_MIN_PIN > -1
|
||||
SET_INPUT(Z_MIN_PIN);
|
||||
#ifdef ENDSTOPPULLUP_ZMIN
|
||||
WRITE(Z_MIN_PIN,HIGH);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if X_MAX_PIN > -1
|
||||
#if defined(X_MAX_PIN) && X_MAX_PIN > -1
|
||||
SET_INPUT(X_MAX_PIN);
|
||||
#ifdef ENDSTOPPULLUP_XMAX
|
||||
WRITE(X_MAX_PIN,HIGH);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if Y_MAX_PIN > -1
|
||||
#if defined(Y_MAX_PIN) && Y_MAX_PIN > -1
|
||||
SET_INPUT(Y_MAX_PIN);
|
||||
#ifdef ENDSTOPPULLUP_YMAX
|
||||
WRITE(Y_MAX_PIN,HIGH);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if Z_MAX_PIN > -1
|
||||
#if defined(Z_MAX_PIN) && Z_MAX_PIN > -1
|
||||
SET_INPUT(Z_MAX_PIN);
|
||||
#ifdef ENDSTOPPULLUP_ZMAX
|
||||
WRITE(Z_MAX_PIN,HIGH);
|
||||
@ -844,26 +844,26 @@ void st_init()
|
||||
|
||||
|
||||
//Initialize Step Pins
|
||||
#if (X_STEP_PIN > -1)
|
||||
#if defined(X_STEP_PIN) && (X_STEP_PIN > -1)
|
||||
SET_OUTPUT(X_STEP_PIN);
|
||||
WRITE(X_STEP_PIN,INVERT_X_STEP_PIN);
|
||||
disable_x();
|
||||
#endif
|
||||
#if (Y_STEP_PIN > -1)
|
||||
#if defined(Y_STEP_PIN) && (Y_STEP_PIN > -1)
|
||||
SET_OUTPUT(Y_STEP_PIN);
|
||||
WRITE(Y_STEP_PIN,INVERT_Y_STEP_PIN);
|
||||
disable_y();
|
||||
#endif
|
||||
#if (Z_STEP_PIN > -1)
|
||||
#if defined(Z_STEP_PIN) && (Z_STEP_PIN > -1)
|
||||
SET_OUTPUT(Z_STEP_PIN);
|
||||
WRITE(Z_STEP_PIN,INVERT_Z_STEP_PIN);
|
||||
#if defined(Z_DUAL_STEPPER_DRIVERS) && (Z2_STEP_PIN > -1)
|
||||
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_STEP_PIN) && (Z2_STEP_PIN > -1)
|
||||
SET_OUTPUT(Z2_STEP_PIN);
|
||||
WRITE(Z2_STEP_PIN,INVERT_Z_STEP_PIN);
|
||||
#endif
|
||||
disable_z();
|
||||
#endif
|
||||
#if (E0_STEP_PIN > -1)
|
||||
#if defined(E0_STEP_PIN) && (E0_STEP_PIN > -1)
|
||||
SET_OUTPUT(E0_STEP_PIN);
|
||||
WRITE(E0_STEP_PIN,INVERT_E_STEP_PIN);
|
||||
disable_e0();
|
||||
@ -879,10 +879,6 @@ void st_init()
|
||||
disable_e2();
|
||||
#endif
|
||||
|
||||
#ifdef CONTROLLERFAN_PIN
|
||||
SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
|
||||
#endif
|
||||
|
||||
// waveform generation = 0100 = CTC
|
||||
TCCR1B &= ~(1<<WGM13);
|
||||
TCCR1B |= (1<<WGM12);
|
||||
@ -978,7 +974,7 @@ void quickStop()
|
||||
|
||||
void digitalPotWrite(int address, int value) // From Arduino DigitalPotControl example
|
||||
{
|
||||
#if DIGIPOTSS_PIN > -1
|
||||
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
|
||||
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(value);
|
||||
@ -989,7 +985,7 @@ void digitalPotWrite(int address, int value) // From Arduino DigitalPotControl e
|
||||
|
||||
void digipot_init() //Initialize Digipot Motor Current
|
||||
{
|
||||
#if DIGIPOTSS_PIN > -1
|
||||
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
|
||||
const uint8_t digipot_motor_current[] = DIGIPOT_MOTOR_CURRENT;
|
||||
|
||||
SPI.begin();
|
||||
@ -1002,7 +998,7 @@ void digipot_init() //Initialize Digipot Motor Current
|
||||
|
||||
void digipot_current(uint8_t driver, int current)
|
||||
{
|
||||
#if DIGIPOTSS_PIN > -1
|
||||
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
|
||||
const uint8_t digipot_ch[] = DIGIPOT_CHANNELS;
|
||||
digitalPotWrite(digipot_ch[driver], current);
|
||||
#endif
|
||||
@ -1010,7 +1006,7 @@ void digipot_current(uint8_t driver, int current)
|
||||
|
||||
void microstep_init()
|
||||
{
|
||||
#if X_MS1_PIN > -1
|
||||
#if defined(X_MS1_PIN) && X_MS1_PIN > -1
|
||||
const uint8_t microstep_modes[] = MICROSTEP_MODES;
|
||||
pinMode(X_MS2_PIN,OUTPUT);
|
||||
pinMode(Y_MS2_PIN,OUTPUT);
|
||||
|
Reference in New Issue
Block a user