Compare commits

...

11 Commits

Author SHA1 Message Date
Roberto Viola
7f83901f4c Update project.pbxproj 2025-06-18 12:34:56 +02:00
Roberto Viola
7ff8be3585 Update wahookickrsnapbike.h 2025-06-18 12:34:23 +02:00
Roberto Viola
93cb1f3e8b watt gain issue! 2025-06-18 11:41:08 +02:00
Roberto Viola
8635eb930b adding the settngs, but need to use the new setting in the wahookickrsnapbike.cpp 2025-06-17 16:29:05 +02:00
Roberto Viola
0d0118e13e Update project.pbxproj 2025-06-16 10:46:35 +02:00
Roberto Viola
e3f9ccc848 trying to restore thing 2025-06-16 10:23:28 +02:00
Roberto Viola
31a74b9304 trying to get the right issue 2025-06-13 15:28:57 +02:00
Roberto Viola
5c39eb98d9 fixing build 2025-06-13 13:14:58 +02:00
Roberto Viola
ba50727563 Update homeform.cpp 2025-06-13 13:08:23 +02:00
Roberto Viola
b02c5e6a67 Update wahookickrsnapbike.h 2025-06-13 13:04:55 +02:00
Roberto Viola
349e6fd2b9 reverting to eb540dc579/src/devices/wahookickrsnapbike/wahookickrsnapbike.cpp 2025-06-13 13:00:39 +02:00
8 changed files with 74 additions and 71 deletions

View File

@@ -4381,7 +4381,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "../src/ios/qdomyos-zwift.entitlements";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1100;
CURRENT_PROJECT_VERSION = 1105;
DEVELOPMENT_TEAM = 6335M7T29D;
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = "ADB_HOST=1";
@@ -4575,7 +4575,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "../src/ios/qdomyos-zwift.entitlements";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1100;
CURRENT_PROJECT_VERSION = 1105;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = 6335M7T29D;
ENABLE_BITCODE = NO;
@@ -4805,7 +4805,7 @@
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1100;
CURRENT_PROJECT_VERSION = 1105;
DEVELOPMENT_TEAM = 6335M7T29D;
ENABLE_BITCODE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -4901,7 +4901,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1100;
CURRENT_PROJECT_VERSION = 1105;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 6335M7T29D;
ENABLE_BITCODE = YES;
@@ -4993,7 +4993,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1100;
CURRENT_PROJECT_VERSION = 1105;
DEVELOPMENT_ASSET_PATHS = "\"watchkit Extension/Preview Content\"";
ENABLE_BITCODE = YES;
ENABLE_PREVIEWS = YES;
@@ -5109,7 +5109,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1100;
CURRENT_PROJECT_VERSION = 1105;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"watchkit Extension/Preview Content\"";
ENABLE_BITCODE = YES;

4
src/CLAUDE.md Normal file
View File

@@ -0,0 +1,4 @@
when you add a setting remember:
- you have to add always as the last settings declared in the settings.qml
- if you have to add a setting also on another qml file, you need also to declare it there always putting as the last one
- in the qzsettings.cpp there is a allsettingscount that must be updated if you add a setting

View File

