Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configuration system #220

Merged
merged 10 commits into from
Feb 17, 2023
Merged

Conversation

mjaskula
Copy link
Collaborator

@mjaskula mjaskula commented Feb 9, 2023

This PR is a rework of (closed) PR #185 and attempts to address the problems identified in issue #163 by way of the addition of a configuration system to the europi firmware. As mentioned in the comments of #185, we have pushed the actual UI portion of this idea out to later work.

This PR adds a configuration system and API, but not a UI, as described in issue #163. The intention of this configuration system is to allow for config file based (rather than in code or UI) user editing parameters that aren't expected to change very often. These are 'set and forget' type options that the user would not expect to be able to change while the script is running. This allows the script itself to forgo the UI complexities of making these options editable. Similarly, it also avoids asking users to edit and re-deploy code to make a change to a setting.

This PR consists of a few parts:

  • the configuration module which contains code for:
    • declaring configuration points (ConfigPoint)
    • managing the resulting configuration specification (ConfigSpec)
    • managing configuration files (ConfigPoint)
  • changes to EuroPiScript to make configuration available to running scripts
  • user scripts for generating and deploying configuration files
  • Example configurations:
    • EuroPi: configure the type of pico installed (pico or pico w). This is unused.
    • EuroPi: configure the cpu frequency (overclocked or not)
    • Turing machine: configure the write switch to write 0 or 1.
    • Turing machine: configure the pulses bit used by the first 3 cv pulse outputs
    • Diagnostic: configure the units for temperature

Additional notable changes to support this work:

  • refactored the file/json reading and writing functions in EuroPi script so config could use them, and pulled them into their own file
  • black formatting of diagnostic.py

Future work:

@mjaskula mjaskula self-assigned this Feb 9, 2023
@mjaskula mjaskula added the firmware Software related issue label Feb 9, 2023
@awonak
Copy link
Collaborator

awonak commented Feb 10, 2023

My initial first pass is really positive! I think this is a great step in providing the optional ability to add per-user configurations. I'll give a more in-depth review later. Nice work. 👍

Copy link
Collaborator

@awonak awonak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is excellent. The examples and documentation are clear and easy to follow. This will be a great addition to the EuroPi ecosystem! Thanks Matthew!

scripts/generate_default_configs.py Show resolved Hide resolved
scripts/generate_default_configs.py Show resolved Hide resolved
software/firmware/configuration.py Outdated Show resolved Hide resolved
software/firmware/configuration.py Outdated Show resolved Hide resolved
software/contrib/diagnostic.py Outdated Show resolved Hide resolved
software/firmware/file_utils.py Show resolved Hide resolved
@awonak
Copy link
Collaborator

awonak commented Feb 13, 2023

LGTM, I'll leave the merge up to you when you're ready.

- introduce ConfigPoints and ConfigPointsBuilder classes
- make configurable the value that the TM write switch writes
- add config point for pico board type
fall back to defaults properly
add int config point
add tests for different config point failures
make the TM pulses bits configurable
move europi_config.py to the firmware
diagnostic temp units are configurable
also black format diagnostic
- removed builder
- simplified EuroPiScript.config_point()
- introduced ConfigPoint class
- rename config_points.py -> configuration.py
- move configPoint helpers out of ConfigSpec class
- move europi config to its own var, this removes the need care about conflicts and namespacing
- only load config points that exist in the spec
- take a range object for IntegerConfigPoint instead of recreating its api
- europi_script validates config when loading it
- move generic file utils out of europi_script
- moved config file methods out of EuroPiScript
add config point for cpu freq
add make target to copy config files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
firmware Software related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants