Skip to content

FTM: use last_direction_bits and axis did_move for direction and motion#28331

Open
narno2202 wants to merge 8 commits intoMarlinFirmware:bugfix-2.1.xfrom
narno2202:Motion_Dir
Open

FTM: use last_direction_bits and axis did_move for direction and motion#28331
narno2202 wants to merge 8 commits intoMarlinFirmware:bugfix-2.1.xfrom
narno2202:Motion_Dir

Conversation

@narno2202
Copy link
Copy Markdown
Contributor

Description

The goal is to use the already defined variables axis_did_move and last_direction_bits with FT_MOTION.

  1. axis_did_move replace axis_moving_flags as is.
  2. last_directions_bits replace axis_move_dir as is but it's updated if necessary on every call to ftMotion.stepper().
  3. Add a preprocessor directive for discard_current_block() in stepper.h, as it's utilized only with standard motion.

Changes are independent of the printer type and now common to the 2 motion systems.
This change allows universal axis_is_moving(const AxisEnum real) and axis_direction(const AxisEnum real) functions.

It's totally transparent for people having only FT_MOTION as a motion system; it diminishes flash size if you have both motion systems.

Requirements

Benefits

Configurations

Related Issues

None

@narno2202
Copy link
Copy Markdown
Contributor Author

narno2202 commented Feb 11, 2026

CI fails for Rambo with "The data size (8847 bytes) is greater than maximum allowed (8192 bytes)".
Perhaps

#define FTM_BUFFER_SIZE             128   // Window size for trajectory generation, must be a power of 2 (e.g 64, 128, 256, ...)
                                            // The total buffered time in seconds is (FTM_BUFFER_SIZE/FTM_FS)
#define FTM_FS                     1000   // (Hz) Frequency for trajectory generation.
#define FTM_MIN_SHAPE_FREQ           20   // (Hz) Minimum shaping frequency, lower consumes more RAM 

should be adapted in the test build for this motherboard.
With my config,RAM size is the same with this PR and current bugfix, only flash size is lower with this PR.

@oliof
Copy link
Copy Markdown
Contributor

oliof commented Feb 11, 2026

Setting FTM_BUFFER_SIZE to 64 and FTM_MIN_SHAPE_FREQ TO 35 should clear enough RAM for ATMEGA2560

@thinkyhead thinkyhead force-pushed the bugfix-2.1.x branch 4 times, most recently from 1bc0732 to 72c7874 Compare March 27, 2026 20:33
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