Skip to content

Commit

Permalink
Rename some feedrate-oriented functions
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Sep 24, 2019
1 parent 938a49f commit 5e13fe9
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ G29_TYPE GcodeSuite::G29() {
}
#endif

if (!faux) setup_for_endstop_or_probe_move();
if (!faux) remember_feedrate_scaling_off();

#if ENABLED(AUTO_BED_LEVELING_BILINEAR)

Expand Down Expand Up @@ -980,7 +980,7 @@ G29_TYPE GcodeSuite::G29() {
} // !isnan(measured_z)

// Restore state after probing
if (!faux) clean_up_after_endstop_or_probe_move();
if (!faux) restore_feedrate_and_scaling();

if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G29");

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ void GcodeSuite::G28(const bool always_home_all) {
extruder_duplication_enabled = false;
#endif

setup_for_endstop_or_probe_move();
remember_feedrate_scaling_off();

endstops.enable(true); // Enable endstops for next homing move

Expand Down Expand Up @@ -427,7 +427,7 @@ void GcodeSuite::G28(const bool always_home_all) {
set_bed_leveling_enabled(leveling_was_active);
#endif

clean_up_after_endstop_or_probe_move();
restore_feedrate_and_scaling();

// Restore the active tool after homing
#if HOTENDS > 1 && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE))
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/calibrate/G33.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void ac_setup(const bool reset_bed) {
#endif

planner.synchronize();
setup_for_endstop_or_probe_move();
remember_feedrate_scaling_off();

#if HAS_LEVELING
if (reset_bed) reset_bed_level(); // After full calibration bed-level data is no longer valid
Expand All @@ -102,7 +102,7 @@ void ac_cleanup(
#if HAS_BED_PROBE
STOW_PROBE();
#endif
clean_up_after_endstop_or_probe_move();
restore_feedrate_and_scaling();
#if HOTENDS > 1
tool_change(old_tool_index, true);
#endif
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/calibrate/M48.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void GcodeSuite::M48() {
set_bed_leveling_enabled(false);
#endif

setup_for_endstop_or_probe_move();
remember_feedrate_scaling_off();

float mean = 0.0, sigma = 0.0, min = 99999.9, max = -99999.9, sample_set[n_samples];

Expand Down Expand Up @@ -256,7 +256,7 @@ void GcodeSuite::M48() {
#endif
}

clean_up_after_endstop_or_probe_move();
restore_feedrate_and_scaling();

// Re-enable bed level correction if it had been on
#if HAS_LEVELING
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/probe/G30.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ void GcodeSuite::G30() {
set_bed_leveling_enabled(false);
#endif

setup_for_endstop_or_probe_move();
remember_feedrate_scaling_off();

const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
const float measured_z = probe_at_point(xpos, ypos, raise_after, 1);

if (!isnan(measured_z))
SERIAL_ECHOLNPAIR("Bed X: ", FIXFLOAT(xpos), " Y: ", FIXFLOAT(ypos), " Z: ", FIXFLOAT(measured_z));

clean_up_after_endstop_or_probe_move();
restore_feedrate_and_scaling();

#ifdef Z_AFTER_PROBING
if (raise_after == PROBE_PT_STOW) move_z_after_probing();
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/probe/G38.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void GcodeSuite::G38(const int8_t subcode) {
// Get X Y Z E F
get_destination_from_command();

setup_for_endstop_or_probe_move();
remember_feedrate_scaling_off();

const bool error_on_fail =
#if ENABLED(G38_PROBE_AWAY)
Expand All @@ -128,7 +128,7 @@ void GcodeSuite::G38(const int8_t subcode) {
break;
}

clean_up_after_endstop_or_probe_move();
restore_feedrate_and_scaling();
}

#endif // G38_PROBE_TARGET
7 changes: 5 additions & 2 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,12 +439,15 @@ void do_blocking_move_to_xy(const float &rx, const float &ry, const float &fr_mm
//
static float saved_feedrate_mm_s;
static int16_t saved_feedrate_percentage;
void setup_for_endstop_or_probe_move() {
void remember_feedrate_and_scaling() {
saved_feedrate_mm_s = feedrate_mm_s;
saved_feedrate_percentage = feedrate_percentage;
}
void remember_feedrate_scaling_off() {
remember_feedrate_and_scaling();
feedrate_percentage = 100;
}
void clean_up_after_endstop_or_probe_move() {
void restore_feedrate_and_scaling() {
feedrate_mm_s = saved_feedrate_mm_s;
feedrate_percentage = saved_feedrate_percentage;
}
Expand Down
5 changes: 3 additions & 2 deletions Marlin/src/module/motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZE], const float &fr_
do_blocking_move_to(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], fr_mm_s);
}

void setup_for_endstop_or_probe_move();
void clean_up_after_endstop_or_probe_move();
void remember_feedrate_and_scaling();
void remember_feedrate_scaling_off();
void restore_feedrate_and_scaling();

//
// Homing
Expand Down

0 comments on commit 5e13fe9

Please sign in to comment.