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

Add config option to force module to always boot into the menu #361

Merged
merged 4 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 26 additions & 15 deletions software/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,28 @@ default configuration:
"DISPLAY_CHANNEL": 0,
"MAX_OUTPUT_VOLTAGE": 10,
"MAX_INPUT_VOLTAGE": 12,
"GATE_VOLTAGE": 5
"GATE_VOLTAGE": 5,
"MENU_AFTER_POWER_ON": false
roryjamesallen marked this conversation as resolved.
Show resolved Hide resolved
}
```

- `EUROPI_MODEL` specifies the type of EuroPi module. Currently only `"europi"` is supported
- `PICO_MODEL` must be one of `"pico"` or `"pico w"`
- `CPU_FREQ` must be one of `250000000` or `125000000`
- `ROTATE_DISPLAY` must be one of `false` or `true`
- `DISPLAY_WIDTH` is the width of the screen in pixels. The standard EuroPi screen is 128 pixels wide
- `DISPLAY_HEIGHT` is the height of the screen in pixels. The standard EuroPi screen is 32 pixels tall
- `DISPLAY_SDA` is the I²C SDA pin used for the display. Only SDA capable pins can be selected
- `DISPLAY_SCL` is the I²C SCL pin used for the display. Only SCL capable pins can be selected
- `DISPLAY_CHANNEL` is the I²C channel used for the display, either 0 or 1.
- `MAX_OUTPUT_VOLTAGE` is an integer in the range `[0, 10]` indicating the maximum voltage CV output can generate.
- `EUROPI_MODEL` specifies the type of EuroPi module. Currently only `"europi"` is supported. Default: `"europi"`
- `PICO_MODEL` must be one of `"pico"` or `"pico w"`. Default: `"pico"`
- `CPU_FREQ` must be one of `250000000` or `125000000`. Default: `"250000000"`
- `ROTATE_DISPLAY` must be one of `false` or `true`. Default: `false`
- `DISPLAY_WIDTH` is the width of the screen in pixels. The standard EuroPi screen is 128 pixels wide. Default: `128`
- `DISPLAY_HEIGHT` is the height of the screen in pixels. The standard EuroPi screen is 32 pixels tall. Default: `32`
- `DISPLAY_SDA` is the I²C SDA pin used for the display. Only SDA capable pins can be selected. Default: `0`
- `DISPLAY_SCL` is the I²C SCL pin used for the display. Only SCL capable pins can be selected. Default: `1`
- `DISPLAY_CHANNEL` is the I²C channel used for the display, either 0 or 1. Default: `0`
- `MAX_OUTPUT_VOLTAGE` is an integer in the range `[0, 10]` indicating the maximum voltage CV output can generate. Default: `10`
The hardware is capable of 10V maximum
- `MAX_INPUT_VOLTAGE` is an integer in the range `[0, 12]` indicating the maximum allowed voltage into the `ain` jack.
The hardware is capable of 12V maximum
The hardware is capable of 12V maximum. Default: `12`
- `GATE_VOLTAGE` is an integer in the range `[0, 10]` indicating the voltage that an output will produce when `cvx.on()`
is called. This value must not be higher than `MAX_OUTPUT_VOLTAGE`

is called. This value must not be higher than `MAX_OUTPUT_VOLTAGE`. Default: `5`
- `MENU_AFTER_POWER_ON` is a boolean indicating whether or not the module should always return to the main menu when
it powers on. By default the EuroPi will re-launch the last-used program instead of returning to the main menu. Default: `false`


# Experimental configuration
Expand All @@ -52,7 +54,7 @@ shows the default configuration:
}
```

- `VOLTS_PER_OCTAVE` must be one of `1.0` (Eurorack standard) or `1.2` (Buchla standard)
- `VOLTS_PER_OCTAVE` must be one of `1.0` (Eurorack standard) or `1.2` (Buchla standard). Default: `1.0`


# Accessing config members in Python code
Expand Down Expand Up @@ -121,6 +123,7 @@ customizations described in the sections above. Below is a detailed summary of t
'GATE_VOLTAGE',
'MAX_INPUT_VOLTAGE',
'MAX_OUTPUT_VOLTAGE',
'MENU_AFTER_POWER_ON',
'PICO_MODEL',
'ROTATE_DISPLAY'
]
Expand All @@ -141,3 +144,11 @@ import europi
# A voltage range we can select from in a user menu
VOLTAGE_RANGE = range(0, europi.europi_config.MAX_OUTPUT_VOLTAGE)
```

# Note on Booleans

Python uses `True` and `False` to represent boolean values (starting with upper-case letters), but JSON uses `true` and
`false` (starting with lower-case letters).

This is an unavoidable inconsistency between the configuration file and the Python source code. When modifying the JSON
file to modify your configuration, make sure to use correct JSON boolean names, not Python names.
7 changes: 7 additions & 0 deletions software/firmware/bootloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ def main(self):
europi.b2._handler_both(europi.b1, self.exit_to_menu)

try:
if (
europi.europi_config.MENU_AFTER_POWER_ON
or script_class_name == "calibrate.Calibrate"
):
# Remove the last-launched file to force the module back to the menu after it powers-on next time
self.save_state_json({})

script_class().main()
except Exception as err:
# set all outputs to zero for safety
Expand Down
8 changes: 7 additions & 1 deletion software/firmware/europi_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def config_points(cls):
default=0
),

# Synthesizer family settings
# I/O voltage settings
configuration.integer(
name="MAX_OUTPUT_VOLTAGE",
range=range(1, 11),
Expand All @@ -89,6 +89,12 @@ def config_points(cls):
range=range(1, 11),
default=5
),

# Menu settings
configuration.boolean(
name="MENU_AFTER_POWER_ON",
default=False
),
]
# fmt: on

Expand Down
Loading