From 91b3b9d037896ed99d19f7906a7b0696ab754c28 Mon Sep 17 00:00:00 2001 From: me Date: Wed, 21 Apr 2021 10:20:19 -0700 Subject: [PATCH] forgot to get rid of hard coded max_freq, fixed now --- Grbl_Esp32/src/Spindles/TecoL510.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Grbl_Esp32/src/Spindles/TecoL510.cpp b/Grbl_Esp32/src/Spindles/TecoL510.cpp index 75d67f0b..0a8799d3 100644 --- a/Grbl_Esp32/src/Spindles/TecoL510.cpp +++ b/Grbl_Esp32/src/Spindles/TecoL510.cpp @@ -80,8 +80,8 @@ namespace Spindles { if (speed < 0) { speed = 0; } - if (speed > 40000) { - speed = 40000; + if (speed > max_freq) { + speed = max_freq; } data.msg[1] = 0x06; // WRITE @@ -96,7 +96,8 @@ namespace Spindles { } uint16_t L510::rpm_to_frequency(uint32_t rpm){ auto max_rpm = this->_max_rpm; - uint16_t freq = (uint32_t(rpm) * 40000L) / uint32_t(max_rpm); + auto max_freq = this->_max_freq; + uint16_t freq = (uint32_t(rpm) * max_freq) / uint32_t(max_rpm); return freq; }