Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LCD menu_move: Treat rotational axes in angular degrees #24334

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
e21e81f
LCD move_menu: rotary axes in degrees
DerAndere1 Jun 11, 2022
e8c2ea6
manual feedrate in deg per s for rotary axes
DerAndere1 Jun 12, 2022
dbb972f
explicit float, improve feedrate documentation
DerAndere1 Jun 13, 2022
9d9d9a1
Use LCD_STR_DEGREE
thinkyhead Jun 22, 2022
e3fdac1
clean up, simplify
thinkyhead Jun 22, 2022
29e6275
must be in mm/s already, surely
thinkyhead Jun 22, 2022
b4f8ada
simplify
thinkyhead Jun 22, 2022
3a7d592
fix regression in displayed position
DerAndere1 Jun 22, 2022
ec20327
separate feedrate for rotational-only moves
DerAndere1 Jul 2, 2022
5726a3f
merge followup
thinkyhead Jul 10, 2022
22fda23
F command updates feedrate for ALL moves
DerAndere1 Jul 27, 2022
c59c784
G2_G3 travel can be negative
DerAndere1 Jul 28, 2022
1e904af
compatibility of angular feedrate with more feats
DerAndere1 Jul 30, 2022
ae13387
angular feedrate fixup
DerAndere1 Aug 9, 2022
7c0a1cd
use LCD_STR_DEGREE only for degree
DerAndere1 Aug 9, 2022
e643656
do not instantiate hints if hints.fr_deg_s = 0
DerAndere1 Aug 29, 2022
9398db9
Fix compilation of bed leveling with extra axes
Sep 12, 2022
02d9873
fix feedrate for segmented moves
DerAndere1 Nov 2, 2022
a99d6e5
LinuxCNC compat. feedrate for kinematic printers
DerAndere1 Nov 2, 2022
4b72136
fix M240
DerAndere1 Nov 2, 2022
c3d9453
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead Nov 27, 2022
e8d36fc
fix measure_business_card_thickness, etc
thinkyhead Nov 27, 2022
da117ca
conditional, sanity
thinkyhead Nov 27, 2022
36d6de8
*** CI TEST ONLY ***
thinkyhead Nov 27, 2022
5ea9c83
I have forgotten these
DerAndere1 Nov 27, 2022
9e536d0
fixup
DerAndere1 Nov 27, 2022
b80ad3d
Use LINEAR_UNIT macro
DerAndere1 Nov 28, 2022
85a9fbd
fix compilation for U axis by adding missing line
DerAndere1 Jan 31, 2023
520c763
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead Feb 4, 2023
8972719
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead Feb 4, 2023
b717a38
M205 cleanup, axis collision
thinkyhead Feb 4, 2023
a6df386
Put deg fr last
thinkyhead Feb 4, 2023
3a6ff52
only Z moved. add TODO note
thinkyhead Feb 4, 2023
1a32823
not really a "script"
thinkyhead Feb 4, 2023
a82c940
bare flag
thinkyhead Feb 4, 2023
4d1dd49
consistent formatting
DerAndere1 Feb 5, 2023
49adfa1
minor sp
thinkyhead Feb 6, 2023
b6cc67d
test MAG_MOUNTED_PROBE
thinkyhead Feb 6, 2023
c44ef8d
Test for 4th axis
thinkyhead Feb 6, 2023
4c47ccc
tweak sanity
thinkyhead Feb 9, 2023
3d4fdbe
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead Feb 9, 2023
e3766df
misc.
thinkyhead Feb 9, 2023
c659629
Return on !MOTION_CONDITIONS
thinkyhead Feb 9, 2023
2f952ed
G2/G3 E-only move as retract/recover
thinkyhead Feb 9, 2023
2d45864
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead Feb 9, 2023
c0410b9
segmented moves fixup
DerAndere1 Feb 11, 2023
77e8ec9
introduce function for distance calculation
DerAndere1 Feb 12, 2023
431454c
Merge branch 'bugfix-2.1.x' into move_rotary_axes_from_LCD
DerAndere1 Mar 6, 2023
3d95c8e
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead Mar 19, 2023
d8668d0
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead May 10, 2023
80df19c
followup
thinkyhead May 10, 2023
4ca4681
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead May 10, 2023
4a96e41
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead May 11, 2023
b016a4a
merge followup
thinkyhead May 11, 2023
a34e13d
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead Jun 2, 2023
1e937ad
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead Jun 2, 2023
9bdcba2
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead Aug 3, 2023
6500fbe
handle e-only moves like moves with linear axes
DerAndere1 Aug 16, 2023
5dbd191
remove conflicting _U
DerAndere1 Oct 15, 2023
b89168f
distinguish between axes and joints
DerAndere1 Oct 16, 2023
8fd78e4
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead Oct 25, 2023
9776cc2
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead Dec 24, 2023
6d13355
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead Jan 22, 2024
431f23c
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead Mar 2, 2024
9dfe654
use regular members
thinkyhead Mar 2, 2024
35626ea
ABC were always "joints"
thinkyhead Mar 2, 2024
952a498
misc. reorg
thinkyhead Mar 2, 2024
a9dfc4b
put back abc aliases
thinkyhead May 6, 2024
a780d6c
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead May 6, 2024
71efd56
fix types, etc.
thinkyhead May 7, 2024
0fc6d4e
Merge branch 'bugfix-2.1.x' into pr/24334
thinkyhead May 7, 2024
178259e
post merge cleanup
thinkyhead May 7, 2024
29cb208
Re-evaluate this change
thinkyhead May 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -1275,10 +1275,16 @@
* M204 P Acceleration
* M204 R Retract Acceleration
* M204 T Travel Acceleration
* M204 I Angular Acceleration
* M204 J Angular Travel Acceleration
*/
#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration for printing moves
#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts
#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves
#define DEFAULT_ACCELERATION 3000 // X, Y, Z ... and E acceleration for printing moves
#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts
#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z ... acceleration for travel (non printing) moves
#if ENABLED(AXIS4_ROTATES)
#define DEFAULT_ANGULAR_ACCELERATION 3000 // I, J, K acceleration for rotational-only printing moves
#define DEFAULT_ANGULAR_TRAVEL_ACCELERATION 3000 // I, J, K acceleration for rotational-only travel (non printing) moves
#endif

