nanoels
nanoels copied to clipboard
Carriage stops moving
Sometimes the carriage stops moving. Auto modes no starting (shows "step 0"). Manual moves not starting too. It just start humming by stepper, but no move. I'm using "need rest" option, so steppers disabled at idle.
Hard to tell how to reproduce. Like make some moves, and then keep system powered on for long time (1hr 11 min, i guess :) without steppers activity).
I think it's here it not overflow-proof. Not sure, tho, is it only my branch affected, or the main too.
in the void moveAxis(Axis* a)
my branch:
...
unsigned long nowUs = micros();
float delayUs = 1000000.0 / a->speed;
if ((nowUs - a->stepStartUs < delayUs - 5)||
((a->posByDRO && a->backlashByDRO && a->needsDROBacklashCompensation) &&
(a->stepStartUs + DRO_READ_PERIOD_MS * 1000 > nowUs)) ){
// Not enough time has passed to issue this step.
return;
}
...
main:
...
unsigned long nowUs = micros();
float delayUs = 1000000.0 / a->speed;
if (nowUs - a->stepStartUs < delayUs - 5) {
// Not enough time has passed to issue this step.
return;
}
...
micros() rotating aroung 1hr 11min, so if last 'stepStartUs' taken too long ago, it can became significantly bigger then 'nowUs'. I suppose both branches may be affected, but I'm not very good in the overflow handle programmin. If it only mine, I'll be glad to have some advices how to fix.