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

Calibration update #379

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Conversation

chrisib
Copy link
Collaborator

@chrisib chrisib commented Sep 11, 2024

Several changes related to calibration:

  1. Remove calibration & diagnostic tools from their old locations, move them both into a new firmware/tools namespace
  2. Rewrite calibration to support low-accuracy mode with 5V input as well as the old low-10V and high-10V modes (there seem to be relatively few EuroRack modules that generate 10V offset voltages, but 5V is pretty widely available through a variety of modules. This new mode should simplify fast (re-)calibration using only modules in the same case.
  3. Change output calibration to calibrate each output channel instead of just CV1. This should make e.g. quantizers more usable on other channels. europi.py is modified to work with both the new & old calibrations, so anyone who's calibrated using only the CV1-only method will still have usable calibration.
  4. Add new Thermometer class to europi.py to act as a wrapper for the temperature sensor on pin4. Add exception-handling needed for the Pico 2 to prevent crashes when trying to read the temperature sensor.

…O pin wrappers from europi.py instead of re-declaring them.
…n (5V voltage sources seem way more common in EuroRack modules than 10V). Move diagnistic out of contrib, into new firmware/tools namespace. Put calibration here too. Update README, programming instructions, menu accordingly. Add calibration.md with more detailed description of calibration process
… necessary exception handling for Pico 2's (currently) unsupported temperature sensor
@chrisib chrisib added firmware Software related issue draft Not yet ready to merge improvement Improvement or optimization of an existing feature or script labels Sep 11, 2024
@chrisib
Copy link
Collaborator Author

chrisib commented Sep 12, 2024

Did some testing. Found yet another annoying inconsistency with the RP2350 that's been addressed (pin 24 doesn't appear to indicate if the USB is connected or not). Added a new class similar to the Thermometer to address that. Now the USB detection is working reliably on both boards.

Low-accuracy, 5V calibration is, as-expected, noisier, but good-enough for quick calibration.

Working on fixing up the tests; looks like machine.mem32 isn't available, so I'll add that to the mocks.

@chrisib
Copy link
Collaborator Author

chrisib commented Sep 12, 2024

Tests appear to be passing now; I think it's ready for review.

@chrisib chrisib removed the draft Not yet ready to merge label Sep 12, 2024
@chrisib
Copy link
Collaborator Author

chrisib commented Sep 15, 2024

Added per-output calibration instead of just calibrating CV1. Updated description accordingly.

New calibration creates OUTPUT_CALIBRATION_VALUES as an array of the form

OUTPUT_CALIBRATION_VALUES = [
    [CV1_0V, CV1_1V, CV1_2V, ..., CV1_9V, CV1_10V],
    [CV2_0V, CV2_1V, CV2_2V, ..., CV2_9V, CV2_10V],
    ...
]

In the case of someone using the older CV1-only calibration, europi.py will simply duplicate the 1D array six times. This prevents any additional logic being needed inside the Output class to check the size of the output calibration array. The desired calibration array is passed to the constructor of the Output, which should make this easy to expand in the future if we ever need to support more than 6 CV outputs.

Sample calibration_values.py after using the new tool in high accuracy mode:

INPUT_CALIBRATION_VALUES=[236, 4544, 8952, 13352, 17751, 22167, 26634, 31024, 35464, 39891, 44300]
OUTPUT_CALIBRATION_VALUES=[[0, 6400, 12770, 19080, 25430, 31780, 38010, 44330, 50690, 56940, 63150], [0, 6300, 12660, 19050, 25330, 31680, 37990, 44240, 50500, 56730, 62960], [0, 6290, 12630, 18960, 25250, 31610, 37850, 44190, 50280, 56560, 62750], [0, 6270, 12670, 19040, 25320, 31760, 38060, 44380, 50580, 56920, 63120], [0, 6270, 12630, 19060, 25290, 31680, 37920, 44310, 50460, 56860, 62950], [0, 6480, 12760, 19120, 25340, 31740, 38110, 44200, 50640, 56930, 63140]]
CALIBRATION_MODE = 'high'

The CALIBRATION_MODE variable is not actually used anywhere internally, but felt useful to include as a support/debugging measure, as it indicates what method was used to generate the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
firmware Software related issue improvement Improvement or optimization of an existing feature or script
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant