Make arc support (G2/G3) configurable

Saves about 2669 bytes when deactivated. (About 1% for a AT2560, about __4%__ for a AT644!)
master
AnHardt 9 years ago
parent 14cd0f4c92
commit b74af78736

@ -455,6 +455,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -506,7 +506,9 @@ void stop();
void get_available_commands(); void get_available_commands();
void process_next_command(); void process_next_command();
void plan_arc(float target[NUM_AXIS], float* offset, uint8_t clockwise); #if ENABLED(ARC_SUPPORT)
void plan_arc(float target[NUM_AXIS], float* offset, uint8_t clockwise);
#endif
void serial_echopair_P(const char* s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_echopair_P(const char* s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_P(const char* s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_echopair_P(const char* s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
@ -2461,7 +2463,8 @@ inline void gcode_G0_G1() {
* G2: Clockwise Arc * G2: Clockwise Arc
* G3: Counterclockwise Arc * G3: Counterclockwise Arc
*/ */
inline void gcode_G2_G3(bool clockwise) { #if ENABLED(ARC_SUPPORT)
inline void gcode_G2_G3(bool clockwise) {
if (IsRunning()) { if (IsRunning()) {
#if ENABLED(SF_ARC_FIX) #if ENABLED(SF_ARC_FIX)
@ -2486,7 +2489,8 @@ inline void gcode_G2_G3(bool clockwise) {
refresh_cmd_timeout(); refresh_cmd_timeout();
} }
} }
#endif
/** /**
* G4: Dwell S<seconds> or P<milliseconds> * G4: Dwell S<seconds> or P<milliseconds>
@ -6484,7 +6488,7 @@ void process_next_command() {
break; break;
// G2, G3 // G2, G3
#if DISABLED(SCARA) #if ENABLED(ARC_SUPPORT) & DISABLED(SCARA)
case 2: // G2 - CW ARC case 2: // G2 - CW ARC
case 3: // G3 - CCW ARC case 3: // G3 - CCW ARC
gcode_G2_G3(codenum == 2); gcode_G2_G3(codenum == 2);
@ -7423,7 +7427,8 @@ void prepare_move() {
set_current_to_destination(); set_current_to_destination();
} }
/** #if ENABLED(ARC_SUPPORT)
/**
* Plan an arc in 2 dimensions * Plan an arc in 2 dimensions
* *
* The arc is approximated by generating many small linear segments. * The arc is approximated by generating many small linear segments.
@ -7432,11 +7437,11 @@ void prepare_move() {
* larger segments will tend to be more efficient. Your slicer should have * larger segments will tend to be more efficient. Your slicer should have
* options for G2/G3 arc generation. In future these options may be GCode tunable. * options for G2/G3 arc generation. In future these options may be GCode tunable.
*/ */
void plan_arc( void plan_arc(
float target[NUM_AXIS], // Destination position float target[NUM_AXIS], // Destination position
float* offset, // Center of rotation relative to current_position float* offset, // Center of rotation relative to current_position
uint8_t clockwise // Clockwise? uint8_t clockwise // Clockwise?
) { ) {
float radius = hypot(offset[X_AXIS], offset[Y_AXIS]), float radius = hypot(offset[X_AXIS], offset[Y_AXIS]),
center_X = current_position[X_AXIS] + offset[X_AXIS], center_X = current_position[X_AXIS] + offset[X_AXIS],
@ -7563,7 +7568,8 @@ void plan_arc(
// motion control system might still be processing the action and the real tool position // motion control system might still be processing the action and the real tool position
// in any intermediate location. // in any intermediate location.
set_current_to_destination(); set_current_to_destination();
} }
#endif
#if HAS_CONTROLLERFAN #if HAS_CONTROLLERFAN

@ -455,6 +455,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -455,6 +455,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -455,6 +455,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -461,6 +461,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -455,6 +455,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -455,6 +455,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -463,6 +463,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -455,6 +455,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -457,6 +457,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -457,6 +457,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -456,6 +456,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -461,6 +461,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -457,6 +457,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -455,6 +455,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

@ -455,6 +455,7 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25

Loading…
Cancel
Save