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

parser: refactor value dictionary update logic #1072

Closed
wants to merge 1 commit into from

Conversation

deanlee
Copy link
Contributor

@deanlee deanlee commented Aug 1, 2024

Main Changes:

  1. Removed the SignalValue struct and the query_latest() function. These were previously used to copy updated values to Cython code and initializing the value dictionary in Cython's __init__ method when query_latest() was called with empty CAN strings.
  2. Exposed MessageState to Cython code, enabling direct access to values from MessageState after an update.
  3. Tracked updated messages using and returning a set of updated_address in MessageState::update. This ensures that every update is captured and is not related to the current_nanos.
  4. Simplified and robustified the initialization of the value dictionary maps.

These changes significantly simplify the update logic, improve performance, and eliminate issues related to the problematic last_nanos and current_nanos in query_latest(). This refactor fixes multiple issues, including:

Remaining Tasks for Issue 1066 (will be resolved in another PR):
- Ensure the vals in MessageState are always the newest.
- Ensure all_vals are sorted by received time.

@adeebshihadeh
Copy link
Contributor

Can you add some unit tests to enforce this behavior?

@deanlee
Copy link
Contributor Author

deanlee commented Aug 1, 2024

made a few modifications to the test case. It should be able to catch these issues now.

@deanlee deanlee marked this pull request as draft August 3, 2024 18:26
@deanlee deanlee force-pushed the parser_refactor_update branch 2 times, most recently from f9f194f to 441750e Compare August 3, 2024 19:13
update test case

improve update()
@deanlee deanlee marked this pull request as ready for review August 3, 2024 19:33
@deanlee
Copy link
Contributor Author

deanlee commented Aug 9, 2024

merged to #1046

@deanlee deanlee closed this Aug 9, 2024
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.

2 participants