A few small fixes to connection window
This commit is contained in:
@@ -94,7 +94,19 @@ void CANConManager::refreshConnection(CANConnection* pConn_p)
|
|||||||
CANFrame* frame_p = NULL;
|
CANFrame* frame_p = NULL;
|
||||||
QVector<CANFrame> frames;
|
QVector<CANFrame> frames;
|
||||||
|
|
||||||
|
//Each connection only knows about its own bus numbers
|
||||||
|
//so this variable is used to fix that up to turn local bus numbers
|
||||||
|
//into system global bus numbers for display.
|
||||||
|
int busBase = 0;
|
||||||
|
|
||||||
|
foreach (CANConnection* conn, mConns)
|
||||||
|
{
|
||||||
|
if (conn != pConn_p) busBase += conn->getNumBuses();
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
|
||||||
while( (frame_p = pConn_p->getQueue().peek() ) ) {
|
while( (frame_p = pConn_p->getQueue().peek() ) ) {
|
||||||
|
frame_p->bus += busBase;
|
||||||
frames.append(*frame_p);
|
frames.append(*frame_p);
|
||||||
pConn_p->getQueue().dequeue();
|
pConn_p->getQueue().dequeue();
|
||||||
}
|
}
|
||||||
@@ -126,6 +138,7 @@ bool CANConManager::sendFrame(const CANFrame& pFrame)
|
|||||||
if (pFrame.bus <= busBase + conn->getNumBuses())
|
if (pFrame.bus <= busBase + conn->getNumBuses())
|
||||||
{
|
{
|
||||||
workingFrame.bus -= busBase;
|
workingFrame.bus -= busBase;
|
||||||
|
workingFrame.isReceived = false;
|
||||||
txFrame = conn->getQueue().get();
|
txFrame = conn->getQueue().get();
|
||||||
*txFrame = workingFrame;
|
*txFrame = workingFrame;
|
||||||
conn->getQueue().queue();
|
conn->getQueue().queue();
|
||||||
@@ -138,6 +151,7 @@ bool CANConManager::sendFrame(const CANFrame& pFrame)
|
|||||||
|
|
||||||
bool CANConManager::sendFrames(const QList<CANFrame>& pFrames)
|
bool CANConManager::sendFrames(const QList<CANFrame>& pFrames)
|
||||||
{
|
{
|
||||||
|
qDebug() << "CANConManager sendFrames #" << pFrames.count();
|
||||||
foreach(const CANFrame& frame, pFrames)
|
foreach(const CANFrame& frame, pFrames)
|
||||||
{
|
{
|
||||||
if(!sendFrame(frame))
|
if(!sendFrame(frame))
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ void ConnectionWindow::showEvent(QShowEvent* event)
|
|||||||
QDialog::showEvent(event);
|
QDialog::showEvent(event);
|
||||||
qDebug() << "Show connectionwindow";
|
qDebug() << "Show connectionwindow";
|
||||||
ui->tableConnections->selectRow(0);
|
ui->tableConnections->selectRow(0);
|
||||||
|
currentRowChanged(ui->tableConnections->currentIndex(), ui->tableConnections->currentIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -462,6 +463,10 @@ void ConnectionWindow::loadConnections()
|
|||||||
/* add connection to model */
|
/* add connection to model */
|
||||||
connModel->add(conn_p);
|
connModel->add(conn_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (connModel->rowCount() > 0) {
|
||||||
|
ui->tableConnections->selectRow(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionWindow::saveConnections()
|
void ConnectionWindow::saveConnections()
|
||||||
|
|||||||
Reference in New Issue
Block a user