Spindle speed close to minimum fix.
- When spindle speed is close to the minimum rpm, the PWM value would be zero or lower than allowed. The computation error was caused by setting the minimum PWM value to zero, when it should have been 1. - Added a compiler check for minimum PWM to be greater than zero. - Moved some of the spindle PWM macros to a more appropriate place in the cpu_map.h.
This commit is contained in:
@ -125,7 +125,13 @@
|
||||
// Variable spindle configuration below. Do not change unless you know what you are doing.
|
||||
// NOTE: Only used when variable spindle is enabled.
|
||||
#define SPINDLE_PWM_MAX_VALUE 255 // Don't change. 328p fast PWM mode fixes top value as 255.
|
||||
#ifdef SPINDLE_MINIMUM_PWM
|
||||
#define SPINDLE_PWM_MIN_VALUE SPINDLE_MINIMUM_PWM
|
||||
#else
|
||||
#define SPINDLE_PWM_MIN_VALUE 1 // Must be greater than zero.
|
||||
#endif
|
||||
#define SPINDLE_PWM_OFF_VALUE 0
|
||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
||||
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
||||
#define SPINDLE_OCR_REGISTER OCR2A
|
||||
|
Reference in New Issue
Block a user