Temporary commit to make savvy can work with older GVRET versions.
This commit is contained in:
@@ -2,13 +2,14 @@
|
|||||||
#include "ui_frameplaybackwindow.h"
|
#include "ui_frameplaybackwindow.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
FramePlaybackWindow::FramePlaybackWindow(QVector<CANFrame> *frames, QWidget *parent) :
|
FramePlaybackWindow::FramePlaybackWindow(QVector<CANFrame> *frames, SerialWorker *worker, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::FramePlaybackWindow)
|
ui(new Ui::FramePlaybackWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
modelFrames = frames;
|
modelFrames = frames;
|
||||||
|
serialWorker = worker;
|
||||||
|
|
||||||
playbackTimer = new QTimer();
|
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
|
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()
|
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.
|
//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);
|
QList<QListWidgetItem *> idList = ui->listID->findItems(QString::number(modelFrames->at(currentPosition).ID, 16).toUpper().rightJustified(4,'0'), Qt::MatchExactly);
|
||||||
if (idList.count() > 0)
|
if (idList.count() > 0)
|
||||||
{
|
{
|
||||||
@@ -207,7 +211,11 @@ void FramePlaybackWindow::updatePosition(bool forward)
|
|||||||
if (whichBusSend & 1) emit sendCANFrame(thisFrame, 0);
|
if (whichBusSend & 1) emit sendCANFrame(thisFrame, 0);
|
||||||
if (whichBusSend & 2) emit sendCANFrame(thisFrame, 1);
|
if (whichBusSend & 2) emit sendCANFrame(thisFrame, 1);
|
||||||
if (whichBusSend & 4) emit sendCANFrame(thisFrame, thisFrame->bus);
|
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();
|
updateFrameLabel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "can_structs.h"
|
#include "can_structs.h"
|
||||||
|
#include "serialworker.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class FramePlaybackWindow;
|
class FramePlaybackWindow;
|
||||||
@@ -15,7 +16,7 @@ class FramePlaybackWindow : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FramePlaybackWindow(QVector<CANFrame> *frames, QWidget *parent = 0);
|
explicit FramePlaybackWindow(QVector<CANFrame> *frames, SerialWorker *worker, QWidget *parent = 0);
|
||||||
~FramePlaybackWindow();
|
~FramePlaybackWindow();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@@ -43,6 +44,7 @@ private:
|
|||||||
QVector<CANFrame> *modelFrames;
|
QVector<CANFrame> *modelFrames;
|
||||||
int currentPosition;
|
int currentPosition;
|
||||||
QTimer *playbackTimer;
|
QTimer *playbackTimer;
|
||||||
|
SerialWorker *serialWorker;
|
||||||
bool playbackActive;
|
bool playbackActive;
|
||||||
bool playbackForward;
|
bool playbackForward;
|
||||||
int whichBusSend;
|
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.
|
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.
|
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.
|
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 = "";
|
QString MainWindow::loadedFileName = "";
|
||||||
@@ -83,7 +85,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->cbSpeed2->addItem(tr("1000000"));
|
ui->cbSpeed2->addItem(tr("1000000"));
|
||||||
ui->cbSpeed2->addItem(tr("33333"));
|
ui->cbSpeed2->addItem(tr("33333"));
|
||||||
|
|
||||||
SerialWorker *worker = new SerialWorker(model);
|
worker = new SerialWorker(model);
|
||||||
worker->moveToThread(&serialWorkerThread);
|
worker->moveToThread(&serialWorkerThread);
|
||||||
connect(&serialWorkerThread, &QThread::finished, worker, &QObject::deleteLater);
|
connect(&serialWorkerThread, &QThread::finished, worker, &QObject::deleteLater);
|
||||||
connect(this, &MainWindow::sendSerialPort, worker, &SerialWorker::setSerialPort, Qt::QueuedConnection);
|
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::startFrameCapturing, worker, &SerialWorker::startFrameCapture);
|
||||||
connect(this, &MainWindow::stopFrameCapturing, worker, &SerialWorker::stopFrameCapture);
|
connect(this, &MainWindow::stopFrameCapturing, worker, &SerialWorker::stopFrameCapture);
|
||||||
serialWorkerThread.start();
|
serialWorkerThread.start();
|
||||||
|
serialWorkerThread.setPriority(QThread::TimeCriticalPriority);
|
||||||
|
|
||||||
graphingWindow = NULL;
|
graphingWindow = NULL;
|
||||||
frameInfoWindow = NULL;
|
frameInfoWindow = NULL;
|
||||||
@@ -994,9 +997,9 @@ void MainWindow::showPlaybackWindow()
|
|||||||
{
|
{
|
||||||
if (!playbackWindow)
|
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 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();
|
playbackWindow->show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ private:
|
|||||||
DBCHandler *dbcHandler;
|
DBCHandler *dbcHandler;
|
||||||
QList<QSerialPortInfo> ports;
|
QList<QSerialPortInfo> ports;
|
||||||
QThread serialWorkerThread;
|
QThread serialWorkerThread;
|
||||||
|
SerialWorker *worker;
|
||||||
QByteArray inputBuffer;
|
QByteArray inputBuffer;
|
||||||
bool allowCapture;
|
bool allowCapture;
|
||||||
bool bDirty; //have frames been added or subtracted since the last save/load?
|
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(0xF1); //another command to the GVRET
|
||||||
output.append(0x07); //request device information
|
output.append(0x07); //request device information
|
||||||
serial->write(output);
|
serial->write(output);
|
||||||
connected = false;
|
connected = true; //should be false. only set true to test old firmware
|
||||||
connect(serial, SIGNAL(readyRead()), this, SLOT(readSerialData()));
|
connect(serial, SIGNAL(readyRead()), this, SLOT(readSerialData()));
|
||||||
QTimer::singleShot(1000, this, SLOT(connectionTimeout()));
|
QTimer::singleShot(1000, this, SLOT(connectionTimeout()));
|
||||||
if (ticker == NULL)
|
if (ticker == NULL)
|
||||||
@@ -88,9 +88,9 @@ void SerialWorker::connectionTimeout()
|
|||||||
if (!connected) //no?
|
if (!connected) //no?
|
||||||
{
|
{
|
||||||
//then emit the the failure signal and see if anyone cares
|
//then emit the the failure signal and see if anyone cares
|
||||||
qDebug() << "Failed to connect to GVRET at that com port";
|
//qDebug() << "Failed to connect to GVRET at that com port";
|
||||||
ticker->stop();
|
//ticker->stop();
|
||||||
emit connectionFailure();
|
//emit connectionFailure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,10 +112,10 @@ void SerialWorker::sendFrame(const CANFrame *frame, int bus = 0)
|
|||||||
int c;
|
int c;
|
||||||
int ID;
|
int ID;
|
||||||
|
|
||||||
if (!connected) return;
|
|
||||||
|
|
||||||
//qDebug() << "Sending out frame with id " << frame->ID;
|
//qDebug() << "Sending out frame with id " << frame->ID;
|
||||||
|
|
||||||
|
if (!connected) return;
|
||||||
|
|
||||||
ID = frame->ID;
|
ID = frame->ID;
|
||||||
if (frame->extended) ID |= 1 << 31;
|
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 == NULL) return;
|
||||||
if (!serial->isOpen()) return;
|
if (!serial->isOpen()) return;
|
||||||
qDebug() << "writing " << buffer.length() << " bytes to serial port";
|
//qDebug() << "writing " << buffer.length() << " bytes to serial port";
|
||||||
serial->write(buffer);
|
serial->write(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user