1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-23 22:52:58 +02:00

changed 'speed' to 'freq'

This commit is contained in:
me
2021-04-21 10:38:27 -07:00
parent 91b3b9d037
commit bc1d70f36d

View File

@@ -76,19 +76,19 @@ namespace Spindles {
// Assuming max frequncy is 400Hz // Assuming max frequncy is 400Hz
// Speed is in [0..40,000] // Speed is in [0..40,000]
uint16_t speed = (uint16_t(rpm) * max_freq) / uint32_t(max_rpm); uint16_t freq = (uint16_t(rpm) * max_freq) / uint32_t(max_rpm);
if (speed < 0) { if (freq < 0) {
speed = 0; freq = 0;
} }
if (speed > max_freq) { if (freq > max_freq) {
speed = max_freq; freq = max_freq;
} }
data.msg[1] = 0x06; // WRITE data.msg[1] = 0x06; // WRITE
data.msg[2] = 0x25; // Command ID 0x2502 data.msg[2] = 0x25; // Command ID 0x2502
data.msg[3] = 0x02; data.msg[3] = 0x02;
data.msg[4] = uint8_t(speed >> 8); // RPM data.msg[4] = uint8_t(freq >> 8); // RPM
data.msg[5] = uint8_t(speed & 0xFF); data.msg[5] = uint8_t(freq & 0xFF);
#ifdef VFD_DEBUG_MODE2 #ifdef VFD_DEBUG_MODE2
grbl_msg_sendf(CLIENT_SERIAL,MsgLevel::Info,"setting speed to: %d",speed); grbl_msg_sendf(CLIENT_SERIAL,MsgLevel::Info,"setting speed to: %d",speed);