For underflow detection, instead of using a signed value
Signed-off-by: Michel Pollet <buserror@gmail.com>
return;
if (value)
return;
- p->position += p->dir ? 1 : -1;
- if (p->position < 0)
- p->position = 0;
+ p->position += !p->dir && p->position == 0 ? 0 : p->dir ? 1 : -1;
if (p->endstop && p->position < p->endstop)
p->position = p->endstop;
if (p->max_position > 0 && p->position > p->max_position)
char name[32];
int enable : 1, dir : 1, trace : 1;
double steps_per_mm;
- int64_t position; // in steps
+ uint64_t position; // in steps
uint64_t max_position;
uint64_t endstop;
avr_cycle_count_t timer_period;