Skip to content

Commit

Permalink
Format the code to conform with Marlin's coding standards and include…
Browse files Browse the repository at this point in the history
… thinkyhead's suggestions
  • Loading branch information
scalez committed Apr 19, 2016
1 parent 2fa5a8b commit c6eef47
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l

#ifdef REPROBE
#define Z_RETRY_PT 15 // Z height to move the hotend after failed probe
#define NUM_ATTEMPTS 3 // Number of attempts to make before quiting
#define NUM_ATTEMPTS 3 // Number of attempts to make before giving up
//#define PROBE_FAIL_PANIC // Completely give up printing if the final attempt fails (use G26 to get out of failed state)
//#define REWIPE // Re-attempts wiping
#ifdef REWIPE
Expand Down Expand Up @@ -625,7 +625,7 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l

#define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min.

#define MIN_PROBE_PT (Z_MIN_POS-2) //How far the extruder should move down to probe
#define MIN_PROBE_PT (Z_MIN_POS-2) //How far the extruder should move down to probe
#define Z_RAISE_BEFORE_PROBING 15 // How much the Z axis will be raised before traveling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 5 // How much the Z axis will be raised when traveling from between next probing points.
#define Z_RAISE_AFTER_PROBING 15 // How much the Z axis will be raised after the last probing point.
Expand Down
40 changes: 18 additions & 22 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1521,8 +1521,7 @@ static void setup_for_endstop_move() {

#if ENABLED(REPROBE)
void probing_failed() {
if(reprobe_attempts < NUM_ATTEMPTS-1)
{
if (reprobe_attempts < NUM_ATTEMPTS-1) {
#if DISABLED(REWIPE)
SERIAL_ERRORLNPGM(MSG_REPROBE);
LCD_MESSAGEPGM(MSG_REPROBE);
Expand All @@ -1535,8 +1534,7 @@ static void setup_for_endstop_move() {
float rewipe_second_pt[2] = REWIPE_SECOND_PT;
do_blocking_move_to_xy(rewipe_first_pt[X_AXIS], rewipe_first_pt[Y_AXIS]);
do_blocking_move_to_z(Z_REWIPE_PT);
for(uint8_t i=0; i<NUM_REWIPES; i++)
{
for (uint8_t i=0; i < NUM_REWIPES; i++) {
do_blocking_move_to_xy(rewipe_second_pt[X_AXIS], rewipe_second_pt[Y_AXIS]);
do_blocking_move_to_xy(rewipe_first_pt[X_AXIS], rewipe_first_pt[Y_AXIS]);
}
Expand All @@ -1545,8 +1543,7 @@ static void setup_for_endstop_move() {
do_blocking_move_to_xy(LEFT_PROBE_BED_POSITION, FRONT_PROBE_BED_POSITION);
reprobe_attempts++;
}
else
{
else {
do_blocking_move_to_z(Z_RETRY_PT);
reprobe_attempts++;
}
Expand Down Expand Up @@ -1608,8 +1605,7 @@ static void setup_for_endstop_move() {
current_position[E_AXIS]
);
#ifdef REPROBE
if(zPosition == MIN_PROBE_PT && !digitalRead(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING)
{
if (zPosition == MIN_PROBE_PT && !digitalRead(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING) {
probing_failed();
return;
}
Expand Down Expand Up @@ -1959,7 +1955,7 @@ static void setup_for_endstop_move() {
run_z_probe();
float measured_z = current_position[Z_AXIS];
#ifdef REPROBE
if(measured_z == Z_RETRY_PT)
if (measured_z == Z_RETRY_PT)
return MIN_PROBE_PT;
#endif

Expand Down Expand Up @@ -3317,7 +3313,7 @@ inline void gcode_G28() {
int xStart, xStop, xInc;

#if ENABLED(REPROBE)
if(reprobe_attempts == NUM_ATTEMPTS && probePointCounter == -1)
if (reprobe_attempts == NUM_ATTEMPTS && probePointCounter == -1)
break;
#endif

Expand Down Expand Up @@ -3377,8 +3373,8 @@ inline void gcode_G28() {
measured_z = probe_pt(xProbe, yProbe, z_before, act, verbose_level);

#if ENABLED(REPROBE)
if(measured_z == MIN_PROBE_PT) {
if(reprobe_attempts < NUM_ATTEMPTS) {
if (measured_z == MIN_PROBE_PT) {
if (reprobe_attempts < NUM_ATTEMPTS) {
probePointCounter = 0;
zig = true;
yCount = -1;
Expand Down Expand Up @@ -3411,13 +3407,12 @@ inline void gcode_G28() {
} //yProbe

#if ENABLED(PROBE_FAIL_PANIC)
if(reprobe_attempts == NUM_ATTEMPTS && probePointCounter == -1)
{
if(!IS_SD_PRINTING)
if (reprobe_attempts == NUM_ATTEMPTS && probePointCounter == -1) {
if (!IS_SD_PRINTING)
probe_fail = true;
disable_all_heaters();
disable_all_heaters();
#if ENABLED(THERMAL_RUNAWAY_PROTECTION_PERIOD)
for(int i=0; i<EXTRUDERS; i++) target_temp_reached[i] = false;
for (int i=0; i<EXTRUDERS; i++) target_temp_reached[i] = false;
#endif
#if ENABLED(SDSUPPORT)
card.closefile();
Expand All @@ -3426,11 +3421,12 @@ inline void gcode_G28() {
clear_buffer();
reprobe_attempts = 0;
do_blocking_move_to_z(Z_RETRY_PT);
// Move E back to 0 after a failed probe
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 0.0, feedrate/60, active_extruder);
st_synchronize();
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
acceleration = DEFAULT_ACCELERATION;
#if ENABLED(REWIPE)
// If rewiped, move E back to 0 after a failed probe
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 0.0, feedrate/60, active_extruder);
sync_plan_position()
acceleration = DEFAULT_ACCELERATION;
#endif
#if ENABLED(ULTIPANEL)
buzz(750, 1750);
#endif
Expand Down

0 comments on commit c6eef47

Please sign in to comment.