mirror of
				https://github.com/Klipper3d/klipper.git
				synced 2025-11-03 20:05:49 +01:00 
			
		
		
		
	trapq: Fix bug that broke numerical stability workaround for initial movement
Commit b60804bb changed the trapq head sentinel to store
print_time=-1.  However, it failed to update trapq_add_move() that
relied on that value to detect the head sentinel.  As a result,
numerical stability issues could lead to stepcompress errors.
Fix by changing trapq_add_move() to detect the head sentinel even with
a negative print_time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
			
			
This commit is contained in:
		@@ -104,7 +104,7 @@ trapq_add_move(struct trapq *tq, struct move *m)
 | 
				
			|||||||
        // Add a null move to fill time gap
 | 
					        // Add a null move to fill time gap
 | 
				
			||||||
        struct move *null_move = move_alloc();
 | 
					        struct move *null_move = move_alloc();
 | 
				
			||||||
        null_move->start_pos = m->start_pos;
 | 
					        null_move->start_pos = m->start_pos;
 | 
				
			||||||
        if (!prev->print_time && m->print_time > MAX_NULL_MOVE)
 | 
					        if (prev->print_time <= 0. && m->print_time > MAX_NULL_MOVE)
 | 
				
			||||||
            // Limit the first null move to improve numerical stability
 | 
					            // Limit the first null move to improve numerical stability
 | 
				
			||||||
            null_move->print_time = m->print_time - MAX_NULL_MOVE;
 | 
					            null_move->print_time = m->print_time - MAX_NULL_MOVE;
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user