phord/Teacup_Firmware — comment on commit 522b863ee80254b7870835856f2cd4748522ee52
File:  line 0
By Traumflug:

What do you think of this patch to handle E overflows?

--- a/dda.c
+++ b/dda.c
@@ -243,7 +243,12 @@ void dda_create(DDA *dda, TARGET *target) {
dda->x_direction = (target->X >= startpoint.X)?1:0;
dda->y_direction = (target->Y >= startpoint.Y)?1:0;
dda->z_direction = (target->Z >= startpoint.Z)?1:0;
- dda->e_direction = (target->E >= startpoint.E)?1:0;
+ if (e_delta_um < 1000000) {
+ dda->e_direction = (target->E >= startpoint.E)?1:0;
+ } else
+ dda->e_direction = (target->E >= startpoint.E)?0:1;
+ e_delta_um += 0xFFFFFFFF;
+ }

if (DEBUG_DDA && (debug_flags & DEBUG_DDA))
sersendf_P(PSTR("%ld,%ld,%ld,%ld] ["), target->X - startpoint.X,