Python Marlin Configurator to make valid configuration files to be used to compile Marlin with.

Overview

marlin-configurator

Concept originally imagined by The-EG using PowerShell

Build Script for Marlin Configurations

The purpose of this project is to partially eliminate the most common configuration questions for compiling Marlin by providing a mechanism to create configuration files based on an existing Marlin Configuration example. It can also work with local files through options.

Changes to Marin Configuration Directives

Marlin is constantly adding, removing, and changing directives in the configuration files. Even within the same bugfix branch between releases these can change. It is up to the user to be aware of and maintain these options. Not all of the directives are in the Marlin Configuration (.h) files and there are definately some that are valid to be added (such as a PIN reference for a feature).

Configurations

This code will pull an example from the live Marlin Configurations Repo: https://github.com/MarlinFirmware/Configurations

Included Examples

There is an example.json included in this repo under the user directory. Eventually we will write a parser to automatically traverse the Marlin Configurations Repo and kick out a series of example json files that are identical to the stock examples from Marlin. From there you can add/remove as you see fit. This directory structure will mimick that of the Marlin Configurations repo(s).

Pre-tested Configurations for Marlin Firmware

The user community can contribute their .json files to the repo under the contrib folder.

Command-Line Arguments

Defer to py marlin-configurator.py --help for assistance with all of the command line arguments.

Argument Configuration File

Online Reference: Python Argparse

filename: marlin-configurator.ini

** USING THIS FILE WILL IGNORE ALL OTHER PASSED PARAMETERS **

This file can be used in place of using command-line arguments. The format of the file is:

--option
option_value

For example, if you wanted to enable --silent by default (the default is False) your file would look like this:

--silent
True

JSON Configuration File

JSON Configuration File called with argument --config [JSON_CONFIG_FILE] or from marlin-configurator.ini.

Section Subsection Options Purpose
settings default configuration for the environment when not using command-line parameters.
targetdir path_to_directory directory where the resulting modified configuration files go
silent True/False suppresses verbose output during configuration changes
prefer args/config _when arguements conflict, defines what source is preferred, args or config
useExample which example configuration to use and which files to copy.
branch which branch to pull example configuration files from
path path inside the branch
files array of the names of the files
options directives adjusted in Configuration.h and Configuration_Adv.h.
enable directives to enable (if disabled)
disable directives to disable (if enabled)
values directives to enable (if disabled) and replace value

Example JSON Configuration

{  
  "settings": {
    "silent" : true,
    "targetdir" : "user/custom_configs",
    "prefer": "args"
  },
  "useExample": {
    "branch" : "bugfix-2.0.x",
    "path" : "Creality/CR-10 S5/CrealityV1",
    "files" : ["Configuration.h","Configuration_adv.h","_Bootscreen.h","_Statusscreen.h"]
  },
  "options": {
    "enable": {
      "SHOW_BOOTSCREEN" : true,
      "SHOW_CUSTOM_BOOTSCREEN" : true,
      "CUSTOM_STATUS_SCREEN_IMAGE" : true,
      "PID_BED_DEBUG" : true,
      "S_CURVE_ACCELERATION" : true,
      "ARC_P_CIRCLES" : true
    },
    "disable": {
      "JD_HANDLE_SMALL_SEGMENTS" : false,
      "PROBE_MANUALLY" : false,
      "G26_MESH_VALIDATION" : false,
      "LEVEL_BED_CORNERS" : false
    },
    "values": {
      "STRING_CONFIG_H_AUTHOR": "\"(devpeeps.com, James Swart)\"",
      "CUSTOM_MACHINE_NAME": "\"CR-10 S5\"",
      "MACHINE_UUID": "\"cede2a2f-41a2-4748-9b12-c55c62f367ff\"",
      "TEMP_SENSOR_BED" : "5",
      "DEFAULT_Kp" : "24.9685",
      "DEFAULT_Ki" : "2.0183",
      "DEFAULT_Kd" : "77.2068"
    }
  }
}

Structure (Files & Directories)

Name Type Purpose
contrib Dir JSON Configuration files provided by the community.
examples Dir Direct extractions of the Marlin Configuration Repo(s).
legacy Dir Legacy Code which is no longer maintained.
user Dir Your JSON Configuration files for your printers.
README.md File README for the project.
marlin-configurator.ini File Command-Line Argument Configuration File.
marlin-configurator.py File Python program for this project.

Requirements

  • Marlin Build Environment (has Python already) or python environment. Developed using Python 3.8.10 (last 3.8 release with a binary).

Troubleshooting & Help

Please do not reach out to individuals for assistance with this project. Use the Issues section if you run into problems. Most likely we can be found on the Marlin Discord somewhere. This is not officially a marlin sponsored project - yet. If it ever is, it will become it's own project/repo in Marlin and maintained there.

