[TRPD-194][feat] driver keysight: allow to configure rise and fall times - #3569
Conversation
Use a pulse waveform instead of a square waveform, to have extra settings to control the rise and fall edges time. Also handle better when an impossible value is requested: just automatically clip, and update the other values from the device if changing the value changed them.
Just ensure that they are shown the right way.
|
Warning Review limit reachedNext included review available in 56 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🟡 Changes recommended
It includes correctness issues in the Keysight driver (retry loop can silently proceed after failing to set waveform, and edge-time minimum selection can be wrong for the active channel).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds configurable rise/fall edge times for the Keysight TrueForm-based blanker, exposing the new parameters in the GUI configuration and validating them through the simulator-backed driver tests.
Changes:
- Added
riseTimeandfallTimeGUI configuration entries for the e-beam blanker. - Extended the Keysight driver with pulse edge-time set/get support and applied pulse-mode configuration on power-on.
- Updated Keysight driver tests to cover rise/fall time behavior and reflect clipping behavior for duty cycle.
File summaries
| File | Description |
|---|---|
| src/odemis/gui/conf/data.py | Exposes riseTime/fallTime controls for the blanker configuration UI. |
| src/odemis/driver/test/keysight_test.py | Updates simulator test configuration and adds rise/fall time test coverage. |
| src/odemis/driver/keysight.py | Implements pulse edge-time configuration and adjusts power-on setup / simulator parsing. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 7
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| for i in range(3): | ||
| try: | ||
| self.setWaveform(self._channel, "PULS") | ||
| break | ||
| except TrueFormError as ex: | ||
| logging.warning("Failed to set the waveform to pulse, will retry: %s", ex) | ||
|
|
| # Detect the minimum edge time, depending on the voltage. Picking a too small value is not | ||
| # much of an issue as it will be clipped, but that can be confusing for the user. | ||
| edge_min = EDGE_MIN_4V if all(lim[1] - lim[0] <= 4.0 for lim in self._limits) else EDGE_MIN_10V | ||
| rise_time = edge_min | ||
| self.riseTime = model.FloatContinuous(rise_time, range=(edge_min, self.period.range[1] / 2), | ||
| setter=self._set_rise_time, unit="s") | ||
|
|
||
| fall_time = edge_min | ||
| self.fallTime = model.FloatContinuous(fall_time, range=(edge_min, self.period.range[1] / 2), | ||
| setter=self._set_fall_time, unit="s") |
| # if the waveform is not compatible. The device will also complain when setting the waveform | ||
| # if some waveform settings are not compatible. | ||
|
|
||
| # Configure the (square) waveform voltages: low = min and high = max |
| duty_cyle = self.dutyCycle.value | ||
| period = self.period.value | ||
| delay = self.delay.value | ||
| rise_time = self.riseTime.value | ||
| fall_time = self.fallTime.value | ||
| try: | ||
| self.dutyCycle.value = duty_cyle | ||
| except TrueFormError as ex: | ||
| logging.warning("Failed to set the duty cycle to %s after power on: %s", duty_cyle, ex) |
| except TrueFormError as ex: | ||
| # Tracking a channel is similar to activating it, so it can have the same issue | ||
| # as setting the waveform. | ||
| logging.warning("Failed to set the channel %s to track %s, will retry: %s", t, other_c, ex) |
| #"limits": [[-4.0, 4.0], [-5.0, 5.0]], | ||
| "limits": [[-5.0, 5.0], [-5.0, 5.0]], | ||
| #"off_voltage": [0.0, None], | ||
| "off_voltage": [0.0, 0.0], |
| #self.dev.period.value = 25e-9 #DEBUG | ||
| self.dev.power.value = True |
Use a pulse waveform instead of a square waveform, to have extra settings to control the rise and fall edges time.
Also handle better when an impossible value is requested: just automatically clip, and update the other values from the device if changing the value changed them.