mirror of
https://github.com/cagnulein/qdomyos-zwift.git
synced 2026-02-18 00:17:41 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa67022324 | ||
|
|
71ff8e4321 | ||
|
|
63404b8088 |
@@ -4194,7 +4194,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = "../src/ios/qdomyos-zwift.entitlements";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 941;
|
||||
CURRENT_PROJECT_VERSION = 942;
|
||||
DEVELOPMENT_TEAM = 6335M7T29D;
|
||||
ENABLE_BITCODE = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "ADB_HOST=1";
|
||||
@@ -4388,7 +4388,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = "../src/ios/qdomyos-zwift.entitlements";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 941;
|
||||
CURRENT_PROJECT_VERSION = 942;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = 6335M7T29D;
|
||||
ENABLE_BITCODE = NO;
|
||||
@@ -4618,7 +4618,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 941;
|
||||
CURRENT_PROJECT_VERSION = 942;
|
||||
DEVELOPMENT_TEAM = 6335M7T29D;
|
||||
ENABLE_BITCODE = YES;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
@@ -4714,7 +4714,7 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 941;
|
||||
CURRENT_PROJECT_VERSION = 942;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = 6335M7T29D;
|
||||
ENABLE_BITCODE = YES;
|
||||
@@ -4806,7 +4806,7 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 941;
|
||||
CURRENT_PROJECT_VERSION = 942;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"watchkit Extension/Preview Content\"";
|
||||
ENABLE_BITCODE = YES;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
@@ -4920,7 +4920,7 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 941;
|
||||
CURRENT_PROJECT_VERSION = 942;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_ASSET_PATHS = "\"watchkit Extension/Preview Content\"";
|
||||
ENABLE_BITCODE = YES;
|
||||
|
||||
@@ -957,8 +957,23 @@ void homeform::pelotonWorkoutStarted(const QString &name, const QString &instruc
|
||||
}
|
||||
}
|
||||
emit changePelotonProvider(pelotonProvider());
|
||||
m_pelotonAskStart = true;
|
||||
emit changePelotonAskStart(pelotonAskStart());
|
||||
qDebug() << "peloton_start_time" << pelotonHandler->start_time << "current epoch" << QDateTime::currentSecsSinceEpoch() << qAbs(pelotonHandler->start_time - QDateTime::currentSecsSinceEpoch());
|
||||
QSettings settings;
|
||||
bool peloton_auto_start_with_intro = settings.value(QZSettings::peloton_auto_start_with_intro, QZSettings::default_peloton_auto_start_with_intro).toBool();
|
||||
bool peloton_auto_start_without_intro = settings.value(QZSettings::peloton_auto_start_without_intro, QZSettings::default_peloton_auto_start_without_intro).toBool();
|
||||
if(qAbs(pelotonHandler->start_time - QDateTime::currentSecsSinceEpoch()) < 180 && (peloton_auto_start_with_intro || peloton_auto_start_without_intro)) {
|
||||
// auto start is possible!
|
||||
setToastRequested(QStringLiteral("Peloton workout auto started skipping the intro! ") + name + QStringLiteral(" - ") + instructor);
|
||||
peloton_start_workout();
|
||||
|
||||
if(peloton_auto_start_with_intro)
|
||||
trainProgram->decreaseElapsedTime((pelotonHandler->start_time - QDateTime::currentSecsSinceEpoch()) + 64); // 4 average time to buffer
|
||||
else
|
||||
trainProgram->decreaseElapsedTime((pelotonHandler->start_time - QDateTime::currentSecsSinceEpoch()) + 6); // 8 average time to push skip intro and wait the 3 seconds of the intro
|
||||
} else {
|
||||
m_pelotonAskStart = true;
|
||||
emit changePelotonAskStart(pelotonAskStart());
|
||||
}
|
||||
}
|
||||
|
||||
void homeform::pelotonWorkoutChanged(const QString &name, const QString &instructor) {
|
||||
|
||||
@@ -558,6 +558,7 @@ void peloton::workoutlist_onfinish(QNetworkReply *reply) {
|
||||
|
||||
QString id = data.at(0)[QStringLiteral("id")].toString();
|
||||
QString status = data.at(0)[QStringLiteral("status")].toString();
|
||||
start_time = data.at(0)[QStringLiteral("start_time")].toInt();
|
||||
|
||||
if ((status.contains(QStringLiteral("IN_PROGRESS"),
|
||||
Qt::CaseInsensitive) && // NOTE: removed toUpper because of qstring-insensitive-allocation
|
||||
|
||||
@@ -48,6 +48,7 @@ class peloton : public QObject {
|
||||
void downloadImage();
|
||||
QDateTime current_original_air_time;
|
||||
int current_pedaling_duration = 0;
|
||||
qint64 start_time = 0;
|
||||
|
||||
void setTestMode(bool test);
|
||||
|
||||
|
||||
@@ -794,8 +794,10 @@ const QString QZSettings::mqtt_deviceid = QStringLiteral("mqtt_deviceid");
|
||||
const QString QZSettings::default_mqtt_username = QStringLiteral("");
|
||||
const QString QZSettings::default_mqtt_password = QStringLiteral("");
|
||||
const QString QZSettings::default_mqtt_deviceid = QStringLiteral("default");
|
||||
const QString QZSettings::peloton_auto_start_with_intro = QStringLiteral("peloton_auto_start_with_intro");
|
||||
const QString QZSettings::peloton_auto_start_without_intro = QStringLiteral("peloton_auto_start_without_intro");
|
||||
|
||||
const uint32_t allSettingsCount = 670;
|
||||
const uint32_t allSettingsCount = 672;
|
||||
|
||||
QVariant allSettings[allSettingsCount][2] = {
|
||||
{QZSettings::cryptoKeySettingsProfiles, QZSettings::default_cryptoKeySettingsProfiles},
|
||||
@@ -1472,6 +1474,8 @@ QVariant allSettings[allSettingsCount][2] = {
|
||||
{QZSettings::mqtt_username, QZSettings::default_mqtt_username},
|
||||
{QZSettings::mqtt_password, QZSettings::default_mqtt_password},
|
||||
{QZSettings::mqtt_deviceid, QZSettings::default_mqtt_deviceid},
|
||||
{QZSettings::peloton_auto_start_with_intro, QZSettings::default_peloton_auto_start_with_intro},
|
||||
{QZSettings::peloton_auto_start_without_intro, QZSettings::default_peloton_auto_start_without_intro},
|
||||
};
|
||||
|
||||
void QZSettings::qDebugAllSettings(bool showDefaults) {
|
||||
|
||||
@@ -2210,6 +2210,12 @@ class QZSettings {
|
||||
static const QString mqtt_deviceid;
|
||||
static const QString default_mqtt_deviceid;
|
||||
|
||||
static const QString peloton_auto_start_with_intro;
|
||||
static constexpr bool default_peloton_auto_start_with_intro = false;
|
||||
|
||||
static const QString peloton_auto_start_without_intro;
|
||||
static constexpr bool default_peloton_auto_start_without_intro = false;
|
||||
|
||||
/**
|
||||
* @brief Write the QSettings values using the constants from this namespace.
|
||||
* @param showDefaults Optionally indicates if the default should be shown with the key.
|
||||
|
||||
@@ -1016,6 +1016,8 @@ import QtQuick.Dialogs 1.0
|
||||
property string mqtt_username: ""
|
||||
property string mqtt_password: ""
|
||||
property string mqtt_deviceid: "default"
|
||||
property bool peloton_auto_start_with_intro: false
|
||||
property bool peloton_auto_start_without_intro: false
|
||||
}
|
||||
|
||||
function paddingZeros(text, limit) {
|
||||
@@ -4590,6 +4592,60 @@ import QtQuick.Dialogs 1.0
|
||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
color: Material.color(Material.Lime)
|
||||
}
|
||||
|
||||
SwitchDelegate {
|
||||
text: qsTr("Auto Start (with intro)")
|
||||
spacing: 0
|
||||
bottomPadding: 0
|
||||
topPadding: 0
|
||||
rightPadding: 0
|
||||
leftPadding: 0
|
||||
clip: false
|
||||
checked: settings.peloton_auto_start_with_intro
|
||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
onClicked: { settings.peloton_auto_start_with_intro = checked; if(settings.peloton_auto_start_with_intro === true) { settings.peloton_auto_start_without_intro = false; } }
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Turn this on to start a workout automatically when you start a workout on Peloton (wathing the intro). Default is off.")
|
||||
font.bold: true
|
||||
font.italic: true
|
||||
font.pixelSize: Qt.application.font.pixelSize - 2
|
||||
textFormat: Text.PlainText
|
||||
wrapMode: Text.WordWrap
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
color: Material.color(Material.Lime)
|
||||
}
|
||||
|
||||
SwitchDelegate {
|
||||
text: qsTr("Auto Start (without intro)")
|
||||
spacing: 0
|
||||
bottomPadding: 0
|
||||
topPadding: 0
|
||||
rightPadding: 0
|
||||
leftPadding: 0
|
||||
clip: false
|
||||
checked: settings.peloton_auto_start_without_intro
|
||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
onClicked: { settings.peloton_auto_start_without_intro = checked; if(settings.peloton_auto_start_without_intro === true) { settings.peloton_auto_start_with_intro = false; } }
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Turn this on to start a workout automatically when you start a workout on Peloton (skipping the intro). Default is off.")
|
||||
font.bold: true
|
||||
font.italic: true
|
||||
font.pixelSize: Qt.application.font.pixelSize - 2
|
||||
textFormat: Text.PlainText
|
||||
wrapMode: Text.WordWrap
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||
Layout.fillWidth: true
|
||||
color: Material.color(Material.Lime)
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -835,6 +835,11 @@ void trainprogram::scheduler() {
|
||||
|
||||
double odometerFromTheDevice = bluetoothManager->device()->odometer();
|
||||
|
||||
if(ticks < 0) {
|
||||
qDebug() << "waiting for the start...";
|
||||
return;
|
||||
}
|
||||
|
||||
// entry point
|
||||
if (ticks == 1 && currentStep == 0) {
|
||||
rows[currentStep].started = QDateTime::currentDateTime();
|
||||
@@ -1235,13 +1240,13 @@ bool trainprogram::overridePowerForCurrentRow(double power) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void trainprogram::increaseElapsedTime(uint32_t i) {
|
||||
void trainprogram::increaseElapsedTime(int32_t i) {
|
||||
|
||||
offset += i;
|
||||
ticks += i;
|
||||
}
|
||||
|
||||
void trainprogram::decreaseElapsedTime(uint32_t i) {
|
||||
void trainprogram::decreaseElapsedTime(int32_t i) {
|
||||
|
||||
offset -= i;
|
||||
ticks -= i;
|
||||
|
||||
@@ -87,8 +87,8 @@ class trainprogram : public QObject {
|
||||
double totalDistance();
|
||||
trainrow currentRow();
|
||||
trainrow getRowFromCurrent(uint32_t offset);
|
||||
void increaseElapsedTime(uint32_t i);
|
||||
void decreaseElapsedTime(uint32_t i);
|
||||
void increaseElapsedTime(int32_t i);
|
||||
void decreaseElapsedTime(int32_t i);
|
||||
int32_t offsetElapsedTime() { return offset; }
|
||||
void clearRows();
|
||||
double avgSpeedFromGpxStep(int gpxStep, int seconds);
|
||||
|
||||
Reference in New Issue
Block a user