Merge branch 'master' of github.com:collin80/SavvyCAN

This commit is contained in:
Collin Kidder
2019-12-11 19:35:15 -05:00
6 changed files with 46 additions and 15 deletions
+2 -2
View File
@@ -79,7 +79,7 @@ bool DBC_SIGNAL::processAsText(const CANFrame &frame, QString &outString, bool o
//that the bytes that make up the integer are instead treated as having made up //that the bytes that make up the integer are instead treated as having made up
//a 32 bit single precision float. That's evil incarnate but it is very fast and small //a 32 bit single precision float. That's evil incarnate but it is very fast and small
//in terms of new code. //in terms of new code.
result = Utility::processIntegerSignal(frame.data, startBit, 32, false, false); result = Utility::processIntegerSignal(frame.data, startBit, 32, intelByteOrder, false);
endResult = (*((float *)(&result)) * factor) + bias; endResult = (*((float *)(&result)) * factor) + bias;
} }
else //double precision float else //double precision float
@@ -91,7 +91,7 @@ bool DBC_SIGNAL::processAsText(const CANFrame &frame, QString &outString, bool o
} }
//like the above, this is rotten and evil and wrong in so many ways. Force //like the above, this is rotten and evil and wrong in so many ways. Force
//calculation of a 64 bit integer and then cast it into a double. //calculation of a 64 bit integer and then cast it into a double.
result = Utility::processIntegerSignal(frame.data, 0, 64, false, false); result = Utility::processIntegerSignal(frame.data, 0, 64, intelByteOrder, false);
endResult = (*((double *)(&result)) * factor) + bias; endResult = (*((double *)(&result)) * factor) + bias;
} }
+12 -2
View File
@@ -465,6 +465,14 @@ DBC_SIGNAL* DBCFile::parseSignalLine(QString line, DBC_MESSAGE *msg)
case 4: case 4:
sig.valType = STRING; sig.valType = STRING;
break; break;
case 5: //single point float in little endian
sig.valType = SP_FLOAT;
sig.intelByteOrder = true;
break;
case 6: //double point float in little endian
sig.valType = DP_FLOAT;
sig.intelByteOrder = true;
break;
} }
sig.factor = match.captured(6 + offset).toDouble(); sig.factor = match.captured(6 + offset).toDouble();
sig.bias = match.captured(7 + offset).toDouble(); sig.bias = match.captured(7 + offset).toDouble();
@@ -1230,10 +1238,12 @@ void DBCFile::saveFile(QString fileName)
else msgOutput.append("0-"); else msgOutput.append("0-");
break; break;
case SP_FLOAT: case SP_FLOAT:
msgOutput.append("2-"); if (sig->intelByteOrder) msgOutput.append("5-");
else msgOutput.append("2-");
break; break;
case DP_FLOAT: case DP_FLOAT:
msgOutput.append("3-"); if (sig->intelByteOrder) msgOutput.append("6-");
else msgOutput.append("3-");
break; break;
case STRING: case STRING:
msgOutput.append("4-"); msgOutput.append("4-");
-4
View File
@@ -49,8 +49,6 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
{ {
if (currentSignal == nullptr) return; if (currentSignal == nullptr) return;
currentSignal->intelByteOrder = ui->cbIntelFormat->isChecked(); currentSignal->intelByteOrder = ui->cbIntelFormat->isChecked();
if (currentSignal->valType == SP_FLOAT || currentSignal->valType == DP_FLOAT)
currentSignal->intelByteOrder = false;
fillSignalForm(currentSignal); fillSignalForm(currentSignal);
}); });
@@ -74,13 +72,11 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
break; break;
case 2: case 2:
currentSignal->valType = SP_FLOAT; currentSignal->valType = SP_FLOAT;
currentSignal->intelByteOrder = false;
if (currentSignal->startBit > 39) currentSignal->startBit = 39; if (currentSignal->startBit > 39) currentSignal->startBit = 39;
currentSignal->signalSize = 32; currentSignal->signalSize = 32;
break; break;
case 3: case 3:
currentSignal->valType = DP_FLOAT; currentSignal->valType = DP_FLOAT;
currentSignal->intelByteOrder = false;
currentSignal->startBit = 7; //has to be! currentSignal->startBit = 7; //has to be!
currentSignal->signalSize = 64; currentSignal->signalSize = 64;
break; break;
+22 -6
View File
@@ -1287,14 +1287,24 @@ bool FrameFileIO::loadCanalyzerASC(QString filename, QVector<CANFrame>* frames)
if (tokens.length() > 5) if (tokens.length() > 5)
{ {
thisFrame.timestamp = static_cast<uint64_t>(tokens[0].toDouble() * 1000000.0); thisFrame.timestamp = static_cast<uint64_t>(tokens[0].toDouble() * 1000000.0);
thisFrame.ID = tokens[2].toUInt(nullptr, 16); if (tokens[2].endsWith('x'))
{
QByteArray copied_id = tokens[2];
copied_id.chop(1);
thisFrame.ID = copied_id.toUInt(nullptr, 16);
thisFrame.extended = true;
}
else
{
thisFrame.ID = tokens[2].toUInt(nullptr, 16);
thisFrame.extended = false;
}
thisFrame.len = tokens[5].toInt(); thisFrame.len = tokens[5].toInt();
if (thisFrame.len > 8) return false; if (thisFrame.len > 8) return false;
if (thisFrame.len < 0) return false; if (thisFrame.len < 0) return false;
thisFrame.isReceived = tokens[3].toUpper().contains("RX"); thisFrame.isReceived = tokens[3].toUpper().contains("RX");
thisFrame.bus = tokens[1].toInt(); thisFrame.bus = tokens[1].toInt();
thisFrame.extended = (thisFrame.ID > 0x7FF); thisFrame.remote = tokens[4] == "r";
thisFrame.remote = false;
for (int d = 6; d < (6 + static_cast<int>(thisFrame.len)); d++) for (int d = 6; d < (6 + static_cast<int>(thisFrame.len)); d++)
{ {
if (tokens.count() > d) if (tokens.count() > d)
@@ -1365,16 +1375,22 @@ bool FrameFileIO::saveCanalyzerASC(QString filename, const QVector<CANFrame>* fr
outFile->write(QString::number(frames->at(c).bus + 1).toUtf8()); outFile->write(QString::number(frames->at(c).bus + 1).toUtf8());
outFile->write(" "); outFile->write(" ");
if (frames->at(c).extended) if (frames->at(c).extended)
{
outFile->write(QString::number(frames->at(c).ID, 16).toUpper().rightJustified(8, '0').toUtf8()); outFile->write(QString::number(frames->at(c).ID, 16).toUpper().rightJustified(8, '0').toUtf8());
outFile->write("x");
}
else else
{ {
outFile->write(QString::number(frames->at(c).ID, 16).toUpper().rightJustified(3, '0').toUtf8()); outFile->write(QString::number(frames->at(c).ID, 16).toUpper().rightJustified(3, '0').toUtf8());
outFile->write(" "); outFile->write(" ");
} }
outFile->write(" "); outFile->write(" ");
if (frames->at(c).isReceived) outFile->write("Rx D "); if (frames->at(c).isReceived) outFile->write("Rx ");
else outFile->write("Tx D "); else outFile->write("Tx ");
if (frames->at(c).remote) outFile->write("r ");
else outFile->write("d ");
outFile->write(QString::number(frames->at(c).len).toUtf8()); outFile->write(QString::number(frames->at(c).len).toUtf8());
outFile->write(" "); outFile->write(" ");
+9
View File
@@ -28,6 +28,15 @@ function Controller() {
}); });
} }
Controller.prototype.DynamicTelemetryPluginFormCallback = function() {
gui.currentPageWidget().TelemetryPluginForm.statisticGroupBox.disableStatisticRadioButton.setChecked(true);
gui.clickButton(buttons.NextButton);
//for(var key in widget.TelemetryPluginForm.statisticGroupBox){
// console.log(key);
//}
}
Controller.prototype.WelcomePageCallback = function() { Controller.prototype.WelcomePageCallback = function() {
console.log("Step: " + gui.currentPageWidget()); console.log("Step: " + gui.currentPageWidget());
// At least for 3.0.4 immediately clicking Next fails, so wait a bit. // At least for 3.0.4 immediately clicking Next fails, so wait a bit.
+1 -1
View File
@@ -1113,7 +1113,7 @@ void GraphingWindow::createGraph(GraphParams &params, bool createGraphParam)
for (int i = 0; i < modelFrames->count(); i++) for (int i = 0; i < modelFrames->count(); i++)
{ {
CANFrame thisFrame = modelFrames->at(i); CANFrame thisFrame = modelFrames->at(i);
if (thisFrame.ID == params.ID) frameCache.append(thisFrame); if (thisFrame.ID == params.ID && thisFrame.remote == false) frameCache.append(thisFrame);
} }
//to fix weirdness where a graph that has no data won't be able to be edited, selected, or deleted properly //to fix weirdness where a graph that has no data won't be able to be edited, selected, or deleted properly