Keep "astyled" elements in Marlin_main.cpp, Marlin.h

This commit is contained in:
Scott Lahteine
2015-10-02 23:12:03 -07:00
parent d99a4acd4b
commit f844d18724
2 changed files with 353 additions and 381 deletions

View File

@@ -455,12 +455,10 @@ void serial_echopair_P(const char *s_P, unsigned long v) { serialprintPGM(s_P);
int freeMemory() { int freeMemory() {
int free_memory; int free_memory;
if ((int)__brkval == 0) if ((int)__brkval == 0)
free_memory = ((int)&free_memory) - ((int)&__bss_end); free_memory = ((int)&free_memory) - ((int)&__bss_end);
else else
free_memory = ((int)&free_memory) - ((int)__brkval); free_memory = ((int)&free_memory) - ((int)__brkval);
return free_memory; return free_memory;
} }
} }
@@ -509,7 +507,6 @@ void enqueuecommands_P(const char* pgcode) {
* Returns false if it doesn't add any command * Returns false if it doesn't add any command
*/ */
bool enqueuecommand(const char* cmd) { bool enqueuecommand(const char* cmd) {
if (*cmd == ';' || commands_in_queue >= BUFSIZE) return false; if (*cmd == ';' || commands_in_queue >= BUFSIZE) return false;
// This is dangerous if a mixing of serial and this happens // This is dangerous if a mixing of serial and this happens
@@ -1441,39 +1438,32 @@ static void setup_for_endstop_move() {
prepare_move_raw(); // this will also set_current_to_destination prepare_move_raw(); // this will also set_current_to_destination
// Move to engage deployment // Move to engage deployment
if (Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE) { if (Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE)
feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE; feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE;
} if (Z_PROBE_ALLEN_KEY_DEPLOY_2_X != Z_PROBE_ALLEN_KEY_DEPLOY_1_X)
if (Z_PROBE_ALLEN_KEY_DEPLOY_2_X != Z_PROBE_ALLEN_KEY_DEPLOY_1_X) {
destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_X; destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_X;
} if (Z_PROBE_ALLEN_KEY_DEPLOY_2_Y != Z_PROBE_ALLEN_KEY_DEPLOY_1_Y)
if (Z_PROBE_ALLEN_KEY_DEPLOY_2_Y != Z_PROBE_ALLEN_KEY_DEPLOY_1_Y) {
destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_Y; destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_Y;
} if (Z_PROBE_ALLEN_KEY_DEPLOY_2_Z != Z_PROBE_ALLEN_KEY_DEPLOY_1_Z)
if (Z_PROBE_ALLEN_KEY_DEPLOY_2_Z != Z_PROBE_ALLEN_KEY_DEPLOY_1_Z) {
destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_Z; destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_Z;
}
prepare_move_raw(); prepare_move_raw();
#ifdef Z_PROBE_ALLEN_KEY_DEPLOY_3_X #ifdef Z_PROBE_ALLEN_KEY_DEPLOY_3_X
if (Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE) { if (Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE)
feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE; feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE;
}
// Move to trigger deployment // Move to trigger deployment
if (Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE) { if (Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE)
feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE; feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE;
} if (Z_PROBE_ALLEN_KEY_DEPLOY_3_X != Z_PROBE_ALLEN_KEY_DEPLOY_2_X)
if (Z_PROBE_ALLEN_KEY_DEPLOY_3_X != Z_PROBE_ALLEN_KEY_DEPLOY_2_X) {
destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_X; destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_X;
} if (Z_PROBE_ALLEN_KEY_DEPLOY_3_Y != Z_PROBE_ALLEN_KEY_DEPLOY_2_Y)
if (Z_PROBE_ALLEN_KEY_DEPLOY_3_Y != Z_PROBE_ALLEN_KEY_DEPLOY_2_Y) {
destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_Y; destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_Y;
} if (Z_PROBE_ALLEN_KEY_DEPLOY_3_Z != Z_PROBE_ALLEN_KEY_DEPLOY_2_Z)
if (Z_PROBE_ALLEN_KEY_DEPLOY_3_Z != Z_PROBE_ALLEN_KEY_DEPLOY_2_Z) {
destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_Z; destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_Z;
}
prepare_move_raw(); prepare_move_raw();
#endif #endif
} }
@@ -1505,7 +1495,6 @@ static void setup_for_endstop_move() {
} }
static void stow_z_probe(bool doRaise = true) { static void stow_z_probe(bool doRaise = true) {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (marlin_debug_flags & DEBUG_LEVELING) { if (marlin_debug_flags & DEBUG_LEVELING) {
print_xyz("stow_z_probe > current_position", current_position); print_xyz("stow_z_probe > current_position", current_position);
@@ -1553,28 +1542,22 @@ static void setup_for_endstop_move() {
prepare_move_raw(); prepare_move_raw();
// Move the nozzle down to push the Z probe into retracted position // Move the nozzle down to push the Z probe into retracted position
if (Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE != Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE) { if (Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE != Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE)
feedrate = Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE; feedrate = Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE;
} if (Z_PROBE_ALLEN_KEY_STOW_2_X != Z_PROBE_ALLEN_KEY_STOW_1_X)
if (Z_PROBE_ALLEN_KEY_STOW_2_X != Z_PROBE_ALLEN_KEY_STOW_1_X) {
destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_X; destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_X;
} if (Z_PROBE_ALLEN_KEY_STOW_2_Y != Z_PROBE_ALLEN_KEY_STOW_1_Y)
if (Z_PROBE_ALLEN_KEY_STOW_2_Y != Z_PROBE_ALLEN_KEY_STOW_1_Y) {
destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_Y; destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_Y;
}
destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_Z; destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_Z;
prepare_move_raw(); prepare_move_raw();
// Move up for safety // Move up for safety
if (Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE != Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE) { if (Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE != Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE)
feedrate = Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE; feedrate = Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE;
} if (Z_PROBE_ALLEN_KEY_STOW_3_X != Z_PROBE_ALLEN_KEY_STOW_2_X)
if (Z_PROBE_ALLEN_KEY_STOW_3_X != Z_PROBE_ALLEN_KEY_STOW_2_X) {
destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_X; destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_X;
} if (Z_PROBE_ALLEN_KEY_STOW_3_Y != Z_PROBE_ALLEN_KEY_STOW_2_Y)
if (Z_PROBE_ALLEN_KEY_STOW_3_Y != Z_PROBE_ALLEN_KEY_STOW_2_Y) {
destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Y; destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Y;
}
destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Z; destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Z;
prepare_move_raw(); prepare_move_raw();
@@ -1601,9 +1584,7 @@ static void setup_for_endstop_move() {
} }
Stop(); Stop();
} }
#endif // Z_PROBE_ALLEN_KEY #endif // Z_PROBE_ALLEN_KEY
} }
enum ProbeAction { enum ProbeAction {
@@ -1615,7 +1596,6 @@ static void setup_for_endstop_move() {
// Probe bed height at position (x,y), returns the measured z value // Probe bed height at position (x,y), returns the measured z value
static float probe_pt(float x, float y, float z_before, ProbeAction probe_action = ProbeDeployAndStow, int verbose_level = 1) { static float probe_pt(float x, float y, float z_before, ProbeAction probe_action = ProbeDeployAndStow, int verbose_level = 1) {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (marlin_debug_flags & DEBUG_LEVELING) { if (marlin_debug_flags & DEBUG_LEVELING) {
SERIAL_ECHOLNPGM("probe_pt >>>"); SERIAL_ECHOLNPGM("probe_pt >>>");
@@ -2732,7 +2712,8 @@ inline void gcode_G28() {
} }
if (code_seen('Z')) { if (code_seen('Z')) {
z = code_value(); z = code_value();
} else { }
else {
SERIAL_PROTOCOLPGM("Z not entered.\n"); SERIAL_PROTOCOLPGM("Z not entered.\n");
return; return;
} }
@@ -2824,6 +2805,7 @@ inline void gcode_G28() {
} }
int auto_bed_leveling_grid_points = AUTO_BED_LEVELING_GRID_POINTS; int auto_bed_leveling_grid_points = AUTO_BED_LEVELING_GRID_POINTS;
#if DISABLED(DELTA) #if DISABLED(DELTA)
if (code_seen('P')) auto_bed_leveling_grid_points = code_value_short(); if (code_seen('P')) auto_bed_leveling_grid_points = code_value_short();
if (auto_bed_leveling_grid_points < 2) { if (auto_bed_leveling_grid_points < 2) {
@@ -3434,7 +3416,7 @@ inline void gcode_M17() {
} }
} }
#endif #endif //SDSUPPORT
/** /**
* M31: Get the time since the start of SD Print (or last M109) * M31: Get the time since the start of SD Print (or last M109)
@@ -4470,7 +4452,6 @@ inline void gcode_M204() {
SERIAL_ECHOPAIR("Setting Travel Acceleration: ", travel_acceleration); SERIAL_ECHOPAIR("Setting Travel Acceleration: ", travel_acceleration);
SERIAL_EOL; SERIAL_EOL;
} }
} }
/** /**
@@ -4555,7 +4536,9 @@ inline void gcode_M206() {
} }
#endif #endif
} }
#elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS) #elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS)
/** /**
* M666: For Z Dual Endstop setup, set z axis offset to the z2 axis. * M666: For Z Dual Endstop setup, set z axis offset to the z2 axis.
*/ */
@@ -5610,7 +5593,6 @@ inline void gcode_T(uint8_t tmp_extruder) {
current_position[Z_AXIS] = current_position[Z_AXIS] - current_position[Z_AXIS] = current_position[Z_AXIS] -
extruder_offset[Z_AXIS][active_extruder] + extruder_offset[Z_AXIS][active_extruder] +
extruder_offset[Z_AXIS][tmp_extruder]; extruder_offset[Z_AXIS][tmp_extruder];
active_extruder = tmp_extruder; active_extruder = tmp_extruder;
// This function resets the max/min values - the current position may be overwritten below. // This function resets the max/min values - the current position may be overwritten below.
@@ -6372,8 +6354,7 @@ void clamp_to_software_endstops(float target[3]) {
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
// This function is used to split lines on mesh borders so each segment is only part of one mesh area // This function is used to split lines on mesh borders so each segment is only part of one mesh area
void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_rate, const uint8_t &extruder, uint8_t x_splits=0xff, uint8_t y_splits=0xff) void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_rate, const uint8_t& extruder, uint8_t x_splits = 0xff, uint8_t y_splits = 0xff) {
{
if (!mbl.active) { if (!mbl.active) {
plan_buffer_line(x, y, z, e, feed_rate, extruder); plan_buffer_line(x, y, z, e, feed_rate, extruder);
set_current_to_destination(); set_current_to_destination();
@@ -6623,15 +6604,15 @@ void plan_arc(
// CCW angle of rotation between position and target from the circle center. Only one atan2() trig computation required. // CCW angle of rotation between position and target from the circle center. Only one atan2() trig computation required.
float angular_travel = atan2(r_axis0 * rt_axis1 - r_axis1 * rt_axis0, r_axis0 * rt_axis0 + r_axis1 * rt_axis1); float angular_travel = atan2(r_axis0 * rt_axis1 - r_axis1 * rt_axis0, r_axis0 * rt_axis0 + r_axis1 * rt_axis1);
if (angular_travel < 0) { angular_travel += RADIANS(360); } if (angular_travel < 0) angular_travel += RADIANS(360);
if (clockwise) { angular_travel -= RADIANS(360); } if (clockwise) angular_travel -= RADIANS(360);
// Make a circle if the angular rotation is 0 // Make a circle if the angular rotation is 0
if (current_position[X_AXIS] == target[X_AXIS] && current_position[Y_AXIS] == target[Y_AXIS] && angular_travel == 0) if (current_position[X_AXIS] == target[X_AXIS] && current_position[Y_AXIS] == target[Y_AXIS] && angular_travel == 0)
angular_travel += RADIANS(360); angular_travel += RADIANS(360);
float mm_of_travel = hypot(angular_travel * radius, fabs(linear_travel)); float mm_of_travel = hypot(angular_travel * radius, fabs(linear_travel));
if (mm_of_travel < 0.001) { return; } if (mm_of_travel < 0.001) return;
uint16_t segments = floor(mm_of_travel / MM_PER_ARC_SEGMENT); uint16_t segments = floor(mm_of_travel / MM_PER_ARC_SEGMENT);
if (segments == 0) segments = 1; if (segments == 0) segments = 1;
@@ -7113,7 +7094,6 @@ void kill(const char *lcd_msg) {
void setPwmFrequency(uint8_t pin, int val) { void setPwmFrequency(uint8_t pin, int val) {
val &= 0x07; val &= 0x07;
switch (digitalPinToTimer(pin)) { switch (digitalPinToTimer(pin)) {
#if defined(TCCR0A) #if defined(TCCR0A)
case TIMER0A: case TIMER0A:
case TIMER0B: case TIMER0B:
@@ -7121,7 +7101,6 @@ void kill(const char *lcd_msg) {
// TCCR0B |= val; // TCCR0B |= val;
break; break;
#endif #endif
#if defined(TCCR1A) #if defined(TCCR1A)
case TIMER1A: case TIMER1A:
case TIMER1B: case TIMER1B:
@@ -7129,7 +7108,6 @@ void kill(const char *lcd_msg) {
// TCCR1B |= val; // TCCR1B |= val;
break; break;
#endif #endif
#if defined(TCCR2) #if defined(TCCR2)
case TIMER2: case TIMER2:
case TIMER2: case TIMER2:
@@ -7137,7 +7115,6 @@ void kill(const char *lcd_msg) {
TCCR2 |= val; TCCR2 |= val;
break; break;
#endif #endif
#if defined(TCCR2A) #if defined(TCCR2A)
case TIMER2A: case TIMER2A:
case TIMER2B: case TIMER2B:
@@ -7145,7 +7122,6 @@ void kill(const char *lcd_msg) {
TCCR2B |= val; TCCR2B |= val;
break; break;
#endif #endif
#if defined(TCCR3A) #if defined(TCCR3A)
case TIMER3A: case TIMER3A:
case TIMER3B: case TIMER3B:
@@ -7154,7 +7130,6 @@ void kill(const char *lcd_msg) {
TCCR3B |= val; TCCR3B |= val;
break; break;
#endif #endif
#if defined(TCCR4A) #if defined(TCCR4A)
case TIMER4A: case TIMER4A:
case TIMER4B: case TIMER4B:
@@ -7163,7 +7138,6 @@ void kill(const char *lcd_msg) {
TCCR4B |= val; TCCR4B |= val;
break; break;
#endif #endif
#if defined(TCCR5A) #if defined(TCCR5A)
case TIMER5A: case TIMER5A:
case TIMER5B: case TIMER5B:
@@ -7172,8 +7146,6 @@ void kill(const char *lcd_msg) {
TCCR5B |= val; TCCR5B |= val;
break; break;
#endif #endif
}
} }
#endif // FAST_PWM_FAN #endif // FAST_PWM_FAN