diff --git a/Grbl_Esp32/src/Limits.cpp b/Grbl_Esp32/src/Limits.cpp index 061bf92a..1678ff81 100644 --- a/Grbl_Esp32/src/Limits.cpp +++ b/Grbl_Esp32/src/Limits.cpp @@ -200,8 +200,8 @@ void limits_go_home(uint8_t cycle_mask, uint n_locate_cycles) { sys.homing_axis_lock = axislock; // Perform homing cycle. Planner buffer should be empty, as required to initiate the homing cycle. - pl_data->feed_rate = // Set current homing rate. - plan_buffer_line(target, pl_data); // Bypass mc_line(). Directly plan homing motion. + pl_data->feed_rate = homing_rate; + plan_buffer_line(target, pl_data); // Bypass mc_line(). Directly plan homing motion. sys.step_control = {}; sys.step_control.executeSysMotion = true; // Set to execute homing motion and clear existing flags. st_prep_buffer(); // Prep and fill segment buffer from newly planned block. diff --git a/Grbl_Esp32/src/Planner.cpp b/Grbl_Esp32/src/Planner.cpp index 1b308df2..01f9be61 100644 --- a/Grbl_Esp32/src/Planner.cpp +++ b/Grbl_Esp32/src/Planner.cpp @@ -298,7 +298,7 @@ void plan_update_velocity_profile_parameters() { pl.previous_nominal_speed = prev_nominal_speed; // Update prev nominal speed for next incoming block. } -uint8_t plan_buffer_line(float* target, plan_line_data_t* pl_data) { +bool plan_buffer_line(float* target, plan_line_data_t* pl_data) { // Prepare and initialize new block. Copy relevant pl_data for block execution. plan_block_t* block = &block_buffer[block_buffer_head]; memset(block, 0, sizeof(plan_block_t)); // Zero all block values. @@ -336,7 +336,7 @@ uint8_t plan_buffer_line(float* target, plan_line_data_t* pl_data) { } // Bail if this is a zero-length block. Highly unlikely to occur. if (block->step_event_count == 0) { - return PLAN_EMPTY_BLOCK; + return false; } // Calculate the unit vector of the line move and the block maximum feed rate and acceleration scaled @@ -421,7 +421,7 @@ uint8_t plan_buffer_line(float* target, plan_line_data_t* pl_data) { // Finish up by recalculating the plan with the new block. planner_recalculate(); } - return PLAN_OK; + return true; } // Reset the planner position vectors. Called by the system abort/initialization routine. diff --git a/Grbl_Esp32/src/Planner.h b/Grbl_Esp32/src/Planner.h index dd46923e..6f70bb19 100644 --- a/Grbl_Esp32/src/Planner.h +++ b/Grbl_Esp32/src/Planner.h @@ -37,10 +37,6 @@ // new incoming motions as they are executed. const int BLOCK_BUFFER_SIZE = 16; -// Returned status message from planner. -const int PLAN_OK = true; -const int PLAN_EMPTY_BLOCK = false; - // Define planner data condition flags. Used to denote running conditions of a block. struct PlMotion { uint8_t rapidMotion : 1; @@ -100,7 +96,8 @@ void plan_reset_buffer(); // Reset buffer only. // Add a new linear movement to the buffer. target[MAX_N_AXIS] is the signed, absolute target position // in millimeters. Feed rate specifies the speed of the motion. If feed rate is inverted, the feed // rate is taken to mean "frequency" and would complete the operation in 1/feed_rate minutes. -uint8_t plan_buffer_line(float* target, plan_line_data_t* pl_data); +// Returns true on success. +bool plan_buffer_line(float* target, plan_line_data_t* pl_data); // Called when the current block is no longer needed. Discards the block and makes the memory // availible for new blocks.