diff --git a/tools/cabana/canmessages.cc b/tools/cabana/canmessages.cc index d2141c3630..1b46bd9da7 100644 --- a/tools/cabana/canmessages.cc +++ b/tools/cabana/canmessages.cc @@ -87,7 +87,7 @@ void CANMessages::process(QHash> *messages) { } 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. if (!seeking && event->which == cereal::Event::Which::CAN) { 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) { - prev_update_sec = current_sec; + double ts = millis_since_boot(); + if ((ts - prev_update_ts) > (1000.0 / settings.fps)) { + prev_update_ts = ts; // use pointer to avoid data copy in queued connection. emit received(received_msgs.release()); }