We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b4da04f + b219c64 commit bcd5732Copy full SHA for bcd5732
1 file changed
uCNC/src/modules/encoder.c
@@ -22,6 +22,12 @@
22
23
#if ENCODERS > 0
24
25
+#ifndef MIN_ENC_RPM
26
+#define MIN_ENC_RPM 1
27
+#endif
28
+
29
+#define MIN_ENC_RPM_FACTOR (60000000UL / MIN_ENC_RPM)
30
31
static int32_t encoders_pos[ENCODERS];
32
static uint32_t encoders_tstamp[ENCODERS][2];
33
@@ -451,7 +457,7 @@ uint16_t encoder_get_rpm(uint8_t i)
451
457
}
452
458
453
459
uint32_t delta = (t0 - t1);
454
- uint32_t max_elapsed = 60000000UL/g_settings.encoders_resolution[i];
460
+ uint32_t max_elapsed = MIN_ENC_RPM_FACTOR/g_settings.encoders_resolution[i];
455
461
456
462
if (!delta || (t_now - t0) > max_elapsed)
463
{
0 commit comments