From aed66f32294786296d2b2bfa33e24e33ef060fa2 Mon Sep 17 00:00:00 2001 From: Rory Allen <79809962+roryjamesallen@users.noreply.github.com> Date: Thu, 8 Feb 2024 10:54:11 +0000 Subject: [PATCH] Add gate voltage to config (#331) * add gate_voltage to config * black formatting * add changes to CONFIGURATION.md * fix indent --- software/CONFIGURATION.md | 4 +++- software/firmware/europi.py | 3 ++- software/firmware/europi_config.py | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/software/CONFIGURATION.md b/software/CONFIGURATION.md index 6b8335188..a2ae74742 100644 --- a/software/CONFIGURATION.md +++ b/software/CONFIGURATION.md @@ -14,7 +14,8 @@ default configuration: "display_height": 32, "volts_per_octave": 1.0, "max_output_voltage": 10, - "max_input_voltage": 12 + "max_input_voltage": 12, + "gate_voltage": 5 } ``` @@ -29,3 +30,4 @@ default configuration: 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 +- `gate_voltage` is an integer in the range `[0, 12]` indicating the voltage that an output will produce when `cvx.on()` is called diff --git a/software/firmware/europi.py b/software/firmware/europi.py index 1557145bd..86fd79a3c 100644 --- a/software/firmware/europi.py +++ b/software/firmware/europi.py @@ -576,6 +576,7 @@ def __init__(self, pin, min_voltage=MIN_OUTPUT_VOLTAGE, max_voltage=MAX_OUTPUT_V self._duty = 0 self.MIN_VOLTAGE = min_voltage self.MAX_VOLTAGE = max_voltage + self.gate_voltage = clamp(europi_config["gate_voltage"], self.MIN_VOLTAGE, self.MAX_VOLTAGE) self._gradients = [] for index, value in enumerate(OUTPUT_CALIBRATION_VALUES[:-1]): @@ -597,7 +598,7 @@ def voltage(self, voltage=None): def on(self): """Set the voltage HIGH at 5 volts.""" - self.voltage(5) + self.voltage(self.gate_voltage) def off(self): """Set the voltage LOW at 0 volts.""" diff --git a/software/firmware/europi_config.py b/software/firmware/europi_config.py index 3b0f33c65..4d40362bd 100644 --- a/software/firmware/europi_config.py +++ b/software/firmware/europi_config.py @@ -82,6 +82,11 @@ def config_points(cls): range=range(1, 13), default=12 ), + configuration.integer( + name="gate_voltage", + range=range(1, 13), + default=5 + ), ] # fmt: on