Added driver name defines

This commit is contained in:
2026-01-05 12:59:54 +01:00
parent aef6c641d1
commit 0f167a5e32
5 changed files with 19 additions and 10 deletions

View File

@@ -36,13 +36,22 @@
#include <can_drv.h>
#if defined(Q_OS_WIN)
static const char* cMHS_DRIVERNAME = NULL;
#elif defined(Q_OS_LINUX)
// Linux-spezifischer Code (z.B. /proc Filesystem, D-Bus)
static const char* cMHS_DRIVERNAME = "libmhstcan.so";
#endif
//const char* CBCDLL_LIN = "libmhstcan.so";
//const char* CBCDLL_WIN = "mhstcan.dll";
/**
* @brief Destruktor. Entlädt den CAN-Bus Treiber wieder.
*/
BCDriverTinyCan::~BCDriverTinyCan()
{
resetDriver();
}
@@ -72,7 +81,7 @@ BCDriver::DriverStateResult BCDriverTinyCan::loadDriver()
{
qDebug() << " -- Hier!";
//if( ::LoadDriver( NULL ) < 0 )
if( ::LoadDriver( "libmhstcan.so" ) < 0 )
if( ::LoadDriver( cMHS_DRIVERNAME ) < 0 )
return std::unexpected(QString("Driver Error: 'LoadDriver'"));
_driverState = DriverState::Loaded;
return _driverState;

View File

@@ -55,8 +55,6 @@ private:
BCDriver::DriverStateResult setConsoleSlaveMode();
//const char* CBCDLL_LIN = "libmhstcan.so";
//const char* CBCDLL_WIN = "mhstcan.dll";
static constexpr int cRetries = 5;
static constexpr int cTimeOuts = 20;

View File

@@ -27,12 +27,14 @@ sudo apt purge modemmanager
// ---
$ sudo chgrp pi /opt
$ sudo chmod -R 775 /opt
$ cd /opt
$ mv /home/pi/tiny_can_raspberry_790.tar.gz .
$ tar -xzvf tiny_can_raspberry_790.tar.gz
$ rm tiny_can_raspberry_790.tar.gz
https://github.com/MHS-Elektronik/OBD-Display
sudo chgrp pi /opt
sudo chmod -R 775 /opt
cd /opt
mv /home/pi/tiny_can_raspberry_790.tar.gz .
tar -xzvf tiny_can_raspberry_790.tar.gz
rm tiny_can_raspberry_790.tar.gz

Binary file not shown.

Binary file not shown.