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
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
Configuration Extractor for EXE4J PE files

EXE4J Configuration Extractor This script helps reverse engineering Portable Executable files created with EXE4J by extracting their configuration dat

Karsten Hahn 6 Jun 29, 2022
A tool to manage configuration files, build scripts etc. across multiple projects.

A tool to manage configuration files, build scripts etc. across multiple projects.

null 8 Dec 14, 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

null 5 Dec 23, 2022
An application pulls configuration information from JSON files generated

AP Provisioning Automation An application pulls configuration information from JSON files generated by Ekahau and then uses Netmiko to configure the l

Cisco GVE DevNet Team 1 Dec 17, 2021
KConfig Browser is a graphical application which allows you to modify KDE configuration files found in ~/.config

kconfig_browser KConfig Browser is a graphical application which allows you to modify KDE configuration files found in ~/.config Screenshot Why I crea

null 11 Sep 15, 2022
Configuration Management for Python ⚙

dynaconf - Configuration Management for Python. Features Inspired by the 12-factor application guide Settings management (default values, validation,

Bruno Rocha 2.8k Jan 6, 2023
Flexible Python configuration system. The last one you will ever need.

OmegaConf Description Project Code quality Docs and support OmegaConf is a hierarchical configuration system, with support for merging configurations

Omry Yadan 1.4k Jan 2, 2023
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
Pydantic-ish YAML configuration management.

Pydantic-ish YAML configuration management.

Dribia Data Research 18 Oct 27, 2022
Sync any your configuration file to remote. Currently only support gist.

Sync your configuration to remote, such as vimrc. You can use EscSync to manage your configure of editor, shell, etc.

Me1onRind 0 Nov 21, 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
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
A slightly opinionated template for iPython configuration for interactive development

A slightly opinionated template for iPython configuration for interactive development. Auto-reload and no imports for packages and modules in the project.

Seva Zhidkov 24 Feb 16, 2022
Organize Django settings into multiple files and directories. Easily override and modify settings. Use wildcards and optional settings files.

Organize Django settings into multiple files and directories. Easily override and modify settings. Use wildcards in settings file paths and mark setti

Nikita Sobolev 942 Jan 5, 2023
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
Generate config files and qr codes for wireguard vpn

wireguard config generator for python Generate config files and qr codes for wireguard vpn You will need to install qrcode and pillow in python and yo

null 18 Dec 2, 2022
Config files for my GitHub profile.

Config files for my GitHub profile.

Lukas Sales 7 May 17, 2022
Config files for my GitHub profile.

Hacked This is a python base script from which you can hack or clone any person's facebook friendlist or followers accounts which have simple password

null 2 Dec 10, 2021