diff --git a/.gitignore b/.gitignore
index eb98eb9..1bb847c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
BionxControl.pro.user
build/
bcvalue.cpp.autosave
+.qtcreator/BionxControl.pro.user
\ No newline at end of file
diff --git a/BionxControl.qrc b/BionxControl.qrc
index 202de4c..9e39b15 100644
--- a/BionxControl.qrc
+++ b/BionxControl.qrc
@@ -1,5 +1,6 @@
data/bikeinfo.xml
+ BionxControl.qss
diff --git a/BionxControl.qss b/BionxControl.qss
new file mode 100644
index 0000000..057c46b
--- /dev/null
+++ b/BionxControl.qss
@@ -0,0 +1,29 @@
+/* app.qss */
+
+/* Alle QWidgets bekommen diesen Font */
+QWidget {
+ font-size: 14px;
+ font-family: "Segoe UI", sans-serif;
+}
+
+/* Spezifisches Styling für Buttons */
+QPushButton {
+ background-color: #0078d7;
+ color: white;
+ border-radius: 4px;
+ padding: 6px;
+}
+
+QPushButton:hover {
+ background-color: #1084e3;
+}
+
+QPushButton:pressed {
+ background-color: #005a9e;
+}
+
+/* Styling anhand von Objektnamen (ID) */
+#loginButton {
+ font-weight: bold;
+ background-color: green;
+}
\ No newline at end of file
diff --git a/bc.h b/bc.h
index e886e9d..568422c 100644
--- a/bc.h
+++ b/bc.h
@@ -748,6 +748,7 @@ namespace BCTags
{
inline constexpr auto Device = "Device"_L1;
inline constexpr auto ID = "ID"_L1;
+ inline constexpr auto Label = "Label"_L1;
inline constexpr auto Default = "Default"_L1;
inline constexpr auto Current = "Current"_L1;
inline constexpr auto Enabled = "Enabled"_L1;
diff --git a/bcmainwindow.ui b/bcmainwindow.ui
index 7668116..c92f42e 100644
--- a/bcmainwindow.ui
+++ b/bcmainwindow.ui
@@ -27,8 +27,47 @@
QFrame::Shadow::Raised
+
+
+
+ 30
+ 50
+ 171
+ 51
+
+
+
+ PushButton
+
+
+
+
+
+ 20
+ 140
+ 171
+ 51
+
+
+
+ PushButton
+
+
+
+
+
+ QFrame::Shape::NoFrame
+
+
+ QFrame::Shadow::Plain
+
+
+ false
+
+
+ Qt::PenStyle::CustomDashLine
+
-
@@ -39,7 +78,7 @@
0
0
800
- 22
+ 18
diff --git a/bcvalue.cpp b/bcvalue.cpp
index 21fd74e..1c7016b 100644
--- a/bcvalue.cpp
+++ b/bcvalue.cpp
@@ -48,7 +48,7 @@ uint8_t BCValue::getLongValue()
}
-BCValue* BCValue::makeValue( BCDevice::ID deviceID, const BCValueParams& params )
+BCValue BCValue::makeValue( BCDevice::ID deviceID, const BCValueParams& params )
{
auto setIfExists = [&]( QStringView source, optDouble& target )
@@ -69,17 +69,18 @@ BCValue* BCValue::makeValue( BCDevice::ID deviceID, const BCValueParams& params
- eine gültige ID
*/
- BCValue* newValue{};
+ BCValue newValue{};
auto IDVal = s_bcValueEnum.keyToValue64( params.ID.toLatin1().constData() );
if( IDVal.has_value() )
{
- newValue = new BCValue( deviceID, BC::ID( IDVal.value() ) );
- setIfExists( params.Factor, newValue->factor );
- setIfExists( params.Min, newValue->min );
- setIfExists( params.Max, newValue->max );
- newValue->defaultValue.setValue( params.Default );
- newValue->value.setValue( params.Current );
+ newValue = BCValue( deviceID, BC::ID( IDVal.value() ) );
+ setIfExists( params.Factor, newValue.factor );
+ setIfExists( params.Min, newValue.min );
+ setIfExists( params.Max, newValue.max );
+ newValue.defaultValue.setValue( params.Label );
+ newValue.value.setValue( params.Current );
+ newValue.label = params.Label;
}
return newValue;
diff --git a/bcvalue.h b/bcvalue.h
index 1c6bd6d..6b59d18 100644
--- a/bcvalue.h
+++ b/bcvalue.h
@@ -42,14 +42,15 @@ using optDouble = std::optional;
struct BCValueParams
{
- QString ID;
- QString Default;
- QString Current;
- QString Enabled;
- QString UnitType;
- QString Min;
- QString Max;
- QString Factor;
+ QString ID;
+ QString Label;
+ QString Default;
+ QString Current;
+ QString Enabled;
+ QString UnitType;
+ QString Min;
+ QString Max;
+ QString Factor;
};
@@ -81,10 +82,11 @@ public:
optDouble min;
optDouble max;
optDouble factor;
+
QVariant defaultValue;
QVariant value;
- static BCValue* makeValue( BCDevice::ID deviceID, const BCValueParams& params );
+ static BCValue makeValue(BCDevice::ID deviceID, const BCValueParams& params );
};
@@ -104,18 +106,7 @@ constexpr auto to_u(E e) noexcept {
}
*/
-class BCValueShort
-{
-
-};
-
-
-class BCValueLong
-{
-
-};
-
-using BCValueList = QList;
+using BCValueList = QList;
#endif // BCRawValue_H
diff --git a/bcvaluemanager.cpp b/bcvaluemanager.cpp
index 87caf07..0eecb0c 100644
--- a/bcvaluemanager.cpp
+++ b/bcvaluemanager.cpp
@@ -163,9 +163,11 @@ void BCValueManager::readDevice( BCValueList& parsedValues )
{
//qDebug() << " --- found: " << _xml.name() << " : " << _xml.attributes().value(BCTags::ID);
+ QString id = _xml.attributes().value(BCTags::ID).toString();
BCValueParams params
{
- .ID = _xml.attributes().value(BCTags::ID).toString(),
+ .ID = id,
+ .Label = _xml.attributes().value(BCTags::Label).toString(),
.Default = _xml.attributes().value(BCTags::Default).toString(),
.Current = _xml.attributes().value(BCTags::Current).toString(),
.Enabled = _xml.attributes().value(BCTags::Enabled).toString(),
@@ -175,10 +177,11 @@ void BCValueManager::readDevice( BCValueList& parsedValues )
.Factor = _xml.attributes().value(BCTags::Factor).toString()
};
- BCValue* newValue = BCValue::makeValue( _currentDeviceID, params );
- if(newValue)
- parsedValues.push_back( BCValue::makeValue( _currentDeviceID, params ) );
-
+ // __fix! können ungültige werte erzeugt werden ?
+ //BCValue newValue = BCValue::makeValue( _currentDeviceID, params );
+ //if(newValue)
+ // parsedValues.push_back( newValue );
+ parsedValues.push_back( BCValue::makeValue( _currentDeviceID, params ) );
}
//printAttrs (_xml);
diff --git a/data/bikeinfo.xml b/data/bikeinfo.xml
index fc955e2..51e9202 100644
--- a/data/bikeinfo.xml
+++ b/data/bikeinfo.xml
@@ -1,136 +1,156 @@
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
-
+
+
-
-
+
+
-
-
-
+
+
-
-
-
-
-
+
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/doc/BF_BikeInformation.docx b/doc/BF_BikeInformation.docx
new file mode 100644
index 0000000..1f6a6a1
Binary files /dev/null and b/doc/BF_BikeInformation.docx differ
diff --git a/doc/BI_ConsoleInformation.docx b/doc/BI_ConsoleInformation.docx
new file mode 100644
index 0000000..96adc2b
Binary files /dev/null and b/doc/BI_ConsoleInformation.docx differ
diff --git a/doc/console_full.xml b/doc/console_full.xml
new file mode 100644
index 0000000..fc955e2
--- /dev/null
+++ b/doc/console_full.xml
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/data/demo.txt b/doc/demo.txt
similarity index 100%
rename from data/demo.txt
rename to doc/demo.txt
diff --git a/doc/dummy.c b/doc/dummy.c
new file mode 100644
index 0000000..5746a77
--- /dev/null
+++ b/doc/dummy.c
@@ -0,0 +1,129 @@
+
+ hwVersion = getValue(CONSOLE, CONSOLE_REF_HW);
+
+
+ " assistance level ........: %d"
+ getValue(CONSOLE, CONSOLE_ASSIST_INITLEVEL)
+
+ printf( " part number .............: %05d" ((getValue(CONSOLE, CONSOLE_SN_PN_HI) << 8) + getValue(CONSOLE, CONSOLE_SN_PN_LO)),
+ " item number .............: %05d" ((getValue(CONSOLE, CONSOLE_SN_ITEM_HI) << 8) + getValue(CONSOLE, CONSOLE_SN_ITEM_LO))
+
+
+ /* ASSIST speed limit */
+ max limit enabled sl = getValue(CONSOLE, CONSOLE_ASSIST_MAXSPEEDFLAG) == 0 ? "no" : "yes";
+ speed limit speedLimit = ((getValue(CONSOLE, CONSOLE_ASSIST_MAXSPEED_HI) << 8) + getValue(CONSOLE, CONSOLE_ASSIST_MAXSPEED_LO)) / (double)10;
+
+ /* MIN speed limit */
+ sl = getValue(CONSOLE, CONSOLE_ASSIST_MINSPEEDFLAG) == 0 ? "no" : "yes";
+ speedLimit = (getValue(CONSOLE, CONSOLE_ASSIST_MINSPEED)) / (double)10;
+
+
+ /* THROTTLE speed limit */
+ " throttle limit enabled ..: %sl = getValue(CONSOLE, CONSOLE_THROTTLE_MAXSPEEDFLAG) == 0 ? "no" : "yes";
+ " throttle limit enabled ..: %s" = ((getValue(CONSOLE, CONSOLE_THROTTLE_MAXSPEED_HI) << 8) + getValue(CONSOLE, CONSOLE_THROTTLE_MAXSPEED_LO)) / (double)10;
+ printf( " throttle limit enabled ..: %s" _NL
+ " throttle speed limit ....: %0.2f Km/h" _NL _NL, sl, speedLimit);
+
+ /* WHEEL CIRCUMFERENCE */
+ wheel circumference .....: %d mm" = (getValue(CONSOLE, CONSOLE_GEOMETRY_CIRC_HI) << 8) + getValue(CONSOLE, CONSOLE_GEOMETRY_CIRC_LO);
+
+ " mountain cap ............: %0.2f%%" _NL,
+ (getValue(CONSOLE, CONSOLE_ASSIST_MOUNTAINCAP) * 1.5625));
+
+ printf( " odo .....................: %0.2f Km" _NL _NL,
+ ((getValue(CONSOLE, CONSOLE_STATS_ODO_1) << 24) +
+ (getValue(CONSOLE, CONSOLE_STATS_ODO_2) << 16) +
+ (getValue(CONSOLE, CONSOLE_STATS_ODO_3) << 8) +
+ (getValue(CONSOLE, CONSOLE_STATS_ODO_4))) / (double)10
+ );
+ }
+
+
+ hwVersion = getValue(BATTERY, BATTERY_REF_HW);
+ if (hwVersion == 0)
+ printf("Battery not responding" _NL _NL);
+ else {
+ printf( "Battery information:" _NL
+ " hardware version ........: %02d" _NL
+ " software version ........: %02d" _NL,
+ hwVersion, getValue(BATTERY, BATTERY_REF_SW)
+ );
+
+ if (!gNoSerialNumbers)
+ printf( " part number .............: %05d" _NL
+ " item number .............: %05d" _NL,
+ ((getValue(BATTERY, BATTERY_SN_PN_HI) << 8) + getValue(BATTERY, BATTERY_SN_PN_LO)),
+ ((getValue(BATTERY, BATTERY_SN_ITEM_HI) << 8) + getValue(BATTERY, BATTERY_SN_ITEM_LO))
+ );
+
+ printf( " voltage .................: %0.2fV" _NL
+ " battery level ...........: %0.2f%%" _NL
+ " maximum voltage .........: %0.2f%%" _NL
+ " minimum voltage .........: %0.2f%%" _NL
+ " mean voltage ............: %0.2f%%" _NL
+ " resets ..................: %0d" _NL
+ " ggjrCalib ...............: %0d" _NL
+ " vctrlShorts .............: %0d" _NL
+ " lmd .....................: %0.2fAh" _NL
+ " cell capacity ...........: %0.2fAh" _NL _NL,
+ ((getValue(BATTERY, BATTERY_STATUS_VBATT_HI) << 8) + getValue(BATTERY, BATTERY_STATUS_VBATT_LO)) * 0.001,
+ (getValue(BATTERY, BATTERY_STATUS_LEVEL) * 6.6667),
+ getVoltageValue(BATTERY, BATTERY_STATS_VBATTMAX),
+ getVoltageValue(BATTERY, BATTERY_STATS_VBATTMIN),
+ getVoltageValue(BATTERY, BATTERY_STATS_VBATTMEAN),
+ (getValue(BATTERY, BATTERY_STATS_RESET_HI) << 8) + getValue(BATTERY, BATTERY_STATS_RESET_LO),
+ getValue(BATTERY, BATTERY_STSTS_GGJSRCALIB),
+ getValue(BATTERY, BATTERY_STSTS_VCTRLSHORTS),
+ ((getValue(BATTERY, BATTERY_STATS_LMD_HI) << 8) + getValue(BATTERY, BATTERY_STATS_LMD_LO)) * 0.002142,
+ ((getValue(BATTERY, BATTERY_CONFIG_CELLCAPACITY_HI) << 8) + getValue(BATTERY, BATTERY_CONFIG_CELLCAPACITY_LO)) * 0.001
+ );
+
+ printf( " charge time worst .......: %0d" _NL
+ " charge time mean ........: %0d" _NL
+ " charge cycles ...........: %0d" _NL
+ " full charge cycles ......: %0d" _NL
+ " power cycles ............: %0d" _NL
+ " battery temp max ........: %0d" _NL
+ " battery temp min ........: %0d" _NL _NL,
+ (getValue(BATTERY, BATTERY_STATS_CHARGETIMEWORST_HI) << 8) + getValue(BATTERY, BATTERY_STATS_CHARGETIMEWORST_LO),
+ (getValue(BATTERY, BATTERY_STATS_CHARGETIMEMEAN_HI) << 8) + getValue(BATTERY, BATTERY_STATS_CHARGETIMEMEAN_LO),
+ (getValue(BATTERY, BATTERY_STATS_BATTCYCLES_HI) << 8) + getValue(BATTERY, BATTERY_STATS_BATTCYCLES_LO),
+ (getValue(BATTERY, BATTERY_STATS_BATTFULLCYCLES_HI) << 8) + getValue(BATTERY, BATTERY_STATS_BATTFULLCYCLES_LO),
+ (getValue(BATTERY, BATTERY_STATS_POWERCYCLES_HI) << 8) + getValue(BATTERY, BATTERY_STATS_POWERCYCLES_HI),
+ getValue(BATTERY, BATTERY_STATS_TBATTMAX),
+ getValue(BATTERY, BATTERY_STATS_TBATTMIN)
+ );
+
+ printChargeStats();
+
+ if (hwVersion >= 60)
+ printBatteryStats();
+ else
+ printf(" no battery details supported by battery hardware #%d" _NL _NL, hwVersion);
+ }
+
+ hwVersion = getValue(MOTOR, MOTOR_REF_HW);
+ if (hwVersion == 0)
+ printf("Motor not responding" _NL _NL);
+ else {
+ printf( "Motor information:" _NL
+ " hardware version ........: %02d" _NL
+ " software version ........: %02d" _NL
+ " temperature .............: %02d" _DEGREE_SIGN "C"_NL
+ " speed limit .............: %02d Km/h" _NL,
+ hwVersion, getValue(MOTOR, MOTOR_REF_SW),
+ getValue(MOTOR, MOTOR_REALTIME_TEMP),
+ getValue(MOTOR, MOTOR_ASSIST_MAXSPEED)
+ );
+
+ wheelCirc = (getValue(MOTOR, MOTOR_GEOMETRY_CIRC_HI) << 8) + getValue(MOTOR, MOTOR_GEOMETRY_CIRC_LO);
+ printf( " wheel circumference .....: %d mm" _NL _NL, wheelCirc);
+
+ if (!gNoSerialNumbers)
+ printf( " part number .............: %05d" _NL
+ " item number .............: %05d" _NL _NL,
+ ((getValue(MOTOR, MOTOR_SN_PN_HI) << 8) + getValue(MOTOR, MOTOR_SN_PN_LO)),
+ ((getValue(MOTOR, MOTOR_SN_ITEM_HI) << 8) + getValue(MOTOR, MOTOR_SN_ITEM_LO))
+ );
+ }
+}
\ No newline at end of file
diff --git a/doc/~$_BikeInformation.docx b/doc/~$_BikeInformation.docx
new file mode 100644
index 0000000..b47c923
Binary files /dev/null and b/doc/~$_BikeInformation.docx differ
diff --git a/doc/~$_ConsoleInformation.docx b/doc/~$_ConsoleInformation.docx
new file mode 100644
index 0000000..0c52200
Binary files /dev/null and b/doc/~$_ConsoleInformation.docx differ
diff --git a/main.cpp b/main.cpp
index 712c507..ad07c10 100644
--- a/main.cpp
+++ b/main.cpp
@@ -30,6 +30,7 @@
#include
#include
+#include
// main.cpp
#include
@@ -65,6 +66,22 @@ if (ok) {
#include
+bool setApplicationStyleSheet( QAnyStringView path )
+{
+ QFile styleFile( path.toString() );
+ if (styleFile.open(QIODevice::ReadOnly | QIODevice::Text))
+ {
+ QString style = styleFile.readAll();
+ qApp->setStyleSheet(style);
+ styleFile.close();
+ return true;
+ }
+
+ qWarning() << "Konnte Stylesheet nicht laden:" << styleFile.errorString();
+ return true;
+}
+
+// 2. Datei öffnen und lesen
int main(int argc, char *argv[])
{
auto x = BC::ID::Motor_Status_Main;
@@ -80,8 +97,7 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
- BCMainWindow w;
- w.show();
+ setApplicationStyleSheet( ":/BionxControl.qss"_L1 );
QMetaEnum metaEnum = QMetaEnum::fromType();
@@ -103,6 +119,9 @@ int main(int argc, char *argv[])
//myMgr.loadXml();
+ BCMainWindow w;
+ w.show();
+
return app.exec();
}