Skip to content

Conversation

@DerAndere1
Copy link
Contributor

@DerAndere1 DerAndere1 commented Oct 4, 2025

Description

Add option FEEDRATE_MODE_SUPPORT. When this option is enabled, the following G-codes are supported:

  • G93 (inverse time mode): Feedrate (Value of the F word) is specified in strokes per minute.
  • G94 (units per minute feedrate mode (default)

Background:

So far, Marlin only supported feedrate specified in units per minute (G94). Marlin uses the LinuxCNC definition of feedrate (

/**
* Calculate distance for feedrate interpretation in accordance with NIST RS274NGC interpreter - version 3) and its default CANON_XYZ feed reference mode.
* Assume:
* - X, Y, Z are the primary linear axes;
* - U, V, W are secondary linear axes;
* - A, B, C are rotational axes.
*
* Then:
* - dX, dY, dZ are the displacements of the primary linear axes;
* - dU, dV, dW are the displacements of linear axes;
* - dA, dB, dC are the displacements of rotational axes.
*
* The time it takes to execute a move command with feedrate F is t = D/F,
* plus any time for acceleration and deceleration.
* Here, D is the total distance, calculated as follows:
*
* D^2 = dX^2 + dY^2 + dZ^2
* if D^2 == 0 (none of XYZ move but any secondary linear axes move, whether other axes are moved or not):
* D^2 = dU^2 + dV^2 + dW^2
* if D^2 == 0 (only rotational axes are moved):
* D^2 = dA^2 + dB^2 + dC^2
*/
). Feedrate in units per minute is not very intuitive if more than 3 axes are involved. Thus, G93 inverse time mode is usually preferred for multi-axis machining.

Example:

G90 ; absolute positioning
G1 X0 Y0 ; move to X0 Y0
G93 ; inverse time mode
G1 X10 F60 ; this move takes 1/60 minutes, i.e. 1 second
G1 X5 F60 ; this move takes in 1/60 minutes, i.e. 1 second
G1 X10 F10 ; this move takes 1/10 minutes, i.e.  6 seconds

Caveats:

  • Currently, fixed time motion (FT_MOTION) will probably not work correctly when G93 inverse time mode is active.
  • Currently, in G93 mode, each move will be completed in ((1/F) minutes + time for acceleration + time for deceleration). It would be a further improvement if each move (including acceleration and deceleration) completes in (1/F) minutes.

Requirements

#define FEEDRATE_MODE_SUPPORT

Benefits

Support for G93 inverse time feedrate mode. This mode is preferred in multi-axis machining.

Configurations

Enable this new option in the default Configuration.h:
#define FEEDRATE_MODE_SUPPORT

Related Issues

@GMagician
Copy link
Contributor

I think this will implement what required here #8290.
Just one doubt because AFAIK in standard CNC feedrate doesn't consider acc/dec, it is constant velocity target while interpolating or I am wrong?

@DerAndere1
Copy link
Contributor Author

The following discussion indicates that my current implementation indeed behaves like LinuxCNC with regards to acceleration and deceleration: https://forum.linuxcnc.org/20-g-code/50870-inverse-time-feed-g93-ignored-with-4th-rotary-axis . Source code of Grbl planner.c also indicates that Grbl behaves the same.

@DerAndere1 DerAndere1 force-pushed the feedrate_mode branch 2 times, most recently from 0ab3d74 to 59af653 Compare October 9, 2025 19:55
@DerAndere1
Copy link
Contributor Author

Extended to work with G2/G3. I tested various combinations of G93, G94, G0, G1 and G2 with FEEDRATE_MODE_SUPPORT, G0_FEEDRATE and ARC_SUPPORT enabled on real hardware.

@DerAndere1 DerAndere1 force-pushed the feedrate_mode branch 7 times, most recently from c48d8d5 to ea39b62 Compare October 14, 2025 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants