Domyos TC 540 Dirk Püschmann (Issue #2568)

This commit is contained in:
Roberto Viola
2024-09-05 17:53:33 +02:00
parent 1ade078827
commit fe801547dc
6 changed files with 23 additions and 4 deletions

View File

@@ -1102,7 +1102,9 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
} else if (b.name().startsWith(QStringLiteral("Domyos")) &&
!b.name().startsWith(QStringLiteral("DomyosBr")) &&
!b.name().toUpper().startsWith(QStringLiteral("DOMYOS-BIKING-")) && !domyos && !domyosElliptical && b.name().compare(ftms_treadmill, Qt::CaseInsensitive) &&
!domyosBike && !domyosRower && !ftmsBike && !horizonTreadmill && !deviceHasService(b, QBluetoothUuid((quint16)0x1826)) && filter) {
!domyosBike && !domyosRower && !ftmsBike && !horizonTreadmill &&
(!deviceHasService(b, QBluetoothUuid((quint16)0x1826)) || settings.value(QZSettings::domyostreadmill_notfmts, QZSettings::default_domyostreadmill_notfmts).toBool()) &&
filter) {
this->setLastBluetoothDevice(b);
this->stopDiscovery();
domyos = new domyostreadmill(this->pollDeviceTime, noConsole, noHeartService);
@@ -1317,7 +1319,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
(b.name().toUpper().startsWith(QStringLiteral("I-CONSOLE+")))) &&
!toorx_ftms && toorx_ftms_treadmill) ||
!b.name().compare(ftms_treadmill, Qt::CaseInsensitive) ||
(b.name().toUpper().startsWith(QStringLiteral("DOMYOS-TC")) && deviceHasService(b, QBluetoothUuid((quint16)0x1826))) ||
(b.name().toUpper().startsWith(QStringLiteral("DOMYOS-TC")) && deviceHasService(b, QBluetoothUuid((quint16)0x1826)) && !settings.value(QZSettings::domyostreadmill_notfmts, QZSettings::default_domyostreadmill_notfmts).toBool()) ||
b.name().toUpper().startsWith(QStringLiteral("XT685")) ||
b.name().toUpper().startsWith(QStringLiteral("XT285")) ||
b.name().toUpper().startsWith(QStringLiteral("XTERRA TR")) ||

View File

@@ -1,5 +1,5 @@
#include "horizontreadmill.h"
#include "homeform.h"
#include "devices/ftmsbike/ftmsbike.h"
#include "virtualdevices/virtualbike.h"
#include "virtualdevices/virtualtreadmill.h"
@@ -2088,10 +2088,18 @@ void horizontreadmill::stateChanged(QLowEnergyService::ServiceState state) {
QBluetoothUuid _gattTreadmillDataId((quint16)0x2ACD);
QBluetoothUuid _gattCrossTrainerDataId((quint16)0x2ACE);
QBluetoothUuid _gattInclinationSupported((quint16)0x2AD5);
QBluetoothUuid _DomyosServiceId(QStringLiteral("49535343-fe7d-4ae5-8fa9-9fafd205e455"));
emit debug(QStringLiteral("BTLE stateChanged ") + QString::fromLocal8Bit(metaEnum.valueToKey(state)));
for (QLowEnergyService *s : qAsConst(gattCommunicationChannelService)) {
qDebug() << QStringLiteral("stateChanged") << s->serviceUuid() << s->state();
if(s->serviceUuid() == _DomyosServiceId && DOMYOS) {
settings.setValue(QZSettings::domyostreadmill_notfmts, true);
homeform::singleton()->setToastRequested("Domyos Treadmill presents itself like a FTMS but it's not. Restart QZ to apply the fix, thanks.");
return;
}
if (s->state() != QLowEnergyService::ServiceDiscovered && s->state() != QLowEnergyService::InvalidService) {
qDebug() << QStringLiteral("not all services discovered");
return;
@@ -2343,6 +2351,9 @@ void horizontreadmill::deviceDiscovered(const QBluetoothDeviceInfo &device) {
} else if(device.name().toUpper().startsWith("T01_")) {
ICONCEPT_FTMS_treadmill = true;
qDebug() << QStringLiteral("ICONCEPT_FTMS_treadmill workaround ON!");
} else if ((device.name().toUpper().startsWith("DOMYOS"))) {
qDebug() << QStringLiteral("DOMYOS found");
DOMYOS = true;
}
if (device.name().toUpper().startsWith(QStringLiteral("TRX3500"))) {

View File

@@ -98,6 +98,7 @@ class horizontreadmill : public treadmill {
bool disableAutoPause = false;
bool HORIZON_78AT_treadmill = false;
bool ICONCEPT_FTMS_treadmill = false;
bool DOMYOS = false;
void testProfileCRC();
void updateProfileCRC();

View File

@@ -757,8 +757,9 @@ const QString QZSettings::domyosbike_notfmts = QStringLiteral("domyosbike_notfmt
const QString QZSettings::gears_volume_debouncing = QStringLiteral("gears_volume_debouncing");
const QString QZSettings::tile_biggears_enabled = QStringLiteral("tile_biggears_enabled");
const QString QZSettings::tile_biggears_order = QStringLiteral("tile_biggears_order");
const QString QZSettings::domyostreadmill_notfmts = QStringLiteral("domyostreadmill_notfmts");
const uint32_t allSettingsCount = 640;
const uint32_t allSettingsCount = 641;
QVariant allSettings[allSettingsCount][2] = {
{QZSettings::cryptoKeySettingsProfiles, QZSettings::default_cryptoKeySettingsProfiles},
@@ -1405,6 +1406,7 @@ QVariant allSettings[allSettingsCount][2] = {
{QZSettings::gears_volume_debouncing, QZSettings::default_gears_volume_debouncing},
{QZSettings::tile_biggears_enabled, QZSettings::default_tile_biggears_enabled},
{QZSettings::tile_biggears_order, QZSettings::default_tile_biggears_order},
{QZSettings::domyostreadmill_notfmts, QZSettings::default_domyostreadmill_notfmts},
};
void QZSettings::qDebugAllSettings(bool showDefaults) {

View File

@@ -2120,6 +2120,8 @@ class QZSettings {
static const QString tile_biggears_order;
static constexpr int default_tile_biggears_order = 54;
static const QString domyostreadmill_notfmts;
static constexpr bool default_domyostreadmill_notfmts = false;
/**
* @brief Write the QSettings values using the constants from this namespace.

View File

@@ -972,6 +972,7 @@ import QtQuick.Dialogs 1.0
property bool gears_volume_debouncing: false
property bool tile_biggears_enabled: false
property int tile_biggears_order: 54
property bool domyostreadmill_notfmts: false
}
function paddingZeros(text, limit) {