@@ -219,6 +219,8 @@ MainWindow::MainWindow(QWidget *parent) :
219219 mKeyLeft = false ;
220220 mKeyRight = false ;
221221
222+ shouldSetDisplayBars = false ;
223+
222224 connect (mDebugTimer , SIGNAL (timeout ()),
223225 this , SLOT (timerSlotDebugMsg ()));
224226 connect (mTimer , SIGNAL (timeout ()),
@@ -480,6 +482,7 @@ MainWindow::MainWindow(QWidget *parent) :
480482 mPollAppTimer .start (int (1000.0 / mSettings .value (" poll_rate_app_data" , 50 ).toDouble ()));
481483 mPollImuTimer .start (int (1000.0 / mSettings .value (" poll_rate_imu_data" , 50 ).toDouble ()));
482484 mPollBmsTimer .start (int (1000.0 / mSettings .value (" poll_rate_bms_data" , 10 ).toDouble ()));
485+ mRepaintDisplayBarTimer .start (100 );
483486
484487 connect (&mPollRtTimer , &QTimer::timeout, [this ]() {
485488 if (ui->actionRtData ->isChecked ()) {
@@ -514,6 +517,15 @@ MainWindow::MainWindow(QWidget *parent) :
514517 }
515518 });
516519
520+ connect (&mRepaintDisplayBarTimer , &QTimer::timeout, [this ]() {
521+ if (shouldSetDisplayBars) {
522+ ui->dispCurrent ->setVal (mMcValues .current_motor );
523+ ui->dispDuty ->setVal (mMcValues .duty_now * 100.0 );
524+
525+ shouldSetDisplayBars = false ;
526+ }
527+ });
528+
517529 // Restore size and position
518530 if (mSettings .contains (" mainwindow/size" )) {
519531 resize (mSettings .value (" mainwindow/size" ).toSize ());
@@ -951,8 +963,8 @@ void MainWindow::serialPortNotWritable(const QString &port)
951963void MainWindow::valuesReceived (MC_VALUES values, unsigned int mask)
952964{
953965 (void )mask;
954- ui-> dispCurrent -> setVal ( values. current_motor ) ;
955- ui-> dispDuty -> setVal (values. duty_now * 100.0 ) ;
966+ mMcValues = values;
967+ shouldSetDisplayBars = true ;
956968}
957969
958970void MainWindow::paramChangedDouble (QObject *src, QString name, double newParam)
0 commit comments