Comments
  • port to python

    port to python

    After discussion with @the-eg and @p3p it makes the most sense to port this to python.. since anyone who is going to use the output of this to compile marlin.. will already have python installed.

    development 
    opened by mydevpeeps 14
  • PlatformIO Environment Config

    PlatformIO Environment Config

    Right now the code just assumes PlatformIO is installed and in the default user profile location. If it's not there it will just fail to build.

    Change behavior so if it can't find it there, throw an error.

    Make an option to define the PlatformIO environment location in JSON settings section.

    bug 
    opened by mydevpeeps 4
  • add --createdir option

    add --createdir option

    This option will create the marlin root directory if it does not exist. It will pull down the branch as defined in either the JSON or --branch flag. If neither are specified it will throw an error if using this flag.

    enhancement 
    opened by mydevpeeps 3
  • inject configurator into top of modified files

    inject configurator into top of modified files

    I think it is important to inject metadata into the to of the modified .h files with the metadata from the run so there is evidence of not only a tool was used on it, it also doubles as a "how-to" should they want to get that config again.

    enhancement 
    opened by mydevpeeps 2
  • Sanitize --buildargs input

    Sanitize --buildargs input

    From discord:

    platformio.ini
     build_flags = 
      -DPWM_FREQUENCY=(168*10^6)/(2*255*1)
    

    need to adjust logic of build commands to accommodate special characters and math objects.

    bug 
    opened by mydevpeeps 2
  • more sanity checking around build w/jason w/o args

    more sanity checking around build w/jason w/o args

    when values are set in the json settings but there is nothing passed on the commandline it triggers a conflict error. using --preferargs after that allows it to continue on with broken values and the build fails.

    bug development 
    opened by mydevpeeps 2
  • conflicting marlin root path

    conflicting marlin root path

    When there is a different marlin root path defined in the json config and the command line arg, the command-line arg wins regardless of --preferargs. It should throw an error forcing use of the --preferargs flag.

    development 
    opened by mydevpeeps 2
  • store mapping of which directive sections

    store mapping of which directive sections

    parse the configuration file prior to modification to create a map of which directives are in which sections. store them into a new json file with the config version as the name for future reference..

    enhancement wontfix 
    opened by mydevpeeps 1
  • move configuration out of json and into .ini structure

    move configuration out of json and into .ini structure

    the new python module argparse has its own mechanism for reading in conf settings for the flags. this actually helps a lot since one of the flags is the JSON config file.. created a bit of a catch-22 for me. This way the configuration for flags set by command-line arguments are seperated from the configuration for parsing.

    development 
    opened by mydevpeeps 1
  • add --mode (batch|interactive) option

    add --mode (batch|interactive) option

    In batch mode everything that would default to throwing an error, that is a logic choice, will default to the behavior that would allow it to progress. An example might be to add a missing directive automatically or enable --skipmissing. Or, there is a config conflict and the default action is to force an option, it might default to--preferargs rather than exit.

    In interactive mode everything that causes an error or has a conflict will ask for a choice instead of forcing the command to be rerun with an argument.

    enhancement 
    opened by mydevpeeps 1
  • add --prefer (conf|args) option

    add --prefer (conf|args) option

    similar to the --preferargs flag, add a --preferconf flag that would allow the override in the other direction, using what is in the json config file instead of the command-line.

    enhancement 
    opened by mydevpeeps 1
  • Inform on already enabled / disabled directives

    Inform on already enabled / disabled directives

    If moving through the logic we are asked to enable an already enabled, or disable an already disabled directive, display a message and skip that item.

    development 
    opened by mydevpeeps 0
  • Convert code to use the new json format

    Convert code to use the new json format

    Used the config to json script to convert my existing config into the new format. Added the old format to the end of it. Working on the code now to parse it ... then will start working on the offsets.

    development 
    opened by mydevpeeps 0
  • separate default values from global values

    separate default values from global values

    currently unable to determine if a global value is a default or a conf (json) value if the json value has the same value as the default. need to define an array of what the defaults are as a constant that never changes so i can compare the values.

    development 
    opened by mydevpeeps 0
  • Support multiple JSON input files

    Support multiple JSON input files

    The idea is to have a main JSON File, and then other smaller files with a specific purpose.

    They will be processed in the order they are created.

    An example might be the stock creality cr10 s5 from the repo... with your changes... a month goes by and you want to add a bltouch. So you find a bltouch.json in contrib and include it...

    enhancement 
    opened by mydevpeeps 0
  • config to json library

    config to json library

    need to write a fully functional library that will allow the two config files to be converted into a json, that can later be used to create new configuration files from.

    development 
    opened by mydevpeeps 6
