Allen-Synthesis / EuroPi

EuroPi: A reprogrammable Eurorack module based on the Raspberry Pi Pico
Creative Commons Zero v1.0 Universal
420 stars 79 forks source link

Improve numerical `ConfigPoint` implementations #370

Closed chrisib closed 1 month ago

chrisib commented 2 months ago

Currently if an IntegerConfigPoint has a very wide range, the entire range is saved as a list in RAM, which could have negative impacts on scripts. Instead of inheriting from the ChoiceConfigPoint instead we inherit directly from ConfigPoint and save the maximum & minimum values of the range and check that the value is within the correct bounds.

This also lets us add the new FloatConfigPoint class, which works the same way but with floating point values instead of integers.

europi_config is modified to use the new floating point config points for the master input & output voltages, to allow more precision (e.g. if someone really needs to restrict the output voltage to e.g. 2.5 volts, they now can).

External interfaces for the IntegerConfigPoint and the configuration.integer(...) helper function remain unchanged.

mjaskula commented 1 month ago

New changes look good.