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

This commit is contained in:
Collin Kidder
2021-07-23 22:15:50 -04:00
6 changed files with 91 additions and 19 deletions
+6 -6
View File
@@ -8,7 +8,7 @@ capturing of canbus frames.
Please use the "Discussions" tab here on GitHub to ask questions and interact with the community.
Requires at a resolution of at least 1024x768. Fully multi-monitor capable. Works on 4K monitors as well.
Requires a resolution of at least 1024x768. Fully multi-monitor capable. Works on 4K monitors as well.
You are highly recommended to use the
[CANDue board from EVTV](http://store.evtv.me/proddetail.php?prod=ArduinoDueCANBUS&cat=23).
@@ -16,7 +16,7 @@ You are highly recommended to use the
The CANDue board must be running the GVRET firmware which can also be found
within the collin80 repos.
It is now possible to use any QT SerialBus driver (socketcan, Vector, PeakCAN, TinyCAN).
It is now possible to use any Qt SerialBus driver (socketcan, Vector, PeakCAN, TinyCAN).
There may, however, be some loss of some functionality as
some functions of SavvyCAN are designed for use directly with the
EVTVDue and CANDue 2.0 boards.
@@ -28,7 +28,7 @@ of this program. It can load and save in several formats:
2. Microchip log file
3. CRTD format (OVMS log file format from Mark Webb-Johnson)
4. GVRET native format
5. Generic CSV file (ID,D0 D1 D2 D3 D4 D5 D6 D7)
5. Generic CSV file (ID, D0 D1 D2 D3 D4 D5 D6 D7)
6. Vector Trace files
7. IXXAT Minilog files
8. CAN-DO Logs
@@ -48,10 +48,10 @@ http://www.qcustomplot.com/
However, this source code is integrated into the source for SavvyCAN and one isn't required
to download it separately.
This project requires 5.13.0 or higher because of a dependency on QtSerialBus and other new additions to QT.
This project requires 5.13.0 or higher because of a dependency on QtSerialBus and other new additions to Qt.
NOTE: QT6 currently lacks support for QtSerialBus and many other QT sub-features. At this time you cannot
use QT6 to compile SavvyCAN. Support for QT6 should be possible around QT6.2.
NOTE: Qt6 currently lacks support for QtSerialBus and many other Qt sub-features. At this time you cannot
use Qt6 to compile SavvyCAN. Support for Qt6 should be possible around Qt6.2.
## Instructions for compiling:
+11 -1
View File
@@ -3966,7 +3966,17 @@ bool FrameFileIO::loadCabanaFile(QString filename, QVector<CANFrame>* frames)
bytes[6] = ((tempData >> 8) & 0xFF);
bytes[7] = (tempData & 0xFF);
}
thisFrame.setPayload(bytes);
// Shift the bytes back correctly so we have a frame that is the proper length
unsigned int framelength = tokens[3].length() / 2;
QByteArray finalbytes(framelength,0);
uint8_t bytes_shifted_by = 8 - framelength;
for (unsigned int j = 0; j < framelength; j++)
{
finalbytes[j] = bytes[j + bytes_shifted_by];
}
thisFrame.setPayload(finalbytes);
frames->append(thisFrame);
}
else foundErrors = true;
+33 -2
View File
@@ -54,6 +54,7 @@ protected:
private:
QSet<QString> m_keywords;
QSet<QString> m_knownIds;
QSet<QString> m_customIds;
QHash<JSEdit::ColorComponent, QColor> m_colors;
QString m_markString;
Qt::CaseSensitivity m_markCaseSensitivity;
@@ -73,6 +74,7 @@ JSHighlighter::JSHighlighter(QTextDocument *parent)
m_colors[JSEdit::Keyword] = QColor("#000080");
m_colors[JSEdit::BuiltIn] = QColor("#008080");
m_colors[JSEdit::Marker] = QColor("#ffff00");
m_colors[JSEdit::Custom] = QColor("#ff00ff");
// https://developer.mozilla.org/en/JavaScript/Reference/Reserved_Words
m_keywords << "break";
@@ -249,6 +251,27 @@ JSHighlighter::JSHighlighter(QTextDocument *parent)
m_knownIds << "window";
m_knownIds << "navigator";
m_knownIds << "userAgent";
//Custom objects
m_customIds << "host";
m_customIds << "can";
m_customIds << "isotp";
m_customIds << "uds";
//Custom callback functions
m_customIds << "setup";
m_customIds << "tick";
m_customIds << "gotCANFrame";
m_customIds << "gotISOTPMessage";
m_customIds << "gotUDSMessage";
//Custom functions
m_customIds << "setTickInterval";
m_customIds << "log"; //Duplicate
m_customIds << "addParameter";
m_customIds << "setFilter";
m_customIds << "clearFilters";
m_customIds << "sendFrame";
m_customIds << "sendISOTP";
m_customIds << "sendUDS";
}
void JSHighlighter::setColor(JSEdit::ColorComponent component, const QColor &color)
@@ -271,6 +294,7 @@ void JSHighlighter::highlightBlock(const QString &text)
};
QList<int> bracketPositions;
QString previousToken;
int blockState = previousBlockState();
int bracketLevel = blockState >> 4;
@@ -351,10 +375,17 @@ void JSHighlighter::highlightBlock(const QString &text)
case Identifier:
if (ch.isSpace() || !(ch.isDigit() || ch.isLetter() || ch == '_')) {
QString token = text.mid(start, i - start).trimmed();
if (m_keywords.contains(token))
if (m_customIds.contains(token) && m_customIds.contains(previousToken)) {
setFormat(start, i - start, m_colors[JSEdit::Custom]);
} else if (m_keywords.contains(token)) {
setFormat(start, i - start, m_colors[JSEdit::Keyword]);
else if (m_knownIds.contains(token))
} else if (m_knownIds.contains(token)) {
setFormat(start, i - start, m_colors[JSEdit::BuiltIn]);
if (ch == '.') previousToken = token;
} else if (m_customIds.contains(token)) {
setFormat(start, i - start, m_colors[JSEdit::Custom]);
if (ch == '.') previousToken = token;
}
state = Start;
} else {
++i;
+1
View File
@@ -57,6 +57,7 @@ public:
Identifier,
Keyword,
BuiltIn,
Custom,
Sidebar,
LineNumber,
Cursor,
+6
View File
@@ -21,6 +21,12 @@ ScriptingWindow::ScriptingWindow(const QVector<CANFrame> *frames, QWidget *paren
editor->setEnabled(false);
editor->setFont(QFont("Monospace", 12));
editor->show();
//Show whitespaces
QTextOption option = editor->document()->defaultTextOption();
option.setFlags(QTextOption::ShowTabsAndSpaces);
editor->document()->setDefaultTextOption(option);
ui->verticalLayout->insertWidget(2,editor, 10);
readSettings();
+34 -10
View File
@@ -18,8 +18,14 @@
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Public Variables:</string>
<string>Public Variables</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@@ -31,6 +37,12 @@
</item>
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Loaded Scripts</string>
</property>
@@ -47,21 +59,21 @@
<item>
<widget class="QPushButton" name="btnNewScript">
<property name="text">
<string>New</string>
<string>&amp;New</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnRemoveScript">
<property name="text">
<string>Del</string>
<string>&amp;Del</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnLoadScript">
<property name="text">
<string>Load</string>
<string>&amp;Load</string>
</property>
</widget>
</item>
@@ -73,6 +85,12 @@
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,4,0,0">
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Script Editing Window</string>
</property>
@@ -86,21 +104,21 @@
<item>
<widget class="QPushButton" name="btnSaveScript">
<property name="text">
<string>Save</string>
<string>&amp;Save</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnRevertScript">
<property name="text">
<string>Revert</string>
<string>&amp;Revert</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnRecompile">
<property name="text">
<string>Recompile</string>
<string>Re&amp;compile</string>
</property>
</widget>
</item>
@@ -108,8 +126,14 @@
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Log Window:</string>
<string>Log Window</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@@ -122,14 +146,14 @@
<item>
<widget class="QCheckBox" name="cbAutoScroll">
<property name="text">
<string>Auto Scroll Log Window</string>
<string>&amp;Auto Scroll Log Window</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnClearLog">
<property name="text">
<string>Clear Log Window</string>
<string>Clear Log &amp;Window</string>
</property>
</widget>
</item>