Skip to content

[BUG] mc-apply script doesn't function #27612

@CRCinAU

Description

@CRCinAU

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

Yes, and the problem still exists.

Bug Description

If CONFIGURATION_EMBEDDING is enabled, the M503 C command will write MC.ZIP to the printers SD card with the compile time settings used.

According to docs/ConfigEmbedding.md, the following should be used to then apply that config template back to the .h files:

$ git checkout -f
$ unzip mc.zip
$ python buildroot/share/PlatformIO/scripts/mc-apply.py

When attempting this, the script always returns:

$ python3 ../buildroot/share/PlatformIO/scripts/mc-apply.py 
No marlin_config.json found.

Removing the main try / except block, I get:

$ python3 buildroot/share/PlatformIO/scripts/mc-apply.py 
Traceback (most recent call last):
  File "/home/netwiz/git/Marlin/buildroot/share/PlatformIO/scripts/mc-apply.py", line 22, in <module>
    for k, v in sorted(conf[key].items()):
                       ^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'items'

When adding a debug to see what key contains, I see:

$ python3 buildroot/share/PlatformIO/scripts/mc-apply.py 
Key: Z_SAFE_HOMING_X_POINT
Traceback (most recent call last):
  File "/home/netwiz/git/Marlin/buildroot/share/PlatformIO/scripts/mc-apply.py", line 23, in <module>
    for k, v in sorted(conf[key].items()):
                       ^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'items'

As a result, no configuration files are modified and the marlin_config.json file cannot be folded back into the configuration.

Bug Timeline

Likely a while.

Expected behavior

The script should restore config settings from marlin_config.json to the related .h files.

Actual behavior

Error in output.

Steps to Reproduce

See main description.

Version of Marlin Firmware

bugfix-2.1.x

Printer model

No response

Electronics

No response

LCD/Controller

No response

Other add-ons

No response

Bed Leveling

None

Your Slicer

None

Host Software

None

Don't forget to include

  • A ZIP file containing your Configuration.h and Configuration_adv.h.

Additional information & file uploads

Added example marlin_config.json as per output of M503 C.
marlin_config.json

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions