MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.28k stars 19.23k forks source link

[BUG] Build fails after "🔧 Allow use of a minimal Config.h" #27410

Open oliof opened 2 months ago

oliof commented 2 months ago

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

Yes, and the problem still exists.

Bug Description

I have an existing custom configuration for a machine that worked before https://github.com/MarlinFirmware/Marlin/pull/27338. As pointed out in https://github.com/MarlinFirmware/Marlin/pull/27338#issuecomment-2288202351, 27338 breaks previously working configs

Bug Timeline

started with PR 27346

Expected behavior

I expect my config.ini based configuration to continue to work.

Actual behavior

build breaks

Steps to Reproduce

No response

Version of Marlin Firmware

2.1.-bugfix

Printer model

RatRig V-Minion

Electronics

SKR2

LCD/Controller

Mellow 12864 Mini

Other add-ons

TMC2209 steppers

Bed Leveling

ABL Bilinear mesh

Your Slicer

Cura

Host Software

OctoPrint

Don't forget to include

Additional information & file uploads

Since this is a build breakage, I am not including information from the printer. This issue persists including and up to commit id b94a0d036c843b59488a4de77c1de8cf6e9e5863

I have added my config.ini, and the generated Configuration.h Configuration_adv.h files in configs.zip and a buildlog from running pio run -e STM32F407VG_btt_USB &> buildlog.txt.

configs.zip buildlog.txt

ellensp commented 2 months ago

I cannot replicate this.

steps used: Get a clean current copy of Marlin bugfix 2.1.x extract only the config.ini form provided configs.zip into Marlin directory (same directory as Configuration.h) Edit config.ini replacing the line ini_use_config = disable all with ini_use_config = all

From a platformio new terminal run "pio run -e STM32F407VG_btt"

This updates the Configuration.h and Configuration_adv.h files from config.ini and builds fine.

NOTE:

I notice in the provided Configuration.h from configs.zip has the line #define HAS_MICROSTEPS true // Added by config.ini 2024-09-09 11:50:24

This is the cause of the build error listed, but this line is not in my populated Configuration.h generated from the attached config.ini

I also tested 69f69606e6759b3e53ca05f7aa8ed62eb9a4b34d ie before commit in question and 986344640f186337d92e5e02b55953f19ffbdd1a the commit in question. No issues found.

thisiskeithb commented 1 month ago

I don't use the config.ini method for configuring Marlin, but I confirmed that the provided configs fails when I dropped config.ini, Configuration.h, and Configuration_adv.h onto a current copy of bugfix-2.1.x:

Marlin/src/module/stepper.cpp: In static member function 'static void Stepper::microstep_init()':
Marlin/src/module/stepper.cpp:4102:46: error: 'MICROSTEP_MODES' was not declared in this scope
 4102 |     static const uint8_t microstep_modes[] = MICROSTEP_MODES;
      |                                              ^~~~~~~~~~~~~~~
*** [.pio/build/STM32F407VG_btt_USB/src/src/module/stepper.cpp.o] Error 1
==================================== [FAILED] Took 54.89 seconds ====================================

Environment          Status    Duration
-------------------  --------  ------------
STM32F407VG_btt_USB  FAILED    00:00:54.888
=============================== 1 failed, 0 succeeded in 00:00:54.888 ===============================

If I revert Configuration.h & Configuration_adv.h to stock and modify config.ini as ellensp noted above, that #define HAS_MICROSTEPS true line is not added and the firmware builds fine.

So why/how does that #define HAS_MICROSTEPS true line get added in on OP's build? I don't know.

On our Configuring with INI page, there's a note that:

the behavior of this feature is likely to change as we continue to experiment and find new ways to use it, so consult the codebase for the most up to date information.

So it's really still a beta feature and quite brittle since there's no error checking/cleaning of old values & you'll have to regenerate a working config.ini using a current clean config (that hasn't been previously generated/modified by build scripts).