/**
* Default Jerk limits (mm/s)
Expand Down
9 changes: 7 additions & 2 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1253,8 +1253,12 @@
#define DISABLE_IDLE_E // Shut down all idle extruders

// Default Minimum Feedrates for printing and travel moves
#define DEFAULT_MINIMUMFEEDRATE 0.0 // (mm/s. °/s for rotational-only moves) Minimum feedrate. Set with M205 S.
#define DEFAULT_MINTRAVELFEEDRATE 0.0 // (mm/s. °/s for rotational-only moves) Minimum travel feedrate. Set with M205 T.
#define DEFAULT_MINIMUMFEEDRATE 0.0 // (mm/s) Minimum feedrate. Set with M205 S.
#define DEFAULT_MINTRAVELFEEDRATE 0.0 // (mm/s) Minimum travel feedrate. Set with M205 T.
#if HAS_ROTATIONAL_AXES
#define DEFAULT_ANGULAR_MINIMUMFEEDRATE 0.0 // (°/s) Minimum feedrate for rotational-only moves. Set with M205 P.
#define DEFAULT_ANGULAR_MINTRAVELFEEDRATE 0.0 // (°/s) Minimum travel feedrate for rotational-only moves. Set with M205 Q.
#endif

// Minimum time that a segment needs to take as the buffer gets emptied
#define DEFAULT_MINSEGMENTTIME 20000 // (µs) Set with M205 B.
Expand Down Expand Up @@ -3975,6 +3979,7 @@
#ifdef G0_FEEDRATE
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
//#define G0_ANGULAR_FEEDRATE 2700 // (°/min)

/**
* Startup commands
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/core/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ typedef IF<TERN0(ABL_USES_GRID, (GRID_MAX_POINTS > 255)), uint16_t, uint8_t>::ty
// Conversion macros
#define MMM_TO_MMS(MM_M) feedRate_t(static_cast<float>(MM_M) / 60.0f)
#define MMS_TO_MMM(MM_S) (static_cast<float>(MM_S) * 60.0f)
#define DPM_TO_DPS(DP_M) feedRate_t(static_cast<float>(DP_M) / 60.0f)
#define DPS_TO_DPM(DP_S) (static_cast<float>(DP_S) * 60.0f)

// Packaged character for C macro and other usage
typedef struct SerialChar { char c; SerialChar(char n) : c(n) { } } serial_char_t;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/tramming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ PGM_P const tramming_point_name[] PROGMEM = { REPLIST_1(_NR_TRAM_NAMES, _TRAM_NA
void move_to_tramming_wait_pos() {
constexpr xyz_pos_t wait_pos = ASSISTED_TRAMMING_WAIT_POSITION;
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Moving away");
do_blocking_move_to(wait_pos, XY_PROBE_FEEDRATE_MM_S);
do_blocking_move_to(wait_pos, XY_PROBE_FEEDRATE_MM_S OPTARG(HAS_ROTATIONAL_AXES, XY_PROBE_FEEDRATE_MM_S));
}

#endif
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/gcode/calibrate/G425.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct measurements_t {
#endif

inline void calibration_move() {
do_blocking_move_to((xyz_pos_t)current_position, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL));
do_blocking_move_to((xyz_pos_t)current_position, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL) OPTARG(HAS_ROTATIONAL_AXES, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL)));
}

/**
Expand Down Expand Up @@ -212,7 +212,7 @@ float measuring_movement(const AxisEnum axis, const int dir, const bool stop_sta
destination = current_position;
for (float travel = 0; travel < limit; travel += step) {
destination[axis] += dir * step;
do_blocking_move_to((xyz_pos_t)destination, mms);
do_blocking_move_to((xyz_pos_t)destination, mms OPTARG(HAS_ROTATIONAL_AXES, mms));
planner.synchronize();
if (read_calibration_pin() == stop_state) break;
}
Expand Down Expand Up @@ -247,7 +247,7 @@ inline float measure(const AxisEnum axis, const int dir, const bool stop_state,
// Move back to the starting position
destination = current_position;
destination[axis] = start_pos;
do_blocking_move_to((xyz_pos_t)destination, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL));
do_blocking_move_to((xyz_pos_t)destination, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL) OPTARG(HAS_ROTATIONAL_AXES, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL)));
return measured_pos;
}

Expand Down
26 changes: 25 additions & 1 deletion Marlin/src/gcode/config/M200-M205.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,13 @@ void GcodeSuite::M203_report(const bool forReplay/*=true*/) {
* P<accel> Printing moves
* R<accel> Retract only (no X, Y, Z) moves
* T<accel> Travel (non printing) moves
*
* With any rotational axes:
* I<accel> Angular printing moves
* J<accel> Angular Travel (non-printing) moves
*/
void GcodeSuite::M204() {
if (!parser.seen("PRST"))
if (!parser.seen("PRST" TERN_(HAS_ROTATIONAL_AXES, "IJ")))
return M204_report();
else {
//planner.synchronize();
Expand All @@ -257,6 +261,10 @@ void GcodeSuite::M204() {
if (parser.seenval('P')) planner.settings.acceleration = parser.value_linear_units();
if (parser.seenval('R')) planner.settings.retract_acceleration = parser.value_linear_units();
if (parser.seenval('T')) planner.settings.travel_acceleration = parser.value_linear_units();
#if HAS_ROTATIONAL_AXES
if (parser.seenval('I')) planner.settings.angular_acceleration = parser.value_float();
if (parser.seenval('J')) planner.settings.angular_travel_acceleration = parser.value_float();
#endif
}
}

Expand All @@ -268,6 +276,10 @@ void GcodeSuite::M204_report(const bool forReplay/*=true*/) {
PSTR(" M204 P"), LINEAR_UNIT(planner.settings.acceleration)
, PSTR(" R"), LINEAR_UNIT(planner.settings.retract_acceleration)
, SP_T_STR, LINEAR_UNIT(planner.settings.travel_acceleration)
#if HAS_ROTATIONAL_AXES
, PSTR(" I"), planner.settings.angular_acceleration
, PSTR(" J"), planner.settings.angular_travel_acceleration
#endif
);
}

Expand Down Expand Up @@ -296,6 +308,10 @@ void GcodeSuite::M204_report(const bool forReplay/*=true*/) {
*
* Without CLASSIC_JERK:
* J(mm) : Junction Deviation
*
* With any rotational axes
* P<°/s> : Min Angular Feed Rate
* Q<°/s> : Min Angular Travel Feed Rate
*/
void GcodeSuite::M205() {
if (!parser.seen_any()) return M205_report();
Expand All @@ -304,6 +320,10 @@ void GcodeSuite::M205() {
if (parser.seenval(M205_MIN_SEG_TIME_PARAM)) planner.settings.min_segment_time_us = parser.value_ulong();
if (parser.seenval('S')) planner.settings.min_feedrate_mm_s = parser.value_linear_units();
if (parser.seenval('T')) planner.settings.min_travel_feedrate_mm_s = parser.value_linear_units();
#if HAS_ROTATIONAL_AXES
if (parser.seenval('P')) planner.settings.min_feedrate_deg_s = parser.value_float();
if (parser.seenval('Q')) planner.settings.min_travel_feedrate_deg_s = parser.value_float();
#endif
#if HAS_JUNCTION_DEVIATION
if (parser.seenval('J')) {
const float junc_dev = parser.value_linear_units();
Expand Down Expand Up @@ -356,6 +376,10 @@ void GcodeSuite::M205_report(const bool forReplay/*=true*/) {
PSTR(" M205 " M205_MIN_SEG_TIME_STR), LINEAR_UNIT(planner.settings.min_segment_time_us)
, PSTR(" S"), LINEAR_UNIT(planner.settings.min_feedrate_mm_s)
, SP_T_STR, LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s)
#if HAS_ROTATIONAL_AXES
, SP_P_STR, planner.settings.min_feedrate_deg_s
, PSTR(" Q"), planner.settings.min_travel_feedrate_deg_s
#endif
#if HAS_JUNCTION_DEVIATION
, PSTR(" J"), LINEAR_UNIT(planner.junction_deviation_mm)
#endif
Expand Down
7 changes: 5 additions & 2 deletions Marlin/src/gcode/feature/camera/M240.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ void GcodeSuite::M240() {

feedRate_t fr_mm_s = parser.feedrateval('F');
if (fr_mm_s) NOLESS(fr_mm_s, 10.0f);
#if HAS_ROTATIONAL_AXES
const feedRate_t fr_deg_s = LINEAR_UNIT(fr_mm_s);
#endif

constexpr xyz_pos_t photo_position = PHOTO_POSITION;
xyz_pos_t raw = {
Expand All @@ -152,7 +155,7 @@ void GcodeSuite::M240() {
(parser.seenval('Z') ? parser.value_linear_units() : photo_position.z) + current_position.z
};
apply_motion_limits(raw);
do_blocking_move_to(raw, fr_mm_s);
do_blocking_move_to(raw, fr_mm_s OPTARG(HAS_ROTATIONAL_AXES, fr_deg_s));

#ifdef PHOTO_SWITCH_POSITION
constexpr xy_pos_t photo_switch_position = PHOTO_SWITCH_POSITION;
Expand Down Expand Up @@ -187,7 +190,7 @@ void GcodeSuite::M240() {
const millis_t timeout = millis() + parser.intval('P', PHOTO_DELAY_MS);
while (PENDING(millis(), timeout)) idle();
#endif
do_blocking_move_to(old_pos, fr_mm_s);
do_blocking_move_to(old_pos, fr_mm_s OPTARG(HAS_ROTATIONAL_AXES, fr_deg_s));
#ifdef PHOTO_RETRACT_MM
e_move_m240(rval, sval);
#endif
Expand Down
12 changes: 9 additions & 3 deletions Marlin/src/gcode/feature/pause/G61.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,19 @@ void GcodeSuite::G61() {
if (!TEST(saved_slots[slot >> 3], slot & 0x07)) return;

// Apply any given feedrate over 0.0
REMEMBER(saved, feedrate_mm_s);
REMEMBER(saved_fr, feedrate_mm_s);
#if HAS_ROTATIONAL_AXES
REMEMBER(saved_afr, feedrate_deg_s);
#endif
const float fr = parser.linearval('F');
if (fr > 0.0) feedrate_mm_s = MMM_TO_MMS(fr);
if (fr > 0.0f) {
feedrate_mm_s = fr;
TERN_(HAS_ROTATIONAL_AXES, feedrate_deg_s = LINEAR_UNIT(fr));
}

if (!parser.seen_axis()) {
DEBUG_ECHOLNPGM("Default position restore");
do_blocking_move_to(stored_position[slot], feedrate_mm_s);
do_blocking_move_to(stored_position[slot], feedrate_mm_s OPTARG(HAS_ROTATIONAL_AXES, feedrate_deg_s));
SYNC_E(stored_position[slot].e);
}
else {
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ void GcodeSuite::get_destination_from_command() {

if (parser.floatval('F') > 0) {
feedrate_mm_s = parser.value_feedrate();
TERN_(HAS_ROTATIONAL_AXES, feedrate_deg_s = LINEAR_UNIT(feedrate_mm_s));
// Update the cutter feed rate for use by M4 I set inline moves.
TERN_(LASER_FEATURE, cutter.feedrate_mm_m = MMS_TO_MMM(feedrate_mm_s));
}
Expand Down
30 changes: 24 additions & 6 deletions Marlin/src/gcode/motion/G0_G1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ extern xyze_pos_t destination;

#if ENABLED(VARIABLE_G0_FEEDRATE)
feedRate_t fast_move_feedrate = MMM_TO_MMS(G0_FEEDRATE);
#if HAS_ROTATIONAL_AXES
feedRate_t fast_move_angular_feedrate = DPM_TO_DPS(G0_ANGULAR_FEEDRATE);
#endif
#endif

/**
Expand All @@ -51,23 +54,35 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {

#ifdef G0_FEEDRATE
feedRate_t old_feedrate;
#if HAS_ROTATIONAL_AXES
feedRate_t old_angular_feedrate;
#endif
#if ENABLED(VARIABLE_G0_FEEDRATE)
if (fast_move) {
old_feedrate = feedrate_mm_s; // Back up the (old) motion mode feedrate
feedrate_mm_s = fast_move_feedrate; // Get G0 feedrate from last usage
old_feedrate = feedrate_mm_s; // Back up the (old) motion mode feedrate
feedrate_mm_s = fast_move_feedrate; // Get G0 feedrate from last usage
#if HAS_ROTATIONAL_AXES
old_angular_feedrate = feedrate_deg_s; // Back up the (old) motion mode angular feedrate
feedrate_deg_s = fast_move_angular_feedrate; // Get G0 angular feedrate from last usage with rotational axes
#endif
}
#endif
#endif

get_destination_from_command(); // Get X Y [Z[I[J[K]]]] [E] F (and set cutter power)
get_destination_from_command(); // Get X Y [Z[I[J[K]]]] [E] F (and set cutter power)

#ifdef G0_FEEDRATE
if (fast_move) {
#if ENABLED(VARIABLE_G0_FEEDRATE)
fast_move_feedrate = feedrate_mm_s; // Save feedrate for the next G0
fast_move_feedrate = feedrate_mm_s; // Save feedrate for the next G0
TERN_(ROTATIONAL_AXES, fast_move_angular_feedrate = feedrate_deg_s); // Save angular feedrate for the next G0
#else
old_feedrate = feedrate_mm_s; // Back up the (new) motion mode feedrate
feedrate_mm_s = MMM_TO_MMS(G0_FEEDRATE); // Get the fixed G0 feedrate
old_feedrate = feedrate_mm_s; // Back up the (new) motion mode feedrate
feedrate_mm_s = MMM_TO_MMS(G0_FEEDRATE); // Get the fixed G0 feedrate
#if HAS_ROTATIONAL_AXES
old_angular_feedrate = feedrate_deg_s; // Back up the (new) motion mode angular feedrate
feedrate_deg_s = DPM_TO_DPS(G0_ANGULAR_FEEDRATE); // Get the fixed G0 angular feedrate
#endif
#endif
}
#endif
Expand Down Expand Up @@ -100,6 +115,9 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
#ifdef G0_FEEDRATE
// Restore the motion mode feedrate
if (fast_move) feedrate_mm_s = old_feedrate;
#if HAS_ROTATIONAL_AXES
if (fast_move) feedrate_deg_s = old_angular_feedrate;
#endif
#endif

#if ENABLED(NANODLP_Z_SYNC)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/motion/G2_G3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void plan_arc(
}

// Feedrate for the move, scaled by the feedrate multiplier
const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
const feedRate_t scaled_fr_mm_s = FR_SCALED(feedrate_mm_s);

// Get the ideal segment length for the move based on settings
const float ideal_segment_mm = (
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/motion/G5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void GcodeSuite::G5() {
{ parser.linearval('P'), parser.linearval('Q') }
};

cubic_b_spline(current_position, destination, offsets, MMS_SCALED(feedrate_mm_s), active_extruder);
cubic_b_spline(current_position, destination, offsets, FR_SCALED(feedrate_mm_s), active_extruder OPTARG(HAS_ROTATIONAL_AXES, FR_SCALED(feedrate_deg_s)));
current_position = destination;
}
}
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/gcode/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ class GCodeParser {

#else

static float axis_unit_factor(const AxisEnum) { return 1.0f; }

static constexpr float mm_to_linear_unit(const_float_t mm) { return mm; }
static constexpr float mm_to_volumetric_unit(const_float_t mm) { return mm; }

Expand Down
8 changes: 7 additions & 1 deletion Marlin/src/gcode/probe/G38.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ inline bool G38_run_probe() {
planner.synchronize();

REMEMBER(fr, feedrate_mm_s, feedrate_mm_s * 0.25);
#if HAS_ROTATIONAL_AXES
REMEMBER(angular_fr, feedrate_deg_s, feedrate_deg_s * 0.25);
#endif

// Bump the target more slowly
destination -= retract_mm * 2;
Expand Down Expand Up @@ -116,7 +119,10 @@ void GcodeSuite::G38(const int8_t subcode) {
// If any axis has enough movement, do the move
LOOP_NUM_AXES(i)
if (ABS(destination[i] - current_position[i]) >= G38_MINIMUM_MOVE) {
if (!parser.seenval('F')) feedrate_mm_s = homing_feedrate((AxisEnum)i);
if (!parser.seenval('F')) {
feedrate_mm_s = homing_feedrate((AxisEnum)i);
TERN_(HAS_ROTATIONAL_AXES, feedrate_deg_s = homing_feedrate((AxisEnum)i));
}
// If G38.2 fails throw an error
if (!G38_run_probe() && error_on_fail) SERIAL_ERROR_MSG("Failed to reach target");
break;
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,9 @@
#else
#define ROTATIONAL_AXES 0
#endif
#if ROTATIONAL_AXES
#define HAS_ROTATIONAL_AXES 1
#endif

#if ROTATIONAL_AXES
#define HAS_ROTATIONAL_AXES 1
Expand Down
12 changes: 9 additions & 3 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,14 +856,20 @@ void MarlinUI::init() {
// previous invocation is being blocked. Modifications to offset shouldn't be made while
// processing is true or the planner will get out of sync.
processing = true;
prepare_internal_move_to_destination(fr); // will set current_position from destination
prepare_internal_move_to_destination(fr OPTARG(HAS_ROTATIONAL_AXES, fr)); // will set current_position from destination
processing = false;

#else

#if HAS_ROTATIONAL_AXES
PlannerHints hints;
hints.fr_deg_s = fr;
#endif

// For Cartesian / Core motion simply move to the current_position
planner.buffer_line(current_position, fr,
TERN_(MULTI_E_MANUAL, axis == E_AXIS ? e_index :) active_extruder
planner.buffer_line(current_position, fr
, TERN_(MULTI_E_MANUAL, axis == E_AXIS ? e_index :) active_extruder
OPTARG(HAS_ROTATIONAL_AXES, hints)
);

//SERIAL_ECHOLNPGM("Add planner.move with Axis ", C(AXIS_CHAR(axis)), " at FR ", fr_mm_s);
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/menu/menu_motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void lcd_move_axis(const AxisEnum axis) {
}
#endif

// Get the new position
// Get the new mm / degree position
const float diff = float(int32_t(ui.encoderPosition)) * ui.manual_move.menu_scale;
(void)ui.manual_move.apply_diff(axis, diff, min, max);
ui.manual_move.soon(axis);
Expand All @@ -78,7 +78,7 @@ void lcd_move_axis(const AxisEnum axis) {
if (ui.should_draw()) {
MenuEditItemBase::itemIndex = axis;
const float pos = ui.manual_move.axis_value(axis);
if (parser.using_inch_units() && !parser.axis_is_rotational(axis)) {
if (parser.axis_unit_factor(axis) != 1.0f && !parser.axis_is_rotational(axis)) {
const float imp_pos = parser.per_axis_value(axis, pos);
MenuEditItemBase::draw_edit_screen(GET_TEXT_F(MSG_MOVE_N), ftostr63(imp_pos));
}
Expand Down Expand Up @@ -163,7 +163,7 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int
#endif
#define __MOVE_SUB(L,T,D) if (rotational[axis] || _LINEAR_LIMIT(D)) SUBMENU_S(F(T), L, []{ _goto_manual_move(D); })

if (rotational[axis]) {
if (parser.axis_is_rotational(axis)) {
#ifdef MANUAL_MOVE_DISTANCE_DEG
#define _MOVE_DEG(D) __MOVE_SUB(MSG_MOVE_N_DEG, STRINGIFY(D), D);
MAP(_MOVE_DEG, MANUAL_MOVE_DISTANCE_DEG)
Expand Down
Loading