Fixed crashes.

This commit is contained in:
Erik van der Zalm 2011-10-18 19:13:30 +02:00
parent 27664c6da6
commit 0b1423c303

View file

@ -33,7 +33,7 @@
#include "Marlin.h"
#include "speed_lookuptable.h"
char version_string[] = "0.9.9";
char version_string[] = "0.9.10";
#ifdef SDSUPPORT
#include "SdFat.h"
@ -1286,19 +1286,17 @@ void planner_reverse_pass_kernel(block_t *previous, block_t *current, block_t *n
// implements the reverse pass.
void planner_reverse_pass() {
char block_index = block_buffer_head;
block_t *block[3] = {
NULL, NULL, NULL };
block_index--;
block_t *block[3] = { NULL, NULL, NULL };
while(block_index != block_buffer_tail) {
block_index--;
if(block_index < 0) block_index = BLOCK_BUFFER_SIZE-1;
block[2]= block[1];
block[1]= block[0];
block[0] = &block_buffer[block_index];
planner_reverse_pass_kernel(block[0], block[1], block[2]);
block_index--;
if(block_index < 0) {
block_index = BLOCK_BUFFER_SIZE-1;
}
}
// planner_reverse_pass_kernel(NULL, block[0], block[1]);
planner_reverse_pass_kernel(NULL, block[0], block[1]);
}
// The kernel called by planner_recalculate() when scanning the plan from first to last entry.
@ -1428,7 +1426,6 @@ void check_axes_activity() {
// mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration
// calculation the caller must also provide the physical length of the line in millimeters.
void plan_buffer_line(float x, float y, float z, float e, float feed_rate) {
// The target position of the tool in absolute steps
// Calculate target position in absolute steps
long target[4];
@ -1519,7 +1516,7 @@ void plan_buffer_line(float x, float y, float z, float e, float feed_rate) {
// Compute the acceleration rate for the trapezoid generator.
float travel_per_step = block->millimeters/block->step_event_count;
if(block->steps_x == 0 && block->steps_y == 0 && block->steps_z == 0) {
block->acceleration = ceil( (retract_acceleration)/travel_per_step); // convert to: acceleration steps/sec^2
block->acceleration_st = ceil( (retract_acceleration)/travel_per_step); // convert to: acceleration steps/sec^2
}
else {
block->acceleration_st = ceil( (acceleration)/travel_per_step); // convert to: acceleration steps/sec^2