Temporary commit to make savvy can work with older GVRET versions.
This commit is contained in:
+1
-1
@@ -28,7 +28,7 @@ private slots:
|
||||
void changeLooping(bool check);
|
||||
void timerTriggered();
|
||||
void changeID(QString);
|
||||
void updatedFrames(int);
|
||||
void updatedFrames(int);
|
||||
|
||||
private:
|
||||
Ui::FlowViewWindow *ui;
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
#include "ui_frameplaybackwindow.h"
|
||||
#include <QDebug>
|
||||
|
||||
FramePlaybackWindow::FramePlaybackWindow(QVector<CANFrame> *frames, QWidget *parent) :
|
||||
FramePlaybackWindow::FramePlaybackWindow(QVector<CANFrame> *frames, SerialWorker *worker, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::FramePlaybackWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
modelFrames = frames;
|
||||
serialWorker = worker;
|
||||
|
||||
playbackTimer = new QTimer();
|
||||
|
||||
@@ -43,6 +44,8 @@ FramePlaybackWindow::FramePlaybackWindow(QVector<CANFrame> *frames, QWidget *par
|
||||
|
||||
playbackTimer->setInterval(ui->spinPlaySpeed->value()); //set the timer to the default value of the control
|
||||
|
||||
connect(this, SIGNAL(sendCANFrame(const CANFrame*,int)), worker, SLOT(sendFrame(const CANFrame*,int)), Qt::QueuedConnection);
|
||||
|
||||
}
|
||||
|
||||
FramePlaybackWindow::~FramePlaybackWindow()
|
||||
@@ -197,6 +200,7 @@ void FramePlaybackWindow::updatePosition(bool forward)
|
||||
}
|
||||
|
||||
//only send frame out if its ID is checked in the list. Otherwise discard it.
|
||||
|
||||
QList<QListWidgetItem *> idList = ui->listID->findItems(QString::number(modelFrames->at(currentPosition).ID, 16).toUpper().rightJustified(4,'0'), Qt::MatchExactly);
|
||||
if (idList.count() > 0)
|
||||
{
|
||||
@@ -207,7 +211,11 @@ void FramePlaybackWindow::updatePosition(bool forward)
|
||||
if (whichBusSend & 1) emit sendCANFrame(thisFrame, 0);
|
||||
if (whichBusSend & 2) emit sendCANFrame(thisFrame, 1);
|
||||
if (whichBusSend & 4) emit sendCANFrame(thisFrame, thisFrame->bus);
|
||||
//if (whichBusSend & 1) serialWorker->sendFrame(thisFrame, 0);
|
||||
//if (whichBusSend & 2) serialWorker->sendFrame(thisFrame, 1);
|
||||
//if (whichBusSend & 4) serialWorker->sendFrame(thisFrame, thisFrame->bus);
|
||||
updateFrameLabel();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <QListWidget>
|
||||
#include <QTimer>
|
||||
#include "can_structs.h"
|
||||
#include "serialworker.h"
|
||||
|
||||
namespace Ui {
|
||||
class FramePlaybackWindow;
|
||||
@@ -15,7 +16,7 @@ class FramePlaybackWindow : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FramePlaybackWindow(QVector<CANFrame> *frames, QWidget *parent = 0);
|
||||
explicit FramePlaybackWindow(QVector<CANFrame> *frames, SerialWorker *worker, QWidget *parent = 0);
|
||||
~FramePlaybackWindow();
|
||||
|
||||
private slots:
|
||||
@@ -43,6 +44,7 @@ private:
|
||||
QVector<CANFrame> *modelFrames;
|
||||
int currentPosition;
|
||||
QTimer *playbackTimer;
|
||||
SerialWorker *serialWorker;
|
||||
bool playbackActive;
|
||||
bool playbackForward;
|
||||
int whichBusSend;
|
||||
|
||||
+6
-3
@@ -26,6 +26,8 @@ Things currently broken or in need of attention:
|
||||
2. Some of the save formats are not actually implemented and silently fail.
|
||||
3. It would be nice to be able to save the graphing view in the flow view.
|
||||
4. It would also be nice to be able to save an image of the bitfield grid too.
|
||||
5. New GVRET firmware has a hard time sending data (6 frames per second!)
|
||||
6. If you load a file, use detailed view, clear it, load another, it seems to only show new IDs
|
||||
*/
|
||||
|
||||
QString MainWindow::loadedFileName = "";
|
||||
@@ -83,7 +85,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->cbSpeed2->addItem(tr("1000000"));
|
||||
ui->cbSpeed2->addItem(tr("33333"));
|
||||
|
||||
SerialWorker *worker = new SerialWorker(model);
|
||||
worker = new SerialWorker(model);
|
||||
worker->moveToThread(&serialWorkerThread);
|
||||
connect(&serialWorkerThread, &QThread::finished, worker, &QObject::deleteLater);
|
||||
connect(this, &MainWindow::sendSerialPort, worker, &SerialWorker::setSerialPort, Qt::QueuedConnection);
|
||||
@@ -97,6 +99,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(this, &MainWindow::startFrameCapturing, worker, &SerialWorker::startFrameCapture);
|
||||
connect(this, &MainWindow::stopFrameCapturing, worker, &SerialWorker::stopFrameCapture);
|
||||
serialWorkerThread.start();
|
||||
serialWorkerThread.setPriority(QThread::TimeCriticalPriority);
|
||||
|
||||
graphingWindow = NULL;
|
||||
frameInfoWindow = NULL;
|
||||
@@ -994,9 +997,9 @@ void MainWindow::showPlaybackWindow()
|
||||
{
|
||||
if (!playbackWindow)
|
||||
{
|
||||
playbackWindow = new FramePlaybackWindow(model->getListReference());
|
||||
playbackWindow = new FramePlaybackWindow(model->getListReference(), worker);
|
||||
//connect signal to signal to pass the signal through to whoever is handling the slot
|
||||
connect(playbackWindow, SIGNAL(sendCANFrame(const CANFrame*,int)), this, SIGNAL(sendCANFrame(const CANFrame*,int)));
|
||||
//connect(playbackWindow, SIGNAL(sendCANFrame(const CANFrame*,int)), this, SIGNAL(sendCANFrame(const CANFrame*,int)));
|
||||
}
|
||||
playbackWindow->show();
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ private:
|
||||
DBCHandler *dbcHandler;
|
||||
QList<QSerialPortInfo> ports;
|
||||
QThread serialWorkerThread;
|
||||
SerialWorker *worker;
|
||||
QByteArray inputBuffer;
|
||||
bool allowCapture;
|
||||
bool bDirty; //have frames been added or subtracted since the last save/load?
|
||||
|
||||
+7
-7
@@ -64,7 +64,7 @@ void SerialWorker::setSerialPort(QSerialPortInfo *port)
|
||||
output.append(0xF1); //another command to the GVRET
|
||||
output.append(0x07); //request device information
|
||||
serial->write(output);
|
||||
connected = false;
|
||||
connected = true; //should be false. only set true to test old firmware
|
||||
connect(serial, SIGNAL(readyRead()), this, SLOT(readSerialData()));
|
||||
QTimer::singleShot(1000, this, SLOT(connectionTimeout()));
|
||||
if (ticker == NULL)
|
||||
@@ -88,9 +88,9 @@ void SerialWorker::connectionTimeout()
|
||||
if (!connected) //no?
|
||||
{
|
||||
//then emit the the failure signal and see if anyone cares
|
||||
qDebug() << "Failed to connect to GVRET at that com port";
|
||||
ticker->stop();
|
||||
emit connectionFailure();
|
||||
//qDebug() << "Failed to connect to GVRET at that com port";
|
||||
//ticker->stop();
|
||||
//emit connectionFailure();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,10 +112,10 @@ void SerialWorker::sendFrame(const CANFrame *frame, int bus = 0)
|
||||
int c;
|
||||
int ID;
|
||||
|
||||
if (!connected) return;
|
||||
|
||||
//qDebug() << "Sending out frame with id " << frame->ID;
|
||||
|
||||
if (!connected) return;
|
||||
|
||||
ID = frame->ID;
|
||||
if (frame->extended) ID |= 1 << 31;
|
||||
|
||||
@@ -135,7 +135,7 @@ void SerialWorker::sendFrame(const CANFrame *frame, int bus = 0)
|
||||
|
||||
if (serial == NULL) return;
|
||||
if (!serial->isOpen()) return;
|
||||
qDebug() << "writing " << buffer.length() << " bytes to serial port";
|
||||
//qDebug() << "writing " << buffer.length() << " bytes to serial port";
|
||||
serial->write(buffer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user