1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-22 14:12:59 +02:00

Fix spindle enable pin logic

This commit is contained in:
bdring
2020-06-27 13:15:33 -05:00
parent 98559bab82
commit 04c75e4e22
3 changed files with 5 additions and 11 deletions

View File

@@ -94,10 +94,6 @@ uint32_t DacSpindle::set_rpm(uint32_t rpm) {
pwm_value = map_uint32_t(rpm, _min_rpm, _max_rpm, _pwm_min_value, _pwm_max_value);
}
if (_off_with_zero_speed) {
set_enable_pin(rpm != 0);
}
set_output(pwm_value);

View File

@@ -145,9 +145,6 @@ uint32_t PWMSpindle::set_rpm(uint32_t rpm) {
pwm_value = map_uint32_t(rpm, _min_rpm, _max_rpm, _pwm_min_value, _pwm_max_value);
}
if (_off_with_zero_speed)
set_enable_pin(rpm != 0);
set_output(pwm_value);
return 0;
@@ -165,7 +162,7 @@ void PWMSpindle::set_state(uint8_t state, uint32_t rpm) {
set_rpm(rpm);
}
set_enable_pin(state == SPINDLE_DISABLE);
set_enable_pin(state != SPINDLE_DISABLE);
sys.report_ovr_counter = 0; // Set to report change immediately
}
@@ -227,6 +224,10 @@ void PWMSpindle::set_output(uint32_t duty) {
void PWMSpindle::set_enable_pin(bool enable) {
if (_enable_pin == UNDEFINED_PIN)
return;
if (_off_with_zero_speed && sys.spindle_speed == 0)
enable = false;
#ifndef INVERT_SPINDLE_ENABLE_PIN
digitalWrite(_enable_pin, enable);
#else

View File

@@ -66,9 +66,6 @@ uint32_t RelaySpindle::set_rpm(uint32_t rpm) {
set_output(1);
}
if (_off_with_zero_speed)
set_enable_pin(rpm != 0);
return rpm;
}