cleanup, protected some more module variables as static

This commit is contained in:
Simen Svale Skogsrud 2011-02-12 00:03:58 +01:00
parent f423852657
commit ff73645a14
6 changed files with 14 additions and 25 deletions

14
main.c
View File

@ -33,13 +33,13 @@
int main(void) int main(void)
{ {
sp_init(); // initialize the serial protocol sp_init();
settings_init(); settings_init();
plan_init(); // initialize the stepper plan subsystem plan_init();
st_init(); // initialize the stepper subsystem st_init();
spindle_init(); // initialize spindle controller spindle_init();
gc_init(); // initialize gcode-parser gc_init();
for(;;){ for(;;){
sleep_mode(); // Wait for it ... sleep_mode(); // Wait for it ...
sp_process(); // ... process the serial protocol sp_process(); // ... process the serial protocol

View File

@ -36,14 +36,6 @@ void mc_dwell(uint32_t milliseconds)
_delay_ms(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, // 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 // 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 // circle in millimeters. axis_1 and axis_2 selects the circle plane in tool space. Stick the remaining

View File

@ -28,9 +28,8 @@
// unless invert_feed_rate is true. Then the feed_rate means that the motion should be completed in // unless invert_feed_rate is true. Then the feed_rate means that the motion should be completed in
// (1 minute)/feed_rate time. // (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) #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 // 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 replaced with a macro that // to forward the request to the planner. For efficiency the function is implemented with a macro.
// just forwards the call to the planner.
// Execute an arc. theta == start angle, angular_travel == number of radians to go along the arc, // 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 // positive angular_travel means clockwise, negative means counterclockwise. Radius == the radius of the

View File

@ -66,12 +66,12 @@
// The number of linear motions that can be in the plan at any give time // The number of linear motions that can be in the plan at any give time
#define BLOCK_BUFFER_SIZE 20 #define BLOCK_BUFFER_SIZE 20
block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instructions static 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 static 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 volatile int block_buffer_tail; // Index of the block to process now
// The current position of the tool in absolute steps // 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? static uint8_t acceleration_manager_enabled; // Acceleration management active?

View File

@ -51,8 +51,6 @@ typedef struct {
} block_t; } block_t;
extern int32_t position[3];
// Initialize the motion plan subsystem // Initialize the motion plan subsystem
void plan_init(); void plan_init();

View File

@ -55,7 +55,7 @@ static int32_t counter_x, // Counter variables for the bresenham line trac
counter_y, counter_y,
counter_z; counter_z;
static uint32_t step_events_completed; // The number of step events executed in the current block 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 // Variables used by the trapezoid generation
static uint32_t cycles_per_step_event; // The number of machine cycles between each step event static uint32_t cycles_per_step_event; // The number of machine cycles between each step event