@@ -22,7 +22,6 @@ wahookickrsnapbike::wahookickrsnapbike(bool noWriteResistance, bool noHeartServi
ergModeSupported = true; // IMPORTANT, only for this bike
m_watt.setType(metric::METRIC_WATT);
m_rawWatt.setType(metric::METRIC_WATT);
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;
@@ -219,16 +218,10 @@ void wahookickrsnapbike::update() {
}
QThread::msleep(700);
QByteArray d = setWheelCircumference(wheelCircumference::gearsToWheelDiameter(gears()));
uint8_t e[20];
setGears(settings.value(QZSettings::gears_current_value, QZSettings::default_gears_current_value).toDouble());
memcpy(e, d.constData(), d.length());
writeCharacteristic(e, d.length(), "setWheelCircumference", false, true);
// required to the SS2K only one time
Resistance = 0;
emit resistanceRead(Resistance.value());
initRequest = false;
initRequest = false;
} else if (
#ifndef Q_OS_IOS
bluetoothDevice.isValid() &&
@@ -271,7 +264,10 @@ void wahookickrsnapbike::update() {
inclinationChanged(requestInclination, requestInclination);
Inclination = requestInclination; // the bike is not sending back the inclination?
requestInclination = -100;
} else if (lastGearValue != gears()) {
inclinationChanged(lastGrade, lastGrade);
}
lastGearValue = gears();
} else if (requestResistance != -1 && KICKR_BIKE == false) {
if (requestResistance > 100) {
requestResistance = 100;
@@ -289,30 +285,18 @@ void wahookickrsnapbike::update() {
memcpy(b, a.constData(), a.length());
writeCharacteristic(b, a.length(), "setResistance", false, false);
} else if (requestResistance != currentResistance().value() &&
((virtualBike && !virtualBike->ftmsDeviceConnected()) || !virtualBike)) {
emit debug(QStringLiteral("writing resistance ") + QString::number(lastForcedResistance));
QByteArray a = setResistanceMode(((double)lastForcedResistance) / 100.0);
((virtualBike && !virtualBike->ftmsDeviceConnected()) || !virtualBike) && lastGearValue != gears()) {
emit debug(QStringLiteral("writing resistance due to gears changed ") + QString::number(lastForcedResistance));
QByteArray a = setResistanceMode(((double)lastForcedResistance + (gears() - lastGearValue)) / 100.0);
uint8_t b[20];
memcpy(b, a.constData(), a.length());
writeCharacteristic(b, a.length(), "setResistance", false, false);
} else if (virtualBike && virtualBike->ftmsDeviceConnected() && lastGearValue != gears()) {
inclinationChanged(lastGrade, lastGrade);
}
lastGearValue = gears();
requestResistance = -1;
}
if (lastGearValue != gears()) {
if(KICKR_SNAP) {
inclinationChanged(lastGrade, lastGrade);
} else {
QByteArray a = setWheelCircumference(wheelCircumference::gearsToWheelDiameter(gears()));
uint8_t b[20];
memcpy(b, a.constData(), a.length());
writeCharacteristic(b, a.length(), "setWheelCircumference", false, false);
lastGrade = 999; // to force a change
}
}
lastGearValue = gears();
if (requestStart != -1) {
emit debug(QStringLiteral("starting..."));
@@ -803,7 +787,7 @@ void wahookickrsnapbike::serviceScanDone(void) {
QSettings settings;
settings.setValue(QZSettings::ftms_bike, bluetoothDevice.name());
settings.sync();
if(homeform::singleton())
if(homeform::singleton())
homeform::singleton()->setToastRequested("Zwift Hub device found, please restart the app to enjoy virtual gearing!");
return;
}
@@ -824,13 +808,13 @@ void wahookickrsnapbike::error(QLowEnergyController::Error err) {
void wahookickrsnapbike::deviceDiscovered(const QBluetoothDeviceInfo &device) {
emit debug(QStringLiteral("Found new device: ") + device.name() + QStringLiteral(" (") +
device.address().toString() + ')');
if (device.name().toUpper().startsWith("WAHOO KICKR")) {
WAHOO_KICKR = true;
qDebug() << "WAHOO KICKR workaround activated";
} else if(device.name().toUpper().startsWith("KICKR BIKE")) {
KICKR_BIKE = true;
qDebug() << "KICKR BIKE workaround activated";
if (device.name().toUpper().startsWith("WAHOO KICKR")) {
WAHOO_KICKR = true;
qDebug() << "WAHOO KICKR workaround activated";
} else if(device.name().toUpper().startsWith("KICKR BIKE")) {
KICKR_BIKE = true;
qDebug() << "KICKR BIKE workaround activated";
} else if(device.name().toUpper().startsWith("KICKR SNAP")) {
KICKR_SNAP = true;
qDebug() << "KICKR SNAP workaround activated";
@@ -916,41 +900,17 @@ void wahookickrsnapbike::controllerStateChanged(QLowEnergyController::Controller
void wahookickrsnapbike::inclinationChanged(double grade, double percentage) {
Q_UNUSED(percentage);
if(lastCommandErgMode) {
lastGrade = grade + 1; // to force a refresh
initRequest = true;
qDebug() << "avoid sending this command, since I have first to restore the setSimGrade";
return;
}
if(lastGrade == grade) {
qDebug() << "grade is already set to " << grade << "skipping";
return;
}
lastGrade = grade;
Inclination = grade;
emit debug(QStringLiteral("writing inclination ") + QString::number(grade));
QSettings settings;
double g = grade;
if(KICKR_SNAP) {
g += gears() * 0.5;
qDebug() << "adding gear offset so " << g;
}
g += gears();
QByteArray a = setSimGrade(g);
uint8_t b[20];
memcpy(b, a.constData(), a.length());
writeCharacteristic(b, a.length(), "setSimGrade", false, false);
lastCommandErgMode = false;
}
bool wahookickrsnapbike::inclinationAvailableByHardware() {
return KICKR_BIKE;
}
double wahookickrsnapbike::maxGears() {
wheelCircumference::GearTable g;
return g.maxGears;
}
double wahookickrsnapbike::minGears() {
return 1;
}
}

View File

@@ -43,8 +43,7 @@ class wahookickrsnapbike : public bike {
bool connected() override;
resistance_t maxResistance() override { return 100; }
bool inclinationAvailableByHardware() override;
double maxGears() override;
double minGears() override;
enum OperationCode : uint8_t {
_unlock = 32,
@@ -62,7 +61,7 @@ class wahookickrsnapbike : public bike {
// Variabili per iOS (pubbliche per permettere all'implementazione iOS di impostarle)
bool zwift_found = false;
bool wahoo_found = false;
// Wrapper per characteristicChanged che accetta direttamente QBluetoothUuid
void handleCharacteristicValueChanged(const QBluetoothUuid &uuid, const QByteArray &newValue);

View File

@@ -21,6 +21,7 @@ ScrollView {
property int gear_cog_size: 14
property string gear_wheel_size: "700 x 18C"
property real gear_circumference: 2070
property bool wahoo_without_wheel_diameter: false
}
property int selectedCranksetSize: settings.gear_crankset_size
@@ -323,6 +324,38 @@ ScrollView {
spacing: 20
id: chainringColumn
// Wahoo Options
GroupBox {
title: "Wahoo Options"
Layout.fillWidth: true
ColumnLayout {
IndicatorOnlySwitch {
id: wahooWithoutWheelDiameterDelegate
text: qsTr("Without Wheel Diameter Protocol")
spacing: 0
bottomPadding: 0
topPadding: 0
rightPadding: 0
leftPadding: 0
clip: false
checked: settings.wahoo_without_wheel_diameter
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.fillWidth: true
onClicked: settings.wahoo_without_wheel_diameter = checked
}
Label {
text: qsTr("Enable this for simplified Wahoo protocol that adds gears directly to grade instead of using wheel diameter changes. Default is false (uses master branch behavior).")
wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.maximumWidth: chainringColumn.width - 20
font.pixelSize: Qt.application.font.pixelSize - 2
color: Material.accent
}
}
}
// Crankset Size
GroupBox {
title: "Chainring Size"

View File

@@ -442,6 +442,7 @@ const QString QZSettings::default_horizon_treadmill_profile_user5 = QStringLiter
const QString QZSettings::nordictrack_gx_2_7 = QStringLiteral("nordictrack_gx_2_7");
const QString QZSettings::rolling_resistance = QStringLiteral("rolling_resistance");
const QString QZSettings::wahoo_rgt_dircon = QStringLiteral("wahoo_rgt_dircon");
const QString QZSettings::wahoo_without_wheel_diameter = QStringLiteral("wahoo_without_wheel_diameter");
const QString QZSettings::tts_description_enabled = QStringLiteral("tts_description_enabled");
const QString QZSettings::tile_preset_resistance_1_enabled = QStringLiteral("tile_preset_resistance_1_enabled");
const QString QZSettings::tile_preset_resistance_1_order = QStringLiteral("tile_preset_resistance_1_order");
@@ -941,7 +942,7 @@ const QString QZSettings::default_inclinationResistancePoints = QStringLiteral("
const QString QZSettings::floatingwindow_type = QStringLiteral("floatingwindow_type");
const uint32_t allSettingsCount = 768;
const uint32_t allSettingsCount = 769;
QVariant allSettings[allSettingsCount][2] = {
{QZSettings::cryptoKeySettingsProfiles, QZSettings::default_cryptoKeySettingsProfiles},

View File

@@ -1339,6 +1339,9 @@ class QZSettings {
static const QString wahoo_rgt_dircon;
static constexpr bool default_wahoo_rgt_dircon = false;
static const QString wahoo_without_wheel_diameter;
static constexpr bool default_wahoo_without_wheel_diameter = false;
static const QString tts_description_enabled;
static constexpr bool default_tts_description_enabled = true;

View File

@@ -489,7 +489,7 @@ import Qt.labs.platform 1.1
property bool eslinker_ypoo: false
// from version 2.11.69
property bool wahoo_rgt_dircon: false
property bool wahoo_rgt_dircon: false
// from version 2.11.73
property bool tts_description_enabled: true
@@ -1158,6 +1158,9 @@ import Qt.labs.platform 1.1
property int tile_heat_time_in_zone_4_order: 71
property bool proform_treadmill_carbon_tls: false
// 2.19.1
property bool wahoo_without_wheel_diameter: false
}
function paddingZeros(text, limit) {