Changed copyright notice.

This commit is contained in:
2026-01-03 23:51:14 +01:00
parent 3a132bb584
commit 193579e798
23 changed files with 106 additions and 312 deletions

View File

@@ -27,12 +27,13 @@ windows
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \ SOURCES += \
aalegacy.cpp \
bc.cpp \ bc.cpp \
bcanimateddelegate.cpp \ bcanimateddelegate.cpp \
bcdeviceview.cpp \ bcdeviceview.cpp \
bcdriver.cpp \ bcdriver.cpp \
bcdrivertinycan.cpp \ bcdrivertinycan.cpp \
bclegacy.cpp \ bcguihelpers.cpp \
bctransmitter.cpp \ bctransmitter.cpp \
bcvalue.cpp \ bcvalue.cpp \
bcvaluemodel.cpp \ bcvaluemodel.cpp \
@@ -47,6 +48,7 @@ HEADERS += \
bcdeviceview.h \ bcdeviceview.h \
bcdriver.h \ bcdriver.h \
bcdrivertinycan.h \ bcdrivertinycan.h \
bcguihelpers.h \
bcmainwindow.h \ bcmainwindow.h \
bctransmitter.h \ bctransmitter.h \
bcvalue.h \ bcvalue.h \

View File

@@ -186,11 +186,11 @@ double gSetSpeedLimit = -1, gSetMinSpeedLimit = -1, gSetThrottleSpeedLimit = -1;
#define BIB 4 #define BIB 4
/* /*
class ThemeSwitchButton : public QPushButton { class BCThemeSwitchButton : public QPushButton {
Q_OBJECT Q_OBJECT
public: public:
explicit ThemeSwitchButton(QWidget *parent = nullptr) explicit BCThemeSwitchButton(QWidget *parent = nullptr)
: QPushButton(parent), m_isDarkMode(true) : QPushButton(parent), m_isDarkMode(true)
{ {
// 1. Visuelles Setup: Flach, keine Ränder, Hand-Cursor // 1. Visuelles Setup: Flach, keine Ränder, Hand-Cursor
@@ -216,7 +216,7 @@ public:
updateIcon(); updateIcon();
// 3. Klick verbinden // 3. Klick verbinden
connect(this, &QPushButton::clicked, this, &ThemeSwitchButton::toggle); connect(this, &QPushButton::clicked, this, &BCThemeSwitchButton::toggle);
} }
signals: signals:
@@ -260,13 +260,13 @@ public:
statBar->showMessage("Ready"); statBar->showMessage("Ready");
// 1. Unseren Switcher erstellen // 1. Unseren Switcher erstellen
ThemeSwitchButton *themeBtn = new ThemeSwitchButton(this); BCThemeSwitchButton *themeBtn = new BCThemeSwitchButton(this);
// 2. WICHTIG: Rechts hinzufügen // 2. WICHTIG: Rechts hinzufügen
statBar->addPermanentWidget(themeBtn); statBar->addPermanentWidget(themeBtn);
// 3. Signal verbinden: Button klick -> Theme ändern // 3. Signal verbinden: Button klick -> Theme ändern
connect(themeBtn, &ThemeSwitchButton::themeChanged, this, [this](bool isDark){ connect(themeBtn, &BCThemeSwitchButton::themeChanged, this, [this](bool isDark){
if (isDark) { if (isDark) {
applyFluentDarkTheme(*qApp); // Funktion von vorhin applyFluentDarkTheme(*qApp); // Funktion von vorhin
statusBar()->showMessage("Dark Mode Activated", 3000); statusBar()->showMessage("Dark Mode Activated", 3000);

2
bc.cpp
View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:

2
bc.h
View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:
@@ -93,14 +93,14 @@ public:
// Die möglichen Zustände beim Laden // Die möglichen Zustände beim Laden
// des CAN-Bus Treibers. // des CAN-Bus Treibers.
enum class DriverState enum class DriverState : uint8_t
{ {
NotPresent, NotPresent,
Error,
Loaded, Loaded,
Initialized, Initialized,
Opened, // bis hierher: dll vorhanden, Treiber geladen Opened, // bis hierher: dll vorhanden, Treiber geladen
DeviceReady, // hier: devices connectable, wir können arbeiten. DeviceReady // hier: devices connectable, wir können arbeiten.
Error,
}; };
Q_ENUM(DriverState) Q_ENUM(DriverState)
@@ -131,6 +131,11 @@ protected:
}; };
/// -----------------------------------------------------------------------------------
/// -----------------------------------------------------------------------------------
class BCDriverDummy : public BCDriver class BCDriverDummy : public BCDriver
{ {

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:
@@ -133,35 +133,6 @@ BCDriver::DriverStateResult BCDriverTinyCan::loadDriver()
// __fix // __fix
BCDriver::DriverStateResult BCDriverTinyCan::setConsoleSlaveMode() BCDriver::DriverStateResult BCDriverTinyCan::setConsoleSlaveMode()
{ {
/*
consoleInSlaveMode = getValue(CONSOLE, CONSOLE_STATUS_SLAVE);
if (consoleInSlaveMode)
{
printf("console already in salve mode. good!" _NL _NL);
}
else
{
if (gConsoleSetSlaveMode)
{
int retry = 20;
printf("putting console in salve mode ... ");
do {
setValue(CONSOLE, CONSOLE_STATUS_SLAVE, 1);
consoleInSlaveMode = getValue(CONSOLE, CONSOLE_STATUS_SLAVE);
usleep(200000);
} while(retry-- && !consoleInSlaveMode);
doSleep(500); // give the console some time to settle
printf("%s" _NL _NL, consoleInSlaveMode ? "done" : "failed");
}
else
{
printf("console not in slave mode" _NL _NL);
}
}
*/
uint32_t console = static_cast<uint32_t>(BCDevice::ID::Console); uint32_t console = static_cast<uint32_t>(BCDevice::ID::Console);
uint8_t slaveFlag = static_cast<uint8_t>(BC::ID::Cons_Status_Slave); uint8_t slaveFlag = static_cast<uint8_t>(BC::ID::Cons_Status_Slave);
@@ -217,7 +188,7 @@ TransmitResult BCDriverTinyCan::readRawByte( uint32_t deviceID, uint8_t register
//TransmitResult //TransmitResult
qDebug() << " --- BCDriverTinyCan::readRawByte DriverState: " << getDriverState(); qDebug() << " --- BCDriverTinyCan::readRawByte DriverState: " << getDriverState();
if( _driverState != DriverState::DeviceReady) if( _driverState <DriverState::Opened )
return std::unexpected(QString("readRawValue error: driver not loaded." ) ); return std::unexpected(QString("readRawValue error: driver not loaded." ) );
::TCanMsg msg; ::TCanMsg msg;
@@ -256,15 +227,15 @@ retry:
// message empfangen // message empfangen
int err = ::CanReceive( 0, &msg, 1 ); int err = ::CanReceive( 0, &msg, 1 );
qDebug() << "HÄÄ ?" << err << "reg: "<< registerID <<" timeOuts: " << timeOuts; //qDebug() << "HÄÄ ?" << err << "reg: "<< registerID <<" timeOuts: " << timeOuts;
if( err < 0 ) if( err < 0 )
//throw BCException( "getValue error: could not receive value" ); //throw BCException( "getValue error: could not receive value" );
qDebug( "getValue error: could not receive value" ); qDebug( "getValue error: could not receive value" );
qDebug() << "HÄÄ 2" <<msg.Id; //qDebug() << "HÄÄ 2" <<msg.Id;
qDebug() << "HÄÄ 2" <<msg.MsgLen; //qDebug() << "HÄÄ 2" <<msg.MsgLen;
qDebug() << "HÄÄ 2" <<msg.MsgData[1]; //qDebug() << "HÄÄ 2" <<msg.MsgData[1];
//if( err > 0 ) //if( err > 0 )
if( --retries && ( msg.Id != BIB || msg.MsgLen != 4 || msg.MsgData[1] != registerID ) ) if( --retries && ( msg.Id != BIB || msg.MsgLen != 4 || msg.MsgData[1] != registerID ) )
@@ -282,8 +253,8 @@ retry:
TransmitResult BCDriverTinyCan::writeRawByte( uint32_t deviceID, uint8_t registerID ,uint8_t value ) const TransmitResult BCDriverTinyCan::writeRawByte( uint32_t deviceID, uint8_t registerID ,uint8_t value ) const
{ {
if( _driverState != DriverState::DeviceReady) if( _driverState <DriverState::Opened )
return std::unexpected(QString("writeRawValue error: driver not loaded." ) ); return std::unexpected(QString("readRawValue error: driver not loaded." ) );
qDebug() << " --- BCDriverTinyCan writeRawValue: " << value; qDebug() << " --- BCDriverTinyCan writeRawValue: " << value;

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:
@@ -44,6 +44,7 @@ public:
virtual ~BCDriverTinyCan(); virtual ~BCDriverTinyCan();
BCDriver::DriverStateResult loadAndStartDriver() override; BCDriver::DriverStateResult loadAndStartDriver() override;
void resetDriver();
TransmitResult readRawByte ( uint32_t deviceID, uint8_t registerID ) const override; TransmitResult readRawByte ( uint32_t deviceID, uint8_t registerID ) const override;
TransmitResult writeRawByte( uint32_t deviceID, uint8_t registerID, uint8_t value ) const override; TransmitResult writeRawByte( uint32_t deviceID, uint8_t registerID, uint8_t value ) const override;
@@ -52,7 +53,7 @@ private:
BCDriver::DriverStateResult loadDriver(); BCDriver::DriverStateResult loadDriver();
BCDriver::DriverStateResult setConsoleSlaveMode(); BCDriver::DriverStateResult setConsoleSlaveMode();
void resetDriver();
//const char* CBCDLL_LIN = "libmhstcan.so"; //const char* CBCDLL_LIN = "libmhstcan.so";
//const char* CBCDLL_WIN = "mhstcan.dll"; //const char* CBCDLL_WIN = "mhstcan.dll";

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:
@@ -36,7 +36,7 @@
#include <bcmainwindow.h> #include <bcmainwindow.h>
#include <bcanimateddelegate.h> #include <bcanimateddelegate.h>
#include <ui_bcmainwindow.h> #include <ui_bcmainwindow.h>
#include <bcguihelpers.h>
/** /**
* @brief Das Mainwindow erzeugen * @brief Das Mainwindow erzeugen
@@ -141,20 +141,21 @@ void BCMainWindow::initMainWindow()
fitzeButton->setStyleSheet(style); fitzeButton->setStyleSheet(style);
*/ */
initStatusBar();
// besser: model::emit dataChanged // besser: model::emit dataChanged
// also: emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole, ValueRole}); // also: emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole, ValueRole});
connect( _connectButton, &QToolButton::clicked, &_transmitter, &BCTransmitter::onToggleDriverConnection ); connect( _connectButton, &QToolButton::clicked, &_transmitter, &BCTransmitter::onToggleDriverConnection );
connect( _syncButton, &QToolButton::clicked, this, &BCMainWindow::onSyncDeviceView ); connect( _syncButton, &QToolButton::clicked, this, &BCMainWindow::onSyncDeviceView );
connect( &_transmitter, &BCTransmitter::valueUpdated, this, &BCMainWindow::onValueUpdated ); connect( &_transmitter, &BCTransmitter::valueUpdated, this, &BCMainWindow::onValueUpdated );
_transmitter.moveToThread(&_worker);
connect(this, &BCMainWindow::requestValueUpdate, &_transmitter, &BCTransmitter::enqueueValue); connect(this, &BCMainWindow::requestValueUpdate, &_transmitter, &BCTransmitter::enqueueValue);
connect(&_worker, &QThread::finished, &_transmitter, &QObject::deleteLater); connect(&_worker, &QThread::finished, &_transmitter, &QObject::deleteLater);
connect( &_transmitter, &BCTransmitter::driverStateChanged, this, &BCMainWindow::onDriverStateChanged ); connect( &_transmitter, &BCTransmitter::driverStateChanged, this, &BCMainWindow::onDriverStateChanged );
// transmitter starten // transmitter starten
_transmitter.moveToThread(&_worker);
_worker.start(); _worker.start();
// die Daten des eBikes laden // die Daten des eBikes laden
@@ -167,30 +168,19 @@ void BCMainWindow::initMainWindow()
void BCMainWindow::initStatusBar() void BCMainWindow::initStatusBar()
{ {
// __fix
QStatusBar *statBar = statusBar(); QStatusBar *statBar = statusBar();
// Optional: Normale Nachricht links BCDriverStateWidget* connector = new BCDriverStateWidget(this);
connect( &_transmitter, &BCTransmitter::driverStateChanged, connector, &BCDriverStateWidget::onDriverStateChanged );
statBar->addPermanentWidget(connector);
statBar->showMessage("Ready"); statBar->showMessage("Ready");
BCThemeSwitchButton *themeBtn = new BCThemeSwitchButton(this);
// 1. Unseren Switcher erstellen
ThemeSwitchButton *themeBtn = new ThemeSwitchButton(this);
// 2. WICHTIG: Rechts hinzufügen
statBar->addPermanentWidget(themeBtn); statBar->addPermanentWidget(themeBtn);
connect(themeBtn, &BCThemeSwitchButton::themeChanged, this, [this](bool isDark)
// 3. Signal verbinden: Button klick -> Theme ändern
connect(themeBtn, &ThemeSwitchButton::themeChanged, this, [this](bool isDark){
if (isDark)
{ {
//applyFluentDarkTheme(*qApp); // Funktion von vorhin QString message = isDark ? "Dark Mode Activated" : "Light Mode Activated";
statusBar()->showMessage("Dark Mode Activated", 3000); statusBar()->showMessage( message, 3000);
}
else
{
//applyFluentLightTheme(*qApp); // Funktion von vorhin
statusBar()->showMessage("Light Mode Activated", 3000);
}
}); });
} }
@@ -216,6 +206,7 @@ void BCMainWindow::autoConnect()
void BCMainWindow::onDriverStateChanged( BCDriver::DriverState state, const QString& message ) void BCMainWindow::onDriverStateChanged( BCDriver::DriverState state, const QString& message )
{ {
qDebug() << " --- on DriverStatusChanged: " << state << ":" << message; qDebug() << " --- on DriverStatusChanged: " << state << ":" << message;
_statusbar->showMessage( message, 8000 );
} }
void BCMainWindow::onShowDevicePanel( BCDevice::ID deviceID ) void BCMainWindow::onShowDevicePanel( BCDevice::ID deviceID )

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:
@@ -92,170 +92,4 @@ protected:
}; };
class ThemeSwitchButton : public QPushButton
{
Q_OBJECT
public:
explicit ThemeSwitchButton(QWidget *parent = nullptr)
: QPushButton(parent), m_isDarkMode(true)
{
// 1. Visuelles Setup: Flach, keine Ränder, Hand-Cursor
setFlat(true);
setCursor(Qt::PointingHandCursor);
setFixedSize(24, 24); // Kleiner Footprint im StatusBar
// CSS: Transparent, damit es sich nahtlos in den StatusBar einfügt
// Schriftgröße etwas erhöhen, damit die Emojis gut erkennbar sind
setStyleSheet(R"(
QPushButton {
border: none;
background-color: transparent;
font-size: 11pt;
}
QPushButton:hover {
background-color: rgba(128, 128, 128, 30); // Leichter Hover-Effekt
border-radius: 24px;
}
)");
// 2. Initialer Status (Startet im Dark Mode -> zeigt Mond)
updateIcon();
// 3. Klick verbinden
connect(this, &QPushButton::clicked, this, &ThemeSwitchButton::toggle);
}
signals:
void themeChanged(bool isDark);
private slots:
void toggle() {
m_isDarkMode = !m_isDarkMode;
updateIcon();
emit themeChanged(m_isDarkMode);
}
private:
void updateIcon() {
// Logik:
// Ist Dark Mode an? Zeige Mond (oder Sonne, je nach Geschmack).
// Hier: Zeige das Symbol des AKTUELLEN Modus.
setText(m_isDarkMode ? "🌙" : "☀️");
setToolTip(m_isDarkMode ? "Switch to Light Mode" : "Switch to Dark Mode");
}
bool m_isDarkMode;
};
class BCConnectionWidget : public QWidget
{
Q_OBJECT
public:
// Definition der 3 Zustände
enum class State
{
Disconnected, // Grau: Offline / Standby
Connected, // Grün: Alles OK
Error // Rot: Fehler / Timeout / Abbruch
};
Q_ENUM(State) // Damit Qt das Enum kennt (optional, gut für Debugging)
explicit BCConnectionWidget(QWidget *parent = nullptr)
: QWidget(parent)
{
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setContentsMargins(10, 2, 10, 2);
layout->setSpacing(8);
// 1. Die LED
m_led = new QLabel(this);
m_led->setFixedSize(12, 12);
// 2. Der Text
m_label = new QLabel(this);
m_label->setStyleSheet("font-weight: 500;"); // Medium weight
layout->addWidget(m_led);
layout->addWidget(m_label);
// Startzustand
setState(State::Disconnected, "Offline");
}
public slots:
// Hauptfunktion zum Setzen des Status
// 'customMessage' ist optional. Wenn leer, wird ein Standardtext genommen.
void setState(State state, const QString &customMessage = QString())
{
m_state = state;
// Standard-Texte, falls keine Nachricht übergeben wurde
QString text = customMessage;
if (text.isEmpty()) {
switch (state) {
case State::Connected: text = "Online"; break;
case State::Disconnected: text = "Not Connected"; break;
case State::Error: text = "Connection Error"; break;
}
}
m_label->setText(text);
updateStyle();
}
private:
void updateStyle()
{
QString ledStyle;
QString labelColor;
QString toolTipText;
switch (m_state) {
case State::Connected:
// FLUENT GREEN (Success)
ledStyle = "background-color: #107C10; border: 1px solid #0E600E;#FF5F1F; #FF8C00;<- das isses #FF6700";
labelColor = "#FFFFFF"; // Weiß (Hervorgehoben)
toolTipText = "Verbindung erfolgreich hergestellt.";
break;
case State::Error:
// FLUENT RED (Critical)
ledStyle = "background-color: #C42B1C; border: 1px solid #A80000;";
labelColor = "#FF99A4"; // Ein helleres Rot für Text, damit es auf Dunkel lesbar ist
toolTipText = "Kritischer Fehler bei der Verbindung!";
break;
case State::Disconnected:
default:
// FLUENT GRAY (Neutral)
// Wir machen es dunkelgrau mit hellem Rand -> "Ausgeschaltet"-Look
ledStyle = "background-color: #3B3B3B; border: 1px solid #606060;";
labelColor = "#9E9E9E"; // Ausgegrauter Text
toolTipText = "System ist offline.";
break;
}
// Styles anwenden (immer rund machen)
m_led->setStyleSheet(ledStyle + "border-radius: 6px;");
// Textfarbe setzen
m_label->setStyleSheet(QString("color: %1; font-weight: %2;")
.arg(labelColor)
.arg(m_state == State::Connected ? "bold" : "normal"));
setToolTip(toolTipText);
}
QLabel *m_led;
QLabel *m_label;
State m_state;
};
#endif // BCMAINWINDOW_H #endif // BCMAINWINDOW_H

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:
@@ -57,11 +57,13 @@ void BCTransmitter::onToggleDriverConnection( bool connect )
{ {
qDebug() << " --- onToggleDriverConnection: " << connect; qDebug() << " --- onToggleDriverConnection: " << connect;
// FIX! Ende der current op abwarten! // FIX! Ende der current op abwarten!
// Hier sind wir noch in GUI Thread
QMutexLocker locker(&_mutex);
// weitere operation stoppen // weitere operation stoppen
_isBusy = true; _isBusy = true;
connect ? connectCanDriver() : disconnectCanDriver(); connect ? connectCanDriver() : disconnectCanDriver();
_isBusy = false;
} }
void BCTransmitter::connectCanDriver() void BCTransmitter::connectCanDriver()
@@ -69,27 +71,42 @@ void BCTransmitter::connectCanDriver()
// hier gehts nur um den echten Treiber // hier gehts nur um den echten Treiber
// Treiber laden und/oder starten: // Treiber laden und/oder starten:
BCDriver::DriverStateResult result; //(defaults to 'NotPresent')
if( _tinyCanDriver.getDriverState() != BCDriver::DriverState::DeviceReady ) if( _tinyCanDriver.getDriverState() != BCDriver::DriverState::DeviceReady )
_tinyCanDriver.loadAndStartDriver(); result = _tinyCanDriver.loadAndStartDriver();
QString message("FitzeFatze!");
// hat geklappt // hat geklappt
if( _tinyCanDriver.getDriverState() == BCDriver::DriverState::DeviceReady ) if( _tinyCanDriver.getDriverState() >= BCDriver::DriverState::Opened )
{ {
uint32_t console = static_cast<uint32_t>(BCDevice::ID::Console); uint32_t console = static_cast<uint32_t>(BCDevice::ID::Console);
uint8_t hwRev = static_cast<uint8_t> (BC::ID::Cons_Rev_Hw); uint8_t hwRev = static_cast<uint8_t> (BC::ID::Cons_Rev_Hw);
TransmitResult hwVersion = _tinyCanDriver.readRawByte( console, hwRev); TransmitResult hwVersion = _tinyCanDriver.readRawByte( console, hwRev);
if( hwVersion.has_value() ) if( hwVersion.has_value() )
qDebug() << " ---- HAIL to the king!"; {
message = " ---- HAIL to the king!";
qDebug() << message;
// swap driver
_canDriver = &_tinyCanDriver;
}
else else
{
qDebug() << "Console not responding"; qDebug() << "Console not responding";
} }
}
else
{
message = result.error();
}
emit driverStateChanged( _tinyCanDriver.getDriverState(), message );
} }
void BCTransmitter::disconnectCanDriver() void BCTransmitter::disconnectCanDriver()
{ {
_tinyCanDriver.resetDriver();
_canDriver = &_dummyDriver;
emit driverStateChanged( _tinyCanDriver.getDriverState(), "Disconnected" );
} }

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:
@@ -44,42 +44,6 @@ BCValue::BCValue( BCDevice::ID deviceID_, BC::ID registerID_)
visibleValue = "--"; visibleValue = "--";
} }
/***************************************************************************
BionxControl
Copyright © 2025 christoph holzheuer
christoph.holzheuer@gmail.com
Using:
mhs_can_drv.c
© 2011 - 2023 by MHS-Elektronik GmbH & Co. KG, Germany
Klaus Demlehner, klaus@mhs-elektronik.de
@see www.mhs-elektronik.de
Based on Bionx data type descriptions from:
BigXionFlasher USB V 0.2.4 rev. 97
© 2011-2013 by Thomas Koenig <info@bigxionflasher.org>
@see www.bigxionflasher.org
Bionx Bike Info
© 2018 Thorsten Schmidt (tschmidt@ts-soft.de)
@see www.ts-soft.de
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
@see https://github.com/bikemike/bionx-bikeinfo
***************************************************************************/
QString BCValue::formatValue( uint32_t value ) const QString BCValue::formatValue( uint32_t value ) const
{ {
if( factor == 1 ) if( factor == 1 )

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:
@@ -83,16 +83,25 @@ void BCValueModel::takeValueList(BCValueList& newValueList)
void BCValueModel::onValueUpdated( int row, BCValue::State state, const QString& newVisisbleValue ) void BCValueModel::onValueUpdated( int row, BCValue::State state, const QString& newVisisbleValue )
{ {
qDebug() << " BCValueModel::onValueUpdated update: " << newVisisbleValue;
if( row > -1 && row < _valueList.size() ) if( row > -1 && row < _valueList.size() )
{ {
BCValuePtr value = _valueList[row]; BCValue& value = *(_valueList[row].get());
QModelIndex idx = index(row,1); QModelIndex idx = index(row,1);
value->state = state;
if( !newVisisbleValue.isEmpty() && newVisisbleValue != value->visibleValue ) qDebug();
qDebug() << " --- OLD:";
value.dumpValue();
value.state = state;
if( !newVisisbleValue.isEmpty() && newVisisbleValue != value.visibleValue )
{ {
value->visibleValue = newVisisbleValue; value.visibleValue = newVisisbleValue;
} }
qDebug() << " NEW: " << newVisisbleValue << "";
value.dumpValue();
// wir schicken auf jeden fall einen update request // wir schicken auf jeden fall einen update request
emit dataChanged(idx, idx, {Qt::DisplayRole, Qt::EditRole}); emit dataChanged(idx, idx, {Qt::DisplayRole, Qt::EditRole});
} }

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using:

View File

@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
BionxControl BionxControl
Copyright © 2025 christoph holzheuer © 2025 -2026 christoph holzheuer
christoph.holzheuer@gmail.com christoph.holzheuer@gmail.com
Using: Using: