1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-30 17:49:56 +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:
Mitch Bradley
2021-06-20 08:37:28 -10:00
parent 9c14b7742c
commit 36e1a960f3
3 changed files with 8 additions and 12 deletions

View File

@@ -89,14 +89,14 @@ Huanyang:
PWM:
tool:30
spinup_delay_ms: 20
spinup_ms: 200
spindown_ms: 500
speeds: 0=0% 5000=30% 10000=100%
output_pin: gpio.2
enable_pin: gpio.22
PWM:
tool:40
spinup_delay_ms: 0
speeds: 0=0% 10000=100%
output_pin: gpio.4
enable_pin: gpio.10

View File

@@ -193,10 +193,10 @@ namespace Spindles {
}
}
if (down) {
delay(_spindown_scaler * down >> 16);
delay(_spindown_ms * down / maxSpeed());
}
if (up) {
delay(_spinup_scaler * up >> 16);
delay(_spinup_ms * up / maxSpeed());
}
_current_state = state;
_current_speed = speed;

View File

@@ -81,11 +81,9 @@ namespace Spindles {
// scaler units are ms/rpm * 2^16.
// The computation is deltaRPM * scaler >> 16
uint32_t _spinup_scaler = 0;
uint32_t _spindown_scaler = 0;
uint32_t _spinup_ms = 0;
uint32_t _spindown_ms = 0;
// uint32_t _spinup_delay = 0;
// uint32_t _spindown_delay = 0;
int _tool = -1;
std::vector<Configuration::speedEntry> _speeds;
@@ -101,10 +99,8 @@ namespace Spindles {
virtual void afterParse() override;
void group(Configuration::HandlerBase& handler) override {
handler.item("spinup_scaler", _spinup_scaler);
handler.item("spindown_scaler", _spindown_scaler);
// handler.item("spinup_delay_ms", _spinup_delay);
// handler.item("spindown_delay_ms", _spindown_delay);
handler.item("spinup_ms", _spinup_ms);
handler.item("spindown_ms", _spindown_ms);
handler.item("tool", _tool);
handler.item("speeds", _speeds);
}