1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-23 14:44:13 +02:00

forgot to get rid of hard coded max_freq, fixed now

This commit is contained in:
me
2021-04-21 10:20:19 -07:00
parent 2d4af675e6
commit 91b3b9d037

View File

@@ -80,8 +80,8 @@ namespace Spindles {
if (speed < 0) { if (speed < 0) {
speed = 0; speed = 0;
} }
if (speed > 40000) { if (speed > max_freq) {
speed = 40000; speed = max_freq;
} }
data.msg[1] = 0x06; // WRITE data.msg[1] = 0x06; // WRITE
@@ -96,7 +96,8 @@ namespace Spindles {
} }
uint16_t L510::rpm_to_frequency(uint32_t rpm){ uint16_t L510::rpm_to_frequency(uint32_t rpm){
auto max_rpm = this->_max_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; return freq;
} }