diff --git a/SavvyCAN.pro b/SavvyCAN.pro index fdf6426..7ae89ab 100644 --- a/SavvyCAN.pro +++ b/SavvyCAN.pro @@ -14,7 +14,9 @@ CONFIG += c++11 qscintilla2 TARGET = SavvyCAN TEMPLATE = app -INCLUDEPATH +=/usr/include/qt5/ +#you are fairly likely to have to change this next include to match your linux distro +#this works on Linux Mint 18.1 +unix:!macx: INCLUDEPATH +=/usr/include/x86_64-linux-gnu/qt5 SOURCES += main.cpp\ mainwindow.cpp \ diff --git a/bus_protocols/isotp_handler.cpp b/bus_protocols/isotp_handler.cpp index 67a6148..3dbcfd8 100644 --- a/bus_protocols/isotp_handler.cpp +++ b/bus_protocols/isotp_handler.cpp @@ -107,6 +107,7 @@ void ISOTP_HANDLER::updatedFrames(int numFrames) void ISOTP_HANDLER::rapidFrames(const CANConnection* conn, const QVector& pFrames) { + Q_UNUSED(conn) if (pFrames.length() <= 0) return; qDebug() << "received messages in ISOTP handler"; diff --git a/config.h b/config.h index 5d61a24..a9b6119 100644 --- a/config.h +++ b/config.h @@ -1,7 +1,7 @@ #ifndef CONFIG #define CONFIG -#define VERSION 168 +#define VERSION 169 //try to keep this in sync. //SavvyCAN will complain if you connect a GVRET board with a revision diff --git a/connections/canconmanager.cpp b/connections/canconmanager.cpp index b83f663..4484906 100644 --- a/connections/canconmanager.cpp +++ b/connections/canconmanager.cpp @@ -104,7 +104,7 @@ CANConnection* CANConManager::getByName(const QString& pName) const void CANConManager::refreshConnection(CANConnection* pConn_p) { - int buses = 0; + unsigned int buses = 0; foreach(CANConnection* conn_p, mConns) { if (conn_p->getStatus() == CANCon::CONNECTED) buses += conn_p->getNumBuses(); diff --git a/connections/canconnection.cpp b/connections/canconnection.cpp index 4126de6..1575492 100644 --- a/connections/canconnection.cpp +++ b/connections/canconnection.cpp @@ -257,7 +257,7 @@ void CANConnection::setCapSuspended(bool pIsSuspended) { } void CANConnection::debugInput(QByteArray bytes) { - + Q_UNUSED(bytes) } bool CANConnection::addTargettedFrame(int pBusId, uint32_t ID, uint32_t mask, QObject *receiver) diff --git a/connections/canconnection.h b/connections/canconnection.h index e53b687..aaf7d9f 100644 --- a/connections/canconnection.h +++ b/connections/canconnection.h @@ -183,6 +183,7 @@ public slots: void debugInput(QByteArray bytes); protected: + int mNumBuses; //protected to allow connected device to figure out how many buses are available //determine if the passed frame is part of a filter or not. void checkTargettedFrame(CANFrame &frame); @@ -290,7 +291,6 @@ protected: private: LFQueue mQueue; - const int mNumBuses; const QString mPort; const CANCon::type mType; bool mIsCapSuspended; diff --git a/connections/connectionwindow.cpp b/connections/connectionwindow.cpp index 0d15a9a..0f99a37 100644 --- a/connections/connectionwindow.cpp +++ b/connections/connectionwindow.cpp @@ -485,10 +485,7 @@ void ConnectionWindow::handleRevert() bool ConnectionWindow::isSocketCanAvailable() { #ifdef Q_OS_LINUX - for (const auto &backend : QCanBus::instance()->plugins()) { - if (backend == "socketcan") - return true; - } + if (QCanBus::instance()->plugins().contains(QStringLiteral("socketcan"))) return true; #endif return false; } diff --git a/connections/gvretserial.cpp b/connections/gvretserial.cpp index 129f2af..ffcb5dd 100644 --- a/connections/gvretserial.cpp +++ b/connections/gvretserial.cpp @@ -8,7 +8,7 @@ #include "gvretserial.h" GVRetSerial::GVRetSerial(QString portName) : - CANConnection(portName, CANCon::GVRET_SERIAL, 2, 4000, true), + CANConnection(portName, CANCon::GVRET_SERIAL, 3, 4000, true), mTimer(this) /*NB: set this as parent of timer to manage it from working thread */ { qDebug() << "GVRetSerial()"; @@ -170,7 +170,7 @@ bool GVRetSerial::piSendFrame(const CANFrame& frame) buffer[3] = (unsigned char)(ID >> 8); buffer[4] = (unsigned char)(ID >> 16); buffer[5] = (unsigned char)(ID >> 24); - buffer[6] = (unsigned char)((frame.bus) & 1); + buffer[6] = (unsigned char)((frame.bus) & 3); buffer[7] = (unsigned char)frame.len; for (c = 0; c < frame.len; c++) { @@ -255,6 +255,10 @@ void GVRetSerial::connectDevice() output.append((char)0xF1); //and another command output.append((char)0x01); //Time Sync - Not implemented until 333 but we can try + output.append((char)0xF1); + output.append((char)0x12); //get number of actually implemented buses. Not implemented except on M2RET + mNumBuses = 2; //the proper number if 0x12 is not implemented + continuousTimeSync = true; serial->write(output); @@ -374,6 +378,10 @@ void GVRetSerial::procRXChar(unsigned char c) //qDebug() << "Got validated"; rx_state = IDLE; break; + case 12: + rx_state = GET_NUM_BUSES; + rx_step = 0; + break; } break; case BUILD_CAN_FRAME: @@ -593,7 +601,10 @@ void GVRetSerial::procRXChar(unsigned char c) case SET_SINGLEWIRE_MODE: rx_state = IDLE; break; - + case GET_NUM_BUSES: + mNumBuses = c; + rx_state = IDLE; + break; } } diff --git a/connections/gvretserial.h b/connections/gvretserial.h index 435963f..6b8e5ac 100644 --- a/connections/gvretserial.h +++ b/connections/gvretserial.h @@ -28,7 +28,8 @@ enum STATE //keep this enum synchronized with the Arduino firmware project SETUP_CANBUS, GET_CANBUS_PARAMS, GET_DEVICE_INFO, - SET_SINGLEWIRE_MODE + SET_SINGLEWIRE_MODE, + GET_NUM_BUSES }; } diff --git a/re/udsscanwindow.cpp b/re/udsscanwindow.cpp index 8d241fa..b2088b0 100644 --- a/re/udsscanwindow.cpp +++ b/re/udsscanwindow.cpp @@ -164,7 +164,7 @@ void UDSScanWindow::dumpNode(QTreeWidgetItem* item, QFile *file, int indent) void UDSScanWindow::sendOnBuses(UDS_MESSAGE test, int buses) { - int busList = buses; + //int busList = buses; //if (busList < ui->cbBuses->count() - 1) //{ test.bus = buses; diff --git a/scriptcontainer.cpp b/scriptcontainer.cpp index 66e120c..e8f1d02 100644 --- a/scriptcontainer.cpp +++ b/scriptcontainer.cpp @@ -17,7 +17,7 @@ void ScriptContainer::compileScript() errorWidget->clear(); if (result.isError() && errorWidget) - { + { errorWidget->addItem("SCRIPT EXCEPTION!"); errorWidget->addItem("Line: " + result.property("lineNumber").toString()); errorWidget->addItem(result.property("message").toString()); @@ -71,7 +71,7 @@ void ScriptContainer::setFilter(QJSValue id, QJSValue mask, QJSValue bus) CANConnection* conn_p = CANConManager::getInstance()->getByName(mConName); if(conn_p) { - CANFlt canFlt; + //CANFlt canFlt; for(int i=0 ; igetNumBuses() ; i++) { foreach(const CANFilter& flt, filters)