1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-22 14:12:59 +02:00

fixes for RPM

This commit is contained in:
Jesse Schoch
2021-07-31 15:13:37 -07:00
parent f1b56a7a00
commit b2d4ad2c65

View File

@@ -29,10 +29,9 @@ namespace Spindles {
_baudrate = 9600;
_parity = Uart::Parity::None;
// TODO: should defaults be set here? What happens if the motor settings in the VFD are wrong or default?
/*
_max_rpm = 24000;
_min_rpm = 6000;
_max_freq = 40000;
*/
}
void L510::direction_command(SpindleState mode, ModbusCommand& data) {
@@ -104,6 +103,10 @@ namespace Spindles {
auto max_rpm = this->_max_rpm;
auto max_freq = this->_max_freq;
uint32_t rpm = (freq*max_rpm)/max_freq;
if(rpm < 0){
// sometimes it returns -1 which causes an alarm
rpm = 0;
}
return rpm;
}