1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-01 18:32:37 +02:00

WIP PWM Spindle

This commit is contained in:
bdring
2021-06-14 09:46:51 -05:00
parent db0ee2726a
commit d0370c4fa9
2 changed files with 19 additions and 11 deletions

View File

@@ -84,10 +84,16 @@ probe:
pin: gpio.32:low:pu
PWM:
min_rpm: 200
max_rpm: 1000
pwm_freq: 5000
pwm_off: 0.000
pwm_min: 20.000
pwm_max: 100.000
invert_pwm: true
output_pin: gpio.2
enable_pin: gpio.22
pwm_off: 0.0
pwm_min: 0.0
pwm_max: 100.0
min_rpm: 0
max_rpm: 1000
direction_pin: gpio.21
enable_off_with_zero_speed: true
spinup_delay_ms: 2000
spindown_delay_ms: 1000

View File

@@ -100,19 +100,21 @@ namespace Spindles {
return; // Block during abort.
}
int32_t delayMillis;
if (state == SpindleState::Disable) { // Halt or set spindle direction and rpm.
sys.spindle_speed = 0;
stop();
if (use_delays && (_current_state != state)) {
delay(_spindown_delay);
}
delayMillis = _spindown_delay;
} else {
set_direction(state == SpindleState::Cw);
set_rpm(rpm);
set_enable(state != SpindleState::Disable); // must be done after setting rpm for enable features to work
if (use_delays && (_current_state != state)) {
delay(_spinup_delay);
}
delayMillis = _spinup_delay;
}
if (_current_state != state && use_delays) {
delay(delayMillis);
}
_current_state = state;