Merge pull request #723 from esaulenka/fix/MinorFixes
Several minor fixes
This commit is contained in:
+9
-16
@@ -13,21 +13,13 @@ CANBus::CANBus()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CANBus::CANBus(const CANBus& pBus) :
|
|
||||||
speed(pBus.speed),
|
|
||||||
listenOnly(pBus.listenOnly),
|
|
||||||
singleWire(pBus.singleWire),
|
|
||||||
active(pBus.active),
|
|
||||||
canFD(pBus.canFD),
|
|
||||||
dataRate(pBus.dataRate){}
|
|
||||||
|
|
||||||
|
|
||||||
bool CANBus::operator==(const CANBus& bus) const{
|
bool CANBus::operator==(const CANBus& bus) const{
|
||||||
return speed == bus.speed &&
|
return speed == bus.speed &&
|
||||||
listenOnly == bus.listenOnly &&
|
listenOnly == bus.listenOnly &&
|
||||||
singleWire == bus.singleWire &&
|
singleWire == bus.singleWire &&
|
||||||
active == bus.active &&
|
active == bus.active &&
|
||||||
canFD == bus.canFD;
|
canFD == bus.canFD &&
|
||||||
|
dataRate == bus.dataRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CANBus::setSpeed(int newSpeed){
|
void CANBus::setSpeed(int newSpeed){
|
||||||
@@ -55,11 +47,11 @@ void CANBus::setCanFD(bool mode){
|
|||||||
canFD = mode;
|
canFD = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CANBus::getSpeed(){
|
int CANBus::getSpeed() const {
|
||||||
return speed;
|
return speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CANBus::getDataRate(){
|
int CANBus::getDataRate() const {
|
||||||
return dataRate;
|
return dataRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,19 +60,19 @@ void CANBus::setDataRate(int newSpeed){
|
|||||||
dataRate = newSpeed;
|
dataRate = newSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CANBus::isListenOnly(){
|
bool CANBus::isListenOnly() const {
|
||||||
return listenOnly;
|
return listenOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CANBus::isSingleWire(){
|
bool CANBus::isSingleWire() const {
|
||||||
return singleWire;
|
return singleWire;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CANBus::isActive(){
|
bool CANBus::isActive() const {
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CANBus::isCanFD(){
|
bool CANBus::isCanFD() const {
|
||||||
return canFD;
|
return canFD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,6 +83,7 @@ QDataStream& operator<<( QDataStream & pStream, const CANBus& pCanBus )
|
|||||||
pStream << pCanBus.listenOnly;
|
pStream << pCanBus.listenOnly;
|
||||||
pStream << pCanBus.singleWire;
|
pStream << pCanBus.singleWire;
|
||||||
pStream << pCanBus.active;
|
pStream << pCanBus.active;
|
||||||
|
// FIXME CANFD settings missing
|
||||||
return pStream;
|
return pStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-14
@@ -5,13 +5,6 @@
|
|||||||
|
|
||||||
class CANBus
|
class CANBus
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
CANBus();
|
|
||||||
CANBus(const CANBus&);
|
|
||||||
bool operator==(const CANBus&) const;
|
|
||||||
CANBus& operator=(const CANBus& other) = default;
|
|
||||||
//virtual ~CANBus(){}
|
|
||||||
|
|
||||||
int speed;
|
int speed;
|
||||||
bool listenOnly;
|
bool listenOnly;
|
||||||
bool singleWire;
|
bool singleWire;
|
||||||
@@ -19,18 +12,26 @@ public:
|
|||||||
bool canFD;
|
bool canFD;
|
||||||
int dataRate;
|
int dataRate;
|
||||||
|
|
||||||
|
friend QDataStream& operator<<(QDataStream & pStream, const CANBus& pCanBus);
|
||||||
|
friend QDataStream& operator>>(QDataStream & pStream, CANBus& pCanBus);
|
||||||
|
public:
|
||||||
|
CANBus();
|
||||||
|
|
||||||
|
bool operator==(const CANBus&) const;
|
||||||
|
|
||||||
void setSpeed(int); // new speed
|
void setSpeed(int); // new speed
|
||||||
void setListenOnly(bool); //bool for whether to only listen
|
void setListenOnly(bool); //bool for whether to only listen
|
||||||
void setSingleWire(bool); //bool for whether to use single wire mode
|
void setSingleWire(bool); //bool for whether to use single wire mode
|
||||||
void setActive(bool); //whether this bus should be enabled or not.
|
void setActive(bool); //whether this bus should be enabled or not.
|
||||||
void setCanFD(bool); // enable or disable CANFD support
|
void setCanFD(bool); // enable or disable CANFD support
|
||||||
int getSpeed();
|
|
||||||
int getDataRate();
|
|
||||||
void setDataRate(int newSpeed);
|
void setDataRate(int newSpeed);
|
||||||
bool isListenOnly();
|
|
||||||
bool isSingleWire();
|
int getSpeed() const;
|
||||||
bool isActive();
|
int getDataRate() const;
|
||||||
bool isCanFD();
|
bool isListenOnly() const;
|
||||||
|
bool isSingleWire() const;
|
||||||
|
bool isActive() const;
|
||||||
|
bool isCanFD() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
QDataStream& operator<<(QDataStream & pStream, const CANBus& pCanBus);
|
QDataStream& operator<<(QDataStream & pStream, const CANBus& pCanBus);
|
||||||
@@ -40,7 +41,7 @@ Q_DECLARE_METATYPE(CANBus);
|
|||||||
|
|
||||||
struct BusData {
|
struct BusData {
|
||||||
CANBus mBus;
|
CANBus mBus;
|
||||||
bool mConfigured;
|
bool mConfigured = {};
|
||||||
QVector<CANFltObserver> mTargettedFrames;
|
QVector<CANFltObserver> mTargettedFrames;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ CANConnection::CANConnection(QString pPort,
|
|||||||
int pQueueLen,
|
int pQueueLen,
|
||||||
bool pUseThread) :
|
bool pUseThread) :
|
||||||
mNumBuses(pNumBuses),
|
mNumBuses(pNumBuses),
|
||||||
|
mSerialSpeed(pSerialSpeed),
|
||||||
mQueue(),
|
mQueue(),
|
||||||
mPort(pPort),
|
mPort(pPort),
|
||||||
mDriver(pDriver),
|
mDriver(pDriver),
|
||||||
mType(pType),
|
mType(pType),
|
||||||
mSerialSpeed(pSerialSpeed),
|
|
||||||
mIsCapSuspended(false),
|
mIsCapSuspended(false),
|
||||||
mStatus(CANCon::NOT_CONNECTED),
|
mStatus(CANCon::NOT_CONNECTED),
|
||||||
mStarted(false),
|
mStarted(false),
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void SerialBusConnection::piSetBusSettings(int pBusIdx, CANBus bus)
|
|||||||
setBusConfig(0, bus);
|
setBusConfig(0, bus);
|
||||||
|
|
||||||
/* if bus is not active we are done */
|
/* if bus is not active we are done */
|
||||||
if(!bus.active)
|
if(!bus.isActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* set configuration */
|
/* set configuration */
|
||||||
@@ -105,10 +105,10 @@ void SerialBusConnection::piSetBusSettings(int pBusIdx, CANBus bus)
|
|||||||
|
|
||||||
//You cannot set the speed of a socketcan interface, it has to be set with console commands.
|
//You cannot set the speed of a socketcan interface, it has to be set with console commands.
|
||||||
//But, you can probabaly set the speed of many of the other serialbus devices so go ahead and try
|
//But, you can probabaly set the speed of many of the other serialbus devices so go ahead and try
|
||||||
mDev_p->setConfigurationParameter(QCanBusDevice::BitRateKey, bus.speed);
|
mDev_p->setConfigurationParameter(QCanBusDevice::BitRateKey, bus.getSpeed());
|
||||||
mDev_p->setConfigurationParameter(QCanBusDevice::CanFdKey, bus.canFD);
|
mDev_p->setConfigurationParameter(QCanBusDevice::CanFdKey, bus.isCanFD());
|
||||||
|
|
||||||
if(bus.listenOnly)
|
if(bus.isListenOnly())
|
||||||
sbusconfig |= EN_SILENT_MODE;
|
sbusconfig |= EN_SILENT_MODE;
|
||||||
mDev_p->setConfigurationParameter(QCanBusDevice::UserKey, sbusconfig);
|
mDev_p->setConfigurationParameter(QCanBusDevice::UserKey, sbusconfig);
|
||||||
|
|
||||||
@@ -188,6 +188,7 @@ void SerialBusConnection::framesReceived()
|
|||||||
|
|
||||||
/* check frame */
|
/* check frame */
|
||||||
//if (recFrame.payload().length() <= 8) {
|
//if (recFrame.payload().length() <= 8) {
|
||||||
|
if (true) {
|
||||||
CANFrame* frame_p = getQueue().get();
|
CANFrame* frame_p = getQueue().get();
|
||||||
if(frame_p) {
|
if(frame_p) {
|
||||||
frame_p->setPayload(recFrame.payload());
|
frame_p->setPayload(recFrame.payload());
|
||||||
@@ -218,11 +219,9 @@ void SerialBusConnection::framesReceived()
|
|||||||
|
|
||||||
/* enqueue frame */
|
/* enqueue frame */
|
||||||
getQueue().queue();
|
getQueue().queue();
|
||||||
//}
|
}
|
||||||
#if 0
|
|
||||||
else
|
else
|
||||||
qDebug() << "can't get a frame, ERROR";
|
qDebug() << "can't get a frame, ERROR";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,8 +219,8 @@ void SocketCANd::connectDevice()
|
|||||||
void SocketCANd::deviceConnected(int busNum)
|
void SocketCANd::deviceConnected(int busNum)
|
||||||
{
|
{
|
||||||
sendDebug("Opening CAN on Kayak Device!");
|
sendDebug("Opening CAN on Kayak Device!");
|
||||||
const char* openCanCmd = ("< open " + hostCanIDs[busNum] + " >").toStdString().c_str();
|
QString openCanCmd("< open " % hostCanIDs[busNum] % " >");
|
||||||
sendStringToTCP(openCanCmd, busNum);
|
sendStringToTCP(openCanCmd.toUtf8().data(), busNum);
|
||||||
|
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
}
|
}
|
||||||
@@ -383,8 +383,6 @@ void SocketCANd::procRXData(QString data, int busNum)
|
|||||||
mTimer.stop();
|
mTimer.stop();
|
||||||
mTimer.start();
|
mTimer.start();
|
||||||
}
|
}
|
||||||
QByteArray output;
|
|
||||||
|
|
||||||
switch (rx_state.at(busNum))
|
switch (rx_state.at(busNum))
|
||||||
{
|
{
|
||||||
case IDLE:
|
case IDLE:
|
||||||
|
|||||||
@@ -1054,8 +1054,6 @@ void FrameSenderWindow::processCellChange(int line, int col)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ST_COLS::SENDTAB_COL_DATA: //Data bytes
|
case ST_COLS::SENDTAB_COL_DATA: //Data bytes
|
||||||
for (int i = 0; i < 8; i++) sendingData[line].payload().data()[i] = 0;
|
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
|
#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
|
||||||
tokens = ui->tableSender->item(line, ST_COLS::SENDTAB_COL_DATA)->text().split(" ", Qt::SkipEmptyParts);
|
tokens = ui->tableSender->item(line, ST_COLS::SENDTAB_COL_DATA)->text().split(" ", Qt::SkipEmptyParts);
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -222,8 +222,8 @@ void DBCComparatorWindow::calculateDetails()
|
|||||||
|
|
||||||
ui->treeDetails->addTopLevelItem(msgDiffRoot);
|
ui->treeDetails->addTopLevelItem(msgDiffRoot);
|
||||||
|
|
||||||
QTreeWidgetItem *msgItem;
|
QTreeWidgetItem *msgItem {};
|
||||||
QTreeWidgetItem *sigTemp;
|
QTreeWidgetItem *sigTemp {};
|
||||||
|
|
||||||
for (int i = 0; i < firstDBC->messageHandler->getCount(); i++)
|
for (int i = 0; i < firstDBC->messageHandler->getCount(); i++)
|
||||||
{
|
{
|
||||||
@@ -257,6 +257,7 @@ void DBCComparatorWindow::calculateDetails()
|
|||||||
msgItem->setText(0, msgName + " (" + Utility::formatCANID(thisMsg->ID) + ")");
|
msgItem->setText(0, msgName + " (" + Utility::formatCANID(thisMsg->ID) + ")");
|
||||||
sigDiffTwo->addChild(msgItem);
|
sigDiffTwo->addChild(msgItem);
|
||||||
}
|
}
|
||||||
|
if (msgItem)
|
||||||
msgItem->addChild(missingSigItem);
|
msgItem->addChild(missingSigItem);
|
||||||
}
|
}
|
||||||
else //signal exists on both sides. See if it as changed position or length
|
else //signal exists on both sides. See if it as changed position or length
|
||||||
@@ -301,6 +302,7 @@ void DBCComparatorWindow::calculateDetails()
|
|||||||
sigTemp->setText(0, msgName + " (" + Utility::formatCANID(thisMsg->ID) + ")");
|
sigTemp->setText(0, msgName + " (" + Utility::formatCANID(thisMsg->ID) + ")");
|
||||||
sigModifiedRoot->addChild(sigTemp);
|
sigModifiedRoot->addChild(sigTemp);
|
||||||
}
|
}
|
||||||
|
if (sigTemp)
|
||||||
sigTemp->addChild(sigItem);
|
sigTemp->addChild(sigItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -851,7 +851,7 @@ void FlowViewWindow::updatePosition(bool forward)
|
|||||||
int maxVal = qMin(chunk * 8 + 8, frameCache.at(currentPosition).payload().length());
|
int maxVal = qMin(chunk * 8 + 8, frameCache.at(currentPosition).payload().length());
|
||||||
for (int i = chunk * 8; i < maxVal; i++)
|
for (int i = chunk * 8; i < maxVal; i++)
|
||||||
{
|
{
|
||||||
unsigned char thisByte = static_cast<unsigned char>(frameCache.at(currentPosition).payload().data()[i]);
|
unsigned char thisByte = static_cast<unsigned char>(frameCache.at(currentPosition).payload()[i]);
|
||||||
cngByte = currBytes[i] ^ thisByte;
|
cngByte = currBytes[i] ^ thisByte;
|
||||||
changedBits |= (uint64_t)cngByte << (8ull * (i & 7));
|
changedBits |= (uint64_t)cngByte << (8ull * (i & 7));
|
||||||
}
|
}
|
||||||
|
|||||||
+88
-96
@@ -39,7 +39,7 @@ GraphingWindow::GraphingWindow(const QVector<CANFrame> *frames, QWidget *parent)
|
|||||||
|
|
||||||
if (Utility::timeStyle == TS_CLOCK)
|
if (Utility::timeStyle == TS_CLOCK)
|
||||||
{
|
{
|
||||||
QSharedPointer<QCPAxisTickerTime> timeTicker(new QCPAxisTickerTime);
|
QSharedPointer timeTicker = QSharedPointer<QCPAxisTickerTime>::create();
|
||||||
timeTicker->setTimeFormat("%h:%m:%s.%z");
|
timeTicker->setTimeFormat("%h:%m:%s.%z");
|
||||||
ui->graphingView->xAxis->setTicker(timeTicker);
|
ui->graphingView->xAxis->setTicker(timeTicker);
|
||||||
}
|
}
|
||||||
@@ -571,7 +571,7 @@ void GraphingWindow::removeSelectedGraph()
|
|||||||
int idx = -1;
|
int idx = -1;
|
||||||
for (int i = 0; i < graphParams.count(); i++)
|
for (int i = 0; i < graphParams.count(); i++)
|
||||||
{
|
{
|
||||||
if (graphParams[i].ref == ui->graphingView->selectedGraphs().first())
|
if (graphParams[i].ref == ui->graphingView->selectedGraphs().constFirst())
|
||||||
{
|
{
|
||||||
idx = i;
|
idx = i;
|
||||||
break;
|
break;
|
||||||
@@ -590,7 +590,7 @@ void GraphingWindow::removeSelectedGraph()
|
|||||||
|
|
||||||
graphParams.removeAt(idx);
|
graphParams.removeAt(idx);
|
||||||
|
|
||||||
ui->graphingView->removeGraph(ui->graphingView->selectedGraphs().first());
|
ui->graphingView->removeGraph(ui->graphingView->selectedGraphs().constFirst());
|
||||||
|
|
||||||
if (graphParams.count() == 0) needScaleSetup = true;
|
if (graphParams.count() == 0) needScaleSetup = true;
|
||||||
|
|
||||||
@@ -605,7 +605,7 @@ void GraphingWindow::editSelectedGraph()
|
|||||||
int idx = -1;
|
int idx = -1;
|
||||||
for (int i = 0; i < graphParams.count(); i++)
|
for (int i = 0; i < graphParams.count(); i++)
|
||||||
{
|
{
|
||||||
if (graphParams[i].ref == ui->graphingView->selectedGraphs().first())
|
if (graphParams[i].ref == ui->graphingView->selectedGraphs().constFirst())
|
||||||
{
|
{
|
||||||
idx = i;
|
idx = i;
|
||||||
break;
|
break;
|
||||||
@@ -701,7 +701,6 @@ void GraphingWindow::contextMenuRequest(QPoint pos)
|
|||||||
|
|
||||||
void GraphingWindow::saveGraphs()
|
void GraphingWindow::saveGraphs()
|
||||||
{
|
{
|
||||||
QString filename;
|
|
||||||
QFileDialog dialog(this);
|
QFileDialog dialog(this);
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
@@ -718,7 +717,7 @@ void GraphingWindow::saveGraphs()
|
|||||||
|
|
||||||
if (dialog.exec() == QDialog::Accepted)
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
filename = dialog.selectedFiles()[0];
|
QString filename = dialog.selectedFiles().constFirst();
|
||||||
settings.setValue("Graphing/LoadSaveDirectory", dialog.directory().path());
|
settings.setValue("Graphing/LoadSaveDirectory", dialog.directory().path());
|
||||||
|
|
||||||
if (dialog.selectedNameFilter() == filters[0])
|
if (dialog.selectedNameFilter() == filters[0])
|
||||||
@@ -741,7 +740,6 @@ void GraphingWindow::saveGraphs()
|
|||||||
|
|
||||||
void GraphingWindow::saveSpreadsheet()
|
void GraphingWindow::saveSpreadsheet()
|
||||||
{
|
{
|
||||||
QString filename;
|
|
||||||
QFileDialog dialog(this);
|
QFileDialog dialog(this);
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
@@ -756,14 +754,14 @@ void GraphingWindow::saveSpreadsheet()
|
|||||||
|
|
||||||
if (dialog.exec() == QDialog::Accepted)
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
filename = dialog.selectedFiles()[0];
|
QString filename = dialog.selectedFiles().constFirst();
|
||||||
settings.setValue("Graphing/LoadSaveDirectory", dialog.directory().path());
|
settings.setValue("Graphing/LoadSaveDirectory", dialog.directory().path());
|
||||||
|
|
||||||
if (!filename.contains('.')) filename += ".csv";
|
if (!filename.contains('.')) filename += ".csv";
|
||||||
|
|
||||||
QFile *outFile = new QFile(filename);
|
QFile outFile(filename);
|
||||||
|
|
||||||
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
if (!outFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -779,12 +777,12 @@ void GraphingWindow::saveSpreadsheet()
|
|||||||
QList<GraphParams>::iterator iter;
|
QList<GraphParams>::iterator iter;
|
||||||
double xMin = std::numeric_limits<double>::max(),
|
double xMin = std::numeric_limits<double>::max(),
|
||||||
xMax = std::numeric_limits<double>::min();
|
xMax = std::numeric_limits<double>::min();
|
||||||
size_t maxCount = 0;
|
int maxCount = 0;
|
||||||
size_t numGraphs = graphParams.length();
|
int numGraphs = graphParams.length();
|
||||||
for (auto && graph : graphParams) {
|
for (auto && graph : graphParams) {
|
||||||
xMin = std::min(xMin, graph.x[0]);
|
xMin = std::min(xMin, graph.x[0]);
|
||||||
xMax = std::max(xMax, graph.x[graph.x.count() - 1]);
|
xMax = std::max(xMax, graph.x[graph.x.count() - 1]);
|
||||||
maxCount = std::max(maxCount, static_cast<size_t>(graph.x.count()));
|
maxCount = std::max(maxCount, graph.x.count());
|
||||||
}
|
}
|
||||||
qDebug() << "xMin: " << xMin;
|
qDebug() << "xMin: " << xMin;
|
||||||
qDebug() << "xMax: " << xMax;
|
qDebug() << "xMax: " << xMax;
|
||||||
@@ -795,27 +793,25 @@ void GraphingWindow::saveSpreadsheet()
|
|||||||
double xSize = xMax - xMin;
|
double xSize = xMax - xMin;
|
||||||
double sliceSize = xSize / ((double)maxCount);
|
double sliceSize = xSize / ((double)maxCount);
|
||||||
double equivValue = sliceSize / 100.0;
|
double equivValue = sliceSize / 100.0;
|
||||||
double currentX;
|
|
||||||
double value;
|
|
||||||
QList<int> indices;
|
QList<int> indices;
|
||||||
indices.reserve(numGraphs);
|
indices.reserve(numGraphs);
|
||||||
|
|
||||||
outFile->write("TimeStamp");
|
outFile.write("TimeStamp");
|
||||||
for (auto && graph : graphParams) {
|
for (auto && graph : graphParams) {
|
||||||
indices.append(0);
|
indices.append(0);
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(graph.graphName.toUtf8());
|
outFile.write(graph.graphName.toUtf8());
|
||||||
}
|
}
|
||||||
outFile->write("\n");
|
outFile.write("\n");
|
||||||
|
|
||||||
for (size_t j = 1; j < (maxCount - 1); j++)
|
for (int j = 1; j < (maxCount - 1); j++)
|
||||||
{
|
{
|
||||||
currentX = xMin + (j * sliceSize);
|
double currentX = xMin + (j * sliceSize);
|
||||||
qDebug() << "X: " << currentX;
|
qDebug() << "X: " << currentX;
|
||||||
outFile->write(QString::number(currentX, 'f').toUtf8());
|
outFile.write(QString::number(currentX, 'f').toUtf8());
|
||||||
for (size_t k = 0; k < numGraphs; k++)
|
for (int k = 0; k < numGraphs; k++)
|
||||||
{
|
{
|
||||||
value = 0.0;
|
double value = 0.0;
|
||||||
|
|
||||||
// move cursor to last sample before currentX
|
// move cursor to last sample before currentX
|
||||||
while (graphParams[k].x[indices[k]+1] < currentX)
|
while (graphParams[k].x[indices[k]+1] < currentX)
|
||||||
@@ -849,27 +845,26 @@ void GraphingWindow::saveSpreadsheet()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// find index, where x >= currentX
|
// find index, where x >= currentX
|
||||||
size_t cursor = indices[k];
|
int cursor = indices[k];
|
||||||
double span = graphParams[k].x[cursor+1] - graphParams[k].x[cursor];
|
double span = graphParams[k].x[cursor+1] - graphParams[k].x[cursor];
|
||||||
double progress = (currentX - graphParams[k].x[cursor]) / span;
|
double progress = (currentX - graphParams[k].x[cursor]) / span;
|
||||||
Q_ASSERT(progress >= 0.0 && progress <= 1.0);
|
Q_ASSERT(progress >= 0.0 && progress <= 1.0);
|
||||||
value = Utility::Lerp(graphParams[k].y[cursor], graphParams[k].y[cursor+1], progress);
|
value = Utility::Lerp(graphParams[k].y[cursor], graphParams[k].y[cursor+1], progress);
|
||||||
qDebug() << "Span: " << span << " Prog: " << progress << " Value: " << value;
|
qDebug() << "Span: " << span << " Prog: " << progress << " Value: " << value;
|
||||||
}
|
}
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(value).toUtf8());
|
outFile.write(QString::number(value).toUtf8());
|
||||||
}
|
}
|
||||||
outFile->write("\n");
|
outFile.write("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
outFile->close();
|
outFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphingWindow::saveDefinitions()
|
void GraphingWindow::saveDefinitions()
|
||||||
{
|
{
|
||||||
QString filename;
|
|
||||||
QFileDialog dialog(this);
|
QFileDialog dialog(this);
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
@@ -884,79 +879,78 @@ void GraphingWindow::saveDefinitions()
|
|||||||
|
|
||||||
if (dialog.exec() == QDialog::Accepted)
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
filename = dialog.selectedFiles()[0];
|
QString filename = dialog.selectedFiles().constFirst();
|
||||||
settings.setValue("Graphing/LoadSaveDirectory", dialog.directory().path());
|
settings.setValue("Graphing/LoadSaveDirectory", dialog.directory().path());
|
||||||
|
|
||||||
if (!filename.contains('.')) filename += ".gdf";
|
if (!filename.contains('.')) filename += ".gdf";
|
||||||
|
|
||||||
QFile *outFile = new QFile(filename);
|
QFile outFile(filename);
|
||||||
|
|
||||||
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
if (!outFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QList<GraphParams>::iterator iter;
|
QList<GraphParams>::iterator iter;
|
||||||
for (iter = graphParams.begin(); iter != graphParams.end(); ++iter)
|
for (iter = graphParams.begin(); iter != graphParams.end(); ++iter)
|
||||||
{
|
{
|
||||||
outFile->write("Z,");
|
outFile.write("Z,");
|
||||||
outFile->write(QString::number(iter->ID, 16).toUtf8());
|
outFile.write(QString::number(iter->ID, 16).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->mask, 16).toUtf8());
|
outFile.write(QString::number(iter->mask, 16).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
if (iter->intelFormat) outFile->write(QString::number(iter->startBit).toUtf8());
|
if (iter->intelFormat) outFile.write(QString::number(iter->startBit).toUtf8());
|
||||||
else outFile->write(QString::number(iter->startBit * -1).toUtf8());
|
else outFile.write(QString::number(iter->startBit * -1).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->numBits).toUtf8());
|
outFile.write(QString::number(iter->numBits).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
if (iter->isSigned) outFile->putChar('Y');
|
if (iter->isSigned) outFile.putChar('Y');
|
||||||
else outFile->putChar('N');
|
else outFile.putChar('N');
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->bias).toUtf8());
|
outFile.write(QString::number(iter->bias).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->scale).toUtf8());
|
outFile.write(QString::number(iter->scale).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->stride).toUtf8());
|
outFile.write(QString::number(iter->stride).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->bus).toUtf8());
|
outFile.write(QString::number(iter->bus).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->lineColor.red()).toUtf8());
|
outFile.write(QString::number(iter->lineColor.red()).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->lineColor.green()).toUtf8());
|
outFile.write(QString::number(iter->lineColor.green()).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->lineColor.blue()).toUtf8());
|
outFile.write(QString::number(iter->lineColor.blue()).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(iter->graphName.toUtf8());
|
outFile.write(iter->graphName.toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->fillColor.red()).toUtf8());
|
outFile.write(QString::number(iter->fillColor.red()).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->fillColor.green()).toUtf8());
|
outFile.write(QString::number(iter->fillColor.green()).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->fillColor.blue()).toUtf8());
|
outFile.write(QString::number(iter->fillColor.blue()).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->fillColor.alpha()).toUtf8());
|
outFile.write(QString::number(iter->fillColor.alpha()).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
if (iter->drawOnlyPoints) outFile->putChar('Y');
|
if (iter->drawOnlyPoints) outFile.putChar('Y');
|
||||||
else outFile->putChar('N');
|
else outFile.putChar('N');
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->pointType).toUtf8());
|
outFile.write(QString::number(iter->pointType).toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(QString::number(iter->lineWidth).toUtf8());
|
outFile.write(QString::number(iter->lineWidth).toUtf8());
|
||||||
if (iter->associatedSignal)
|
if (iter->associatedSignal)
|
||||||
{
|
{
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(iter->associatedSignal->parentMessage->name.toUtf8());
|
outFile.write(iter->associatedSignal->parentMessage->name.toUtf8());
|
||||||
outFile->putChar(',');
|
outFile.putChar(',');
|
||||||
outFile->write(iter->associatedSignal->name.toUtf8());
|
outFile.write(iter->associatedSignal->name.toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
outFile->write("\n");
|
outFile.write("\n");
|
||||||
}
|
}
|
||||||
outFile->close();
|
outFile.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphingWindow::loadDefinitions()
|
void GraphingWindow::loadDefinitions()
|
||||||
{
|
{
|
||||||
QString filename;
|
|
||||||
QFileDialog dialog;
|
QFileDialog dialog;
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
@@ -973,17 +967,17 @@ void GraphingWindow::loadDefinitions()
|
|||||||
|
|
||||||
if (dialog.exec() == QDialog::Accepted)
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
filename = dialog.selectedFiles()[0];
|
QString filename = dialog.selectedFiles().constFirst();
|
||||||
settings.setValue("Graphing/LoadSaveDirectory", dialog.directory().path());
|
settings.setValue("Graphing/LoadSaveDirectory", dialog.directory().path());
|
||||||
|
|
||||||
QFile *inFile = new QFile(filename);
|
QFile inFile(filename);
|
||||||
QByteArray line;
|
QByteArray line;
|
||||||
|
|
||||||
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
if (!inFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (!inFile->atEnd()) {
|
while (!inFile.atEnd()) {
|
||||||
line = inFile->readLine().simplified();
|
line = inFile.readLine().simplified();
|
||||||
if (line.length() > 2)
|
if (line.length() > 2)
|
||||||
{
|
{
|
||||||
GraphParams gp;
|
GraphParams gp;
|
||||||
@@ -1205,7 +1199,7 @@ void GraphingWindow::loadDefinitions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inFile->close();
|
inFile.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1325,10 +1319,8 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
double yminval=10000000.0, ymaxval = -1000000.0;
|
double yminval=10000000.0, ymaxval = -1000000.0;
|
||||||
double xminval=10000000000.0, xmaxval = -10000000000.0;
|
double xminval=10000000000.0, xmaxval = -10000000000.0;
|
||||||
GraphParams *refParam = ¶ms;
|
GraphParams *refParam = ¶ms;
|
||||||
int sBit, bits;
|
|
||||||
bool intelFormat, isSigned;
|
|
||||||
QString tempStr;
|
QString tempStr;
|
||||||
double x,y;
|
double x{}, y{};
|
||||||
|
|
||||||
qDebug() << "New Graph ID: " << params.ID;
|
qDebug() << "New Graph ID: " << params.ID;
|
||||||
qDebug() << "Start bit: " << params.startBit;
|
qDebug() << "Start bit: " << params.startBit;
|
||||||
@@ -1365,10 +1357,10 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
//params.x.fill(0, numEntries);
|
//params.x.fill(0, numEntries);
|
||||||
//params.y.fill(0, numEntries);
|
//params.y.fill(0, numEntries);
|
||||||
|
|
||||||
sBit = params.startBit;
|
int sBit = params.startBit;
|
||||||
bits = params.numBits;
|
int bits = params.numBits;
|
||||||
intelFormat = params.intelFormat;
|
bool intelFormat = params.intelFormat;
|
||||||
isSigned = params.isSigned;
|
bool isSigned = params.isSigned;
|
||||||
|
|
||||||
for (int j = 0; j < numEntries; j++)
|
for (int j = 0; j < numEntries; j++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -361,7 +361,6 @@ void NewGraphDialog::loadNodes()
|
|||||||
void NewGraphDialog::loadMessages(int idx)
|
void NewGraphDialog::loadMessages(int idx)
|
||||||
{
|
{
|
||||||
int numFiles = 0;
|
int numFiles = 0;
|
||||||
DBC_MESSAGE *msg;
|
|
||||||
ui->cbMessages->clear();
|
ui->cbMessages->clear();
|
||||||
if (dbcHandler == nullptr) return;
|
if (dbcHandler == nullptr) return;
|
||||||
if ((numFiles = dbcHandler->getFileCount()) == 0) return;
|
if ((numFiles = dbcHandler->getFileCount()) == 0) return;
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ void SnifferWindow::notchTick()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->lblNotch->setBackgroundRole(QPalette::Background);
|
ui->lblNotch->setBackgroundRole(QPalette::Window);
|
||||||
ui->lblNotch->repaint();
|
ui->lblNotch->repaint();
|
||||||
//qDebug() << "Tock";
|
//qDebug() << "Tock";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="layoutWidget">
|
<widget class="QWidget" name="layoutWidget_2">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="2,0,2">
|
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="2,0,2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridUpper"/>
|
<layout class="QGridLayout" name="gridUpper"/>
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ public:
|
|||||||
return (double)timestamp / 1000000.0;
|
return (double)timestamp / 1000000.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return QVariant(); // should never happen
|
||||||
}
|
}
|
||||||
|
|
||||||
//parses the input string to grab as much of it as possible while staying alpha numeric
|
//parses the input string to grab as much of it as possible while staying alpha numeric
|
||||||
|
|||||||
Reference in New Issue
Block a user