Skip to content

Commit 30c0f79

Browse files
committed
Spindle enable pin with variable spindle option fix.
- [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.
1 parent 864d130 commit 30c0f79

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

doc/log/commit_log_v1.1.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
----------------
2+
Date: 2016-12-19
3+
Author: Sonny Jeon
4+
Subject: Fixed homing fail alarm handling. Re-integrated software debouncing.
5+
6+
- [bug] Fixed a homing fail issue, where the alarm was not being set
7+
right, not cleared correctly. It would report the wrong code and enter
8+
an infinite alarm loop. This was due to how alarm codes were altered a
9+
while back. Now updated and fixed to show the right codes.
10+
11+
- [feature] Re-installed optional software debouncing for hard limit
12+
switches. By request.
13+
14+
115
----------------
216
Date: 2016-12-18
317
Author: Sonny Jeon

grbl/grbl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
// Grbl versioning system
2525
#define GRBL_VERSION "1.1e"
26-
#define GRBL_VERSION_BUILD "20161219"
26+
#define GRBL_VERSION_BUILD "20170103"
2727

2828
// Define standard libraries used by Grbl.
2929
#include <avr/io.h>

grbl/spindle_control.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,11 @@ void spindle_stop()
115115
// and stepper ISR. Keep routine small and efficient.
116116
void spindle_set_speed(uint8_t pwm_value)
117117
{
118+
SPINDLE_OCR_REGISTER = pwm_value; // Set PWM output level.
118119
if (pwm_value == SPINDLE_PWM_OFF_VALUE) {
119-
spindle_stop();
120+
SPINDLE_TCCRA_REGISTER &= ~(1<<SPINDLE_COMB_BIT); // Disable PWM. Output voltage is zero.
120121
} else {
121-
SPINDLE_OCR_REGISTER = pwm_value; // Set PWM output level.
122122
SPINDLE_TCCRA_REGISTER |= (1<<SPINDLE_COMB_BIT); // Ensure PWM output is enabled.
123-
124-
#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN)
125-
#ifdef INVERT_SPINDLE_ENABLE_PIN
126-
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT);
127-
#else
128-
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT);
129-
#endif
130-
#endif
131123
}
132124
}
133125

@@ -194,7 +186,8 @@ void spindle_stop()
194186
if (state == SPINDLE_ENABLE_CCW) { rpm = 0.0; } // TODO: May need to be rpm_min*(100/MAX_SPINDLE_SPEED_OVERRIDE);
195187
}
196188
spindle_set_speed(spindle_compute_pwm_value(rpm));
197-
#else
189+
#endif
190+
#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) || !defined(VARIABLE_SPINDLE)
198191
// NOTE: Without variable spindle, the enable bit should just turn on or off, regardless
199192
// if the spindle speed value is zero, as its ignored anyhow.
200193
#ifdef INVERT_SPINDLE_ENABLE_PIN

0 commit comments

Comments
 (0)