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.
|
||||
//SavvyCAN will complain if you connect a GVRET board with a revision
|
||||
//less than this number.
|
||||
#define CURRENT_GVRET_VER 321
|
||||
#define CURRENT_GVRET_VER 322
|
||||
|
||||
#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
|
||||
|
||||
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;
|
||||
headers << "Source" << "Loops";
|
||||
@@ -520,7 +521,8 @@ void FramePlaybackWindow::btnSelectNoneClick()
|
||||
}
|
||||
|
||||
void FramePlaybackWindow::timerTriggered()
|
||||
{
|
||||
{
|
||||
sendingBuffer.clear();
|
||||
for (int count = 0; count < ui->spinBurstSpeed->value(); count++)
|
||||
{
|
||||
if (!playbackActive)
|
||||
@@ -537,6 +539,7 @@ void FramePlaybackWindow::timerTriggered()
|
||||
updatePosition(false);
|
||||
}
|
||||
}
|
||||
emit sendFrameBatch(&sendingBuffer);
|
||||
}
|
||||
|
||||
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.
|
||||
const CANFrame *thisFrame = ¤tSeqItem->data[currentPosition];
|
||||
CANFrame *thisFrame = ¤tSeqItem->data[currentPosition];
|
||||
int originalBus = thisFrame->bus;
|
||||
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
|
||||
if (whichBusSend & 1) emit sendCANFrame(thisFrame, 0);
|
||||
if (whichBusSend & 2) emit sendCANFrame(thisFrame, 1);
|
||||
if (whichBusSend & 4) emit sendCANFrame(thisFrame, thisFrame->bus);
|
||||
if (whichBusSend & 4)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@@ -55,11 +55,13 @@ private slots:
|
||||
|
||||
signals:
|
||||
void sendCANFrame(const CANFrame *, int);
|
||||
void sendFrameBatch(const QList<CANFrame> *);
|
||||
|
||||
private:
|
||||
Ui::FramePlaybackWindow *ui;
|
||||
QList<int> foundID;
|
||||
QList<CANFrame> frameCache;
|
||||
QList<CANFrame> sendingBuffer;
|
||||
const QVector<CANFrame> *modelFrames;
|
||||
int currentPosition;
|
||||
QTimer *playbackTimer;
|
||||
|
||||
+14
-3
@@ -70,11 +70,11 @@ void SerialWorker::setSerialPort(QSerialPortInfo *port)
|
||||
serial = new QSerialPort(*port);
|
||||
|
||||
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->setFlowControl(serial->HardwareControl);
|
||||
serial->setFlowControl(serial->HardwareControl); //this is important though
|
||||
serial->open(QIODevice::ReadWrite);
|
||||
serial->setDataTerminalReady(true);
|
||||
serial->setDataTerminalReady(true); //you do need to set these or the fan gets dirty
|
||||
serial->setRequestToSend(true);
|
||||
QByteArray output;
|
||||
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(0xF1);
|
||||
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())
|
||||
{
|
||||
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
|
||||
qDebug() << "Failed to connect to GVRET at that com port";
|
||||
ticker->stop();
|
||||
closeSerialPort(); //make sure it's properly closed anyway
|
||||
emit connectionFailure();
|
||||
}
|
||||
}
|
||||
@@ -171,6 +174,14 @@ void SerialWorker::sendFrame(const CANFrame *frame, int bus = 0)
|
||||
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)
|
||||
{
|
||||
QByteArray buffer;
|
||||
|
||||
@@ -50,6 +50,7 @@ public slots:
|
||||
void setSerialPort(QSerialPortInfo*);
|
||||
void closeSerialPort();
|
||||
void sendFrame(const CANFrame *, int);
|
||||
void sendFrameBatch(const QList<CANFrame> *);
|
||||
void updateBaudRates(int, int);
|
||||
void stopFrameCapture();
|
||||
void startFrameCapture(); //only need to call this if previously stopped. Otherwise it's the default
|
||||
|
||||
Reference in New Issue
Block a user