Now the playback window is capable of vastly quicker sending of frames.
Use the burst setting and crank it up. Set the time interval to around 2ms and the burst to 6 and you'll be slinging frames like crazy.
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
//try to keep this in sync.
|
//try to keep this in sync.
|
||||||
//SavvyCAN will complain if you connect a GVRET board with a revision
|
//SavvyCAN will complain if you connect a GVRET board with a revision
|
||||||
//less than this number.
|
//less than this number.
|
||||||
#define CURRENT_GVRET_VER 321
|
#define CURRENT_GVRET_VER 322
|
||||||
|
|
||||||
#endif // CONFIG
|
#endif // CONFIG
|
||||||
|
|
||||||
|
|||||||
+21
-5
@@ -71,6 +71,7 @@ FramePlaybackWindow::FramePlaybackWindow(const QVector<CANFrame> *frames, Serial
|
|||||||
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);
|
connect(this, SIGNAL(sendCANFrame(const CANFrame*,int)), worker, SLOT(sendFrame(const CANFrame*,int)), Qt::QueuedConnection);
|
||||||
|
connect(this, SIGNAL(sendFrameBatch(const QList<CANFrame>*)), worker, SLOT(sendFrameBatch(const QList<CANFrame>*)), Qt::QueuedConnection);
|
||||||
|
|
||||||
QStringList headers;
|
QStringList headers;
|
||||||
headers << "Source" << "Loops";
|
headers << "Source" << "Loops";
|
||||||
@@ -520,7 +521,8 @@ void FramePlaybackWindow::btnSelectNoneClick()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FramePlaybackWindow::timerTriggered()
|
void FramePlaybackWindow::timerTriggered()
|
||||||
{
|
{
|
||||||
|
sendingBuffer.clear();
|
||||||
for (int count = 0; count < ui->spinBurstSpeed->value(); count++)
|
for (int count = 0; count < ui->spinBurstSpeed->value(); count++)
|
||||||
{
|
{
|
||||||
if (!playbackActive)
|
if (!playbackActive)
|
||||||
@@ -537,6 +539,7 @@ void FramePlaybackWindow::timerTriggered()
|
|||||||
updatePosition(false);
|
updatePosition(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
emit sendFrameBatch(&sendingBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramePlaybackWindow::updatePosition(bool forward)
|
void FramePlaybackWindow::updatePosition(bool forward)
|
||||||
@@ -606,13 +609,26 @@ 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.
|
||||||
const CANFrame *thisFrame = ¤tSeqItem->data[currentPosition];
|
CANFrame *thisFrame = ¤tSeqItem->data[currentPosition];
|
||||||
|
int originalBus = thisFrame->bus;
|
||||||
if (currentSeqItem->idFilters.find(thisFrame->ID).value())
|
if (currentSeqItem->idFilters.find(thisFrame->ID).value())
|
||||||
{
|
{
|
||||||
//index 0 is none, 1 is Bus 0, 2 is bus 1, 3 is both, 4 is from file
|
//index 0 is none, 1 is Bus 0, 2 is bus 1, 3 is both, 4 is from file
|
||||||
if (whichBusSend & 1) emit sendCANFrame(thisFrame, 0);
|
if (whichBusSend & 4)
|
||||||
if (whichBusSend & 2) emit sendCANFrame(thisFrame, 1);
|
{
|
||||||
if (whichBusSend & 4) emit sendCANFrame(thisFrame, thisFrame->bus);
|
sendingBuffer.append(*thisFrame);
|
||||||
|
}
|
||||||
|
if (whichBusSend & 1)
|
||||||
|
{
|
||||||
|
thisFrame->bus = 0;
|
||||||
|
sendingBuffer.append(*thisFrame);
|
||||||
|
}
|
||||||
|
if (whichBusSend & 2)
|
||||||
|
{
|
||||||
|
thisFrame->bus = 1;
|
||||||
|
sendingBuffer.append(*thisFrame);
|
||||||
|
}
|
||||||
|
thisFrame->bus = originalBus;
|
||||||
updateFrameLabel();
|
updateFrameLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,11 +55,13 @@ private slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendCANFrame(const CANFrame *, int);
|
void sendCANFrame(const CANFrame *, int);
|
||||||
|
void sendFrameBatch(const QList<CANFrame> *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::FramePlaybackWindow *ui;
|
Ui::FramePlaybackWindow *ui;
|
||||||
QList<int> foundID;
|
QList<int> foundID;
|
||||||
QList<CANFrame> frameCache;
|
QList<CANFrame> frameCache;
|
||||||
|
QList<CANFrame> sendingBuffer;
|
||||||
const QVector<CANFrame> *modelFrames;
|
const QVector<CANFrame> *modelFrames;
|
||||||
int currentPosition;
|
int currentPosition;
|
||||||
QTimer *playbackTimer;
|
QTimer *playbackTimer;
|
||||||
|
|||||||
+14
-3
@@ -70,11 +70,11 @@ void SerialWorker::setSerialPort(QSerialPortInfo *port)
|
|||||||
serial = new QSerialPort(*port);
|
serial = new QSerialPort(*port);
|
||||||
|
|
||||||
qDebug() << "Serial port name is " << port->portName();
|
qDebug() << "Serial port name is " << port->portName();
|
||||||
serial->setBaudRate(serial->Baud115200);
|
serial->setBaudRate(10000000); //more speed! probably does nothing for USB serial
|
||||||
serial->setDataBits(serial->Data8);
|
serial->setDataBits(serial->Data8);
|
||||||
serial->setFlowControl(serial->HardwareControl);
|
serial->setFlowControl(serial->HardwareControl); //this is important though
|
||||||
serial->open(QIODevice::ReadWrite);
|
serial->open(QIODevice::ReadWrite);
|
||||||
serial->setDataTerminalReady(true);
|
serial->setDataTerminalReady(true); //you do need to set these or the fan gets dirty
|
||||||
serial->setRequestToSend(true);
|
serial->setRequestToSend(true);
|
||||||
QByteArray output;
|
QByteArray output;
|
||||||
output.append(0xE7); //this puts the device into binary comm mode
|
output.append(0xE7); //this puts the device into binary comm mode
|
||||||
@@ -85,6 +85,8 @@ void SerialWorker::setSerialPort(QSerialPortInfo *port)
|
|||||||
output.append(0x07); //request device information
|
output.append(0x07); //request device information
|
||||||
output.append(0xF1);
|
output.append(0xF1);
|
||||||
output.append(0x08); //setting singlewire mode
|
output.append(0x08); //setting singlewire mode
|
||||||
|
output.append(0xF1); //yet another command
|
||||||
|
output.append(0x09); //comm validation command
|
||||||
if (settings.value("Main/SingleWireMode", false).toBool())
|
if (settings.value("Main/SingleWireMode", false).toBool())
|
||||||
{
|
{
|
||||||
output.append(0x10); //signal that we do want single wire mode
|
output.append(0x10); //signal that we do want single wire mode
|
||||||
@@ -122,6 +124,7 @@ void SerialWorker::connectionTimeout()
|
|||||||
//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();
|
||||||
|
closeSerialPort(); //make sure it's properly closed anyway
|
||||||
emit connectionFailure();
|
emit connectionFailure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,6 +174,14 @@ void SerialWorker::sendFrame(const CANFrame *frame, int bus = 0)
|
|||||||
serial->write(buffer);
|
serial->write(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//a simple way for another thread to pass us a bunch of frames to send.
|
||||||
|
//Don't get carried away here. The GVRET firmware only has finite
|
||||||
|
//buffers and besides, the other end will get buried in traffic.
|
||||||
|
void SerialWorker::sendFrameBatch(const QList<CANFrame> *frames)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < frames->length(); i++) sendFrame(&frames->at(i), frames->at(i).bus);
|
||||||
|
}
|
||||||
|
|
||||||
void SerialWorker::updateBaudRates(int Speed1, int Speed2)
|
void SerialWorker::updateBaudRates(int Speed1, int Speed2)
|
||||||
{
|
{
|
||||||
QByteArray buffer;
|
QByteArray buffer;
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public slots:
|
|||||||
void setSerialPort(QSerialPortInfo*);
|
void setSerialPort(QSerialPortInfo*);
|
||||||
void closeSerialPort();
|
void closeSerialPort();
|
||||||
void sendFrame(const CANFrame *, int);
|
void sendFrame(const CANFrame *, int);
|
||||||
|
void sendFrameBatch(const QList<CANFrame> *);
|
||||||
void updateBaudRates(int, int);
|
void updateBaudRates(int, int);
|
||||||
void stopFrameCapture();
|
void stopFrameCapture();
|
||||||
void startFrameCapture(); //only need to call this if previously stopped. Otherwise it's the default
|
void startFrameCapture(); //only need to call this if previously stopped. Otherwise it's the default
|
||||||
|
|||||||
Reference in New Issue
Block a user