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
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
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
Dynamic Django settings.

Constance - Dynamic Django settings A Django app for storing dynamic settings in pluggable backends (Redis and Django model backend built in) with an

Jazzband 1.5k Jan 04, 2023
A small example project for efficiently configuring a Python application with YAMLs and the CLI

Hydra Example Project for Python A small example project for efficiently configuring a Python application with YAMLs and the CLI. Why should I care? A

Florian Wilhelm 4 Dec 31, 2022
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
Scooch Configures Object Oriented Class Hierarchies for python

Scooch Scooch Configures Object Oriented Class Hierarchies for python. A good place to start with Scooch is at the documentation found here. Scooch is

Pandora Media, Inc. 6 Dec 20, 2022
Python Marlin Configurator to make valid configuration files to be used to compile Marlin with.

marlin-configurator Concept originally imagined by The-EG using PowerShell Build Script for Marlin Configurations The purpose of this project is to pa

DevPeeps 2 Oct 09, 2021
This Ivy plugin adds support for TOML file headers.

This Ivy plugin adds support for TOML file headers as an alternative to YAML.

Darren Mulholland 1 Nov 09, 2021
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
A compact library for Python 3.10x that allows users to configure their SimPads real-time

SimpadLib v1.0.6 What is this? This is a python library programmed by Ashe Muller that allows users to interface directly with their SimPad devices, a

Ashe Muller 2 Jan 08, 2022
ConfZ is a configuration management library for Python based on pydantic.

ConfZ – Pydantic Config Management ConfZ is a configuration management library for Python based on pydantic. It easily allows you to load your configu

Zühlke 164 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
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 05, 2023
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

2 Dec 10, 2021
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
Napalm-vs-openconfig - Comparison of NAPALM and OpenConfig YANG with NETCONF transport

NAPALM vs NETCONF/OPENCONFIG Abstracts Multi vendor network management and autom

Anton Karneliuk 1 Jan 17, 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

18 Dec 02, 2022
Dag-bakery - Dag Bakery enables the capability to define Airflow DAGs via YAML.

DAG Bakery - WIP 🔧 dag-bakery aims to simplify our DAG development by removing all the boilerplate and duplicated code when defining multiple DAG cro

Typeform 2 Jan 08, 2022
Django-environ allows you to utilize 12factor inspired environment variables to configure your Django application.

Django-environ django-environ allows you to use Twelve-factor methodology to configure your Django application with environment variables. import envi

Daniele Faraglia 2.7k Jan 03, 2023
Config files for my GitHub profile.

Config files for my GitHub profile.

Lukas Sales 7 May 17, 2022