Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
optimized for size, shaved 2k
  • Loading branch information
Simen Svale Skogsrud committed Feb 8, 2009
1 parent c07a322 commit 05bacc4
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 220 deletions.
16 changes: 4 additions & 12 deletions gcode.c
Expand Up @@ -52,6 +52,7 @@
#include "spindle_control.h"
#include "geometry.h"
#include "errno.h"
#include "serial_protocol.h"

#include "wiring_serial.h"

Expand Down Expand Up @@ -126,7 +127,6 @@ void select_plane(uint8_t axis_0, uint8_t axis_1)
// characters and signed floats (no whitespace).
uint8_t gc_execute_line(char *line) {
int counter = 0;
int requires_nudge = false;
char letter;
double value;
double unit_converted_value;
Expand Down Expand Up @@ -238,6 +238,7 @@ uint8_t gc_execute_line(char *line) {
}

// Perform any physical actions
sp_send_execution_marker();
switch (next_action) {
case NEXT_ACTION_GO_HOME: mc_go_home(); break;
case NEXT_ACTION_DWELL: mc_dwell(trunc(p*1000)); break;
Expand All @@ -246,10 +247,10 @@ uint8_t gc_execute_line(char *line) {
case MOTION_MODE_CANCEL: break;
case MOTION_MODE_RAPID_LINEAR: case MOTION_MODE_LINEAR:
if (gc.inverse_feed_rate_mode) {
mc_linear_motion(target[X_AXIS], target[Y_AXIS], target[Z_AXIS],
mc_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS],
inverse_feed_rate, true);
} else {
mc_linear_motion(target[X_AXIS], target[Y_AXIS], target[Z_AXIS],
mc_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS],
(gc.motion_mode == MOTION_MODE_LINEAR) ? gc.feed_rate : RAPID_FEEDRATE,
false);
}
Expand Down Expand Up @@ -383,19 +384,10 @@ uint8_t gc_execute_line(char *line) {
// printInteger(trunc(radius));
// printByte(')');
mc_arc(theta_start, angular_travel, radius, gc.plane_axis_0, gc.plane_axis_1, gc.feed_rate);
// Rounding errors means the arcing might not land us exactly where we wanted. Thats why this
// operation must be finalized with a linear nudge to the exact target spot.
requires_nudge = true;
break;
}
}

mc_execute();
if (requires_nudge) {
mc_linear_motion(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], gc.feed_rate, false);
mc_execute();
}

// As far as the parser is concerned, the position is now == target. In reality the
// motion control system might still be processing the action and the real tool position
// in any intermediate location.
Expand Down

0 comments on commit 05bacc4

Please sign in to comment.