Skip to content

Commit

Permalink
Domyos Woodrower #1963
Browse files Browse the repository at this point in the history
  • Loading branch information
cagnulein committed Jan 7, 2024
1 parent f968d66 commit ee1201c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3754,7 +3754,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "../src/ios/qdomyos-zwift.entitlements";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 702;
CURRENT_PROJECT_VERSION = 703;
DEVELOPMENT_TEAM = 6335M7T29D;
ENABLE_BITCODE = NO;
HEADER_SEARCH_PATHS = (
Expand Down Expand Up @@ -3924,7 +3924,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "../src/ios/qdomyos-zwift.entitlements";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 702;
CURRENT_PROJECT_VERSION = 703;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = 6335M7T29D;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -4130,7 +4130,7 @@
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 702;
CURRENT_PROJECT_VERSION = 703;
DEVELOPMENT_TEAM = 6335M7T29D;
ENABLE_BITCODE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -4226,7 +4226,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 702;
CURRENT_PROJECT_VERSION = 703;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 6335M7T29D;
ENABLE_BITCODE = YES;
Expand Down Expand Up @@ -4318,7 +4318,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 702;
CURRENT_PROJECT_VERSION = 703;
DEVELOPMENT_ASSET_PATHS = "\"watchkit Extension/Preview Content\"";
ENABLE_BITCODE = YES;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -4432,7 +4432,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 702;
CURRENT_PROJECT_VERSION = 703;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"watchkit Extension/Preview Content\"";
ENABLE_BITCODE = YES;
Expand Down
22 changes: 20 additions & 2 deletions src/domyosrower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,22 @@ void domyosrower::update() {
bool virtual_device_force_bike =
settings.value(QZSettings::virtual_device_force_bike, QZSettings::default_virtual_device_force_bike)
.toBool();
#ifdef Q_OS_IOS
#ifndef IO_UNDER_QT
bool cadence =
settings.value(QZSettings::bike_cadence_sensor, QZSettings::default_bike_cadence_sensor).toBool();
bool ios_peloton_workaround =
settings.value(QZSettings::ios_peloton_workaround, QZSettings::default_ios_peloton_workaround).toBool();
if (ios_peloton_workaround && cadence) {

qDebug() << "ios_peloton_workaround activated!";
h = new lockscreen();
h->virtualbike_ios();
} else

#endif
#endif
{
if (virtual_device_enabled) {
if (virtual_device_rower) {
qDebug() << QStringLiteral("creating virtual rower interface...");
Expand All @@ -208,9 +224,11 @@ void domyosrower::update() {
connect(virtualBike, &virtualbike::changeInclination, this, &domyosrower::changeInclination);
this->setVirtualDevice(virtualBike, VIRTUAL_DEVICE_MODE::ALTERNATIVE);
}
firstVirtual = 1;
}
}
}
firstVirtual = 1;

// ********************************************************************************************************

// updating the treadmill console every second
Expand Down Expand Up @@ -563,7 +581,7 @@ void domyosrower::characteristicChanged(const QLowEnergyCharacteristic &characte
bool cadence = settings.value(QZSettings::bike_cadence_sensor, QZSettings::default_bike_cadence_sensor).toBool();
bool ios_peloton_workaround =
settings.value(QZSettings::ios_peloton_workaround, QZSettings::default_ios_peloton_workaround).toBool();
if (ios_peloton_workaround && cadence && h && firstStateChanged) {
if (ios_peloton_workaround && cadence && h && firstVirtual) {

h->virtualbike_setCadence(currentCrankRevolutions(), lastCrankEventTime());
h->virtualbike_setHeartRate((uint8_t)metrics_override_heartrate());
Expand Down
8 changes: 8 additions & 0 deletions src/domyosrower.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

#include "rower.h"

#ifdef Q_OS_IOS
#include "ios/lockscreen.h"
#endif

class domyosrower : public rower {
Q_OBJECT
public:
Expand Down Expand Up @@ -78,6 +82,10 @@ class domyosrower : public rower {
QDateTime lastStroke = QDateTime::currentDateTime();
double lastStrokesCount = 0;

#ifdef Q_OS_IOS
lockscreen *h = 0;
#endif

enum _BIKE_TYPE {
CHANG_YOW,
TELINK,
Expand Down

0 comments on commit ee1201c

Please sign in to comment.