Marlin icon indicating copy to clipboard operation
Marlin copied to clipboard

[BUG] Input shaping causes build failure on STM32F070RB_malyan environment

Open plampix opened this issue 5 months ago • 0 comments

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

It's not possible to build Marlin for STM32F070RB_malyan with INPUT_SHAPING_X/INPUT_SHAPING_Y (and probably Z as well) enabled.

Building fails with the following message:

Compiling .pio/build/STM32F070RB_malyan/src/src/core/serial.cpp.o In file included from Marlin/src/inc/MarlinConfigPre-1-axes.h:40, from Marlin/src/inc/Conditionals-1-axes.h:32, from Marlin/src/inc/MarlinConfigPre.h:27, from Marlin/src/inc/MarlinConfigPre-5-post.h:24, from Marlin/src/inc/Conditionals-5-post.h:32, from Marlin/src/inc/MarlinConfigPre-6-type.h:24, from Marlin/src/inc/Conditionals-6-type.h:33, from Marlin/src/inc/MarlinConfig.h:28, from Marlin/src/MarlinCore.h:24, from Marlin/src/MarlinCore.cpp:31: Marlin/src/inc/../core/macros.h:380:27: error: call to non-'constexpr' function 'float floorf(float)' 380 | #define FLOOR(x) floorf(x) | ~~~~~~^~~ Marlin/src/module/stepper.h:166:39: note: in expansion of macro 'FLOOR' 166 | constexpr uint16_t shaping_echoes = FLOOR(max_step_rate / shaping_min_freq / 2) + 3; | ^~~~~ In file included from Marlin/src/MarlinCore.cpp:51: Marlin/src/module/stepper.h:179:41: error: size of array 'times' is not an integral constant-expression 179 | static shaping_time_t times[shaping_echoes]; | ^~~~~~~~~~~~~~ Marlin/src/module/stepper.h:180:45: error: size of array 'echo_axes' is not an integral constant-expression 180 | static shaping_echo_axis_t echo_axes[shaping_echoes]; | ^~~~~~~~~~~~~~ *** [.pio/build/STM32F070RB_malyan/src/src/MarlinCore.cpp.o] Error 1

On discord, Dust provided a solution: Dust: issue is FLOOR is floorf(x) and floorf is not a constexpr, so cannot be used as such Dust: change constexpr uint16_t shaping_echoes = FLOOR(max_step_rate / shaping_min_freq / 2) + 3; Dust: to constexpr uint16_t shaping_echoes = std::floor(max_step_rate / shaping_min_freq / 2) + 3;

(applied in Marlin/src/module/stepper.h)

Which does seem to resolve the issue for me, but is probably only necessary for certain HALs.

Bug Timeline

New issue, started when I switched to bugfix-2.1.x. Builds fine on 2.1.x

Expected behavior

Succesful build.

Actual behavior

Failed build

Steps to Reproduce

Build Marlin for a BOARD_MALYAN_M200_V2 board with INPUT_SHAPING_X and/or INPUT_SHAPING_Y enabled.

Version of Marlin Firmware

bugfix-2.1.x

Printer model

Monoprice Mini Select V2

Electronics

Stock

LCD/Controller

Weird ESP based thingy on serial.

Other add-ons

No response

Bed Leveling

None

Your Slicer

Prusa Slicer

Host Software

OctoPrint

Don't forget to include

  • [x] A ZIP file containing your Configuration.h and Configuration_adv.h.

Additional information & file uploads

Configuration.zip

plampix avatar Jun 10 '25 22:06 plampix