-
Notifications
You must be signed in to change notification settings - Fork 1
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
Display mirror angle #680
Display mirror angle #680
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #680 +/- ##
==========================================
+ Coverage 86.92% 86.97% +0.05%
==========================================
Files 69 69
Lines 3556 3570 +14
==========================================
+ Hits 3091 3105 +14
Misses 465 465 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made some small suggestions. Besides that there are a couple of bugs:
- The display shows the previous angle, not the current one (see comment)
- The display will never show a "moving" state, because
_update_mirror_position_display
is only ever called when the motor has finished moving. To figure out when it has started moving you need to listen for themove.begin
message instead. My PR might help with working on this: Add dummy stepper motor delay in default configuration #681
FYI: I'm just merging #694 and I've updated the required status checks for the Python 3.12 changes, so this branch will need updating before the checks pass now. You should just be able to do a simple merge/rebase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there I think! But it still won't display "moving" when the mirror is moving. See comment.
finesse/gui/stepper_motor_view.py
Outdated
otherwise, display angle or its associated name. | ||
""" | ||
if moved_to is None: | ||
self.mirror_position_display.setText("Moving...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still something that needs tweaking if we want it to display "moving" when the mirror is moving. You need to have a separate handler which sets the text to moving when you get a move.begin
message.
finesse/gui/stepper_motor_view.py
Outdated
preset = next((k for k, v in ANGLE_PRESETS.items() if v == moved_to), None) | ||
if preset: | ||
self.mirror_position_display.setText(preset.upper()) | ||
else: | ||
self.mirror_position_display.setText(f"{moved_to}°") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On reflection, I'm thinking it might be useful to see the angle for presets too. How about:
preset = next((k for k, v in ANGLE_PRESETS.items() if v == moved_to), None) | |
if preset: | |
self.mirror_position_display.setText(preset.upper()) | |
else: | |
self.mirror_position_display.setText(f"{moved_to}°") | |
text = f"{moved_to}°" | |
if preset := next((k for k, v in ANGLE_PRESETS.items() if v == moved_to), None): | |
text += f" ({preset})" | |
self.mirror_position_display.setText(text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does display the names as, e.g. "cold_bb", rather than the text on the labels ("COLD BB"), but it's still obvious which each corresponds to haha
be429e4
to
4744088
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just need to resolve that merge conflict then this is ready to go 😄
Co-authored-by: Alex Dewar <[email protected]>
Co-authored-by: Alex Dewar <[email protected]>
Co-authored-by: Alex Dewar <[email protected]>
548da22
to
7b1a7f1
Compare
Description
This PR adds the ability to display the current mirror angle on the GUI, as determined by the stepper motor controller.
The GUI should display the angle moved to (broadcast by the device once it has finished moving), or the name of the corresponding preset.
We'd like to also have the GUI indicate that the mirror is moving, however I don't think this is possible to test with the dummy device.
Fixes #583
Type of change
Key checklist
pre-commit run -a
)pytest
)mkdocs build -s
)pyinstaller
-built executable works (if relevant)Further checks