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.
This commit is contained in:
		| @@ -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> | ||||
|   | ||||
| @@ -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 | ||||
|     } | ||||
|   } | ||||
|  | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user