Applied master branch bug fixes.

- Planner was under-estimating maximum speeds through straight
junctions in certain cases. The calculations have been updated to be
more accurate.

- Strange sizeof() bug in the most recent releases. Manifested as an
alarm upon a power up even when homing was disabled. Fixed by declaring
sizeof() with struct types, rather than variable names, even though
they were validated to give the same value.

- Spindle speed zero should disable the spindle. Now fixed.

- New configuration option for inverting certain limit pins. Handy for
mixed NO and NC switch machines. See config.h for details.
This commit is contained in:
Sonny Jeon
2016-03-04 13:39:29 -07:00
parent 5eee10845b
commit 111d28dc9a
9 changed files with 79 additions and 36 deletions

View File

@ -200,7 +200,7 @@ static void planner_recalculate()
void plan_reset()
{
memset(&pl, 0, sizeof(pl)); // Clear planner struct
memset(&pl, 0, sizeof(planner_t)); // Clear planner struct
block_buffer_tail = 0;
block_buffer_head = 0; // Empty = tail
next_buffer_head = 1; // plan_next_block_index(block_buffer_head)
@ -394,11 +394,11 @@ uint8_t plan_check_full_buffer()
change the overall maximum entry speed conditions of all blocks.
*/
// NOTE: Computed without any expensive trig, sin() or acos(), by trig half angle identity of cos(theta).
if (junction_cos_theta > 0.99) {
if (junction_cos_theta > 0.999999) {
// For a 0 degree acute junction, just set minimum junction speed.
block->max_junction_speed_sqr = MINIMUM_JUNCTION_SPEED*MINIMUM_JUNCTION_SPEED;
} else {
junction_cos_theta = max(junction_cos_theta,-0.99); // Check for numerical round-off to avoid divide by zero.
junction_cos_theta = max(junction_cos_theta,-0.999999); // Check for numerical round-off to avoid divide by zero.
float sin_theta_d2 = sqrt(0.5*(1.0-junction_cos_theta)); // Trig half angle identity. Always positive.
// TODO: Technically, the acceleration used in calculation needs to be limited by the minimum of the