Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Nov 2, 2024
1 parent 45d0281 commit e9c66ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions opendbc/can/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ CANParser::CANParser(int abus, const std::string& dbc_name, bool ignore_checksum
void CANParser::update(const std::vector<CanData> &can_data, std::vector<SignalValue> &vals) {
if (can_data.empty()) return;

// used to check for updated messages in earlier frames when we receive multiple at once
uint64_t current_nanos = 0;
for (const auto &c : can_data) {
if (first_nanos == 0) {
Expand Down Expand Up @@ -242,10 +243,10 @@ void CANParser::UpdateValid(uint64_t nanos) {
can_valid = (can_invalid_cnt < CAN_INVALID_CNT) && _counters_valid;
}

void CANParser::query_latest(std::vector<SignalValue> &vals, uint64_t last_ts) {
void CANParser::query_latest(std::vector<SignalValue> &vals, uint64_t current_nanos) {
for (auto& kv : message_states) {
auto& state = kv.second;
if (state.last_seen_nanos < last_ts) {
if (state.last_seen_nanos < current_nanos) {
continue;
}

Expand Down

0 comments on commit e9c66ea

Please sign in to comment.