From a841adc8b5cb7eeb8b6ee563f780636df63ba696 Mon Sep 17 00:00:00 2001 From: jogo- Date: Fri, 2 Jul 2021 20:14:24 +0200 Subject: [PATCH 1/7] Update scriptingwindow.ui Improve UX: * Add Accelerator Keys to push buttons and check-box * Remove 2 trailing ':' --- ui/scriptingwindow.ui | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ui/scriptingwindow.ui b/ui/scriptingwindow.ui index 1cf4ebd..43c2a76 100644 --- a/ui/scriptingwindow.ui +++ b/ui/scriptingwindow.ui @@ -19,7 +19,7 @@ - Public Variables: + Public Variables Qt::AlignCenter @@ -47,21 +47,21 @@ - New + &New - Del + &Del - Load + &Load @@ -86,21 +86,21 @@ - Save + &Save - Revert + &Revert - Recompile + Re&compile @@ -109,7 +109,7 @@ - Log Window: + Log Window Qt::AlignCenter @@ -122,14 +122,14 @@ - Auto Scroll Log Window + &Auto Scroll Log Window - Clear Log Window + Clear Log &Window From e2d8864808493f2210ca568f85192a72c089233c Mon Sep 17 00:00:00 2001 From: jogo- Date: Sat, 3 Jul 2021 10:59:58 +0200 Subject: [PATCH 2/7] Update scriptingwindow.ui Add Bold on the 4 labels --- ui/scriptingwindow.ui | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ui/scriptingwindow.ui b/ui/scriptingwindow.ui index 43c2a76..35c0b9e 100644 --- a/ui/scriptingwindow.ui +++ b/ui/scriptingwindow.ui @@ -18,6 +18,12 @@ + + + 75 + true + + Public Variables @@ -31,6 +37,12 @@ + + + 75 + true + + Loaded Scripts @@ -73,6 +85,12 @@ + + + 75 + true + + Script Editing Window @@ -108,6 +126,12 @@ + + + 75 + true + + Log Window From 7333d2704ec1b3b3fbdeb7b9572d27ed809d38bf Mon Sep 17 00:00:00 2001 From: jogo- Date: Sat, 3 Jul 2021 11:17:51 +0200 Subject: [PATCH 3/7] Update scriptingwindow.cpp Show whitespaces in Scripting Window --- scriptingwindow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scriptingwindow.cpp b/scriptingwindow.cpp index 2fe7238..1d5f378 100644 --- a/scriptingwindow.cpp +++ b/scriptingwindow.cpp @@ -21,6 +21,12 @@ ScriptingWindow::ScriptingWindow(const QVector *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(); From 859bf55265b970637836fb92c028f2a3f0f682ab Mon Sep 17 00:00:00 2001 From: jogo- Date: Sat, 3 Jul 2021 11:22:24 +0200 Subject: [PATCH 4/7] Update jsedit.h Add Custom Color --- jsedit.h | 1 + 1 file changed, 1 insertion(+) diff --git a/jsedit.h b/jsedit.h index 104856e..52eefc8 100644 --- a/jsedit.h +++ b/jsedit.h @@ -57,6 +57,7 @@ public: Identifier, Keyword, BuiltIn, + Custom, Sidebar, LineNumber, Cursor, From 392b2a4fb51f417c149d318a1d5b018d8ac8dc07 Mon Sep 17 00:00:00 2001 From: jogo- Date: Sat, 3 Jul 2021 11:33:37 +0200 Subject: [PATCH 5/7] Update jsedit.cpp Highlight custom objects, callback functions and functions with a custom flashy color --- jsedit.cpp | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/jsedit.cpp b/jsedit.cpp index aff5f81..05978ad 100644 --- a/jsedit.cpp +++ b/jsedit.cpp @@ -54,6 +54,7 @@ protected: private: QSet m_keywords; QSet m_knownIds; + QSet m_customIds; QHash 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"; @@ -248,6 +250,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) @@ -269,6 +292,7 @@ void JSHighlighter::highlightBlock(const QString &text) }; QList bracketPositions; + QString previousToken; int blockState = previousBlockState(); int bracketLevel = blockState >> 4; @@ -336,10 +360,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; From 10608d5f7b1dfd561c9d4780a07fb7b39e15e4d0 Mon Sep 17 00:00:00 2001 From: jogo- Date: Mon, 5 Jul 2021 09:21:56 +0200 Subject: [PATCH 6/7] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0286f11..f296ed1 100644 --- a/README.md +++ b/README.md @@ -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: From 4fa194a4d436c0204852b6c0c44f54533014b553 Mon Sep 17 00:00:00 2001 From: Chris Whiteford Date: Thu, 8 Jul 2021 21:12:26 -0400 Subject: [PATCH 7/7] Correctly unpack bytes from a cabana file Frames were always showing up as 8 bytes and were padded with 0's from the left incorrectly --- framefileio.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/framefileio.cpp b/framefileio.cpp index 41f0434..043d19c 100644 --- a/framefileio.cpp +++ b/framefileio.cpp @@ -3966,7 +3966,17 @@ bool FrameFileIO::loadCabanaFile(QString filename, QVector* 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;