Skip to content

Commit

Permalink
Spindle enable pin with variable spindle option fix.
Browse files Browse the repository at this point in the history
- [fix] When USE_SPINDLE_DIR_AS_ENABLE_PIN is enabled in config.h, the
enable pin was not being set when spindle speed is zero. This behavior
should now be fixed.
  • Loading branch information
chamnit committed Jan 3, 2017
1 parent 864d130 commit 30c0f79
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
14 changes: 14 additions & 0 deletions doc/log/commit_log_v1.1.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
----------------
Date: 2016-12-19
Author: Sonny Jeon
Subject: Fixed homing fail alarm handling. Re-integrated software debouncing.

- [bug] Fixed a homing fail issue, where the alarm was not being set
right, not cleared correctly. It would report the wrong code and enter
an infinite alarm loop. This was due to how alarm codes were altered a
while back. Now updated and fixed to show the right codes.

- [feature] Re-installed optional software debouncing for hard limit
switches. By request.


----------------
Date: 2016-12-18
Author: Sonny Jeon
Expand Down
2 changes: 1 addition & 1 deletion grbl/grbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

// Grbl versioning system
#define GRBL_VERSION "1.1e"
#define GRBL_VERSION_BUILD "20161219"
#define GRBL_VERSION_BUILD "20170103"

// Define standard libraries used by Grbl.
#include <avr/io.h>
Expand Down
15 changes: 4 additions & 11 deletions grbl/spindle_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,11 @@ void spindle_stop()
// and stepper ISR. Keep routine small and efficient.
void spindle_set_speed(uint8_t pwm_value)
{
SPINDLE_OCR_REGISTER = pwm_value; // Set PWM output level.
if (pwm_value == SPINDLE_PWM_OFF_VALUE) {
spindle_stop();
SPINDLE_TCCRA_REGISTER &= ~(1<<SPINDLE_COMB_BIT); // Disable PWM. Output voltage is zero.
} else {
SPINDLE_OCR_REGISTER = pwm_value; // Set PWM output level.
SPINDLE_TCCRA_REGISTER |= (1<<SPINDLE_COMB_BIT); // Ensure PWM output is enabled.

#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN)
#ifdef INVERT_SPINDLE_ENABLE_PIN
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT);
#else
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT);
#endif
#endif
}
}

Expand Down Expand Up @@ -194,7 +186,8 @@ void spindle_stop()
if (state == SPINDLE_ENABLE_CCW) { rpm = 0.0; } // TODO: May need to be rpm_min*(100/MAX_SPINDLE_SPEED_OVERRIDE);
}
spindle_set_speed(spindle_compute_pwm_value(rpm));
#else
#endif
#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) || !defined(VARIABLE_SPINDLE)
// 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.
#ifdef INVERT_SPINDLE_ENABLE_PIN
Expand Down

0 comments on commit 30c0f79

Please sign in to comment.