Please answer the following questions.
What version of the firmware are you using?
b7ee4265515757c82a732c4b19e3a976ffc39a56
Is the problem repeatable?
Yes
Under what conditions does the bug occur?
Using INVERTSPINDLEPWM, there is an intercept error in the characteristic of measured dutycycle vs requested dutycycle.
!Clip 058
The intercept should be zero.
The following changes fixes the problem, results in intercept of 2e-5 which is good.
“text
@@ -108,11 +108,12 @@ void spindlesetspeed(uint32t pwmvalue)
#else
if (pwm_value == 0) {
grblanalogWrite(SPINDLEPWMCHANNEL, (1<
}
else {
- grblanalogWrite(SPINDLEPWMCHANNEL, (1<
+//od grblanalogWrite(SPINDLEPWMCHANNEL, (1<
+ grblanalogWrite(SPINDLEPWMCHANNEL, (1<
}
#endif
#endif
“
In fact, the other branch of the if statement is redundant, and the code could be simplified.
评论 (5)
#2 – owenduffy 于 2019-10-15
YEs, but it simplifies to:
“C++
void spindlesetspeed(uint32t pwmvalue)
{
#ifndef SPINDLEPWMPIN
return;
#else
#ifndef SPINDLEENABLEOFFWITHZERO_SPEED
spindlesetenable(true);
#else
spindlesetenable(pwm_value != 0);
#endif
#ifndef INVERTSPINDLEPWM
grblanalogWrite(SPINDLEPWMCHANNEL, pwmvalue);
#else
grblanalogWrite(SPINDLEPWMCHANNEL, (1<
#endif
#endif
}
“
Ok?
#3 – bdring 于 2019-10-15
OK
#4 – owenduffy 于 2019-10-15
Apologies for not finding that in testing… I attributed the small error to the piecewise approximation. Fixing this improves cal at the low end.
Thanks again.
#5 – bdring 于 2019-10-15
merged to master
#1 – bdring 于 2019-10-15
Is this correct? I have trouble reading your code formatting.
“
C++void spindlesetspeed(uint32t pwmvalue)
{
#ifndef SPINDLEPWMPIN
return;
#else
#ifndef SPINDLEENABLEOFFWITHZERO_SPEED
spindlesetenable(true);
#else
spindlesetenable(pwm_value != 0);
#endif
#ifndef INVERTSPINDLEPWMPWMBITPRECISION));PWMBITPRECISION) - pwm_value);
grblanalogWrite(SPINDLEPWMCHANNEL, pwmvalue);
#else
if (pwm_value == 0) {
grblanalogWrite(SPINDLEPWMCHANNEL, (1<
}
else {
grblanalogWrite(SPINDLEPWMCHANNEL, (1<
}
#endif
#endif
}
“