Releases(v0.3-alpha)
  • v0.3-alpha(Oct 8, 2021)

  • releases-v0.2-alpha(Oct 5, 2021)

    this is the initial port over to python (#20). once this is finished the powershell version will be removed from the repo.

    Full Changelog: https://github.com/mydevpeeps/marlin-configurator/compare/release-v0.11-alpha...releases-v0.2-alpha

    Source code(tar.gz)
    Source code(zip)
  • release-v0.11-alpha(Oct 3, 2021)

    Another phase in the initial release with a lot of error trapping.

    • Includes enhancements: #2 #4 #5 #14 #15
    • Includes Bug Fixes: #4
    • Known Issue(s): #1 #13
    Source code(tar.gz)
    Source code(zip)
  • releases(Oct 1, 2021)

Owner
DevPeeps
DevPeeps
Simple dataclasses configuration management for Python with hocon/json/yaml/properties/env-vars/dict support.

Simple dataclasses configuration management for Python with hocon/json/yaml/properties/env-vars/dict support, based on awesome and lightweight pyhocon parsing library.

Teo Stocco 62 Dec 23, 2022
Kubernates Config Manager

Kubernates Config Manager Sometimes we need manage more than one kubernates cluster at the same time. Switch cluster configs is a dangerous and troubl

周文阳 3 Jan 10, 2022
filetailor is a peer-based configuration management utility for plain-text files such as dotfiles.

filetailor filetailor is a peer-based configuration management utility for plain-text files (and directories) such as dotfiles. Files are backed up to

5 Dec 23, 2022
sqlconfig: manage your config files with sqlite

sqlconfig: manage your config files with sqlite The problem Your app probably has a lot of configuration in git. Storing it as files in a git repo has

Pete Hunt 4 Feb 21, 2022
Secsie is a configuration language made for speed, beauty, and ease of use.

secsie-conf pip3 install secsie-conf Secsie is a configuration language parser for Python, made for speed and beauty. Instead of writing config files

Noah Broyles 3 Feb 19, 2022
Strict separation of config from code.

Python Decouple: Strict separation of settings from code Decouple helps you to organize your settings so that you can change parameters without having

Henrique Bastos 2.3k Dec 30, 2022
Tools to assist with the configuration and maintenance of fapolicyd.

Tools to assist with the configuration and maintenance of fapolicyd.

Concurrent Technologies Corporation (CTC) 7 Dec 27, 2022
Apt2sbom python package generates SPDX or YAML files

Welcome to apt2sbom This package contains a library and a CLI tool to convert a Ubuntu software package inventory to a software bill of materials. You

Eliot Lear 15 Nov 13, 2022
Python 3+ compatible port of the configobj library

configobj Python 3+ compatible port of the configobj library. Documentation You can find a full manual on how to use ConfigObj at readthedocs. If you

Differently Sized Kittens 288 Dec 14, 2022
Event Coding for the HV Protocol MEG datasets

Scripts for QA and trigger preprocessing of NIMH HV Protocol Install pip install git+https://github.com/nih-megcore/hv_proc Usage hv_process.py will

2 Nov 14, 2022
A Python library to parse PARI/GP configuration and header files

pari-utils A Python library to parse PARI/GP configuration and header files. This is mainly used in the code generation of https://github.com/sagemath

Sage Mathematical Software System 3 Sep 18, 2022
A lightweight Traits like module

Traitlets home https://github.com/ipython/traitlets pypi-repo https://pypi.org/project/traitlets/ docs https://traitlets.readthedocs.io/ license Modif

IPython 532 Dec 27, 2022
Configuration for Python planets

Configuration for Python planets

Python 127 Dec 16, 2022
MOHAconfig - Gerador de arquivo de configuração para Medal of Honor: Airborne

MOHAconfig Gerador de arquivo de configuração para Medal of Honor: Airborne MOHA - Gerador de arquivo de configuração. Essa aplicação foi feita em pyt

1 Dec 31, 2021
Inject your config variables into methods, so they are as close to usage as possible

Inject your config variables into methods, so they are as close to usage as possible

GDWR 7 Dec 14, 2022
Read configuration settings from python configuration files.

Maison Read configuration settings from python configuration files. Motivation When developing a python application, e.g a command-line tool, it can b

9 Jan 04, 2023
Pyleri is an easy-to-use parser created for SiriDB

Python Left-Right Parser Pyleri is an easy-to-use parser created for SiriDB. We first used lrparsing and wrote jsleri for auto-completion and suggesti

Cesbit 106 Dec 06, 2022
Config files for my GitHub profile.

Config files for my GitHub profile.

Lukas Sales 7 May 17, 2022
Yamale (ya·ma·lē) - A schema and validator for YAML.

Yamale (ya·ma·lē) ⚠️ Ensure that your schema definitions come from internal or trusted sources. Yamale does not protect against intentionally maliciou

23andMe 534 Dec 21, 2022
Hydra is a framework for elegantly configuring complex applications

Python Decouple: Strict separation of settings from code Decouple helps you to organize your settings so that you can change parameters without having

Facebook Research 6.6k Jan 04, 2023