mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-01 18:32:37 +02:00
Fixed proportional spin delays
The names are now spinup_ms and spindown_ms. The units are milliseconds, reflecting the time necessary for a change from 0 to full speed and vice versa. The actual delay is proportional, depending on how much the speed changes.
This commit is contained in:
@@ -89,14 +89,14 @@ Huanyang:
|
|||||||
|
|
||||||
PWM:
|
PWM:
|
||||||
tool:30
|
tool:30
|
||||||
spinup_delay_ms: 20
|
spinup_ms: 200
|
||||||
|
spindown_ms: 500
|
||||||
speeds: 0=0% 5000=30% 10000=100%
|
speeds: 0=0% 5000=30% 10000=100%
|
||||||
output_pin: gpio.2
|
output_pin: gpio.2
|
||||||
enable_pin: gpio.22
|
enable_pin: gpio.22
|
||||||
|
|
||||||
PWM:
|
PWM:
|
||||||
tool:40
|
tool:40
|
||||||
spinup_delay_ms: 0
|
|
||||||
speeds: 0=0% 10000=100%
|
speeds: 0=0% 10000=100%
|
||||||
output_pin: gpio.4
|
output_pin: gpio.4
|
||||||
enable_pin: gpio.10
|
enable_pin: gpio.10
|
||||||
|
@@ -193,10 +193,10 @@ namespace Spindles {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (down) {
|
if (down) {
|
||||||
delay(_spindown_scaler * down >> 16);
|
delay(_spindown_ms * down / maxSpeed());
|
||||||
}
|
}
|
||||||
if (up) {
|
if (up) {
|
||||||
delay(_spinup_scaler * up >> 16);
|
delay(_spinup_ms * up / maxSpeed());
|
||||||
}
|
}
|
||||||
_current_state = state;
|
_current_state = state;
|
||||||
_current_speed = speed;
|
_current_speed = speed;
|
||||||
|
@@ -81,11 +81,9 @@ namespace Spindles {
|
|||||||
|
|
||||||
// scaler units are ms/rpm * 2^16.
|
// scaler units are ms/rpm * 2^16.
|
||||||
// The computation is deltaRPM * scaler >> 16
|
// The computation is deltaRPM * scaler >> 16
|
||||||
uint32_t _spinup_scaler = 0;
|
uint32_t _spinup_ms = 0;
|
||||||
uint32_t _spindown_scaler = 0;
|
uint32_t _spindown_ms = 0;
|
||||||
|
|
||||||
// uint32_t _spinup_delay = 0;
|
|
||||||
// uint32_t _spindown_delay = 0;
|
|
||||||
int _tool = -1;
|
int _tool = -1;
|
||||||
|
|
||||||
std::vector<Configuration::speedEntry> _speeds;
|
std::vector<Configuration::speedEntry> _speeds;
|
||||||
@@ -101,10 +99,8 @@ namespace Spindles {
|
|||||||
virtual void afterParse() override;
|
virtual void afterParse() override;
|
||||||
|
|
||||||
void group(Configuration::HandlerBase& handler) override {
|
void group(Configuration::HandlerBase& handler) override {
|
||||||
handler.item("spinup_scaler", _spinup_scaler);
|
handler.item("spinup_ms", _spinup_ms);
|
||||||
handler.item("spindown_scaler", _spindown_scaler);
|
handler.item("spindown_ms", _spindown_ms);
|
||||||
// handler.item("spinup_delay_ms", _spinup_delay);
|
|
||||||
// handler.item("spindown_delay_ms", _spindown_delay);
|
|
||||||
handler.item("tool", _tool);
|
handler.item("tool", _tool);
|
||||||
handler.item("speeds", _speeds);
|
handler.item("speeds", _speeds);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user