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

[Python] Some conflicting looking code #65

Closed
magoorden opened this issue Aug 28, 2024 · 1 comment · Fixed by #71
Closed

[Python] Some conflicting looking code #65

magoorden opened this issue Aug 28, 2024 · 1 comment · Fixed by #71

Comments

@magoorden
Copy link
Collaborator

In _underflow_check, the first few lines contains

if not self.ready():
    # do liveness check and update state if device is outdated but was ready on last communication
    if self.outdated():
        print(f"Device is outdated. {self.state.last_update=}, {datetime.now()=}")
        # if last line is OK, then device is still alive, do update of state
        if self.read_buffer and self.read_buffer[-1] == CLAIRE_READY_SIGNAL:
            print(f"Device is alive. {self.state.last_update=}, {datetime.now()=}")
            self.busy = False
            self.update_state(quick=True)
else:
    if DEBUG:
        print(f'{TAG}: Device is not ready. Waiting {UNDERFLOW_CHECK_INTERVAL} seconds.')
        sleep(UNDERFLOW_CHECK_INTERVAL)
    continue

The print statement in the else part seems conflicting with the actual if condition: if the claire device is not not self.ready(), it is printed that device is not ready. This is in conflict with each other. Unclear what the intended behavior is.

@magoorden
Copy link
Collaborator Author

@falkecarlsen Need you help to figure out your intention with this piece of code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant