|
|
@ -87,7 +87,7 @@ void CANMessages::process(QHash<QString, std::deque<CanData>> *messages) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool CANMessages::eventFilter(const Event *event) { |
|
|
|
bool CANMessages::eventFilter(const Event *event) { |
|
|
|
static double prev_update_sec = 0; |
|
|
|
static double prev_update_ts = 0; |
|
|
|
// drop packets when the GUI thread is calling seekTo. to make sure the current_sec is accurate.
|
|
|
|
// drop packets when the GUI thread is calling seekTo. to make sure the current_sec is accurate.
|
|
|
|
if (!seeking && event->which == cereal::Event::Which::CAN) { |
|
|
|
if (!seeking && event->which == cereal::Event::Which::CAN) { |
|
|
|
if (!received_msgs) { |
|
|
|
if (!received_msgs) { |
|
|
@ -121,8 +121,9 @@ bool CANMessages::eventFilter(const Event *event) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (current_sec < prev_update_sec || (current_sec - prev_update_sec) > 1.0 / settings.fps) { |
|
|
|
double ts = millis_since_boot(); |
|
|
|
prev_update_sec = current_sec; |
|
|
|
if ((ts - prev_update_ts) > (1000.0 / settings.fps)) { |
|
|
|
|
|
|
|
prev_update_ts = ts; |
|
|
|
// use pointer to avoid data copy in queued connection.
|
|
|
|
// use pointer to avoid data copy in queued connection.
|
|
|
|
emit received(received_msgs.release()); |
|
|
|
emit received(received_msgs.release()); |
|
|
|
} |
|
|
|
} |
|
|
|