cleanup, protected some more module variables as static
This commit is contained in:
parent
f423852657
commit
ff73645a14
14
main.c
14
main.c
@ -33,13 +33,13 @@
|
||||
|
||||
int main(void)
|
||||
{
|
||||
sp_init(); // initialize the serial protocol
|
||||
settings_init();
|
||||
plan_init(); // initialize the stepper plan subsystem
|
||||
st_init(); // initialize the stepper subsystem
|
||||
spindle_init(); // initialize spindle controller
|
||||
gc_init(); // initialize gcode-parser
|
||||
|
||||
sp_init();
|
||||
settings_init();
|
||||
plan_init();
|
||||
st_init();
|
||||
spindle_init();
|
||||
gc_init();
|
||||
|
||||
for(;;){
|
||||
sleep_mode(); // Wait for it ...
|
||||
sp_process(); // ... process the serial protocol
|
||||
|
@ -36,14 +36,6 @@ void mc_dwell(uint32_t milliseconds)
|
||||
_delay_ms(milliseconds);
|
||||
}
|
||||
|
||||
// Execute linear motion in absolute millimeter coordinates. Feed rate given in millimeters/second
|
||||
// unless invert_feed_rate is true. Then the feed_rate means that the motion should be completed in
|
||||
// 1/feed_rate minutes.
|
||||
// void mc_line(double x, double y, double z, double feed_rate, int invert_feed_rate)
|
||||
// {
|
||||
// plan_buffer_line(x, y, z, feed_rate, invert_feed_rate);
|
||||
// }
|
||||
|
||||
// Execute an arc. theta == start angle, angular_travel == number of radians to go along the arc,
|
||||
// positive angular_travel means clockwise, negative means counterclockwise. Radius == the radius of the
|
||||
// circle in millimeters. axis_1 and axis_2 selects the circle plane in tool space. Stick the remaining
|
||||
|
@ -28,9 +28,8 @@
|
||||
// unless invert_feed_rate is true. Then the feed_rate means that the motion should be completed in
|
||||
// (1 minute)/feed_rate time.
|
||||
#define mc_line(x, y, z, feed_rate, invert_feed_rate) plan_buffer_line(x, y, z, feed_rate, invert_feed_rate)
|
||||
// NOTE: Although this function structurally belongs in this module, there is nothing to to but
|
||||
// to forward the request to the planner. For efficiency the function is replaced with a macro that
|
||||
// just forwards the call to the planner.
|
||||
// NOTE: Although this function structurally belongs in this module, there is nothing to do but
|
||||
// to forward the request to the planner. For efficiency the function is implemented with a macro.
|
||||
|
||||
// Execute an arc. theta == start angle, angular_travel == number of radians to go along the arc,
|
||||
// positive angular_travel means clockwise, negative means counterclockwise. Radius == the radius of the
|
||||
|
@ -66,12 +66,12 @@
|
||||
// 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
|
||||
static block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instructions
|
||||
static volatile int block_buffer_head; // Index of the next block to be pushed
|
||||
static volatile int block_buffer_tail; // Index of the block to process now
|
||||
|
||||
// The current position of the tool in absolute steps
|
||||
int32_t position[3];
|
||||
static int32_t position[3];
|
||||
|
||||
static uint8_t acceleration_manager_enabled; // Acceleration management active?
|
||||
|
||||
|
@ -51,8 +51,6 @@ typedef struct {
|
||||
|
||||
} block_t;
|
||||
|
||||
extern int32_t position[3];
|
||||
|
||||
// Initialize the motion plan subsystem
|
||||
void plan_init();
|
||||
|
||||
|
@ -55,7 +55,7 @@ static int32_t counter_x, // Counter variables for the bresenham line trac
|
||||
counter_y,
|
||||
counter_z;
|
||||
static uint32_t step_events_completed; // The number of step events executed in the current block
|
||||
volatile int busy; // TRUE when SIG_OUTPUT_COMPARE1A is being serviced. Used to avoid retriggering that handler.
|
||||
static volatile int busy; // TRUE when SIG_OUTPUT_COMPARE1A is being serviced. Used to avoid retriggering that handler.
|
||||
|
||||
// Variables used by the trapezoid generation
|
||||
static uint32_t cycles_per_step_event; // The number of machine cycles between each step event
|
||||
|
Loading…
Reference in New Issue
Block a user