Ported spindle enable pin + FEED_HOLD, CYCLE_START and DOOR_SWITCH pins
This commit is contained in:
parent
92b093ee43
commit
0721e573ef
@ -185,7 +185,7 @@
|
|||||||
// immediately forces a feed hold and then safely de-energizes the machine. Resuming is blocked until
|
// immediately forces a feed hold and then safely de-energizes the machine. Resuming is blocked until
|
||||||
// the safety door is re-engaged. When it is, Grbl will re-energize the machine and then resume on the
|
// the safety door is re-engaged. When it is, Grbl will re-energize the machine and then resume on the
|
||||||
// previous tool path, as if nothing happened.
|
// previous tool path, as if nothing happened.
|
||||||
// #define ENABLE_SAFETY_DOOR_INPUT_PIN // Default disabled. Uncomment to enable.
|
#define ENABLE_SAFETY_DOOR_INPUT_PIN // Default disabled. Uncomment to enable.
|
||||||
|
|
||||||
// After the safety door switch has been toggled and restored, this setting sets the power-up delay
|
// After the safety door switch has been toggled and restored, this setting sets the power-up delay
|
||||||
// between restoring the spindle and coolant and resuming the cycle.
|
// between restoring the spindle and coolant and resuming the cycle.
|
||||||
@ -199,7 +199,7 @@
|
|||||||
// defined at (http://corexy.com/theory.html). Motors are assumed to positioned and wired exactly as
|
// defined at (http://corexy.com/theory.html). Motors are assumed to positioned and wired exactly as
|
||||||
// described, if not, motions may move in strange directions. Grbl requires the CoreXY A and B motors
|
// described, if not, motions may move in strange directions. Grbl requires the CoreXY A and B motors
|
||||||
// have the same steps per mm internally.
|
// have the same steps per mm internally.
|
||||||
//#define COREXY // Default disabled. Uncomment to enable.
|
#define COREXY // Default disabled. Uncomment to enable.
|
||||||
|
|
||||||
// Inverts pin logic of the control command pins based on a mask. This essentially means you can use
|
// Inverts pin logic of the control command pins based on a mask. This essentially means you can use
|
||||||
// normally-closed switches on the specified pins, rather than the default normally-open switches.
|
// normally-closed switches on the specified pins, rather than the default normally-open switches.
|
||||||
@ -221,7 +221,7 @@
|
|||||||
// NOTE: If VARIABLE_SPINDLE is enabled(default), this option has no effect as the PWM output and
|
// NOTE: If VARIABLE_SPINDLE is enabled(default), this option has no effect as the PWM output and
|
||||||
// spindle enable are combined to one pin. If you need both this option and spindle speed PWM,
|
// spindle enable are combined to one pin. If you need both this option and spindle speed PWM,
|
||||||
// uncomment the config option USE_SPINDLE_DIR_AS_ENABLE_PIN below.
|
// uncomment the config option USE_SPINDLE_DIR_AS_ENABLE_PIN below.
|
||||||
// not ported #define INVERT_SPINDLE_ENABLE_PIN // Default disabled. Uncomment to enable.
|
#define INVERT_SPINDLE_ENABLE_PIN // Default disabled. Uncomment to enable.
|
||||||
|
|
||||||
// Inverts the selected coolant pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful
|
// Inverts the selected coolant pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful
|
||||||
// for some pre-built electronic boards.
|
// for some pre-built electronic boards.
|
||||||
@ -384,13 +384,13 @@
|
|||||||
|
|
||||||
// By default on a 328p(Uno), Grbl combines the variable spindle PWM and the enable into one pin to help
|
// By default on a 328p(Uno), Grbl combines the variable spindle PWM and the enable into one pin to help
|
||||||
// preserve I/O pins. For certain setups, these may need to be separate pins. This configure option uses
|
// preserve I/O pins. For certain setups, these may need to be separate pins. This configure option uses
|
||||||
// the spindle direction pin(D13) as a separate spindle enable pin along with spindle speed PWM on pin D11.
|
// the spindle direction pin (defined in cpu-map.h) as a separate spindle enable pin along with spindle speed PWM pin.
|
||||||
// NOTE: This configure option only works with VARIABLE_SPINDLE enabled and a 328p processor (Uno).
|
// NOTE: This configure option only works with VARIABLE_SPINDLE enabled.
|
||||||
// NOTE: Without a direction pin, M4 will not have a pin output to indicate a difference with M3.
|
// NOTE: Without a direction pin, M4 will not have a pin output to indicate a difference with M3.
|
||||||
// NOTE: BEWARE! The Arduino bootloader toggles the D13 pin when it powers up. If you flash Grbl with
|
// NOTE: BEWARE! The Arduino bootloader toggles the D13 pin when it powers up. If you flash Grbl with
|
||||||
// a programmer (you can use a spare Arduino as "Arduino as ISP". Search the web on how to wire this.),
|
// a programmer (you can use a spare Arduino as "Arduino as ISP". Search the web on how to wire this.),
|
||||||
// this D13 LED toggling should go away. We haven't tested this though. Please report how it goes!
|
// this D13 LED toggling should go away. We haven't tested this though. Please report how it goes!
|
||||||
// not ported #define USE_SPINDLE_DIR_AS_ENABLE_PIN // Default disabled. Uncomment to enable.
|
#define USE_SPINDLE_DIR_AS_ENABLE_PIN // Default disabled. Uncomment to enable.
|
||||||
|
|
||||||
// Alters the behavior of the spindle enable pin with the USE_SPINDLE_DIR_AS_ENABLE_PIN option . By default,
|
// Alters the behavior of the spindle enable pin with the USE_SPINDLE_DIR_AS_ENABLE_PIN option . By default,
|
||||||
// Grbl will not disable the enable pin if spindle speed is zero and M3/4 is active, but still sets the PWM
|
// Grbl will not disable the enable pin if spindle speed is zero and M3/4 is active, but still sets the PWM
|
||||||
|
@ -191,13 +191,25 @@
|
|||||||
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=25
|
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=25
|
||||||
#define Y_LIMIT_BIT 26 // Y-MIN=26, Y-MAX=27
|
#define Y_LIMIT_BIT 26 // Y-MIN=26, Y-MAX=27
|
||||||
#define Z_LIMIT_BIT 28 // Z-MIN=28, Z-MAX=29
|
#define Z_LIMIT_BIT 28 // Z-MIN=28, Z-MAX=29
|
||||||
#define A_LIMIT_BIT 29 // reuse p1.29
|
#define A_LIMIT_BIT 29 // reuse Z-MAX (P1.29)
|
||||||
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)|(1<<A_LIMIT_BIT)) // All limit bits
|
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)|(1<<A_LIMIT_BIT)) // All limit bits
|
||||||
|
|
||||||
|
// Define spindle enable and spindle direction output pins.
|
||||||
|
#define SPINDLE_ENABLE_DDR LPC_GPIO1->FIODIR
|
||||||
|
#define SPINDLE_ENABLE_PORT LPC_GPIO1->FIOPIN
|
||||||
|
#define SPINDLE_ENABLE_BIT 30 // P1.30
|
||||||
|
#define SPINDLE_DIRECTION_DDR LPC_GPIO1->FIODIR
|
||||||
|
#define SPINDLE_DIRECTION_PORT LPC_GPIO1->FIOPIN
|
||||||
|
#define SPINDLE_DIRECTION_BIT 31 // P1.31
|
||||||
|
|
||||||
// Define flood and mist coolant enable output pins.
|
// Define flood and mist coolant enable output pins.
|
||||||
#define COOLANT_FLOOD_DDR LPC_GPIO2->FIODIR
|
#define COOLANT_FLOOD_DDR LPC_GPIO2->FIODIR
|
||||||
#define COOLANT_FLOOD_PORT LPC_GPIO2->FIOPIN
|
#define COOLANT_FLOOD_PORT LPC_GPIO2->FIOPIN
|
||||||
#define COOLANT_FLOOD_BIT 4 // SMALL MOSFET Q8 (P2.4)
|
#ifndef SPINDLE_PWM_PIN_2_4
|
||||||
|
#define COOLANT_FLOOD_BIT 4 // SMALL MOSFET Q8 (P2.4)
|
||||||
|
#else
|
||||||
|
#define COOLANT_FLOOD_BIT 5 // SMALL MOSFET Q8 (P2.5)
|
||||||
|
#endif
|
||||||
#define COOLANT_MIST_DDR LPC_GPIO2->FIODIR
|
#define COOLANT_MIST_DDR LPC_GPIO2->FIODIR
|
||||||
#define COOLANT_MIST_PORT LPC_GPIO2->FIOPIN
|
#define COOLANT_MIST_PORT LPC_GPIO2->FIOPIN
|
||||||
#define COOLANT_MIST_BIT 6 // SMALL MOSFET Q9 (P2.6)
|
#define COOLANT_MIST_BIT 6 // SMALL MOSFET Q9 (P2.6)
|
||||||
@ -205,13 +217,13 @@
|
|||||||
|
|
||||||
// Define user-control controls (cycle start, reset, feed hold) input pins.
|
// Define user-control controls (cycle start, reset, feed hold) input pins.
|
||||||
// NOTE: All CONTROLs pins must be on the same port and not on a port with other input pins (limits).
|
// NOTE: All CONTROLs pins must be on the same port and not on a port with other input pins (limits).
|
||||||
#define CONTROL_DDR NotUsed
|
#define CONTROL_DDR LPC_GPIO1->FIODIR
|
||||||
#define CONTROL_PIN NotUsed
|
#define CONTROL_PIN LPC_GPIO1->FIOPIN
|
||||||
#define CONTROL_PORT NotUsed
|
#define CONTROL_PORT LPC_GPIO1->FIOPIN
|
||||||
#define CONTROL_RESET_BIT 0 // Uno Analog Pin 0
|
#define CONTROL_RESET_BIT NotUsed // Not needed as there is a special RESET pin on the Smoothiebaord
|
||||||
#define CONTROL_FEED_HOLD_BIT 1 // Uno Analog Pin 1
|
#define CONTROL_FEED_HOLD_BIT 22 // P1.22
|
||||||
#define CONTROL_CYCLE_START_BIT 2 // Uno Analog Pin 2
|
#define CONTROL_CYCLE_START_BIT 23 // P1.23
|
||||||
#define CONTROL_SAFETY_DOOR_BIT 1 // Uno Analog Pin 1 NOTE: Safety door is shared with feed hold. Enabled by config define.
|
#define CONTROL_SAFETY_DOOR_BIT 22 // P1.22 NOTE: Safety door is shared with feed hold. Enabled by config define.
|
||||||
#define CONTROL_INT PCIE1 // Pin change interrupt enable pin
|
#define CONTROL_INT PCIE1 // Pin change interrupt enable pin
|
||||||
#define CONTROL_INT_vect PCINT1_vect
|
#define CONTROL_INT_vect PCINT1_vect
|
||||||
#define CONTROL_PCMSK NotUsed // Pin change interrupt register
|
#define CONTROL_PCMSK NotUsed // Pin change interrupt register
|
||||||
@ -219,10 +231,10 @@
|
|||||||
#define CONTROL_INVERT_MASK CONTROL_MASK // May be re-defined to only invert certain control pins.
|
#define CONTROL_INVERT_MASK CONTROL_MASK // May be re-defined to only invert certain control pins.
|
||||||
|
|
||||||
// Define probe switch input pin.
|
// Define probe switch input pin.
|
||||||
#define PROBE_DDR NotUsed
|
#define PROBE_DDR LPC_GPIO2->FIODIR
|
||||||
#define PROBE_PIN NotUsed
|
#define PROBE_PIN LPC_GPIO2->FIOPIN
|
||||||
#define PROBE_PORT NotUsed
|
#define PROBE_PORT LPC_GPIO2->FIOPIN
|
||||||
#define PROBE_BIT 5 // Uno Analog Pin 5
|
#define PROBE_BIT 11 // P2.11
|
||||||
#define PROBE_MASK (1<<PROBE_BIT)
|
#define PROBE_MASK (1<<PROBE_BIT)
|
||||||
|
|
||||||
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
|
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
|
||||||
@ -509,6 +521,14 @@
|
|||||||
#define A_LIMIT_BIT 29 // reuse p1.29
|
#define A_LIMIT_BIT 29 // reuse p1.29
|
||||||
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)|(1<<A_LIMIT_BIT)) // All limit bits
|
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)|(1<<A_LIMIT_BIT)) // All limit bits
|
||||||
|
|
||||||
|
// Define spindle enable and spindle direction output pins.
|
||||||
|
#define SPINDLE_ENABLE_DDR LPC_GPIO1->FIODIR
|
||||||
|
#define SPINDLE_ENABLE_PORT LPC_GPIO1->FIOPIN
|
||||||
|
#define SPINDLE_ENABLE_BIT 30 // P1.30
|
||||||
|
#define SPINDLE_DIRECTION_DDR LPC_GPIO1->FIODIR
|
||||||
|
#define SPINDLE_DIRECTION_PORT LPC_GPIO1->FIOPIN
|
||||||
|
#define SPINDLE_DIRECTION_BIT 31 // P1.31
|
||||||
|
|
||||||
// Define flood and mist coolant enable output pins.
|
// Define flood and mist coolant enable output pins.
|
||||||
#define COOLANT_FLOOD_DDR LPC_GPIO2->FIODIR
|
#define COOLANT_FLOOD_DDR LPC_GPIO2->FIODIR
|
||||||
#define COOLANT_FLOOD_PORT LPC_GPIO2->FIOPIN
|
#define COOLANT_FLOOD_PORT LPC_GPIO2->FIOPIN
|
||||||
@ -520,13 +540,13 @@
|
|||||||
|
|
||||||
// Define user-control controls (cycle start, reset, feed hold) input pins.
|
// Define user-control controls (cycle start, reset, feed hold) input pins.
|
||||||
// NOTE: All CONTROLs pins must be on the same port and not on a port with other input pins (limits).
|
// NOTE: All CONTROLs pins must be on the same port and not on a port with other input pins (limits).
|
||||||
#define CONTROL_DDR NotUsed
|
#define CONTROL_DDR LPC_GPIO1->FIODIR
|
||||||
#define CONTROL_PIN NotUsed
|
#define CONTROL_PIN LPC_GPIO1->FIOPIN
|
||||||
#define CONTROL_PORT NotUsed
|
#define CONTROL_PORT LPC_GPIO1->FIOPIN
|
||||||
#define CONTROL_RESET_BIT 0 // Uno Analog Pin 0
|
#define CONTROL_RESET_BIT NotUsed // Not needed as there is a special RESET pin on the Smoothiebaord
|
||||||
#define CONTROL_FEED_HOLD_BIT 1 // Uno Analog Pin 1
|
#define CONTROL_FEED_HOLD_BIT 22 // P1.22
|
||||||
#define CONTROL_CYCLE_START_BIT 2 // Uno Analog Pin 2
|
#define CONTROL_CYCLE_START_BIT 23 // P1.23
|
||||||
#define CONTROL_SAFETY_DOOR_BIT 1 // Uno Analog Pin 1 NOTE: Safety door is shared with feed hold. Enabled by config define.
|
#define CONTROL_SAFETY_DOOR_BIT 22 // P1.22 NOTE: Safety door is shared with feed hold. Enabled by config define.
|
||||||
#define CONTROL_INT PCIE1 // Pin change interrupt enable pin
|
#define CONTROL_INT PCIE1 // Pin change interrupt enable pin
|
||||||
#define CONTROL_INT_vect PCINT1_vect
|
#define CONTROL_INT_vect PCINT1_vect
|
||||||
#define CONTROL_PCMSK NotUsed // Pin change interrupt register
|
#define CONTROL_PCMSK NotUsed // Pin change interrupt register
|
||||||
@ -534,10 +554,10 @@
|
|||||||
#define CONTROL_INVERT_MASK CONTROL_MASK // May be re-defined to only invert certain control pins.
|
#define CONTROL_INVERT_MASK CONTROL_MASK // May be re-defined to only invert certain control pins.
|
||||||
|
|
||||||
// Define probe switch input pin.
|
// Define probe switch input pin.
|
||||||
#define PROBE_DDR NotUsed
|
#define PROBE_DDR LPC_GPIO2->FIODIR
|
||||||
#define PROBE_PIN NotUsed
|
#define PROBE_PIN LPC_GPIO2->FIOPIN
|
||||||
#define PROBE_PORT NotUsed
|
#define PROBE_PORT LPC_GPIO2->FIOPIN
|
||||||
#define PROBE_BIT 5 // Uno Analog Pin 5
|
#define PROBE_BIT 11 // P2.11
|
||||||
#define PROBE_MASK (1<<PROBE_BIT)
|
#define PROBE_MASK (1<<PROBE_BIT)
|
||||||
|
|
||||||
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
|
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
|
||||||
|
@ -75,9 +75,11 @@
|
|||||||
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled"
|
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P)
|
#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P)
|
||||||
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"
|
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
#if !defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED)
|
#if !defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED)
|
||||||
#error "SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED may only be used with USE_SPINDLE_DIR_AS_ENABLE_PIN enabled"
|
#error "SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED may only be used with USE_SPINDLE_DIR_AS_ENABLE_PIN enabled"
|
||||||
|
@ -42,7 +42,6 @@ void spindle_init()
|
|||||||
pwm_init(&SPINDLE_PWM_CHANNEL, SPINDLE_PWM_USE_PRIMARY_PIN, SPINDLE_PWM_USE_SECONDARY_PIN, spindle_pwm_period, 0);
|
pwm_init(&SPINDLE_PWM_CHANNEL, SPINDLE_PWM_USE_PRIMARY_PIN, SPINDLE_PWM_USE_SECONDARY_PIN, spindle_pwm_period, 0);
|
||||||
pwm_enable(&SPINDLE_PWM_CHANNEL);
|
pwm_enable(&SPINDLE_PWM_CHANNEL);
|
||||||
|
|
||||||
/* not ported
|
|
||||||
// Configure variable spindle PWM and enable pin, if requried. On the Uno, PWM and enable are
|
// Configure variable spindle PWM and enable pin, if requried. On the Uno, PWM and enable are
|
||||||
// combined unless configured otherwise.
|
// combined unless configured otherwise.
|
||||||
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||||
@ -50,16 +49,13 @@ void spindle_init()
|
|||||||
#else
|
#else
|
||||||
SPINDLE_DIRECTION_DDR |= (1<<SPINDLE_DIRECTION_BIT); // Configure as output pin.
|
SPINDLE_DIRECTION_DDR |= (1<<SPINDLE_DIRECTION_BIT); // Configure as output pin.
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
|
|
||||||
pwm_gradient = (spindle_pwm_max_value-spindle_pwm_min_value)/(settings.rpm_max-settings.rpm_min);
|
pwm_gradient = (spindle_pwm_max_value-spindle_pwm_min_value)/(settings.rpm_max-settings.rpm_min);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* not ported
|
|
||||||
// Configure no variable spindle and only enable pin.
|
// Configure no variable spindle and only enable pin.
|
||||||
SPINDLE_ENABLE_DDR |= (1<<SPINDLE_ENABLE_BIT); // Configure as output pin.
|
SPINDLE_ENABLE_DDR |= (1<<SPINDLE_ENABLE_BIT); // Configure as output pin.
|
||||||
SPINDLE_DIRECTION_DDR |= (1<<SPINDLE_DIRECTION_BIT); // Configure as output pin.
|
SPINDLE_DIRECTION_DDR |= (1<<SPINDLE_DIRECTION_BIT); // Configure as output pin.
|
||||||
*/
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spindle_stop();
|
spindle_stop();
|
||||||
@ -68,32 +64,30 @@ void spindle_init()
|
|||||||
|
|
||||||
uint8_t spindle_get_state()
|
uint8_t spindle_get_state()
|
||||||
{
|
{
|
||||||
/* not ported
|
|
||||||
#ifdef VARIABLE_SPINDLE
|
#ifdef VARIABLE_SPINDLE
|
||||||
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||||
// No spindle direction output pin.
|
// No spindle direction output pin.
|
||||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||||
if (bit_isfalse(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) { return(SPINDLE_STATE_CW); }
|
if (bit_isfalse(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) { return(SPINDLE_STATE_CW); }
|
||||||
#else
|
#else
|
||||||
if (bit_istrue(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) { return(SPINDLE_STATE_CW); }
|
if (bit_istrue(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) { return(SPINDLE_STATE_CW); }
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
if (SPINDLE_TCCRA_REGISTER & (1<<SPINDLE_COMB_BIT)) { // Check if PWM is enabled.
|
if (SPINDLE_TCCRA_REGISTER & (1<<SPINDLE_COMB_BIT)) { // Check if PWM is enabled.
|
||||||
if (SPINDLE_DIRECTION_PORT & (1<<SPINDLE_DIRECTION_BIT)) { return(SPINDLE_STATE_CCW); }
|
if (SPINDLE_DIRECTION_PORT & (1<<SPINDLE_DIRECTION_BIT)) { return(SPINDLE_STATE_CCW); }
|
||||||
else { return(SPINDLE_STATE_CW); }
|
else { return(SPINDLE_STATE_CW); }
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||||
if (bit_isfalse(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) {
|
if (bit_isfalse(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) {
|
||||||
#else
|
#else
|
||||||
if (bit_istrue(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) {
|
if (bit_istrue(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) {
|
||||||
#endif
|
#endif
|
||||||
if (SPINDLE_DIRECTION_PORT & (1<<SPINDLE_DIRECTION_BIT)) { return(SPINDLE_STATE_CCW); }
|
if (SPINDLE_DIRECTION_PORT & (1<<SPINDLE_DIRECTION_BIT)) { return(SPINDLE_STATE_CCW); }
|
||||||
else { return(SPINDLE_STATE_CW); }
|
else { return(SPINDLE_STATE_CW); }
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
return(SPINDLE_STATE_DISABLE);
|
return(SPINDLE_STATE_DISABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,26 +97,22 @@ uint8_t spindle_get_state()
|
|||||||
// Called by spindle_init(), spindle_set_speed(), spindle_set_state(), and mc_reset().
|
// Called by spindle_init(), spindle_set_speed(), spindle_set_state(), and mc_reset().
|
||||||
void spindle_stop()
|
void spindle_stop()
|
||||||
{
|
{
|
||||||
#ifdef VARIABLE_SPINDLE
|
#ifdef VARIABLE_SPINDLE
|
||||||
pwm_set_width(&SPINDLE_PWM_CHANNEL, 0);
|
pwm_set_width(&SPINDLE_PWM_CHANNEL, 0);
|
||||||
/* not ported
|
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||||
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT); // Set pin to high
|
||||||
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT); // Set pin to high
|
#else
|
||||||
#else
|
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT); // Set pin to low
|
||||||
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT); // Set pin to low
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
#else
|
|
||||||
/* not ported
|
|
||||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
|
||||||
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT); // Set pin to high
|
|
||||||
#else
|
#else
|
||||||
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT); // Set pin to low
|
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||||
|
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT); // Set pin to high
|
||||||
|
#else
|
||||||
|
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT); // Set pin to low
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -183,13 +173,11 @@ void spindle_stop()
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
#ifndef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
#ifndef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||||
/* not ported
|
|
||||||
if (state == SPINDLE_ENABLE_CW) {
|
if (state == SPINDLE_ENABLE_CW) {
|
||||||
SPINDLE_DIRECTION_PORT &= ~(1<<SPINDLE_DIRECTION_BIT);
|
SPINDLE_DIRECTION_PORT &= ~(1<<SPINDLE_DIRECTION_BIT);
|
||||||
} else {
|
} else {
|
||||||
SPINDLE_DIRECTION_PORT |= (1<<SPINDLE_DIRECTION_BIT);
|
SPINDLE_DIRECTION_PORT |= (1<<SPINDLE_DIRECTION_BIT);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VARIABLE_SPINDLE
|
#ifdef VARIABLE_SPINDLE
|
||||||
@ -203,13 +191,11 @@ void spindle_stop()
|
|||||||
!defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED)) || !defined(VARIABLE_SPINDLE)
|
!defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED)) || !defined(VARIABLE_SPINDLE)
|
||||||
// NOTE: Without variable spindle, the enable bit should just turn on or off, regardless
|
// NOTE: Without variable spindle, the enable bit should just turn on or off, regardless
|
||||||
// if the spindle speed value is zero, as its ignored anyhow.
|
// if the spindle speed value is zero, as its ignored anyhow.
|
||||||
/* not ported
|
|
||||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||||
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT);
|
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT);
|
||||||
#else
|
#else
|
||||||
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT);
|
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT);
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user