-
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
Fix shutter position consts and logic for setting shutter pos #63
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,8 +49,8 @@ | |
15, | ||
] | ||
|
||
SHUTTER_CLOSED = "CLOSED" | ||
SHUTTER_OPEN = "OPEN" | ||
SHUTTER_CLOSED = 0 | ||
SHUTTER_OPEN = 1 | ||
|
||
|
||
def _if_connected(func: Callable) -> Callable: | ||
|
@@ -851,7 +851,7 @@ async def _set_shutter(self, shutter_state: int) -> None: | |
|
||
await caput(f"{self.motors}:SHUTTER", pos, wait=False, throw=False) | ||
|
||
def _set_shutter_pos(self, val: float, shutter_state: str) -> None: | ||
def _set_shutter_pos(self, val: float, shutter_state: int) -> None: | ||
""" | ||
Set the shutter position count value. | ||
|
||
|
@@ -862,7 +862,9 @@ def _set_shutter_pos(self, val: float, shutter_state: str) -> None: | |
if shutter_state == SHUTTER_CLOSED: | ||
self._configure_param({"shutter_closed_position": val}) | ||
|
||
current_shutter_state = "CLOSED" if self.shutter.get() == 0 else "OPEN" | ||
current_shutter_state = ( | ||
SHUTTER_CLOSED if self.shutter.get() == 0 else SHUTTER_OPEN | ||
) | ||
if current_shutter_state == shutter_state: | ||
self._set_shutter(shutter_state) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this wrong? Shouldn't it only call set if the current value does not match the new value? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. e.g. if in the SHUTTER_CLOSED state, but the |
||
|
||
|
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.
@GDYendell The reason I changed it to ints was because of this line. It would then pass a string into _set_shutter() which expects 0, otherwise the else is triggered. So pretty much it would always trigger the else clause as they were strings.
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 don't understand. You haven't changed the conditional, it is still checking
self.shutter.get() == 0
, you have only changed the assignment to be an int rather than a string, which just changes the value passed toself._set_shutter
(which does make sense to me, just the explanation does not).