formatting + moved current position getter to planner
This commit is contained in:
parent
07f8623098
commit
6dc81b41c9
@ -55,7 +55,7 @@ void mc_arc(double theta, double angular_travel, double radius, double linear_tr
|
||||
int axis_linear, double feed_rate, int invert_feed_rate)
|
||||
{
|
||||
int32_t position[3];
|
||||
st_get_position_steps(&position);
|
||||
plan_get_position_steps(&position);
|
||||
int acceleration_manager_was_enabled = plan_is_acceleration_manager_enabled();
|
||||
plan_set_acceleration_manager_enabled(FALSE); // disable acceleration management for the duration of the arc
|
||||
double millimeters_of_travel = hypot(angular_travel*radius, labs(linear_travel));
|
||||
|
@ -61,6 +61,9 @@
|
||||
#include "config.h"
|
||||
#include "wiring_serial.h"
|
||||
|
||||
// The number of linear motions that can be in the plan at any give time
|
||||
#define BLOCK_BUFFER_SIZE 20
|
||||
|
||||
block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instructions
|
||||
volatile int block_buffer_head; // Index of the next block to be pushed
|
||||
volatile int block_buffer_tail; // Index of the block to process now
|
||||
@ -407,3 +410,7 @@ void plan_buffer_line(double x, double y, double z, double feed_rate, int invert
|
||||
st_wake_up();
|
||||
}
|
||||
|
||||
void plan_get_position_steps(int32_t (*vector)[3]) {
|
||||
memcpy(vector, position, sizeof(position)); // vector[] = position[]
|
||||
}
|
||||
|
||||
|
11
planner.h
11
planner.h
@ -26,9 +26,6 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
// Pick a suitable block-buffer size
|
||||
#define BLOCK_BUFFER_SIZE 20 // Atmega 328 has one full kilobyte of extra RAM!
|
||||
|
||||
// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in
|
||||
// the source g-code and may never actually be reached if acceleration management is active.
|
||||
typedef struct {
|
||||
@ -64,16 +61,20 @@ void plan_init();
|
||||
// rate is taken to mean "frequency" and would complete the operation in 1/feed_rate minutes.
|
||||
void plan_buffer_line(double x, double y, double z, double feed_rate, int invert_feed_rate);
|
||||
|
||||
// Call when the current block is no longer needed. Discards the block and makes the memory
|
||||
// Called when the current block is no longer needed. Discards the block and makes the memory
|
||||
// availible for new blocks.
|
||||
inline void plan_discard_current_block();
|
||||
|
||||
// Gets the current block. Returns NULL if buffer empty
|
||||
inline block_t *plan_get_current_block();
|
||||
|
||||
// Enables acceleration-management for upcoming blocks
|
||||
// Enables or disables acceleration-management for upcoming blocks
|
||||
void plan_set_acceleration_manager_enabled(int enabled);
|
||||
|
||||
// Is acceleration-management currently enabled?
|
||||
int plan_is_acceleration_manager_enabled();
|
||||
|
||||
// Copy the current absolute position in steps into the provided vector
|
||||
void plan_get_position_steps(int32_t (*vector)[3]);
|
||||
|
||||
#endif
|
@ -112,10 +112,6 @@ inline void trapezoid_generator_tick() {
|
||||
}
|
||||
}
|
||||
|
||||
void st_get_position_steps(int32_t (*vector)[3]) {
|
||||
memcpy(vector, position, sizeof(position)); // vector[] = position[]
|
||||
}
|
||||
|
||||
// "The Stepper Driver Interrupt" - This timer interrupt is the workhorse of Grbl. It is executed at the rate set with
|
||||
// config_step_timer. It pops blocks from the block_buffer and executes them by pulsing the stepper pins appropriately.
|
||||
// It is supported by The Stepper Port Reset Interrupt which it uses to reset the stepper port after each pulse.
|
||||
|
Loading…
Reference in New Issue
Block a user