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

Add control message expiration time #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

samderanova
Copy link
Contributor

Resolves #37.

Changes

  • Use absolute_time_diff_us from pico/time.h to calculate difference between last received message and the current time
    • If the difference is greater than the threshold of EXPIRATION_TIME, set the frequency to be zero
  • Refactor monitor_serial to directly assign to lcm rather than assigning by attribute

@samderanova samderanova requested a review from taesungh May 31, 2024 07:16
Copy link
Member

@taesungh taesungh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird that it seemed we needed volatile the other day but we don't need it anymore.

Comment on lines +88 to +90
// Calculate time difference in microseconds and check if the difference is
// greater than the expiration time. If so, set frequency to 0. Otherwise,
// set frequency to the data received.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick [non-blocking]: comment seems a bit too verbose, describing the code literally rather than explaining intent.

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 this pull request may close these issues.

Add control message expiration time
2 participants