Compare commits

...

381 Commits

Author SHA1 Message Date
Roberto Viola
9f85ea84aa Update project.pbxproj 2025-12-01 14:30:34 +01:00
Roberto Viola
b9d65081d5 RUNNA: Add average speed to treadmill BLE notifications
Enhanced treadmill BLE characteristic notifications to include average speed, updating both C++ and Swift implementations. Also fixed distance calculation in virtualtreadmill to use odometerFromStartup for consistency.
2025-12-01 14:28:51 +01:00
Roberto Viola
fdb359a89d Add signal for Zwift auth token result and show toast
Introduces a tokenReceived signal in AuthToken to notify when the Zwift authentication token is received. Updates trainprogram to connect this signal and display a toast message indicating success or failure, improving user feedback on login attempts.
2025-12-01 14:20:11 +01:00
Roberto Viola
6f166d2760 Impossible to connect to treadmill BH S7Ti (Issue #1800) (#1808)
* Update toorxtreadmill.cpp

* Update toorxtreadmill.cpp

* Update toorxtreadmill.cpp

* fixing crash on startup

d3c8441717

* Update toorxtreadmill.cpp

* Revert "Update toorxtreadmill.cpp"

This reverts commit 3228633cd8.

* Update toorxtreadmill.cpp

* trying to add the frame missing

* Update toorxtreadmill.cpp

* Update toorxtreadmill.cpp

* trying to do the same of #2732

https://github.com/cagnulein/qdomyos-zwift/pull/2732

* Update iconceptbike.cpp

* Revert "Update iconceptbike.cpp"

This reverts commit 37e63737bb.

* fixing doubling devices and init

* Update bluetooth.cpp

* Update toorxtreadmill.h

* Update toorxtreadmill.cpp

* Update toorxtreadmill.cpp

* Update toorxtreadmill.cpp

* Update toorxtreadmill.cpp

* Update toorxtreadmill.cpp

* Update toorxtreadmill.cpp

https://github.com/cagnulein/qdomyos-zwift/issues/2985#issuecomment-3311500996

* ant treadmill speed fix

* miles speed handled

* Add treadmill max speed setting to limit maximum speed

Implemented a new treadmill_speed_max setting (default: 100 km/h) that allows users to cap the maximum speed their treadmill can reach. This is useful for safety and to prevent excessive speeds.

Changes:
- Added treadmill_speed_max setting to qzsettings.h/.cpp
- Updated allSettingsCount from 805 to 806
- Added UI controls in settings.qml for max speed configuration
- Implemented speed limiting in treadmill::changeSpeed() method
- Speed check follows same pattern as treadmill_incline_max

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add unit conversion for treadmill max speed setting

The treadmill max speed field now displays and accepts input in either km/h or mph based on the selected unit. The label and description have been updated to reflect the units, and conversions are handled when saving the value.

* Update qzsettings.cpp

* Pafer treadmill (Issue #2985)

https://github.com/cagnulein/qdomyos-zwift/issues/2985#issuecomment-3457781383

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-01 09:48:49 +01:00
Roberto Viola
2e077e9268 Allow cadence >256 when using wheel revs fallback
Mail from Gabriel C. 28/11/2025

Modified cadence calculation to permit values above 256 when using wheel revolutions as a fallback (i.e., when _CrankRevs == 0). This ensures accurate cadence reporting in scenarios where crank data is unavailable.
2025-11-28 15:17:10 +01:00
Roberto Viola
28c7de4608 Add FTMS command tracking to kettlerusbbike
Introduces tracking of the last FTMS command received via a new ftmsCharacteristicChanged slot. Slope control is now only enabled if the last FTMS command was FTMS_SET_INDOOR_BIKE_SIMULATION_PARAMS, improving protocol compliance and device behavior.
2025-11-28 14:49:55 +01:00
Roberto Viola
19b204ff2d Revert "Kettler E7 USB power and slope collision"
This reverts commit 76d6ebceeb.
2025-11-28 14:38:16 +01:00
Roberto Viola
76d6ebceeb Kettler E7 USB power and slope collision 2025-11-28 10:22:21 +01:00
Roberto Viola
a945fa6314 Add support for Sunny Fitness Treadmill devices
Updated device discovery logic to recognize devices with names starting with 'SF-T' as Sunny Fitness Treadmills. Also added a missing check for 'horizonTreadmill' in the elliptical device filter to prevent incorrect device selection.
2025-11-28 09:48:20 +01:00
Roberto Viola
6eed563655 Update project.pbxproj 2025-11-27 14:53:02 +01:00
Roberto Viola
f0ac2da4f9 Add FITSHOW device support to FTMS rower
Email Problems Christopeit ET 6 from Tom 27/11/2025

Introduces detection and handling for FITSHOW devices by adding a FITSHOW flag and updating logic to treat FITSHOW similarly to ICONSOLE_PLUS for distance calculation. This enhances compatibility with additional rowing machine models.
2025-11-27 14:52:02 +01:00
Roberto Viola
6863ebcbfe Exclude SS2K from forcePower resistance logic
Updated the condition in ftmsbike::forcePower to exclude SS2K devices from the resistance level mode logic, ensuring correct handling for SS2K.
2025-11-27 14:38:58 +01:00
Roberto Viola
9a4c368492 Christopeit ET 6 bike
mail from Tom 26/11/2025
2025-11-27 13:33:57 +01:00
Roberto Viola
4af83bd51b Update project.pbxproj 2025-11-27 12:26:13 +01:00
Roberto Viola
a8136f2cbc Christopeit ET 6 bike
mail from Tom 26/11/2025
2025-11-27 11:59:25 +01:00
Roberto Viola
49fbf8acec Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-11-27 10:28:15 +01:00
Roberto Viola
9fa6eb2a48 Handle NaN values in peloton resistance calculation
Added checks to prevent assigning NaN to m_pelotonResistance. If the calculated resistance is NaN and cadence is zero, set resistance to 0; otherwise, retain the last valid value. This improves stability when sensor data is invalid or missing.
2025-11-27 10:28:04 +01:00
Roberto Viola
be12057c51 Add flights climbed metric to Apple Health for treadmill workouts (#3909)
* Add flights climbed metric to Apple Health for treadmill workouts

Implement calculation and tracking of flights climbed in Apple Health for
treadmill workouts on both iOS and watchOS, using the treadmill's inclination
data.

Changes:
- Add flightsClimbed static variable to WorkoutTracking class to track accumulated flights
- Add inclination parameter to addMetrics() function with default value of 0
- Calculate flights climbed based on inclination and distance delta:
  * Vertical gain = distance * sin(atan(inclination/100))
  * Flights = vertical gain / 3.048 meters (10 feet per flight)
- Add HealthKit authorization for flightsClimbed quantity type
- Write flights climbed data to HealthKit in stopWorkOut() for walking/running workouts
- Reset flights climbed counter at workout start and end
- Pass inclination from lockscreen.mm to WorkoutTracking Swift code
- Convert inclination from centesimal int16 to percentage double

The implementation only tracks flights for treadmill workouts (sport types 0 and 1
for walking and running) when inclination is greater than 0.

* Add flights climbed metric to watchOS for treadmill workouts

Extend Apple Health flights climbed tracking to watchOS companion app
for treadmill workouts using inclination data.

Changes to watchkit Extension/WatchWorkoutTracking.swift:
- Add flightsClimbed, inclination, and previousDistance static variables
- Add HealthKit authorization for flightsClimbed quantity type
- Add updateMetrics() method to calculate flights climbed in real-time:
  * Vertical gain = distance delta * sin(atan(inclination/100))
  * Flights = vertical gain / 3.048 meters (10 feet per flight)
- Write flights climbed data to HealthKit in stopWorkOut() for walking/running
- Reset flights climbed counter at workout start and end
- Combine steps, distance, and flights into single sample array

The implementation tracks flights only for walking/running workouts (sport
types 1 and 2) when inclination is greater than 0, matching iOS behavior.

* Refactor flights climbed to use QZ's existing elevationGain

Replace manual elevation calculation with QZ's built-in elevationGain metric
for improved accuracy and efficiency.

Changes:
- Add elevationGain parameter to virtualtreadmill_updateFTMS() signature
- Pass elevationGain (meters) from virtualtreadmill.cpp to iOS/watchOS
- Remove manual calculation in WorkoutTracking.swift and WatchWorkoutTracking.swift
- Simplify code by using pre-calculated metric from treadmill.cpp
- Remove unnecessary variables (previousDistance, inclination)

Benefits:
- More accurate: uses QZ's time-aware calculation with deltaTime
- More efficient: eliminates duplicate elevation calculations
- Cleaner code: reduces complexity and improves maintainability
- Consistent: aligns with QZ's existing metrics infrastructure

The elevationGain is calculated by treadmill::update_metrics() as:
  elevationAcc += (speed / 3600.0) * 1000.0 * (inclination / 100.0) * deltaTime

Flights climbed = elevationGain (meters) / 3.048 (10 feet per flight)

* Implement WatchConnectivity bridge for flights climbed on watchOS

Complete the watchOS integration by implementing WatchConnectivity bridge
to pass elevationGain from iOS to Apple Watch, enabling flights climbed
tracking on the watch.

iOS changes:
- Add elevationGain static variable to WatchKitConnection.swift
- Include elevationGain in WatchConnectivity replyHandler
- Add @objc setElevationGain() method in AppDelegate.swift
- Declare and implement setElevationGain() in lockscreen.h/mm
- Call setElevationGain() from virtualtreadmill.cpp with elevationGain value

watchOS changes:
- Add elevationGain static variable to WatchKitConnection.swift
- Extract elevationGain from iOS message in replyHandler
- Calculate flights climbed (elevationGain / 3.048) and update WorkoutTracking
- Remove unused updateMetrics() method from WatchWorkoutTracking.swift

Flow:
1. C++ treadmill.cpp calculates elevationGain from speed/inclination/deltaTime
2. virtualtreadmill.cpp passes elevationGain to iOS via lockscreen bridge
3. iOS stores elevationGain in WatchKitConnection static variable
4. When watch requests data, iOS includes elevationGain in reply message
5. Watch receives elevationGain, calculates flights climbed, updates HealthKit

Benefits:
- watchOS now receives accurate elevation data from QZ's calculations
- Flights climbed synced to Apple Health from both iOS and watchOS
- Consistent implementation across platforms
- Removes duplicate/unused code

* Fix compilation error: add previousDistance variable for distance delta calculations

Add missing previousDistance variable to WorkoutTracking class. This variable
is needed to calculate distance deltas for cycling and rowing metrics, which
is separate from the flights climbed calculation.

The previousDistance is used in:
- Cycling distance delta calculation (line 622)
- Rowing distance delta calculation (line 664)

Initialize previousDistance to 0 at workout start and update it at the end
of each addMetrics() call.

* Fix Swift static member access: use WorkoutTracking.previousDistance

Correct the static member access syntax. Since previousDistance is a static
variable, it must be accessed via the class name WorkoutTracking.previousDistance
rather than as a local variable.

Fixed in two locations:
- Line 624: cycling distance delta calculation
- Line 666: rowing distance delta calculation

* Add missing elevationGain parameter to addMetrics calls

Add elevationGain:0 parameter to three addMetrics calls in lockscreen.mm:
- workoutTrackingUpdate(): general workout tracking (line 211)
- virtualbike_updateFTMS(): bike workout tracking (line 269)
- virtualrower_updateFTMS(): rower workout tracking (line 279)

These devices don't have elevation gain relevant for flights climbed
calculation, so passing 0 is appropriate. The treadmill-specific call
in virtualtreadmill_updateFTMS() already correctly passes the actual
elevationGain value.

* Update project.pbxproj

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-27 10:09:03 +01:00
Roberto Viola
390471abb7 Add timeout and retry logic to rawRead method (#3922) 2025-11-26 20:45:02 +01:00
Roberto Viola
f0188aa9b1 Update project.pbxproj 2025-11-26 16:02:58 +01:00
Roberto Viola
9b784d935b Adding support for - HOP-SPORT HS-090H iConsole+ (Issue #2082) 2025-11-26 15:54:49 +01:00
Roberto Viola
cd07e46ff0 Update peloton.h 2025-11-26 10:51:23 +01:00
Roberto Viola
0393488c69 Walking Tread Bootcamp (Issue #3856) 2025-11-26 10:16:45 +01:00
Roberto Viola
29613b97fa Kettler USB Slope Implementation (#3917) 2025-11-25 20:03:51 +01:00
Roberto Viola
c3ff3c2e06 Update bluetooth.cpp 2025-11-25 09:35:18 +01:00
Roberto Viola
60e23c731b Update settings.qml 2025-11-24 20:22:33 +01:00
Roberto Viola
7d33d87f04 Update project.pbxproj 2025-11-24 13:14:37 +01:00
Roberto Viola
b15055e914 Add THINK_X check to characteristicChanged logic
Updated the conditional in characteristicChanged to include a THINK_X flag, ensuring that crank revolutions are only incremented when THINK_X is false. This accommodates devices where THINK_X sends crank revs in the power characteristic.
2025-11-24 12:43:33 +01:00
Roberto Viola
5ddb5f08cd Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-11-24 12:34:53 +01:00
Roberto Viola
13161cd894 Fix resistance value formatting in update method
Ensures the resistance value is formatted as a floating-point number with zero decimal places when updating the UI.
2025-11-24 12:34:47 +01:00
Roberto Viola
3089dc8a1c Revert "Format resistance values as strings with no decimals"
This reverts commit fdbc6e94e1.
2025-11-24 12:34:12 +01:00
Roberto Viola
f38652f7b2 Add support for NordicTrack Elliptical SE7i (#3900)
* Add support for NordicTrack Elliptical SE7i

Introduces device-specific initialization, polling, and control logic for the NordicTrack Elliptical SE7i in proformelliptical. Adds a new settings flag and UI switch for enabling SE7i support. Updates QZSettings and settings.qml to include the new option and default value.

* Update proformelliptical.h

* Update proformelliptical.cpp

* moved to right module, and init fixed

* build fix

* Update nordictrackelliptical.cpp

* Update settings.qml

* Update settings.qml
2025-11-24 12:02:53 +01:00
Roberto Viola
fdbc6e94e1 Format resistance values as strings with no decimals
Changed resistance and peloton_resistance assignments to use QString::number with zero decimal places, ensuring consistent string formatting for display.
2025-11-24 12:00:21 +01:00
Roberto Viola
025815fe99 Treadmill NYMAN PLUS min step inclination to 1 2025-11-24 08:40:00 +01:00
Roberto Viola
e2a93cde72 QZ app does not record cadence or resistance after connecting with SmartSpin2k (Issue #3887) 2025-11-21 14:08:14 +01:00
Roberto Viola
a44002c924 Change Kettler USB baudrate from 9600 to 57600 (#3899)
* Change Kettler USB baudrate from 9600 to 57600

Update baudrate configuration for Kettler USB bike support across all platforms:
- Android: Update JNI call parameter to 57600
- Linux/Mac: Change cfsetspeed to B57600
- Windows: Change BaudRate to CBR_57600

* Add baudrate selection setting for Kettler USB

- Add kettler_usb_baud_57600 setting (default: true for 57600 baud)
- Add baudrate parameter to KettlerUSB constructor
- Update openPort() to use configured baudrate for all platforms (Android, Linux/Mac, Windows)
- Add UI ComboBox in Kettler USB Bike Options to choose between 9600 and 57600 baud
- Update settings infrastructure (qzsettings.h/cpp, settings.qml)
- Allow users to switch between 9600 and 57600 baudrate via UI

* Change Kettler USB baudrate setting from bool to int

- Replace kettler_usb_baud_57600 (bool) with kettler_usb_baudrate (int)
- Change default from 57600 to 9600 as requested
- Update KettlerUSB constructor to accept int baudrate parameter
- Add switch statements to convert int to platform-specific constants:
  * Linux/Mac: Convert to speed_t (B9600, B57600)
  * Windows: Convert to CBR constants (CBR_9600, CBR_57600)
  * Android: Use int value directly
- Update settings.qml to use int property and parseInt()
- Future-proof: Can easily add more baudrate options without new settings

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-21 14:00:21 +01:00
Roberto Viola
3bcd4d0ee4 Improve KettlerUSB status parsing and serial buffer handling
Added validation to ignore non-status and malformed responses in parseStatusResponse. Introduced flushSerialBuffer to clear serial buffers after initialization. Reduced polling interval for faster response and improved handling of power command responses.
2025-11-21 11:40:27 +01:00
Roberto Viola
e15e8ebf9e Concept2>QZ: Rower Distance Discrepancy #3872 2025-11-20 15:38:54 +01:00
Roberto Viola
fba48cb7da Update project.pbxproj 2025-11-20 14:39:36 +01:00
Roberto Viola
daacf806bf Track valid cadence from 0x2AD2 characteristic
email "QZ compatibility smart Trainer" from Niklas H. on 20/11/2025

Introduces a static flag to ensure cadence from the 0x2A5B characteristic is only processed until a valid cadence is received from 0x2AD2. This prevents duplicate or conflicting cadence data.
2025-11-20 13:39:50 +01:00
Roberto Viola
4c21b01903 Set ergModeSupported to false for JFBK5.0 devices
mail from Darren K. on 20/11/2025

When discovering devices with names starting with JFBK5.0 or JFBK7.0, explicitly set ergModeSupported to false to reflect their capabilities.
2025-11-20 13:32:15 +01:00
Roberto Viola
59228197ac Update horizontreadmill.cpp (#3842) 2025-11-18 13:17:59 +01:00
Roberto Viola
f7b514c623 Add Kettler USB bike support for Android (#3878) 2025-11-17 20:07:28 +01:00
Roberto Viola
088208ff57 Update project.pbxproj 2025-11-17 15:29:23 +01:00
Roberto Viola
a5a4b93407 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-11-17 11:59:25 +01:00
Roberto Viola
47696c24ad Add support for NordicTrack Series 7 treadmill
Introduces detection, initialization, and polling logic for the NordicTrack Series 7 treadmill in proformtreadmill. Updates QZSettings and settings UI to include the new model, allowing users to select and configure it.
2025-11-17 11:59:19 +01:00
Roberto Viola
ba9da36087 Update project.pbxproj 2025-11-17 10:24:03 +01:00
Roberto Viola
8fcc9b6725 Update fakerower.cpp 2025-11-17 10:23:16 +01:00
Roberto Viola
d065dd5bd1 2.20.15 2025-11-17 10:13:46 +01:00
Roberto Viola
6f42a0d2cc Fix: Apply volume gear patch only when volume_change_gears is enabled (#3881) 2025-11-17 06:16:17 +01:00
Roberto Viola
14e2e16595 Fix iOS Live Activity updates for ellipticals with builtin heart rate (#3879) 2025-11-16 21:42:14 +01:00
Roberto Viola
025a757c35 2.20.14 2025-11-15 07:52:34 +01:00
Roberto Viola
292a5600c9 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-11-14 20:08:06 +01:00
Roberto Viola
468bc8f87b Concept2>QZ: Rower Distance Discrepancy (Issue #3872) 2025-11-14 20:07:51 +01:00
Roberto Viola
b0e011fd34 Update project.pbxproj 2025-11-14 12:50:21 +01:00
Roberto Viola
2ef0a3c5a7 kinomap and exr compatibility on android added 2025-11-14 10:45:48 +01:00
Roberto Viola
019b3c8abb Schwinn 411/510e cadence issue 2025-11-14 08:55:05 +01:00
Roberto Viola
317116f2d5 Update fakerower.cpp 2025-11-14 08:04:05 +01:00
Roberto Viola
fe005a2f00 SMARTBIKE added 2025-11-13 10:04:59 +01:00
Roberto Viola
08c1e26d3b mqtt settings in command line 2025-11-12 13:53:42 +01:00
Roberto Viola
e98820601a Update project.pbxproj 2025-11-12 11:02:21 +01:00
Roberto Viola
c499092460 Skandika wiry not working correct in qz app (Discussion #3860) 2025-11-12 08:18:17 +01:00
Roberto Viola
e3d50bda7c Add setting for Skandika X-2000 protocol selection
Introduces a new setting to enable or disable the X-2000 protocol for Skandika Wiri bikes. Updates the device discovery logic to respect this setting and adds a corresponding option in the settings UI, allowing users to select the appropriate protocol for their bike model.
2025-11-11 08:36:09 +01:00
Roberto Viola
c060e8b24a height setting fixed for miles units 2025-11-11 08:32:10 +01:00
Roberto Viola
f15f841860 Revert "Remove MLKit integration (#3859)"
This reverts commit 54a8b2619a.
2025-11-10 12:07:48 +01:00
Roberto Viola
15010b27dd Walking Tread Bootcamp (Issue #3856) 2025-11-10 10:03:03 +01:00
Roberto Viola
88c6091e21 Fix division by zero in speed calculation
Added a check to set Speed to 0 when instantPace is zero, preventing a division by zero error during speed calculation.
2025-11-10 08:27:59 +01:00
Roberto Viola
4a6df1c020 handleurl build fix for android 2025-11-09 12:04:34 +01:00
Roberto Viola
3d24e7c1a0 2.20.13 2025-11-09 11:52:18 +01:00
Roberto Viola
54a8b2619a Remove MLKit integration (#3859)
* Remove MLKit integration

- Remove OCR UI elements from settings.qml (Peloton and Zwift auto-sync features)
- Remove MLKit meta-data from AndroidManifest.xml
- Remove MLKit dependencies from build.gradle (both Amazon and Google Play versions)
- Keep underlying properties and qzsettings intact, only UI elements removed

* Restore Zwift OCR settings for Windows only

- Restored zwift_ocr, zwift_ocr_climb_portal, zwift_workout_ocr UI elements
- These settings are visible only on Windows (Qt.platform.os === "windows")
- Windows uses PaddleOCR for screen reading, not MLKit
- Android/iOS OCR features remain removed (they used MLKit)
- Updated labels to clarify these use PaddleOCR, not MLKit

* Remove MLKit OCR code from ScreenCaptureService

- Removed all MLKit imports (InputImage, Text, TextRecognition, etc.)
- Removed TextRecognizer field initialization
- Removed OCR processing code from onImageAvailable method
- Service kept for compatibility but OCR functionality disabled
- Fixes compilation errors after MLKit dependency removal

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-09 11:50:04 +01:00
Roberto Viola
038c4a6165 Update project.pbxproj 2025-11-07 08:14:27 +01:00
Roberto Viola
0831a4ed20 Comment out total distance calculation logic
email "debug qz file rower" from Martin B. on 6/11/2025

The code for calculating total distance from characteristic data has been commented out. Instead, distance is now incremented based on speed and elapsed time, possibly for testing or to address an issue with the original calculation.
2025-11-07 08:04:03 +01:00
Roberto Viola
74fc5f660c problem with Bkool smart bike 1.0 conection #3851 2025-11-07 07:59:22 +01:00
Roberto Viola
ae5dd54738 zwo message commands to TTS (Issue #3823) (#3824) 2025-11-05 14:46:38 +01:00
Roberto Viola
c0299b16ac Support for Proform Trainer 9.0 (PFTL69921-INT.4)
https://github.com/cagnulein/QZCompanionNordictrackTreadmill/issues/144#issuecomment-3491211756
2025-11-05 14:41:48 +01:00
Roberto Viola
6401a66f4c Update project.pbxproj 2025-11-05 14:18:05 +01:00
Roberto Viola
ba064c2acd Support for Proform Trainer 9.0 (PFTL69921-INT.4)
https://github.com/cagnulein/QZCompanionNordictrackTreadmill/issues/144#issuecomment-3490770427
2025-11-05 13:26:37 +01:00
Roberto Viola
9375f15207 Update AndroidManifest.xml 2025-11-05 10:40:17 +01:00
Roberto Viola
24183a4968 added all the android library aligned to 16k 2025-11-05 10:39:36 +01:00
Roberto Viola
9e1537caad 2.20.12 2025-11-05 10:07:38 +01:00
Roberto Viola
9fe72d13c0 Support for Proform Trainer 9.0 (PFTL69921-INT.4) (Issue #144)
https://github.com/cagnulein/QZCompanionNordictrackTreadmill/issues/144#issuecomment-3490007042
2025-11-05 09:58:09 +01:00
Roberto Viola
df5e80a5be Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-11-05 09:39:30 +01:00
Roberto Viola
3b751d44e6 Treadmill incline multiplied on QZ output [BUG] #2511
BH Vanquish II no regula la velocidad automáticamente #3839
2025-11-05 09:39:24 +01:00
Roberto Viola
3815e45107 PitPat-T01 treadmill #3589 (#3737)
* PitPat-T01 treadmill #3589

* fixing

* wait for a packet and init from 0

* Update deerruntreadmill.cpp

* Update deerruntreadmill.cpp

* new xor

* stop command handled

* minspeedstep handled

* start and stop?

* start and stop

* Update deerruntreadmill.cpp
2025-11-05 08:25:12 +01:00
Roberto Viola
580eb3f092 Create libc++_shared.so 2025-11-04 17:02:41 +01:00
Roberto Viola
aba59cd136 Update peloton.h 2025-11-04 17:02:20 +01:00
Roberto Viola
369fbc4bc0 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-11-04 17:01:42 +01:00
Roberto Viola
871e704852 resistance for elliptical in the summary must be not the peloton resistance 2025-11-04 14:44:03 +01:00
Roberto Viola
b574e86804 cadence for elliptical in apple health must divide by 2 2025-11-04 14:43:44 +01:00
Roberto Viola
91735a714b Update project.pbxproj 2025-11-04 12:48:51 +01:00
Roberto Viola
da3b5b168e Trying to figure out how to best use this, monitor vs control (Discussion #3834) 2025-11-04 12:47:47 +01:00
Roberto Viola
d339cd461d Cadence and Wattage no responding the right way in Zwift (using a Elite Drivo 2) (Issue #3767) 2025-11-04 12:05:03 +01:00
Roberto Viola
f5ac438905 Update project.pbxproj 2025-11-04 11:42:42 +01:00
Roberto Viola
073b331535 Trying to figure out how to best use this, monitor vs control (Discussion #3834) 2025-11-04 11:40:49 +01:00
Roberto Viola
184c99ff6c Bkool smart bike (Issue #3774) 2025-11-04 11:35:06 +01:00
Roberto Viola
b25f7acf20 Support for Proform Trainer 9.0 (PFTL69921-INT.4)
https://github.com/cagnulein/QZCompanionNordictrackTreadmill/issues/144#issuecomment-3482194626
2025-11-04 11:11:33 +01:00
Roberto Viola
cb0df3ae27 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-11-04 10:56:20 +01:00
Roberto Viola
7f9ffb7e0e heart rate monitors battery levels (Issue #3833) 2025-11-04 10:55:49 +01:00
Roberto Viola
dd104da06d Update project.pbxproj 2025-11-04 10:37:54 +01:00
Roberto Viola
9440089d05 Trying to figure out how to best use this, monitor vs control (Discussion #3834) 2025-11-04 10:35:51 +01:00
Roberto Viola
39b6ad7463 Peloton and Yesoul resistance numbers the same #3729 2025-11-04 09:46:13 +01:00
Roberto Viola
fdc548fda7 Matrix FTMS Bikes not showing any data (Issue #3837) 2025-11-04 09:40:57 +01:00
Roberto Viola
cc85cbba4f Update project.pbxproj 2025-11-03 16:03:23 +01:00
Roberto Viola
7576a77cd8 Add sanity check for cadence calculation
Cadence is now only updated if the 5-second average is below 200, preventing unrealistic values from being set due to erroneous stride data.
2025-11-03 15:53:48 +01:00
Roberto Viola
61c633474a iOS Apple Health: elliptical as cycling speed and distance 2025-11-03 14:44:29 +01:00
Roberto Viola
69aefc0b30 Domyos 900 + garmin fenix = ANT+ FTMS profile ( smart trainer bike) (Issue #3835) 2025-11-03 14:01:32 +01:00
Roberto Viola
19ca844968 Update qdomyos-zwift.pri 2025-11-03 13:40:40 +01:00
Roberto Viola
5bb3a808a1 ftmselliptical: Refactor cadence calculation logic
Introduces an instantCadence metric to store the immediate cadence value and updates Cadence to use a 5-second average. This improves the accuracy and stability of cadence reporting in ypooelliptical.
2025-11-03 13:15:06 +01:00
Roberto Viola
63cedd457d Update project.pbxproj 2025-11-03 12:11:31 +01:00
Roberto Viola
d9925ac780 SCH_411_510E cadence overflow 2025-11-03 12:11:03 +01:00
Roberto Viola
e4a71e2940 Improve cadence calculation using stride count
Email: Schwinn 411/510e compatibility 03/11/2025

Cadence is now calculated from stride count differences when no external cadence sensor is present, providing more accurate RPM values. Added tracking for last stride count and timestamp to support this calculation.
2025-11-03 12:06:22 +01:00
Roberto Viola
d66d2fd915 Add support for FS-YK Bluetooth bike model
Recognizes devices with names starting with 'FS-YK-' and sets up model-specific flags and behavior. FS-YK bikes are now detected and marked as not supporting ERG mode natively.
2025-11-03 11:37:17 +01:00
Roberto Viola
d20f651672 Add option to force virtual treadmill mode
Introduces a new setting 'virtual_device_force_treadmill' allowing rower devices to be presented as treadmills to client apps. Updates the settings UI, QZSettings class, and device logic to support this feature.
2025-11-03 10:03:18 +01:00
Roberto Viola
19a564d832 Domyos bike 900 disconnecting[BUG] (Issue #3829) 2025-11-03 08:40:15 +01:00
Roberto Viola
5e100f8857 Enable manual workflow dispatch for nordictrack-build job
Modified the nordictrack-build job condition to allow manual triggering
in addition to scheduled runs.

Changes:
- Updated job condition from 'schedule' only to 'schedule || workflow_dispatch'
- This allows users to manually trigger the nordictrack build from GitHub Actions UI

Now the nordictrack-build job can be triggered:
1. Automatically: Every night at midnight (cron schedule)
2. Manually: Via GitHub Actions "Run workflow" button

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 16:16:46 +01:00
Roberto Viola
5491007a2a Add NordicTrack Rower variant to GitHub Actions workflow
Extended the nordictrack-build job to include a third variant for rower
devices, in addition to existing treadmill and bike variants.

Changes:
- Added rower variant to matrix strategy with proform_rower_ip setting
- Updated artifact list to include nordictrack-rower-android-trial APK
- Added rower description in release notes section

The workflow will now build three specialized APKs:
- android-debug-nordictrack-treadmill.apk (nordictrack_2950_ip)
- android-debug-nordictrack-bike.apk (tdf_10_ip)
- android-debug-nordictrack-rower.apk (proform_rower_ip) [NEW]

All three variants use the same nordictrack-build-grpc branch (PR #3478)
and set their respective IP settings to "localhost" for gRPC communication.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 16:12:57 +01:00
Giuseppe Macario
028b5b4c4a typos and grammar (#3768)
* Update HomeForm.ui.qml

grammar

* Update settings.qml

typos
2025-11-02 15:19:33 +01:00
Roberto Viola
8eb0083897 Add SCH_411_510E to power divisor exception list
SCH_411_510E devices now use a divisor of 1.0 for instant power calculation, aligning with other listed models. This change ensures correct power readings for SCH_411_510E ellipticals.
2025-11-02 14:52:52 +01:00
Roberto Viola
89ed87ecb1 Update project.pbxproj 2025-11-02 14:19:15 +01:00
Roberto Viola
eac18d7a51 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-11-02 14:18:15 +01:00
Roberto Viola
d9a50973cd Improve cadence and power calculation for SCH_411_510E
Cadence is now calculated from speed for SCH_411_510E devices when step count is unavailable and the cadence sensor is disabled. Instant power calculation logic is updated to always process when the flag is set, and SCH_411_510E is excluded from the DOMYOS power calculation branch.
2025-11-02 14:18:11 +01:00
Roberto Viola
39c33f3ebc Make SCH_290R behave like hammer_racer_s in FTMS bike
Add SCH_290R device support to FTMS bike with same behavior as hammer_racer_s.
The device will subscribe only to FTMS service and use the same initialization logic.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 12:15:28 +01:00
Roberto Viola
2858468a04 Update project.pbxproj 2025-11-01 21:16:52 +01:00
Roberto Viola
1bbbda4efb Technogym ride 2025-11-01 21:16:21 +01:00
Roberto Viola
49fc672538 Technogym ride 2025-11-01 21:08:18 +01:00
Roberto Viola
d93107e286 Update project.pbxproj 2025-11-01 20:00:38 +01:00
Roberto Viola
08af7d61a5 rouvy dircon fixed! 2025-11-01 19:07:54 +01:00
Roberto Viola
e25dfc2354 Add debug logging and update slope change handling
Added debug output for requested slope changes in BLEPeripheralManagerTreadmillZwift and corrected indentation. In virtualtreadmill.cpp, restored lastSlopeChanged assignment after heart rate update to ensure proper slope change timing.
2025-11-01 15:28:07 +01:00
Roberto Viola
a4a4d1b9c5 App closes after Bluetooth connection (Issue #3807) 2025-10-31 20:37:34 +01:00
Roberto Viola
5761865916 Only able to control resistance or incline at once (Issue #3798) (#3813) 2025-10-31 13:22:23 +01:00
Roberto Viola
5be7b8530e Add SCH_290R to recognized Bluetooth devices
Included support for devices with names starting with SCH_290R in the device discovery logic to ensure proper recognition and handling.
2025-10-31 10:40:29 +01:00
Roberto Viola
fe44490ad9 Update project.pbxproj 2025-10-31 08:19:52 +01:00
Roberto Viola
97138d8492 Add FTMS bike filter to device discovery
Device discovery now checks if the FTMS bike list contains the default FTMS bike before proceeding. This adds an additional filter to improve device selection accuracy.
2025-10-31 08:14:12 +01:00
Roberto Viola
76845d5507 Toputure TEB1 (Issue #3814)
Updated forceResistance and deviceDiscovered methods to handle SPORT01 devices. Resistance is now initialized to 1 for SPORT01, ensuring correct behavior on device discovery and resistance setting.
2025-10-30 14:20:23 +01:00
Roberto Viola
28bc5670c4 Update project.pbxproj 2025-10-30 13:24:55 +01:00
Roberto Viola
e0b84cb4a3 Check SCH_411_510E before processing instant power
Added a condition to ensure instant power is only processed when SCH_411_510E is not set. This prevents unintended behavior for devices with SCH_411_510E.
2025-10-30 13:23:27 +01:00
Roberto Viola
4cdf23d544 Toputure TEB1 #3814 2025-10-30 11:22:34 +01:00
Roberto Viola
7beb1aed6f set watchos to 6.0
https://developer.apple.com/forums/thread/805538
2025-10-30 09:00:59 +01:00
Roberto Viola
91841a1ff7 Find minimum start offset in target metrics
mail from Christian P. 29/10/2025 "qdomyos-zwift"

Replaces logic that assumed the first element was chronologically first with a search for the minimum 'start' offset among all target metrics. This ensures the correct offset is used even if the data is unordered.
2025-10-30 08:54:07 +01:00
Roberto Viola
886310497c Update project.pbxproj 2025-10-29 15:36:01 +01:00
Roberto Viola
5e96d3cff3 Update ypooelliptical.cpp 2025-10-29 13:59:20 +01:00
Roberto Viola
d66af32eed Update project.pbxproj 2025-10-29 13:55:41 +01:00
Roberto Viola
982318326f Elliptical FlowFitness 2Xi (Issue #3811) 2025-10-29 13:54:37 +01:00
Roberto Viola
2d680b9c4c Update project.pbxproj 2025-10-29 09:47:19 +01:00
Roberto Viola
17e2d211c1 Update watt calculation for SCH_411_510E device
Modified the power calculation logic to exclude SCH_411_510E from the divisor adjustment and to handle watt calculation for SCH_411_510E similarly to DOMYOS. Also moved the debug emit for current watt outside conditional blocks for consistent logging.
2025-10-29 09:41:14 +01:00
Roberto Viola
e1020be250 Bkool smart bike #3774 2025-10-29 09:17:22 +01:00
Roberto Viola
ce219a790a Sportstech sbike lite autoresistance in Rouvy #3803 2025-10-28 14:51:41 +01:00
Roberto Viola
7e55ded95d QZ Android Sends Data Even Without Pedaling (Issue #3763) 2025-10-28 12:31:45 +01:00
Roberto Viola
f70c6e8feb Add FIT_BK to 2-byte resistance protocol in ftmsbike
This ensures FIT_BK bikes receive resistance values multiplied by 10 using the 2-byte protocol, consistent with other similar bikes (JFBK5_0, DIRETO_XR, YPBM).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 19:53:36 +01:00
Roberto Viola
bdfaaecc83 Update WorkoutTracking.swift 2025-10-27 15:34:42 +01:00
Roberto Viola
4622fd6df2 Update project.pbxproj 2025-10-27 15:24:43 +01:00
Roberto Viola
fa5691fa2a Fix cadence handling for SCH_411_510E 2025-10-27 15:12:54 +01:00
Roberto Viola
2b995f8396 adding rowing, elliptical and walking on ios apple health 2025-10-27 14:55:34 +01:00
Roberto Viola
e044dc69bc fixing github ios CI 2025-10-27 11:45:25 +01:00
Roberto Viola
26bf095f19 Update project.pbxproj 2025-10-27 10:41:21 +01:00
Roberto Viola
2ba66d9625 writing ios heart rate without using apple watch and air pods 3 2025-10-27 10:40:45 +01:00
Roberto Viola
621440f981 writing ios heart rate without using apple watch and air pods 3 2025-10-27 09:47:56 +01:00
Roberto Viola
a0c1efce9c right device type in apple health from ios directly 2025-10-26 15:53:22 +01:00
Roberto Viola
861f916eb4 Update Windows build job to windows-2022
Changed the GitHub Actions workflow to use 'windows-2022' instead of 'windows-latest' for the window-build job. Also updated the build step to use Windows path separators and removed the explicit msys2 shell specification.
2025-10-26 14:23:28 +01:00
Roberto Viola
8ae1c59b41 Update project.pbxproj 2025-10-26 13:51:13 +01:00
Roberto Viola
d213b5dffe Add support for SCH411/510E elliptical device 2025-10-26 13:49:03 +01:00
Roberto Viola
099531be72 Después de cargar el archivo gpx, no se visualiza el mapa #3795 2025-10-26 13:40:54 +01:00
Roberto Viola
b7e92ab33c Fix Windows MinGW build after GitHub Actions runner update
GitHub migrated windows-latest from Windows Server 2022 to 2025, which
changed how PowerShell inherits PATH from MSYS2. The qthttpserver build
step now explicitly uses the msys2 shell to access MinGW tools (g++, make).

Changes:
- Add shell: msys2 {0} to Build qthttpserver step
- Fix path separator from backslash to forward slash for MSYS2 compatibility

Fixes: "Project ERROR: Cannot run compiler 'g++'"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 13:30:28 +01:00
Roberto Viola
0720d431db ios github build fixed 2025-10-26 13:16:39 +01:00
Roberto Viola
62c7b7b9df Add FTMS auto-detection for Domyos-Bike
- Check ftms_bike is disabled before connecting to domyosbike in bluetooth.cpp
- Auto-switch to FTMS bike when main service not found but FTMS service available
- Show toast notification to restart app when FTMS service detected

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 08:38:43 +02:00
Roberto Viola
4eed4be958 Update project.pbxproj 2025-10-24 17:55:13 +02:00
Roberto Viola
eb0dc48d24 Add support for SCH411/510E elliptical device
Added SCH411/510E device support to ypooelliptical class following the same FTMS pattern used for other devices like SCH_590E, E35, and KETTLER.

Changes:
- Added SCH_411_510E boolean flag to ypooelliptical.h
- Added device detection in bluetooth.cpp
- Updated all FTMS conditional checks to include SCH_411_510E

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 17:27:16 +02:00
Roberto Viola
4ff8e8335a GTABikeV ios compatibility 2025-10-24 08:42:05 +02:00
Roberto Viola
ec263a402d Update project.pbxproj 2025-10-23 21:14:47 +02:00
Roberto Viola
0ffb06cc79 Bkool smart bike #3774 (#3792) 2025-10-23 21:08:53 +02:00
Roberto Viola
302526000f Enable continuous gear shifting by decoupling from system volume limits on Android (Issue #3775) (#3779) 2025-10-23 13:34:33 +02:00
Roberto Viola
76891d41e2 Request : add support for Proform Sport 7.0 treadmill #2635
mail Re: I'm having problems with a Proform 7.0 Sport treadmill. The data is refreshed every 5 seconds, so it becomes impossible to uy application... in fact, with Kinomaps it ends up taking me out of the training due to many disconnections... for Kinomaps, when it stays at 0 km/h it pauses... thank you very much in advance and congratulations for this magnificent application 21/10/2025
2025-10-22 09:03:09 +02:00
Roberto Viola
bb3f9fe216 GTABikeV ios compatibility 2025-10-22 08:17:47 +02:00
Roberto Viola
dd0ce73260 Update trxappgateusbbike.cpp 2025-10-21 17:06:57 +02:00
Roberto Viola
206fa06049 Adjust packet length check for TOORX_SRX_500
Changed the minimum packet length for TOORX_SRX_500 from 21 to 19 in characteristicChanged. This ensures short packets are correctly ignored for this bike type.
2025-10-21 08:51:44 +02:00
Roberto Viola
3985eecfe6 Update trxappgateusbbike.cpp 2025-10-21 08:50:40 +02:00
Roberto Viola
97a7b5c27c Think A102-0063521 2025-10-20 15:05:24 +02:00
Roberto Viola
02c7063655 Update project.pbxproj 2025-10-20 10:59:18 +02:00
Roberto Viola
0067a728a4 iOS live activity continues after app closes (Issue #3783) 2025-10-20 09:34:23 +02:00
Roberto Viola
3ec15253d0 issues connecting zwift play with thinkrider max 2 (Issue #3758) (#3759)
* issues connecting zwift play with thinkrider max 2 (Issue #3758)

* Revert "issues connecting zwift play with thinkrider max 2 (Issue #3758)"

This reverts commit c657127675.

* avoiding char 0xFFF4 for cadence increment

* Update tacxneo2.cpp

* Update tacxneo2.cpp
2025-10-16 15:53:07 +02:00
Roberto Viola
09772d0968 ICSE patching
mail from Jean - Connectivity from 16/10/2025
2025-10-16 15:37:57 +02:00
Roberto Viola
6496e0cf7c Update project.pbxproj 2025-10-16 13:43:30 +02:00
Roberto Viola
b6ef01c59a ICSE patching
mail from Jean - Connectivity from 16/10/2025
2025-10-16 13:41:20 +02:00
Roberto Viola
522ea54ff2 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-10-15 10:24:55 +02:00
Roberto Viola
ba4cc11196 Walking speed surges/spikes #3757 2025-10-15 10:24:49 +02:00
Roberto Viola
95622182c9 Update project.pbxproj 2025-10-13 17:08:55 +02:00
Roberto Viola
0349dfcbaf Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-10-13 17:08:13 +02:00
Roberto Viola
9fc9d9cfe9 patching ftmsbike for multiple connectedAndDiscovered.
email from Jean-Noel - Connectivity from 13/10/2025
2025-10-13 16:12:53 +02:00
Roberto Viola
5ea16d0869 fixing git for live activities 2025-10-13 09:15:25 +02:00
Roberto Viola
57b259fcba ICSE reset to 15 seconds
mail "Connectivity" from Jean 13/10/2025
2025-10-13 08:05:34 +02:00
Roberto Viola
b78cf1fca5 fixing crash on ios 2025-10-11 07:39:04 +02:00
Roberto Viola
77b71e56de Update project.pbxproj 2025-10-10 14:00:25 +02:00
Roberto Viola
c8e3d370a1 fixing build on ios 2025-10-10 13:54:27 +02:00
Roberto Viola
ab8a325da2 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-10-10 13:43:24 +02:00
Roberto Viola
a3158514af Update project.pbxproj 2025-10-10 13:42:54 +02:00
Roberto Viola
2804d4686a Proform Rower (Proform 750R) cannot change resistance from app (Issue #3746) 2025-10-10 13:39:06 +02:00
Roberto Viola
cf0dc2d00d nordictrack integration broken #3731 2025-10-10 10:12:08 +02:00
Roberto Viola
164aa38cb1 adding horizon treadmill XP
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-09 20:53:30 +02:00
Roberto Viola
14998d0f25 TOPUTURE TP1 2025-10-09 13:29:40 +02:00
Roberto Viola
ca74fe7ccd fixing wattage reset on the elliptical class 2025-10-09 09:55:38 +02:00
Roberto Viola
facba11bae miles on live activity 2025-10-09 08:00:17 +02:00
Giuseppe Macario
8b8302fb53 typos (#3744) 2025-10-09 04:59:43 +02:00
Roberto Viola
eaea4bf8b8 Recently I managed to decode the Rowing data from Merach NovaRow R50, are any guideline I can follow in order to add it to the app? #3593 2025-10-08 14:01:24 +02:00
Roberto Viola
3d9c3e4103 Recently I managed to decode the Rowing data from Merach NovaRow R50, are any guideline I can follow in order to add it to the app? (Discussion #3593) 2025-10-08 12:00:02 +02:00
Roberto Viola
e840d7b3e9 Update bkoolbike.cpp 2025-10-07 15:03:27 +02:00
Roberto Viola
3a248ad2c5 Update project.pbxproj 2025-10-07 15:01:35 +02:00
Roberto Viola
5912d7df2d Airpods pro 3 heart rate (#3718)
* Airpods Pro 3 Heart Rate

* Update project.pbxproj
2025-10-07 14:53:48 +02:00
Roberto Viola
94842114e6 BKOOL Bike V 1 2025-10-07 14:47:16 +02:00
Roberto Viola
d83df0ba5a Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-10-07 08:54:33 +02:00
Roberto Viola
0764fb50b2 Peloton Walking Pace Targets at bottom of range (Issue #3738) 2025-10-07 08:54:26 +02:00
Roberto Viola
bb5de868ab Live Actions iOS (#3735)
* Add iOS Live Activity support at startup

- Created LiveActivityManager.swift for managing fitness metrics Live Activities
- Added Objective-C++ bridge (ios_liveactivity.h/mm) for Qt integration
- Updated Info.plist with NSSupportsLiveActivities flag
- Initialized LiveActivityManager in AppDelegate on app startup (iOS 16.1+)
- Added new files to qdomyos-zwift.pri build configuration

Live Activities display real-time fitness metrics (speed, cadence, power, heart rate, distance, calories) on Lock Screen and Dynamic Island.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Update project.pbxproj

* Update AppDelegate.swift

* fixing build error

* let's see

* qzwidget

* distance fixed in live activities

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-05 14:34:17 +02:00
Roberto Viola
2b8fe6c28d Schwinn CABLE concerns (Issue #3727) 2025-10-04 06:50:45 +02:00
Roberto Viola
0153e09f0d TOPUTURE TP1 treadmill 2025-10-03 15:19:09 +02:00
Roberto Viola
dc44433d7c Update project.pbxproj 2025-10-03 12:45:32 +02:00
Roberto Viola
8bdefdb331 Auto inclination not working when using an Android tablet (Issue #3730) 2025-10-03 12:44:01 +02:00
Roberto Viola
c7f5e320fc Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-10-02 15:35:10 +02:00
Roberto Viola
c1582cc763 When using Watt Gain < 1 , unable to fulfil the requested power in Workouts (ERG) (Issue #3728) 2025-10-02 15:34:58 +02:00
Roberto Viola
f2f0f7a793 Update project.pbxproj 2025-10-01 17:07:23 +02:00
Roberto Viola
3d665e397e BKOOL Bike V 1 2025-10-01 17:06:13 +02:00
Roberto Viola
194f8686f3 Update project.pbxproj 2025-10-01 15:49:33 +02:00
Roberto Viola
fb79d0ddd6 SportsTech sWalk Walking Pad 2025-10-01 15:39:55 +02:00
Roberto Viola
d7e0a4e441 stop workout confirmation 2025-10-01 09:54:44 +02:00
Roberto Viola
465123a156 KUBIsport BC91EK 2025-10-01 09:30:48 +02:00
Roberto Viola
88d01562b1 DMASUN Bikes 2025-09-30 15:34:15 +02:00
Roberto Viola
85421f41b8 KUBIsport BC91EK 2025-09-30 08:11:11 +02:00
Roberto Viola
a67cb10633 Update project.pbxproj 2025-09-29 13:35:41 +02:00
Roberto Viola
f00a161fc1 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-09-29 13:33:10 +02:00
Roberto Viola
c071c56eb7 Toorx BRX R100 ergo bicycle 2025-09-29 13:33:03 +02:00
Roberto Viola
b39f769423 Update project.pbxproj 2025-09-28 08:41:58 +02:00
Roberto Viola
dde526c059 Merach MRK-T25-EF79 (T25) discovered but no tiles report any activity (Issue #3720) 2025-09-28 08:38:39 +02:00
Roberto Viola
c223d6e81d ORLAUF ARES device added 2025-09-27 14:44:58 +02:00
Roberto Viola
d531a1d313 ios adb debug 2025-09-26 09:05:07 +02:00
Roberto Viola
b0722cc827 ios adb log 2025-09-26 08:46:06 +02:00
Roberto Viola
2e534abfbb Update lockscreen.mm 2025-09-24 16:23:48 +02:00
Roberto Viola
6d3ca9877a Update project.pbxproj 2025-09-24 16:08:07 +02:00
Roberto Viola
f477cb32ab Proform CSX210 2025-09-24 12:10:34 +02:00
Roberto Viola
51b79ed413 Wattage gain max value increase #3709 2025-09-24 09:32:56 +02:00
Roberto Viola
fa78f03f0a D500 trainer added 2025-09-22 08:16:39 +02:00
Roberto Viola
a40fec4082 adding LSApplicationCategoryType on iOS 2025-09-21 07:38:50 +02:00
Roberto Viola
f6a9d8ca4e removed gears gain changes from Wizard.qml 2025-09-18 16:30:25 +02:00
Roberto Viola
dd2bfc4e1b Update proformbike.cpp 2025-09-18 12:09:24 +02:00
Roberto Viola
06fd78378e Proform CSX210 2025-09-18 11:38:11 +02:00
Roberto Viola
f28574245c Update project.pbxproj 2025-09-18 09:58:38 +02:00
Roberto Viola
b964c523dd How to Make 10s Intervals Work with Virtual Shifting #3603 2025-09-18 09:50:06 +02:00
Roberto Viola
0721bc3ec5 Update project.pbxproj 2025-09-17 17:00:58 +02:00
Roberto Viola
3f783305b2 How to Make 10s Intervals Work with Virtual Shifting #3603 2025-09-17 17:00:09 +02:00
Roberto Viola
be29180e48 Update project.pbxproj 2025-09-17 12:22:46 +02:00
Roberto Viola
19c65d7d90 Taurua IC90 (#3697) 2025-09-17 12:20:21 +02:00
Roberto Viola
704c7f1f80 Kingsmith WalkingPad R3 Hybrid+ 2025-09-16 10:49:48 +02:00
Roberto Viola
678ac9d466 adding info for MAC 2025-09-16 10:00:15 +02:00
Roberto Viola
a8a6c5d736 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-09-16 09:39:33 +02:00
Roberto Viola
e8408710df adding MACCATALYST for ios 2025-09-16 09:39:13 +02:00
Roberto Viola
47825f0783 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-09-16 09:16:26 +02:00
Roberto Viola
f7ce518812 mobvoi se manual incline (Issue #3690) 2025-09-16 09:16:21 +02:00
Roberto Viola
f887a068b9 Power zone tiles not using erg mode (Issue #3681) 2025-09-15 13:49:29 +02:00
Roberto Viola
6ecbce4b87 adding KICKR RUN treadmill 2025-09-15 11:26:44 +02:00
Roberto Viola
9454d75f55 Update project.pbxproj 2025-09-12 10:39:04 +02:00
Roberto Viola
4063321418 Update project.pbxproj 2025-09-12 09:27:16 +02:00
Roberto Viola
bb88d58e47 Power zone tiles not using erg mode (Issue #3681) 2025-09-12 09:26:17 +02:00
Roberto Viola
7bc2f065c0 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-09-12 08:52:58 +02:00
Roberto Viola
c773b45ddf 2.20.11 2025-09-12 08:52:55 +02:00
Roberto Viola
eaf7db7813 Implement threaded FIT backup file writing (#3676)
* Implement threaded FIT backup file writing

- Add FitBackupWriter class to handle FIT file saving in background thread
- Move FIT backup writing from main thread to dedicated worker thread
- Use Qt's signal/slot mechanism with QueuedConnection for thread safety
- Similar implementation pattern to existing LogWriter threading
- Prevents UI blocking during FIT file saves every minute

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* build fix

* fix

* fix signal

* fix

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-11 20:46:36 +02:00
Roberto Viola
a29f6350d0 Update project.pbxproj 2025-09-11 12:39:53 +02:00
Roberto Viola
65ad925d37 How to Make 10s Intervals Work with Virtual Shifting (Discussion #3603) 2025-09-11 12:33:49 +02:00
Roberto Viola
8fd486d582 adding decimal places to current strokes length 2025-09-10 09:35:47 +02:00
Roberto Viola
8fa5dcadcb strokelength for Concept rower 2025-09-09 16:03:58 +02:00
Roberto Viola
6abf6c9cfd strokelength for Concept rower 2025-09-08 16:05:19 +02:00
Roberto Viola
b4603da714 Saris H3+ Slow to gear and resistance/incline changes on Zwift (Windows) + QZ on Android 16 (Pixel 8 Pro) #3660 2025-09-08 15:26:17 +02:00
Roberto Viola
b27e84de69 Update project.pbxproj 2025-09-05 11:44:02 +02:00
Roberto Viola
49337cbbc6 Update toorxtreadmill.h 2025-09-05 11:34:34 +02:00
Roberto Viola
fe2f5e923c Pafer treadmill #2985 2025-09-05 09:20:43 +02:00
Roberto Viola
69f54dbd54 Pafer treadmill #2985 2025-09-05 09:18:53 +02:00
Roberto Viola
bc20ec0d8f Option to Enable/Disable Haptic Feedback on Zwift Play Controllers (Issue #3669) 2025-09-05 08:44:45 +02:00
Roberto Viola
278add7a11 Setting resistance for skandika nordlys (Issue #3667) 2025-09-04 16:11:18 +02:00
Roberto Viola
6e90091883 Support for LSG Treadmills (Issue #3665) 2025-09-04 09:29:16 +02:00
Roberto Viola
ebda22d7b4 skandika nordlys 2025-09-03 16:20:01 +02:00
Roberto Viola
625ffb3932 skandika nordlys 2025-09-03 16:17:28 +02:00
Roberto Viola
fe6868911e Controlar intensidad de un workout aumentando o disminuyendo el porcentaje de FTP objetivo (Discussion #3664) 2025-09-03 10:28:57 +02:00
Roberto Viola
1c73d15377 webserverinfosender disconnect crash (#3661) 2025-09-01 15:20:50 +02:00
Roberto Viola
c33ee55efb Update homeform.cpp 2025-09-01 11:50:25 +02:00
Roberto Viola
56979a2122 Update homeform.cpp 2025-09-01 11:07:31 +02:00
Roberto Viola
3e1db8bfdf Support ROWING device type in writeProcess
mail "Question re QZ App" from Michael M. of 31/8/2025

Extended the writeProcess method to handle the ROWING device type in addition to BIKE. This allows the processor to support additional device types for characteristic writes.
2025-09-01 11:05:57 +02:00
Roberto Viola
10fdc52446 QZ & Peloton Sync Drift in Tread Classes (Issue #3624) 2025-09-01 10:56:41 +02:00
Roberto Viola
23d23c40a5 QZ & Peloton Sync Drift in Tread Classes (Issue #3624) 2025-09-01 09:54:59 +02:00
Roberto Viola
90e8eeb983 Update main.yml 2025-08-31 06:47:17 +02:00
Roberto Viola
dcf395ec46 Update main.yml 2025-08-29 16:06:13 +02:00
Roberto Viola
d55cb553d3 Add chart display mode setting with zoom controls (#3627)
Introduces a new 'chart_display_mode' setting allowing users to select between both charts, heart rate only, or power only in the chart footer. Updates QML and settings UI to support this option, and adds zoom buttons to each chart for focused time-range viewing. JavaScript logic is enhanced to handle dynamic chart display and zooming, including interval-based updates to the visible time window.
2025-08-29 15:32:52 +02:00
Roberto Viola
b862d26bc3 Multiple files in different instances Other Folder in Training Program List (#3651)
* Update TrainingProgramsList.qml

* Update TrainingProgramsList.qml

* did for gpx, profiles and settings
2025-08-29 10:35:37 +02:00
Roberto Viola
d5e4f11849 Active Calories (#3630)
* first commit

* Update AppDelegate.swift

* watchkit

* apex bike cadence updated

* adding something for debug

* Update project.pbxproj

* removing basal

* fixing

* build 1145

* Update project.pbxproj

* Add option to calculate calories from heart rate

Introduces a new setting to calculate calories based on heart rate data instead of power. Updates the bluetoothdevice logic to support HR-based calorie calculation, adds a new metric for HR calories, and exposes the option in the settings UI. Also updates QZSettings to include the new configuration key and default.

* build 1149

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Zwift erg mode workouts not functioning #3643

* Update project.pbxproj
2025-08-29 08:43:29 +02:00
Roberto Viola
5e9679f6c3 Merach W50 FTMS Treadmill 2025-08-29 08:40:25 +02:00
Roberto Viola
8799c447fb QZ not working with Taurus FX9.9 elliptical (Issue #3618) 2025-08-27 14:57:18 +02:00
Roberto Viola
bcdb767b7e adding compensation when there is a power sensor and an ergModeSupported bike (PR #3388) 2025-08-27 11:29:22 +02:00
Roberto Viola
15e208d34c Zwift erg mode workouts not functioning (Discussion #3643)
Improves logic for routing power requests to the bike, including handling of virtual bikes, ZwiftPlay, and external power sensors. Updates FTMS characteristic change handling to block simulation commands in resistance level mode and only allow power commands when no external power sensor is present.
2025-08-27 10:48:48 +02:00
Roberto Viola
f16c41e6dd Zwift erg mode workouts not functioning (Discussion #3643)
Refines the logic for routing FTMS power commands to the bike by considering the presence of an external power sensor and erg mode support. Now allows power commands through when no external power sensor is configured and erg mode is supported, even if resistance level mode is active. Adds more detailed debug output for easier troubleshooting.
2025-08-27 10:43:57 +02:00
Roberto Viola
9110c55cb1 Zwift erg mode workouts not functioning (Discussion #3643) 2025-08-27 10:39:17 +02:00
Roberto Viola
881e155cbc QZ & Peloton Sync Drift in Tread Classes #3624 2025-08-27 09:39:26 +02:00
Roberto Viola
e2d187a7bd Zwift erg mode workouts not functioning (Discussion #3643) 2025-08-26 14:57:11 +02:00
Roberto Viola
66821d884a Update main.yml 2025-08-26 13:54:32 +02:00
Roberto Viola
73ad1dc46c Add support for KS-HDSY-X21C treadmill variant
Introduces detection and handling for KS-HDSY-X21C devices, including new flags and GATT service/characteristic UUIDs. This improves compatibility with additional Kingsmith treadmill models.
2025-08-26 08:22:20 +02:00
Roberto Viola
c91a2d3ee5 Update main.yml 2025-08-25 14:13:00 +02:00
Roberto Viola
87c0e95b01 Update main.yml 2025-08-25 14:10:59 +02:00
Roberto Viola
174da2ac14 Update main.yml 2025-08-25 14:05:45 +02:00
Roberto Viola
b61ba37b8f Update main.yml 2025-08-25 14:05:07 +02:00
Roberto Viola
27333e7836 Constant low wattage regardless of resistance #3641 2025-08-25 10:48:32 +02:00
Roberto Viola
58a9e81bd8 peloton bike setting removed 2025-08-25 10:10:38 +02:00
Roberto Viola
d78e92f42f Connected JTX Fitness elliptical trainer but no data in QZ fitness panel (Issue #3638) 2025-08-23 16:18:15 +02:00
Roberto Viola
2a5eb7b057 Connected JTX Fitness elliptical trainer but no data in QZ fitness panel (Issue #3638) 2025-08-23 14:58:48 +02:00
Roberto Viola
ae5f70645a Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-08-23 14:48:33 +02:00
Roberto Viola
d26b14276e How to Make 10s Intervals Work with Virtual Shifting (Discussion #3603) 2025-08-23 14:47:42 +02:00
Roberto Viola
9166ce7218 removing tester android 14 2025-08-23 14:39:10 +02:00
Roberto Viola
5f0ec98b0c Update main.yml 2025-08-23 12:17:15 +02:00
Roberto Viola
1bc7af0a88 fix ios github actions (#3637) 2025-08-23 09:25:42 +02:00
Roberto Viola
df75d33ca6 Fix SQL linking in GitHub Actions by adding sql module to defaults.pri (#3635) 2025-08-22 15:20:51 +02:00
Roberto Viola
34f7df6bfb Kettler HOI Frame Connectivity (Issue #3636) 2025-08-22 15:06:48 +02:00
Roberto Viola
1208b439fa Concept2 RowERG PM5 and QZ not getting metrocs (Issue #3625) (#3626) 2025-08-21 06:58:33 +02:00
Roberto Viola
14a9faa2ee apex bike cadence updated 2025-08-20 15:47:34 +02:00
Roberto Viola
ca4fb0b35e technogym trainer 2025-08-19 15:25:29 +02:00
Roberto Viola
6ea6e6d9b2 Update project.pbxproj 2025-08-18 16:03:25 +02:00
Roberto Viola
2e17aa40ec apex bike table updated 2025-08-18 15:14:59 +02:00
Roberto Viola
098392684f 2.20.8 2025-08-17 15:28:24 +02:00
Roberto Viola
6678e225c5 Fixing Trainprogram Timer Jitter (#1849)
* fixing

* Update trainprogram.cpp

* Update trainprogram.cpp

* Update trainprogram.cpp
2025-08-17 15:17:24 +02:00
Roberto Viola
ca0bd15e69 virtual rower on nordictrackifitadbrower 2025-08-17 06:23:11 +02:00
Roberto Viola
1675240f13 fix wrong wattage for proform_bike_PFEVEX71316_0 2025-08-16 16:37:57 +02:00
Roberto Viola
b21c6325bb rebook bike fix for treadmill 2025-08-16 16:03:41 +02:00
Roberto Viola
b2f9e3d754 Update project.pbxproj 2025-08-15 16:33:48 +02:00
Roberto Viola
6dc5d74de3 proform_bike_PFEVEX71316_0 (Issue #3448)
mail QZ control of Proform TDF 1.0 with Zwift
from steve b. 12/08/2025
2025-08-15 16:06:10 +02:00
Roberto Viola
be560aae89 apex bike watt table improved 2025-08-15 15:52:24 +02:00
Roberto Viola
37858ca972 Removing Huge font from android (#3616)
* removing font

* fixing

* Update fontmanager.h

* fixing
2025-08-14 16:15:17 +02:00
Roberto Viola
d3a1a2aafb QZ not working with Taurus FX9.9 elliptical (Issue #3618) 2025-08-14 12:01:45 +02:00
Roberto Viola
49b890715e Update project.pbxproj 2025-08-13 16:28:22 +02:00
Roberto Viola
f19449107b fixing inclinationResistanceTable with gears 2025-08-13 16:25:14 +02:00
Roberto Viola
8bbed4fa76 Update project.pbxproj 2025-08-13 15:26:11 +02:00
Roberto Viola
efc4950f92 QZ not working with Taurus FX9.9 elliptical (Issue #3618) 2025-08-13 15:12:19 +02:00
Roberto Viola
23fd13ad0c Matrix A50 XR elliptical 2025-08-13 14:56:31 +02:00
Roberto Viola
64cd90dfaa let's push to the release even if the linux builds are not ok 2025-08-12 16:38:44 +02:00
Roberto Viola
ec5919d67f Update main.yml 2025-08-12 06:40:15 +02:00
Roberto Viola
0fc9d7fb40 apex bike watt table improved 2025-08-12 06:35:38 +02:00
Roberto Viola
4f03554fbb fixing crash on mac 2025-08-11 07:07:13 +02:00
Roberto Viola
4a16605f43 auto start peloton now starts the QZ session too if in pause mode 2025-08-10 17:47:09 +02:00
Roberto Viola
3ae60e1c41 Adding libqt5sql5-sqlite to github actions 2025-08-10 07:17:15 +02:00
Roberto Viola
edab888e31 fixing sql github actions for linux? 2025-08-10 06:31:21 +02:00
Roberto Viola
2eefcee9b7 fixing negative calories on apple health without apple watch 2025-08-10 06:23:49 +02:00
Roberto Viola
c1db263dcf Sole F63 Cannot get stable connection or auto incline (Issue #3606) 2025-08-09 06:52:17 +02:00
Roberto Viola
cdf0d34b86 fixing crash pressing start when a device is not connected 2025-08-08 10:55:39 +02:00
Roberto Viola
eb0528215b Update project.pbxproj 2025-08-08 08:51:53 +02:00
Roberto Viola
30d0940359 2.20.7 2025-08-08 08:48:05 +02:00
Roberto Viola
9f7cdd8b42 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-08-08 08:47:06 +02:00
Roberto Viola
af00334455 Handle negative resistance in forceResistance
Adds a check for negative resistance values in forceResistance. If a negative value is detected, it logs a debug message and sets the resistance to a fallback value of 1 to prevent invalid input.
2025-08-08 08:40:10 +02:00
Roberto Viola
4e8af61539 Workout history and start of previous trainings #2383 2025-08-07 12:31:18 +02:00
Roberto Viola
a17b78c56b Revert "Update WorkoutsHistory.qml"
This reverts commit d59eabc9b3.
2025-08-07 12:20:28 +02:00
Roberto Viola
8f536f487e Update project.pbxproj 2025-08-07 12:11:27 +02:00
Roberto Viola
82cad601bf Update project.pbxproj 2025-08-07 11:47:27 +02:00
Roberto Viola
a3579c42fa fixing crash without apple watch 2025-08-07 11:46:55 +02:00
Roberto Viola
9af0046554 Nordictrack RW900 rower v1 2025-08-07 11:31:16 +02:00
Roberto Viola
d59eabc9b3 Update WorkoutsHistory.qml 2025-08-07 09:34:19 +02:00
Roberto Viola
d8d55cfbf8 fixing linux builds 2025-08-07 09:07:08 +02:00
Roberto Viola
bce3f3cef3 adding sql dependencies 2025-08-06 16:13:21 +02:00
Roberto Viola
e2d5e602e1 saving training session even outside peloton 2025-08-06 15:35:03 +02:00
Roberto Viola
054087a3bf Update main.yml 2025-08-06 14:11:30 +02:00
Roberto Viola
123d1f9634 Update 10_Installation.md 2025-08-06 14:10:25 +02:00
Roberto Viola
9130cabc65 adding sql for linux in the github actions 2025-08-06 14:09:27 +02:00
Roberto Viola
3c893444e6 Update project.pbxproj 2025-08-06 13:45:21 +02:00
Roberto Viola
24935046e9 added cruise, sprint and climb profile for automatic shifting 2025-08-06 13:41:30 +02:00
Roberto Viola
ecf596623e Workout history and healthkit without apple watch (#3594)
* preparing form...

* workout history works with a bluetooth device connected

* using a different template for the  preview charts

* sport type added to preview function

* build fixed

* added target cadence, watt and resistance to fit file along with user info

* Update WorkoutTracking.swift

* building

* Update WorkoutTracking.swift

* Update lockscreen.mm

* doing

* Update lockscreen.mm

* Update WorkoutTracking.swift

* Update homeform.cpp

* Update WorkoutTracking.swift

* Update WorkoutTracking.swift

* seems working

* Update project.pbxproj

* Update project.pbxproj

* fixing speed

* adding metrics also when the virtualbike is not the zwift interface

* adding device type

* fix build

* let's work on build up the list

* emitting signal not tested

* connection works

* Update project.pbxproj

* fix build issue, forcing bike

* adding kcal

* fix build

* Update project.pbxproj

* fix build

* fake bike to test

* fixing crash and metrics

* Update WorkoutTracking.swift

* Update project.pbxproj

* adding logs

* improving logs

* Update project.pbxproj

* fixing

* adding fit file processor

* the workout history works with the db!

* kind of works on ios

* data fixed

* removed workoutdetails because db would be too heavy. let's open the fit files

* preview of the fit file is almost ready

* details start to work!

* adding kcal on the summary

* Update bluetooth.cpp

* adding check that apple watch is available

* Update homeform.cpp

* fixing build and tested

* Update project.pbxproj

* fixing crash?

* fake treadmill simulatoion on the simulator

* Update homeform.cpp

* Update project.pbxproj

* Update lockscreen.mm

* Update project.pbxproj

* BT Log share for LifeSpan-TM-2000 #3021

* adding steps for treadmills

* NOT TESTED handling device type

* fixing whitespaces

* fixing build

* fixing build on xcode

* fixed distance issue and steps

* Update project.pbxproj

* fixing high steps

https://github.com/cagnulein/qdomyos-zwift/discussions/3277#discussioncomment-12425461

* Update project.pbxproj

* fix build

* fix build

* build fix

* build fix

* claude fixes

* it kind of works

* improving

* fixing summary

* optimized!

* rogue bike fix

* Update project.pbxproj

* Update qfit.cpp

* Update qfit.cpp

* Update project.pbxproj

* Update qdomyos-zwift-tests.pro

* fix build

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update virtualrower.cpp

* restoring changes

* Update lockscreen.mm

* fixing build

* Update project.pbxproj

* removing save from the dochart in the preview

* Update dochartliveheart.js

* Update project.pbxproj

* reducing logging

* Update Server.swift

* Update WorkoutsHistory.qml

* Update project.pbxproj

* adding fit file processor right after the workout stopped

* streak message

* Update bluetooth.cpp

* Update fitdatabaseprocessor.cpp

* Update WorkoutsHistory.qml

* 2.20.6

* adding font for emoji on android

* Update settings.qml

* Update WorkoutsHistory.qml

* html android emoji font

* workout calendar

* calendar with points work!

* peloton link and download from the workout history

* fix point in the calendar

* Update project.pbxproj

* fixing

* fixing

* fixing

* fixing and debug

* Update qfit.cpp

* Update WorkoutsHistory.qml

* Update WorkoutsHistory.qml

* Update WorkoutsHistory.qml

* Update project.pbxproj
2025-08-06 11:26:56 +02:00
Roberto Viola
620be36635 first version of automatic virtual shifting 2025-08-04 14:48:35 +02:00
Roberto Viola
3c98edfb6d Start the activity from the treadmill's start button #3590 2025-08-04 08:59:46 +02:00
Roberto Viola
b0c4690489 Start the activity from the treadmill's start button (Issue #3590) 2025-08-04 08:58:18 +02:00
Roberto Viola
64f1fce8c8 Tunturi T80 QZ doesn't start when I start via the treadmill start button (Issue #3568) 2025-08-04 08:39:35 +02:00
Roberto Viola
f2df53b94b 2.20.5 2025-08-01 08:11:03 +02:00
Roberto Viola
ae4aec68c6 Peloton Walking Pace Targets #3550 2025-08-01 08:10:07 +02:00
Roberto Viola
68696a585a Peloton Walking Pace Targets #3550 2025-07-31 08:43:11 +02:00
Roberto Viola
ee0279186a Improve gear boundary handling with smart clamping
Refines the logic for setting gears to allow clamping to valid ranges when starting from invalid states, preventing the system from getting stuck below minimum gears due to fractional gains. Maintains normal rejection behavior when already at valid gear boundaries, and adds detailed debug output for each case.

Wahoo kickr core and Zwift Play And Fulgaz #3575
2025-07-29 13:57:32 +02:00
Roberto Viola
60c4747a0e Tunturi T80 QZ doesn't start when I start via the treadmill start button (Issue #3568) (#3569) 2025-07-27 21:08:26 +02:00
Roberto Viola
23e2202bc0 Update project.pbxproj 2025-07-27 14:26:34 +02:00
Roberto Viola
e9c2ed8a76 VANRYSEL_HT Kcal issue fixed
mail from Sina M. 27/7/2025
2025-07-27 14:12:36 +02:00
Roberto Viola
9b9174b45a fixing crash
mail from Barry W. 27/7/2025
2025-07-27 14:10:44 +02:00
Roberto Viola
e9451c1c76 build 1126 was already submitted 2025-07-25 00:11:41 +02:00
Roberto Viola
28bd6423b7 PELOTON: removing frequent /me calling 2025-07-25 00:03:48 +02:00
Roberto Viola
083fe13ce3 adding watt step for pid hr for bikes 2025-07-24 23:07:59 +02:00
Roberto Viola
574a78ba0b ApexBike: resistance and wattage fixed 2025-07-23 22:42:30 +02:00
Roberto Viola
54177f927e ApexBike: resistance and wattage fixed 2025-07-23 16:17:27 +02:00
289 changed files with 17788 additions and 4537 deletions

File diff suppressed because it is too large Load Diff

2
.gitignore vendored
View File

@@ -1,3 +1,5 @@
src/qdomyos-zwift.pro.user
.idea/
src/Makefile

View File

@@ -0,0 +1,84 @@
//
// QZWidget.swift
// QZWidget
//
// Created by Roberto Viola on 04/10/25.
//
import WidgetKit
import SwiftUI
struct Provider: TimelineProvider {
func placeholder(in context: Context) -> SimpleEntry {
SimpleEntry(date: Date(), emoji: "😀")
}
func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) {
let entry = SimpleEntry(date: Date(), emoji: "😀")
completion(entry)
}
func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
var entries: [SimpleEntry] = []
// Generate a timeline consisting of five entries an hour apart, starting from the current date.
let currentDate = Date()
for hourOffset in 0 ..< 5 {
let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)!
let entry = SimpleEntry(date: entryDate, emoji: "😀")
entries.append(entry)
}
let timeline = Timeline(entries: entries, policy: .atEnd)
completion(timeline)
}
// func relevances() async -> WidgetRelevances<Void> {
// // Generate a list containing the contexts this widget is relevant in.
// }
}
struct SimpleEntry: TimelineEntry {
let date: Date
let emoji: String
}
struct QZWidgetEntryView : View {
var entry: Provider.Entry
var body: some View {
VStack {
Text("Time:")
Text(entry.date, style: .time)
Text("Emoji:")
Text(entry.emoji)
}
}
}
struct QZWidget: Widget {
let kind: String = "QZWidget"
var body: some WidgetConfiguration {
StaticConfiguration(kind: kind, provider: Provider()) { entry in
if #available(iOS 17.0, *) {
QZWidgetEntryView(entry: entry)
.containerBackground(.fill.tertiary, for: .widget)
} else {
QZWidgetEntryView(entry: entry)
.padding()
.background()
}
}
.configurationDisplayName("My Widget")
.description("This is an example widget.")
}
}
#Preview(as: .systemSmall) {
QZWidget()
} timeline: {
SimpleEntry(date: .now, emoji: "😀")
SimpleEntry(date: .now, emoji: "🤩")
}

View File

@@ -0,0 +1,18 @@
//
// QZWidgetBundle.swift
// QZWidget
//
// Created by Roberto Viola on 04/10/25.
//
import WidgetKit
import SwiftUI
@main
struct QZWidgetBundle: WidgetBundle {
var body: some Widget {
QZWidget()
QZWidgetControl()
QZWidgetLiveActivity()
}
}

View File

@@ -0,0 +1,54 @@
//
// QZWidgetControl.swift
// QZWidget
//
// Created by Roberto Viola on 04/10/25.
//
import AppIntents
import SwiftUI
import WidgetKit
struct QZWidgetControl: ControlWidget {
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(
kind: "org.cagnulein.qdomyoszwift.QZWidget",
provider: Provider()
) { value in
ControlWidgetToggle(
"Start Timer",
isOn: value,
action: StartTimerIntent()
) { isRunning in
Label(isRunning ? "On" : "Off", systemImage: "timer")
}
}
.displayName("Timer")
.description("A an example control that runs a timer.")
}
}
extension QZWidgetControl {
struct Provider: ControlValueProvider {
var previewValue: Bool {
false
}
func currentValue() async throws -> Bool {
let isRunning = true // Check if the timer is running
return isRunning
}
}
}
struct StartTimerIntent: SetValueIntent {
static let title: LocalizedStringResource = "Start a timer"
@Parameter(title: "Timer is running")
var value: Bool
func perform() async throws -> some IntentResult {
// Start / stop the timer based on `value`.
return .result()
}
}

View File

@@ -0,0 +1,174 @@
//
// QZWidgetLiveActivity.swift
// QDomyos-Zwift Live Activity Widget
//
// Displays workout metrics on Dynamic Island and Lock Screen
//
import ActivityKit
import WidgetKit
import SwiftUI
// QZWorkoutAttributes is defined in QZWorkoutAttributes.swift (shared file)
// MARK: - Live Activity Widget
@available(iOS 16.1, *)
struct QZWidgetLiveActivity: Widget {
var body: some WidgetConfiguration {
ActivityConfiguration(for: QZWorkoutAttributes.self) { context in
// Lock screen/banner UI
LockScreenLiveActivityView(context: context)
} dynamicIsland: { context in
DynamicIsland {
// Expanded UI
DynamicIslandExpandedRegion(.leading) {
VStack(alignment: .leading, spacing: 4) {
let speed = context.attributes.useMiles ? context.state.speed * 0.621371 : context.state.speed
let speedUnit = context.attributes.useMiles ? "mph" : "km/h"
Label("\(Int(speed)) \(speedUnit)", systemImage: "speedometer")
.font(.caption)
Label("\(context.state.heartRate) bpm", systemImage: "heart.fill")
.font(.caption)
.foregroundColor(.red)
}
}
DynamicIslandExpandedRegion(.trailing) {
VStack(alignment: .trailing, spacing: 4) {
Label("\(Int(context.state.power)) W", systemImage: "bolt.fill")
.font(.caption)
.foregroundColor(.yellow)
Label("\(Int(context.state.cadence)) rpm", systemImage: "arrow.clockwise")
.font(.caption)
}
}
DynamicIslandExpandedRegion(.center) {
// Empty or can add more info
}
DynamicIslandExpandedRegion(.bottom) {
HStack {
let distanceKm = context.state.distance / 1000.0
let distance = context.attributes.useMiles ? distanceKm * 0.621371 : distanceKm
let distanceUnit = context.attributes.useMiles ? "mi" : "km"
Label(String(format: "%.2f \(distanceUnit)", distance), systemImage: "map")
Spacer()
Label("\(Int(context.state.kcal)) kcal", systemImage: "flame.fill")
.foregroundColor(.orange)
}
.font(.caption)
.padding(.horizontal)
}
} compactLeading: {
// Compact leading (left side of Dynamic Island)
HStack(spacing: 2) {
Image(systemName: "heart.fill")
.foregroundColor(.red)
Text("\(context.state.heartRate)")
.font(.caption2)
}
} compactTrailing: {
// Compact trailing (right side of Dynamic Island)
HStack(spacing: 2) {
Image(systemName: "bolt.fill")
.foregroundColor(.yellow)
Text("\(Int(context.state.power))")
.font(.caption2)
}
} minimal: {
// Minimal view (when multiple activities)
Image(systemName: "figure.run")
}
}
}
}
// MARK: - Lock Screen View
@available(iOS 16.1, *)
struct LockScreenLiveActivityView: View {
let context: ActivityViewContext<QZWorkoutAttributes>
var body: some View {
VStack(alignment: .leading, spacing: 8) {
HStack {
Image(systemName: "figure.indoor.cycle")
.foregroundColor(.blue)
Text(context.attributes.deviceName)
.font(.headline)
Spacer()
}
HStack(spacing: 16) {
let speed = context.attributes.useMiles ? context.state.speed * 0.621371 : context.state.speed
let speedUnit = context.attributes.useMiles ? "mph" : "km/h"
MetricView(icon: "speedometer", value: String(format: "%.1f", speed), unit: speedUnit)
MetricView(icon: "heart.fill", value: "\(context.state.heartRate)", unit: "bpm", color: .red)
MetricView(icon: "bolt.fill", value: "\(Int(context.state.power))", unit: "W", color: .yellow)
}
HStack(spacing: 16) {
let distanceKm = context.state.distance / 1000.0
let distance = context.attributes.useMiles ? distanceKm * 0.621371 : distanceKm
let distanceUnit = context.attributes.useMiles ? "mi" : "km"
MetricView(icon: "arrow.clockwise", value: "\(Int(context.state.cadence))", unit: "rpm")
MetricView(icon: "map", value: String(format: "%.2f", distance), unit: distanceUnit)
MetricView(icon: "flame.fill", value: "\(Int(context.state.kcal))", unit: "kcal", color: .orange)
}
}
.padding()
}
}
// MARK: - Metric View Component
struct MetricView: View {
let icon: String
let value: String
let unit: String
var color: Color = .primary
var body: some View {
VStack(spacing: 2) {
Image(systemName: icon)
.foregroundColor(color)
.font(.caption)
Text(value)
.font(.system(.body, design: .rounded))
.fontWeight(.semibold)
Text(unit)
.font(.caption2)
.foregroundColor(.secondary)
}
.frame(maxWidth: .infinity)
}
}
// MARK: - Preview
@available(iOS 16.1, *)
struct QZWidgetLiveActivity_Previews: PreviewProvider {
static let attributes = QZWorkoutAttributes(deviceName: "QZ Bike", useMiles: false)
static let contentState = QZWorkoutAttributes.ContentState(
speed: 25.5,
cadence: 85,
power: 200,
heartRate: 145,
distance: 12500, // meters (will be displayed as 12.50 km or 7.77 mi)
kcal: 320,
useMiles: false
)
static var previews: some View {
attributes
.previewContext(contentState, viewKind: .dynamicIsland(.compact))
.previewDisplayName("Island Compact")
attributes
.previewContext(contentState, viewKind: .dynamicIsland(.expanded))
.previewDisplayName("Island Expanded")
attributes
.previewContext(contentState, viewKind: .dynamicIsland(.minimal))
.previewDisplayName("Minimal")
attributes
.previewContext(contentState, viewKind: .content)
.previewDisplayName("Lock Screen")
}
}

View File

@@ -0,0 +1,41 @@
//
// QZWorkoutAttributes.swift
// QDomyos-Zwift
//
// Shared attributes for Live Activities
// MUST be included in both qdomyoszwift and QZWidget targets
//
import Foundation
import ActivityKit
@available(iOS 16.1, *)
public struct QZWorkoutAttributes: ActivityAttributes {
public struct ContentState: Codable, Hashable {
public var speed: Double
public var cadence: Double
public var power: Double
public var heartRate: Int
public var distance: Double
public var kcal: Double
public var useMiles: Bool
public init(speed: Double, cadence: Double, power: Double, heartRate: Int, distance: Double, kcal: Double, useMiles: Bool) {
self.speed = speed
self.cadence = cadence
self.power = power
self.heartRate = heartRate
self.distance = distance
self.kcal = kcal
self.useMiles = useMiles
}
}
public var deviceName: String
public var useMiles: Bool
public init(deviceName: String, useMiles: Bool) {
self.deviceName = deviceName
self.useMiles = useMiles
}
}

View File

@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objectVersion = 70;
objects = {
/* Begin PBXBuildFile section */
@@ -130,6 +130,7 @@
87097D31275EA9AF0020EE6F /* moc_sportsplusbike.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87097D30275EA9AE0020EE6F /* moc_sportsplusbike.cpp */; };
870A5DB32CEF8FB100839641 /* moc_technogymbike.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 870A5DB22CEF8FB100839641 /* moc_technogymbike.cpp */; };
870A5DB52CEF8FD200839641 /* technogymbike.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 870A5DB42CEF8FD200839641 /* technogymbike.cpp */; };
870C72652E91565E00DC8A84 /* ios_liveactivity.mm in Compile Sources */ = {isa = PBXBuildFile; fileRef = 870C72632E91565E00DC8A84 /* ios_liveactivity.mm */; };
8710706C29C48AEA0094D0F3 /* handleurl.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 8710706B29C48AEA0094D0F3 /* handleurl.cpp */; };
8710706E29C48AF30094D0F3 /* moc_handleurl.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 8710706D29C48AF30094D0F3 /* moc_handleurl.cpp */; };
8710707329C4A5E70094D0F3 /* GarminConnect.swift in Compile Sources */ = {isa = PBXBuildFile; fileRef = 8710707229C4A5E70094D0F3 /* GarminConnect.swift */; };
@@ -286,6 +287,8 @@
8752C0E92B15D85600C3D1A5 /* ios_eliteariafan.mm in Compile Sources */ = {isa = PBXBuildFile; fileRef = 8752C0E62B15D85600C3D1A5 /* ios_eliteariafan.mm */; };
87540FAD2848FD70005E0D44 /* libqtexttospeech_speechios.a in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 87540FAC2848FD70005E0D44 /* libqtexttospeech_speechios.a */; };
8754D24C27F786F0003D7054 /* virtualrower.swift in Compile Sources */ = {isa = PBXBuildFile; fileRef = 8754D24B27F786F0003D7054 /* virtualrower.swift */; };
8755E5D42E4E260B006A12E4 /* moc_fontmanager.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 8755E5D32E4E260B006A12E4 /* moc_fontmanager.cpp */; };
8755E5D52E4E260B006A12E4 /* fontmanager.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 8755E5D22E4E260B006A12E4 /* fontmanager.cpp */; };
87586A4125B8340E00A243C4 /* proformbike.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87586A4025B8340E00A243C4 /* proformbike.cpp */; };
87586A4325B8341B00A243C4 /* moc_proformbike.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87586A4225B8341B00A243C4 /* moc_proformbike.cpp */; };
875CA9462D0C740000667EE6 /* moc_kineticinroadbike.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 875CA9452D0C740000667EE6 /* moc_kineticinroadbike.cpp */; };
@@ -340,6 +343,8 @@
876BFC9D27BE35C5001D7645 /* bowflext216treadmill.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 876BFC9927BE35C4001D7645 /* bowflext216treadmill.cpp */; };
876BFCA027BE35D8001D7645 /* moc_proformelliptical.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 876BFC9E27BE35D8001D7645 /* moc_proformelliptical.cpp */; };
876BFCA127BE35D8001D7645 /* moc_bowflext216treadmill.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 876BFC9F27BE35D8001D7645 /* moc_bowflext216treadmill.cpp */; };
876C64712E74139F00F1BEC0 /* moc_fitbackupwriter.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 876C64702E74139F00F1BEC0 /* moc_fitbackupwriter.cpp */; };
876C64722E74139F00F1BEC0 /* fitbackupwriter.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 876C646F2E74139F00F1BEC0 /* fitbackupwriter.cpp */; };
876E4E142594748000BD5714 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 876E4E132594748000BD5714 /* Assets.xcassets */; };
876E4E1B2594748000BD5714 /* watchkit Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 876E4E1A2594748000BD5714 /* watchkit Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
876E4E202594748000BD5714 /* qdomyoszwiftApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 876E4E1F2594748000BD5714 /* qdomyoszwiftApp.swift */; };
@@ -388,6 +393,9 @@
8781908526150C8E0085E656 /* libqtlabsplatformplugin.a in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 8781908126150B490085E656 /* libqtlabsplatformplugin.a */; };
8783153B25E8D81E0007817C /* moc_sportstechbike.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 8783153A25E8D81E0007817C /* moc_sportstechbike.cpp */; };
8783153C25E8DAFD0007817C /* sportstechbike.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87A3EBBA25D2CFED0040EB4C /* sportstechbike.cpp */; };
878521CD2E42552A00922796 /* libqtlabscalendarplugin.a in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 878521CC2E42552A00922796 /* libqtlabscalendarplugin.a */; };
878521D42E44B26600922796 /* moc_nordictrackifitadbrower.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 878521D12E44B26600922796 /* moc_nordictrackifitadbrower.cpp */; };
878521D52E44B26600922796 /* nordictrackifitadbrower.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 878521D32E44B26600922796 /* nordictrackifitadbrower.cpp */; };
878531642711A3E1004B153D /* fakebike.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 878531602711A3E0004B153D /* fakebike.cpp */; };
878531652711A3E1004B153D /* activiotreadmill.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 878531612711A3E1004B153D /* activiotreadmill.cpp */; };
878531682711A3EC004B153D /* moc_activiotreadmill.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 878531662711A3EB004B153D /* moc_activiotreadmill.cpp */; };
@@ -582,8 +590,20 @@
87EB918A27EE5FE7002535E1 /* qdomyoszwift_qmltyperegistrations.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EB917F27EE5FE7002535E1 /* qdomyoszwift_qmltyperegistrations.cpp */; };
87EB918B27EE5FE7002535E1 /* moc_inappproductqmltype.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EB918027EE5FE7002535E1 /* moc_inappproductqmltype.cpp */; };
87EB918C27EE5FE7002535E1 /* moc_inappproduct.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EB918127EE5FE7002535E1 /* moc_inappproduct.cpp */; };
87EBB2A62D39214E00348B15 /* moc_workoutloaderworker.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EBB2A02D39214E00348B15 /* moc_workoutloaderworker.cpp */; };
87EBB2A72D39214E00348B15 /* workoutmodel.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EBB2A52D39214E00348B15 /* workoutmodel.cpp */; };
87EBB2A82D39214E00348B15 /* workoutloaderworker.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EBB2A32D39214E00348B15 /* workoutloaderworker.cpp */; };
87EBB2A92D39214E00348B15 /* moc_fitdatabaseprocessor.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EBB29F2D39214E00348B15 /* moc_fitdatabaseprocessor.cpp */; };
87EBB2AA2D39214E00348B15 /* fitdatabaseprocessor.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EBB29E2D39214E00348B15 /* fitdatabaseprocessor.cpp */; };
87EBB2AB2D39214E00348B15 /* moc_workoutmodel.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EBB2A12D39214E00348B15 /* moc_workoutmodel.cpp */; };
87EFB56E25BD703D0039DD5A /* proformtreadmill.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EFB56C25BD703C0039DD5A /* proformtreadmill.cpp */; };
87EFB57025BD704A0039DD5A /* moc_proformtreadmill.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EFB56F25BD704A0039DD5A /* moc_proformtreadmill.cpp */; };
87EFC5662E918D35005BB573 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 87EFC5652E918D35005BB573 /* WidgetKit.framework */; };
87EFC5672E918D35005BB573 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 87FA94662B6B89FD00B6AB9A /* SwiftUI.framework */; };
87EFC5762E918D38005BB573 /* QZWidgetExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 87EFC5642E918D35005BB573 /* QZWidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
87EFC57D2E918DAA005BB573 /* LiveActivityBridge.swift in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EFC57C2E918DAA005BB573 /* LiveActivityBridge.swift */; };
87EFC58F2E919DB7005BB573 /* QZWorkoutAttributes.swift in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EFC58E2E919DB7005BB573 /* QZWorkoutAttributes.swift */; };
87EFC5902E919DB7005BB573 /* QZWorkoutAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87EFC58E2E919DB7005BB573 /* QZWorkoutAttributes.swift */; };
87EFE45927A518F5006EA1C3 /* nautiluselliptical.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EFE45827A518F5006EA1C3 /* nautiluselliptical.cpp */; };
87EFE45B27A51901006EA1C3 /* moc_nautiluselliptical.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87EFE45A27A51900006EA1C3 /* moc_nautiluselliptical.cpp */; };
87F02E4029178524000DB52C /* octaneelliptical.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 87F02E3E29178523000DB52C /* octaneelliptical.cpp */; };
@@ -691,6 +711,13 @@
remoteGlobalIDString = 876E4E102594747F00BD5714;
remoteInfo = watchkit;
};
87EFC5742E918D38005BB573 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6DB9C3763D02B1415CD9D565 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 87EFC5632E918D35005BB573;
remoteInfo = QZWidgetExtension;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -716,6 +743,17 @@
name = "Embed App Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
87EFC57B2E918D38005BB573 /* Embed Foundation Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
files = (
87EFC5762E918D38005BB573 /* QZWidgetExtension.appex in Embed Foundation Extensions */,
);
name = "Embed Foundation Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
99542592E9780B9225F24AA8 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
@@ -961,6 +999,8 @@
87097D30275EA9AE0020EE6F /* moc_sportsplusbike.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = moc_sportsplusbike.cpp; sourceTree = "<group>"; };
870A5DB22CEF8FB100839641 /* moc_technogymbike.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = moc_technogymbike.cpp; sourceTree = "<group>"; };
870A5DB42CEF8FD200839641 /* technogymbike.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = technogymbike.cpp; path = ../src/devices/technogymbike/technogymbike.cpp; sourceTree = SOURCE_ROOT; };
870C72622E91565E00DC8A84 /* ios_liveactivity.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ios_liveactivity.h; path = ../src/ios/ios_liveactivity.h; sourceTree = SOURCE_ROOT; };
870C72632E91565E00DC8A84 /* ios_liveactivity.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = ios_liveactivity.mm; path = ../src/ios/ios_liveactivity.mm; sourceTree = SOURCE_ROOT; };
8710706A29C48AE90094D0F3 /* handleurl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = handleurl.h; path = ../src/handleurl.h; sourceTree = "<group>"; };
8710706B29C48AEA0094D0F3 /* handleurl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = handleurl.cpp; path = ../src/handleurl.cpp; sourceTree = "<group>"; };
8710706D29C48AF30094D0F3 /* moc_handleurl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = moc_handleurl.cpp; sourceTree = "<group>"; };
@@ -1198,6 +1238,9 @@
8752C0E72B15D85600C3D1A5 /* ios_eliteariafan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ios_eliteariafan.h; path = ../src/ios/ios_eliteariafan.h; sourceTree = "<group>"; };
87540FAC2848FD70005E0D44 /* libqtexttospeech_speechios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libqtexttospeech_speechios.a; path = ../../Qt/5.15.2/ios/plugins/texttospeech/libqtexttospeech_speechios.a; sourceTree = "<group>"; };
8754D24B27F786F0003D7054 /* virtualrower.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = virtualrower.swift; path = ../src/ios/virtualrower.swift; sourceTree = "<group>"; };
8755E5D12E4E260B006A12E4 /* fontmanager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = fontmanager.h; path = ../src/fontmanager.h; sourceTree = SOURCE_ROOT; };
8755E5D22E4E260B006A12E4 /* fontmanager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = fontmanager.cpp; path = ../src/fontmanager.cpp; sourceTree = SOURCE_ROOT; };
8755E5D32E4E260B006A12E4 /* moc_fontmanager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = moc_fontmanager.cpp; sourceTree = "<group>"; };
87586A3F25B8340D00A243C4 /* proformbike.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = proformbike.h; path = ../src/devices/proformbike/proformbike.h; sourceTree = "<group>"; };
87586A4025B8340E00A243C4 /* proformbike.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = proformbike.cpp; path = ../src/devices/proformbike/proformbike.cpp; sourceTree = "<group>"; };
87586A4225B8341B00A243C4 /* moc_proformbike.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = moc_proformbike.cpp; sourceTree = "<group>"; };
@@ -1284,6 +1327,9 @@
876BFC9B27BE35C5001D7645 /* proformelliptical.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = proformelliptical.h; path = ../src/devices/proformelliptical/proformelliptical.h; sourceTree = "<group>"; };
876BFC9E27BE35D8001D7645 /* moc_proformelliptical.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = moc_proformelliptical.cpp; sourceTree = "<group>"; };
876BFC9F27BE35D8001D7645 /* moc_bowflext216treadmill.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = moc_bowflext216treadmill.cpp; sourceTree = "<group>"; };
876C646E2E74139F00F1BEC0 /* fitbackupwriter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = fitbackupwriter.h; path = ../src/fitbackupwriter.h; sourceTree = SOURCE_ROOT; };
876C646F2E74139F00F1BEC0 /* fitbackupwriter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = fitbackupwriter.cpp; path = ../src/fitbackupwriter.cpp; sourceTree = SOURCE_ROOT; };
876C64702E74139F00F1BEC0 /* moc_fitbackupwriter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = moc_fitbackupwriter.cpp; sourceTree = "<group>"; };
876E4E112594747F00BD5714 /* watchkit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = watchkit.app; sourceTree = BUILT_PRODUCTS_DIR; };
876E4E132594748000BD5714 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
876E4E152594748000BD5714 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -1367,6 +1413,10 @@
878225C234983ACB863D2D29 /* fit_nmea_sentence_mesg.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = fit_nmea_sentence_mesg.hpp; path = "/Users/cagnulein/qdomyos-zwift/src/fit-sdk/fit_nmea_sentence_mesg.hpp"; sourceTree = "<absolute>"; };
8783153A25E8D81E0007817C /* moc_sportstechbike.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = moc_sportstechbike.cpp; sourceTree = "<group>"; };
87842E7E25AF88FB00321E69 /* secret.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = secret.h; path = ../src/secret.h; sourceTree = "<group>"; };
878521CC2E42552A00922796 /* libqtlabscalendarplugin.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libqtlabscalendarplugin.a; path = ../../Qt/5.15.2/ios/qml/Qt/labs/calendar/libqtlabscalendarplugin.a; sourceTree = "<group>"; };
878521D12E44B26600922796 /* moc_nordictrackifitadbrower.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = moc_nordictrackifitadbrower.cpp; sourceTree = "<group>"; };
878521D22E44B26600922796 /* nordictrackifitadbrower.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = nordictrackifitadbrower.h; path = ../src/devices/nordictrackifitadbrower/nordictrackifitadbrower.h; sourceTree = SOURCE_ROOT; };
878521D32E44B26600922796 /* nordictrackifitadbrower.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = nordictrackifitadbrower.cpp; path = ../src/devices/nordictrackifitadbrower/nordictrackifitadbrower.cpp; sourceTree = SOURCE_ROOT; };
878531602711A3E0004B153D /* fakebike.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fakebike.cpp; path = ../src/devices/fakebike/fakebike.cpp; sourceTree = "<group>"; };
878531612711A3E1004B153D /* activiotreadmill.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = activiotreadmill.cpp; path = ../src/devices/activiotreadmill/activiotreadmill.cpp; sourceTree = "<group>"; };
878531622711A3E1004B153D /* activiotreadmill.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = activiotreadmill.h; path = ../src/devices/activiotreadmill/activiotreadmill.h; sourceTree = "<group>"; };
@@ -1658,9 +1708,23 @@
87EB917F27EE5FE7002535E1 /* qdomyoszwift_qmltyperegistrations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = qdomyoszwift_qmltyperegistrations.cpp; sourceTree = "<group>"; };
87EB918027EE5FE7002535E1 /* moc_inappproductqmltype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = moc_inappproductqmltype.cpp; sourceTree = "<group>"; };
87EB918127EE5FE7002535E1 /* moc_inappproduct.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = moc_inappproduct.cpp; sourceTree = "<group>"; };
87EBB29D2D39214E00348B15 /* fitdatabaseprocessor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = fitdatabaseprocessor.h; path = ../src/fitdatabaseprocessor.h; sourceTree = SOURCE_ROOT; };
87EBB29E2D39214E00348B15 /* fitdatabaseprocessor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = fitdatabaseprocessor.cpp; path = ../src/fitdatabaseprocessor.cpp; sourceTree = SOURCE_ROOT; };
87EBB29F2D39214E00348B15 /* moc_fitdatabaseprocessor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = moc_fitdatabaseprocessor.cpp; sourceTree = "<group>"; };
87EBB2A02D39214E00348B15 /* moc_workoutloaderworker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = moc_workoutloaderworker.cpp; sourceTree = "<group>"; };
87EBB2A12D39214E00348B15 /* moc_workoutmodel.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = moc_workoutmodel.cpp; sourceTree = "<group>"; };
87EBB2A22D39214E00348B15 /* workoutloaderworker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = workoutloaderworker.h; path = ../src/workoutloaderworker.h; sourceTree = SOURCE_ROOT; };
87EBB2A32D39214E00348B15 /* workoutloaderworker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = workoutloaderworker.cpp; path = ../src/workoutloaderworker.cpp; sourceTree = SOURCE_ROOT; };
87EBB2A42D39214E00348B15 /* workoutmodel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = workoutmodel.h; path = ../src/workoutmodel.h; sourceTree = SOURCE_ROOT; };
87EBB2A52D39214E00348B15 /* workoutmodel.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = workoutmodel.cpp; path = ../src/workoutmodel.cpp; sourceTree = SOURCE_ROOT; };
87EFB56C25BD703C0039DD5A /* proformtreadmill.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = proformtreadmill.cpp; path = ../src/devices/proformtreadmill/proformtreadmill.cpp; sourceTree = "<group>"; };
87EFB56D25BD703C0039DD5A /* proformtreadmill.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = proformtreadmill.h; path = ../src/devices/proformtreadmill/proformtreadmill.h; sourceTree = "<group>"; };
87EFB56F25BD704A0039DD5A /* moc_proformtreadmill.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = moc_proformtreadmill.cpp; sourceTree = "<group>"; };
87EFC5642E918D35005BB573 /* QZWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = QZWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
87EFC5652E918D35005BB573 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
87EFC57C2E918DAA005BB573 /* LiveActivityBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = LiveActivityBridge.swift; path = ../src/ios/LiveActivityBridge.swift; sourceTree = SOURCE_ROOT; };
87EFC57E2E919C98005BB573 /* QZWidgetExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = QZWidgetExtension.entitlements; sourceTree = "<group>"; };
87EFC58E2E919DB7005BB573 /* QZWorkoutAttributes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = QZWorkoutAttributes.swift; path = QZWidget/QZWorkoutAttributes.swift; sourceTree = "<group>"; };
87EFE45727A518F5006EA1C3 /* nautiluselliptical.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = nautiluselliptical.h; path = ../src/devices/nautiluselliptical/nautiluselliptical.h; sourceTree = "<group>"; };
87EFE45827A518F5006EA1C3 /* nautiluselliptical.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = nautiluselliptical.cpp; path = ../src/devices/nautiluselliptical/nautiluselliptical.cpp; sourceTree = "<group>"; };
87EFE45A27A51900006EA1C3 /* moc_nautiluselliptical.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = moc_nautiluselliptical.cpp; sourceTree = "<group>"; };
@@ -1897,6 +1961,20 @@
FF5BDAB0076F3391B219EA52 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = "<absolute>"; };
/* End PBXFileReference section */
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
87EFC5772E918D38005BB573 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
Info.plist,
);
target = 87EFC5632E918D35005BB573 /* QZWidgetExtension */;
};
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
/* Begin PBXFileSystemSynchronizedRootGroup section */
87EFC5682E918D35005BB573 /* QZWidget */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (87EFC5772E918D38005BB573 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = QZWidget; sourceTree = "<group>"; };
/* End PBXFileSystemSynchronizedRootGroup section */
/* Begin PBXFrameworksBuildPhase section */
876E4E172594748000BD5714 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
@@ -1905,10 +1983,20 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
87EFC5612E918D35005BB573 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
87EFC5672E918D35005BB573 /* SwiftUI.framework in Frameworks */,
87EFC5662E918D35005BB573 /* WidgetKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
D1C883685E82D5676953459A /* Link Binary With Libraries */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
878521CD2E42552A00922796 /* libqtlabscalendarplugin.a in Link Binary With Libraries */,
8768C9282BBC13220099DBE1 /* libcrypto.a in Link Binary With Libraries */,
87FA94672B6B89FD00B6AB9A /* SwiftUI.framework in Link Binary With Libraries */,
879F74112893D5B8009A64C8 /* libqavfcamera.a in Link Binary With Libraries */,
@@ -2245,9 +2333,31 @@
2EB56BE3C2D93CDAB0C52E67 /* Sources */ = {
isa = PBXGroup;
children = (
87EFC58E2E919DB7005BB573 /* QZWorkoutAttributes.swift */,
87EFC57C2E918DAA005BB573 /* LiveActivityBridge.swift */,
870C72622E91565E00DC8A84 /* ios_liveactivity.h */,
870C72632E91565E00DC8A84 /* ios_liveactivity.mm */,
876C646E2E74139F00F1BEC0 /* fitbackupwriter.h */,
876C646F2E74139F00F1BEC0 /* fitbackupwriter.cpp */,
876C64702E74139F00F1BEC0 /* moc_fitbackupwriter.cpp */,
8755E5D12E4E260B006A12E4 /* fontmanager.h */,
8755E5D22E4E260B006A12E4 /* fontmanager.cpp */,
8755E5D32E4E260B006A12E4 /* moc_fontmanager.cpp */,
878521D12E44B26600922796 /* moc_nordictrackifitadbrower.cpp */,
878521D22E44B26600922796 /* nordictrackifitadbrower.h */,
878521D32E44B26600922796 /* nordictrackifitadbrower.cpp */,
87ACBE9B2E250F7D00F1B6EA /* androidstatusbar.h */,
87ACBE9C2E250F7D00F1B6EA /* androidstatusbar.cpp */,
87ACBE9D2E250F7D00F1B6EA /* moc_androidstatusbar.cpp */,
87EBB29D2D39214E00348B15 /* fitdatabaseprocessor.h */,
87EBB29E2D39214E00348B15 /* fitdatabaseprocessor.cpp */,
87EBB29F2D39214E00348B15 /* moc_fitdatabaseprocessor.cpp */,
87EBB2A02D39214E00348B15 /* moc_workoutloaderworker.cpp */,
87EBB2A12D39214E00348B15 /* moc_workoutmodel.cpp */,
87EBB2A22D39214E00348B15 /* workoutloaderworker.h */,
87EBB2A32D39214E00348B15 /* workoutloaderworker.cpp */,
87EBB2A42D39214E00348B15 /* workoutmodel.h */,
87EBB2A52D39214E00348B15 /* workoutmodel.cpp */,
878C9DC62DF01C16001114D5 /* moc_speraxtreadmill.cpp */,
878C9DC72DF01C16001114D5 /* speraxtreadmill.h */,
878C9DC82DF01C16001114D5 /* speraxtreadmill.cpp */,
@@ -2948,6 +3058,7 @@
AF39DD055C3EF8226FBE929D /* Frameworks */ = {
isa = PBXGroup;
children = (
878521CC2E42552A00922796 /* libqtlabscalendarplugin.a */,
8768C9262BBC12D10099DBE1 /* libcrypto.a */,
87FA94682B6B8A5A00B6AB9A /* libSystem.B.tbd */,
87FA94662B6B89FD00B6AB9A /* SwiftUI.framework */,
@@ -3079,6 +3190,7 @@
4D765E1B1EA6C757220C63E7 /* CoreFoundation.framework */,
FCC237CA5AD60B9BA4447615 /* Foundation.framework */,
344F66310C19536DB4886D8F /* qtpcre2 */,
87EFC5652E918D35005BB573 /* WidgetKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -3341,6 +3453,7 @@
E8C543AB96796ECAA2E65C57 /* qdomyoszwift */ = {
isa = PBXGroup;
children = (
87EFC57E2E919C98005BB573 /* QZWidgetExtension.entitlements */,
8768C8CE2BBC12170099DBE1 /* adb */,
87BAC3BE2BA497160003E925 /* PrivacyInfo.xcprivacy */,
8745B2752AFCB4A300991A39 /* android */,
@@ -3351,6 +3464,7 @@
74B182DB50CB5611B5C1C297 /* Supporting Files */,
876E4E122594747F00BD5714 /* watchkit */,
876E4E1E2594748000BD5714 /* watchkit Extension */,
87EFC5682E918D35005BB573 /* QZWidget */,
AF39DD055C3EF8226FBE929D /* Frameworks */,
858FCAB0EB1F29CF8B07677C /* Bundle Data */,
FE0A091FDBFB3E9C31B7A1BD /* Products */,
@@ -3365,6 +3479,7 @@
040B10E2EF2CEF79F2205FE2 /* qdomyoszwift.app */,
876E4E112594747F00BD5714 /* watchkit.app */,
876E4E1A2594748000BD5714 /* watchkit Extension.appex */,
87EFC5642E918D35005BB573 /* QZWidgetExtension.appex */,
);
name = Products;
sourceTree = "<group>";
@@ -3381,11 +3496,13 @@
30414803F31797EB689AE508 /* Copy Bundle Resources */,
99542592E9780B9225F24AA8 /* Embed Frameworks */,
876E4E332594748100BD5714 /* Embed Watch Content */,
87EFC57B2E918D38005BB573 /* Embed Foundation Extensions */,
);
buildRules = (
);
dependencies = (
876E4E312594748100BD5714 /* PBXTargetDependency */,
87EFC5752E918D38005BB573 /* PBXTargetDependency */,
);
name = qdomyoszwift;
packageProductDependencies = (
@@ -3431,6 +3548,28 @@
productReference = 876E4E1A2594748000BD5714 /* watchkit Extension.appex */;
productType = "com.apple.product-type.watchkit2-extension";
};
87EFC5632E918D35005BB573 /* QZWidgetExtension */ = {
isa = PBXNativeTarget;
buildConfigurationList = 87EFC5782E918D38005BB573 /* Build configuration list for PBXNativeTarget "QZWidgetExtension" */;
buildPhases = (
87EFC5602E918D35005BB573 /* Sources */,
87EFC5612E918D35005BB573 /* Frameworks */,
87EFC5622E918D35005BB573 /* Resources */,
);
buildRules = (
);
dependencies = (
);
fileSystemSynchronizedGroups = (
87EFC5682E918D35005BB573 /* QZWidget */,
);
name = QZWidgetExtension;
packageProductDependencies = (
);
productName = QZWidgetExtension;
productReference = 87EFC5642E918D35005BB573 /* QZWidgetExtension.appex */;
productType = "com.apple.product-type.app-extension";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -3438,7 +3577,7 @@
isa = PBXProject;
attributes = {
DefaultBuildSystemTypeForWorkspace = Original;
LastSwiftUpdateCheck = 1220;
LastSwiftUpdateCheck = 2600;
TargetAttributes = {
799833E5566DEFFC37E4BF1E = {
DevelopmentTeam = 6335M7T29D;
@@ -3454,6 +3593,9 @@
DevelopmentTeam = 6335M7T29D;
ProvisioningStyle = Automatic;
};
87EFC5632E918D35005BB573 = {
CreatedOnToolsVersion = 26.0.1;
};
};
};
buildConfigurationList = DAC4C1AA5EDEA1C85E9CA5E6 /* Build configuration list for PBXProject "qdomyoszwift" */;
@@ -3475,6 +3617,7 @@
799833E5566DEFFC37E4BF1E /* qdomyoszwift */,
876E4E102594747F00BD5714 /* watchkit */,
876E4E192594748000BD5714 /* watchkit Extension */,
87EFC5632E918D35005BB573 /* QZWidgetExtension */,
);
};
/* End PBXProject section */
@@ -3521,6 +3664,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
87EFC5622E918D35005BB573 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -3538,10 +3688,19 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
87EFC5602E918D35005BB573 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
87EFC5902E919DB7005BB573 /* QZWorkoutAttributes.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F7E50F631C51CD5B5DC0BC43 /* Compile Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
870C72652E91565E00DC8A84 /* ios_liveactivity.mm in Compile Sources */,
8738249627E646E3004F1B46 /* characteristicnotifier2acd.cpp in Compile Sources */,
8738249127E646E3004F1B46 /* dirconpacket.cpp in Compile Sources */,
870A5DB52CEF8FD200839641 /* technogymbike.cpp in Compile Sources */,
@@ -3688,6 +3847,8 @@
87873AF12D09A8CE005F86B4 /* sportsplusrower.cpp in Compile Sources */,
8762D5132601F89500F6F049 /* scanrecordresult.cpp in Compile Sources */,
3015F9B9FF4CA6D653D46CCA /* fit_developer_field_description.cpp in Compile Sources */,
878521D42E44B26600922796 /* moc_nordictrackifitadbrower.cpp in Compile Sources */,
878521D52E44B26600922796 /* nordictrackifitadbrower.cpp in Compile Sources */,
87310B22266FBB78008BA0D6 /* moc_homefitnessbuddy.cpp in Compile Sources */,
87958F1B27628D5400124B24 /* moc_elitesterzosmart.cpp in Compile Sources */,
8768C8D82BBC12890099DBE1 /* centraldir.c in Compile Sources */,
@@ -3788,6 +3949,7 @@
87943AB429E0215D007575F2 /* localipaddress.cpp in Compile Sources */,
87EB917627EE5FB3002535E1 /* nautilusbike.cpp in Compile Sources */,
ACB47DC464A2BC9D39C544AD /* gpx.cpp in Compile Sources */,
87EFC57D2E918DAA005BB573 /* LiveActivityBridge.swift in Compile Sources */,
6361329E515248BB41640C07 /* homeform.cpp in Compile Sources */,
87A18F072660D5C1002D7C96 /* ftmsrower.cpp in Compile Sources */,
87C5F0D026285E7E0067A1B5 /* moc_smtpclient.cpp in Compile Sources */,
@@ -3815,6 +3977,12 @@
8768C9022BBC12B80099DBE1 /* socket_loopback_client.c in Compile Sources */,
87C5F0B926285E5F0067A1B5 /* mimehtml.cpp in Compile Sources */,
27E452D452B62D0948DF0755 /* sessionline.cpp in Compile Sources */,
87EBB2A62D39214E00348B15 /* moc_workoutloaderworker.cpp in Compile Sources */,
87EBB2A72D39214E00348B15 /* workoutmodel.cpp in Compile Sources */,
87EBB2A82D39214E00348B15 /* workoutloaderworker.cpp in Compile Sources */,
87EBB2A92D39214E00348B15 /* moc_fitdatabaseprocessor.cpp in Compile Sources */,
87EBB2AA2D39214E00348B15 /* fitdatabaseprocessor.cpp in Compile Sources */,
87EBB2AB2D39214E00348B15 /* moc_workoutmodel.cpp in Compile Sources */,
E40895A73216AC52D35083D9 /* signalhandler.cpp in Compile Sources */,
873CD22427EF8E18000131BC /* inappproductqmltype.cpp in Compile Sources */,
87DF68BF25E2675100FCDA46 /* moc_schwinnic4bike.cpp in Compile Sources */,
@@ -3874,6 +4042,8 @@
87440FBF2640292900E4DC0B /* moc_fitplusbike.cpp in Compile Sources */,
8768C8CA2BBC11C80099DBE1 /* sockets.c in Compile Sources */,
87B617EC25F25FED0094A1CB /* screencapture.cpp in Compile Sources */,
8755E5D42E4E260B006A12E4 /* moc_fontmanager.cpp in Compile Sources */,
8755E5D52E4E260B006A12E4 /* fontmanager.cpp in Compile Sources */,
876F9B5F275385C9006AE6FA /* fitmetria_fanfit.cpp in Compile Sources */,
FB2566376FE0FB17ED3DE94D /* FitDeveloperField.mm in Compile Sources */,
43FA2D5EA73D9C89F1A333B6 /* FitEncode.mm in Compile Sources */,
@@ -3890,6 +4060,9 @@
2B42755BF45173E11E2110CB /* FitFieldDefinition.mm in Compile Sources */,
873824AE27E64706004F1B46 /* moc_browser.cpp in Compile Sources */,
8738249727E646E3004F1B46 /* characteristicnotifier2a53.cpp in Compile Sources */,
876C64712E74139F00F1BEC0 /* moc_fitbackupwriter.cpp in Compile Sources */,
87EFC58F2E919DB7005BB573 /* QZWorkoutAttributes.swift in Compile Sources */,
876C64722E74139F00F1BEC0 /* fitbackupwriter.cpp in Compile Sources */,
DF373364C5474D877506CB26 /* FitMesg.mm in Compile Sources */,
87FE06812D170D3C00CDAAF6 /* moc_trxappgateusbrower.cpp in Compile Sources */,
872261F0289EA887006A6F75 /* moc_nordictrackelliptical.cpp in Compile Sources */,
@@ -4068,6 +4241,11 @@
target = 876E4E102594747F00BD5714 /* watchkit */;
targetProxy = 876E4E302594748100BD5714 /* PBXContainerItemProxy */;
};
87EFC5752E918D38005BB573 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 87EFC5632E918D35005BB573 /* QZWidgetExtension */;
targetProxy = 87EFC5742E918D38005BB573 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
@@ -4391,7 +4569,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "../src/ios/qdomyos-zwift.entitlements";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1125;
CURRENT_PROJECT_VERSION = 1219;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_TEAM = 6335M7T29D;
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = "ADB_HOST=1";
@@ -4427,6 +4606,7 @@
../../Qt/5.15.2/ios/include/QtCore/5.15.2/QtCore/private,
../../Qt/5.15.2/ios/include/QtCore/5.15.2,
../../Qt/5.15.2/ios/include/QtCore/5.15.2/QtCore/,
../../Qt/5.15.2/ios/include/QtSql,
);
LIBRARY_SEARCH_PATHS = (
/Users/cagnulein/Qt/5.15.2/ios/plugins/platforms,
@@ -4472,6 +4652,7 @@
/Users/cagnulein/Qt/5.15.2/ios/plugins/playlistformats,
/Users/cagnulein/Qt/5.15.2/ios/plugins/audio,
"/Users/cagnulein/qdomyos-zwift/src/ios/adb",
/Users/cagnulein/Qt/5.15.2/ios/qml/Qt/labs/calendar,
);
MARKETING_VERSION = 2.20;
OTHER_CFLAGS = (
@@ -4566,7 +4747,11 @@
QMAKE_PKGINFO_TYPEINFO = "????";
QMAKE_SHORT_VERSION = 1.7;
QT_LIBRARY_SUFFIX = "";
REGISTER_APP_GROUPS = YES;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_INSTALL_OBJC_HEADER = YES;
SWIFT_OBJC_BRIDGING_HEADER = "qdomyoszwift-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift2.h";
@@ -4585,8 +4770,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "../src/ios/qdomyos-zwift.entitlements";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1125;
CURRENT_PROJECT_VERSION = 1219;
DEBUG_INFORMATION_FORMAT = dwarf;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_TEAM = 6335M7T29D;
ENABLE_BITCODE = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -4623,6 +4809,7 @@
../../Qt/5.15.2/ios/include/QtCore/5.15.2/QtCore/private,
../../Qt/5.15.2/ios/include/QtCore/5.15.2,
../../Qt/5.15.2/ios/include/QtCore/5.15.2/QtCore/,
../../Qt/5.15.2/ios/include/QtSql,
);
LIBRARY_SEARCH_PATHS = (
/Users/cagnulein/Qt/5.15.2/ios/plugins/platforms,
@@ -4668,6 +4855,7 @@
/Users/cagnulein/Qt/5.15.2/ios/plugins/playlistformats,
/Users/cagnulein/Qt/5.15.2/ios/plugins/audio,
"/Users/cagnulein/qdomyos-zwift/src/ios/adb",
/Users/cagnulein/Qt/5.15.2/ios/qml/Qt/labs/calendar,
);
MARKETING_VERSION = 2.20;
ONLY_ACTIVE_ARCH = YES;
@@ -4763,7 +4951,11 @@
QMAKE_PKGINFO_TYPEINFO = "????";
QMAKE_SHORT_VERSION = 1.7;
QT_LIBRARY_SUFFIX = _debug;
REGISTER_APP_GROUPS = YES;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_INSTALL_OBJC_HEADER = YES;
SWIFT_OBJC_BRIDGING_HEADER = "qdomyoszwift-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift2.h";
@@ -4815,7 +5007,7 @@
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1125;
CURRENT_PROJECT_VERSION = 1219;
DEVELOPMENT_TEAM = 6335M7T29D;
ENABLE_BITCODE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -4911,7 +5103,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1125;
CURRENT_PROJECT_VERSION = 1219;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 6335M7T29D;
ENABLE_BITCODE = YES;
@@ -5003,7 +5195,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1125;
CURRENT_PROJECT_VERSION = 1219;
DEVELOPMENT_ASSET_PATHS = "\"watchkit Extension/Preview Content\"";
ENABLE_BITCODE = YES;
ENABLE_PREVIEWS = YES;
@@ -5119,7 +5311,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1125;
CURRENT_PROJECT_VERSION = 1219;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"watchkit Extension/Preview Content\"";
ENABLE_BITCODE = YES;
@@ -5191,6 +5383,184 @@
};
name = Release;
};
87EFC5792E918D38005BB573 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = QZWidgetExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1219;
DEVELOPMENT_TEAM = 6335M7T29D;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = QZWidget/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = QZWidget;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
LIBRARY_SEARCH_PATHS = "";
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
OTHER_LDFLAGS = (
"-framework",
SwiftUI,
"-framework",
WidgetKit,
);
PRODUCT_BUNDLE_IDENTIFIER = org.cagnulein.qdomyoszwift.QZWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
87EFC57A2E918D38005BB573 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = QZWidgetExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1219;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 6335M7T29D;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = QZWidget/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = QZWidget;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
LIBRARY_SEARCH_PATHS = "";
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_LDFLAGS = (
"-framework",
SwiftUI,
"-framework",
WidgetKit,
);
PRODUCT_BUNDLE_IDENTIFIER = org.cagnulein.qdomyoszwift.QZWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -5221,6 +5591,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
87EFC5782E918D38005BB573 /* Build configuration list for PBXNativeTarget "QZWidgetExtension" */ = {
isa = XCConfigurationList;
buildConfigurations = (
87EFC5792E918D38005BB573 /* Debug */,
87EFC57A2E918D38005BB573 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
DAC4C1AA5EDEA1C85E9CA5E6 /* Build configuration list for PBXProject "qdomyoszwift" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View File

@@ -23,11 +23,13 @@ class WatchKitConnection: NSObject {
static let shared = WatchKitConnection()
public static var distance = 0.0
public static var kcal = 0.0
public static var totalKcal = 0.0
public static var stepCadence = 0
public static var speed = 0.0
public static var cadence = 0.0
public static var power = 0.0
public static var steps = 0
public static var elevationGain = 0.0
weak var delegate: WatchKitConnectionDelegate?
private override init() {
@@ -70,6 +72,9 @@ extension WatchKitConnection: WatchKitConnectionProtocol {
WatchKitConnection.distance = dDistance
let dKcal = Double(result["kcal"] as! Double)
WatchKitConnection.kcal = dKcal
if let totalKcalDouble = result["totalKcal"] as? Double {
WatchKitConnection.totalKcal = totalKcalDouble
}
let dSpeed = Double(result["speed"] as! Double)
WatchKitConnection.speed = dSpeed
@@ -81,6 +86,13 @@ extension WatchKitConnection: WatchKitConnectionProtocol {
let iSteps = Int(stepsDouble)
WatchKitConnection.steps = iSteps
}
if let elevationGainDouble = result["elevationGain"] as? Double {
WatchKitConnection.elevationGain = elevationGainDouble
// Calculate flights climbed and update WorkoutTracking
let flightsClimbed = elevationGainDouble / 3.048 // One flight = 10 feet = 3.048 meters
WorkoutTracking.flightsClimbed = flightsClimbed
print("WatchKitConnection: Received elevation gain: \(elevationGainDouble)m, flights: \(flightsClimbed)")
}
}, errorHandler: { (error) in
print(error)
})

View File

@@ -28,6 +28,7 @@ class WorkoutTracking: NSObject {
static let shared = WorkoutTracking()
public static var distance = Double()
public static var kcal = Double()
public static var totalKcal = Double()
public static var cadenceTimeStamp = NSDate().timeIntervalSince1970
public static var cadenceLastSteps = Double()
public static var cadenceSteps = 0
@@ -36,17 +37,18 @@ class WorkoutTracking: NSObject {
public static var steps = Int()
public static var cadence = Double()
public static var lastDateMetric = Date()
public static var flightsClimbed = Double()
var sport: Int = 0
let healthStore = HKHealthStore()
let configuration = HKWorkoutConfiguration()
var workoutSession: HKWorkoutSession!
var workoutBuilder: HKLiveWorkoutBuilder!
weak var delegate: WorkoutTrackingDelegate?
override init() {
super.init()
}
}
}
extension WorkoutTracking {
@@ -166,6 +168,7 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
HKSampleType.quantityType(forIdentifier: .distanceCycling)!,
HKSampleType.quantityType(forIdentifier: .distanceWalkingRunning)!,
HKSampleType.quantityType(forIdentifier: .activeEnergyBurned)!,
HKSampleType.quantityType(forIdentifier: .basalEnergyBurned)!,
HKSampleType.quantityType(forIdentifier: .cyclingPower)!,
HKSampleType.quantityType(forIdentifier: .cyclingSpeed)!,
HKSampleType.quantityType(forIdentifier: .cyclingCadence)!,
@@ -175,6 +178,7 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
HKSampleType.quantityType(forIdentifier: .runningVerticalOscillation)!,
HKSampleType.quantityType(forIdentifier: .walkingSpeed)!,
HKSampleType.quantityType(forIdentifier: .walkingStepLength)!,
HKSampleType.quantityType(forIdentifier: .flightsClimbed)!,
HKSampleType.workoutType()
])
} else {
@@ -185,6 +189,8 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
HKSampleType.quantityType(forIdentifier: .distanceCycling)!,
HKSampleType.quantityType(forIdentifier: .distanceWalkingRunning)!,
HKSampleType.quantityType(forIdentifier: .activeEnergyBurned)!,
HKSampleType.quantityType(forIdentifier: .basalEnergyBurned)!,
HKSampleType.quantityType(forIdentifier: .flightsClimbed)!,
HKSampleType.workoutType()
])
}
@@ -203,6 +209,8 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
func startWorkOut() {
WorkoutTracking.lastDateMetric = Date()
// Reset flights climbed for new workout
WorkoutTracking.flightsClimbed = 0
print("Start workout")
configWorkout()
workoutSession.startActivity(with: Date())
@@ -223,25 +231,30 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
workoutSession.stopActivity(with: Date())
workoutSession.end()
guard let quantityType = HKQuantityType.quantityType(
// Write active calories
guard let activeQuantityType = HKQuantityType.quantityType(
forIdentifier: .activeEnergyBurned) else {
return
}
let unit = HKUnit.kilocalorie()
let totalEnergyBurned = WorkoutTracking.kcal
let quantity = HKQuantity(unit: unit,
doubleValue: totalEnergyBurned)
let activeEnergyBurned = WorkoutTracking.kcal
let activeQuantity = HKQuantity(unit: unit,
doubleValue: activeEnergyBurned)
let startDate = workoutSession.startDate ?? WorkoutTracking.lastDateMetric
let sample = HKCumulativeQuantitySeriesSample(type: quantityType,
quantity: quantity,
start: startDate,
end: Date())
let activeSample = HKCumulativeQuantitySeriesSample(type: activeQuantityType,
quantity: activeQuantity,
start: startDate,
end: Date())
workoutBuilder.add([sample]) {(success, error) in}
workoutBuilder.add([activeSample]) {(success, error) in
if let error = error {
print("WatchWorkoutTracking active calories: \(error.localizedDescription)")
}
}
let unitDistance = HKUnit.mile()
let miles = WorkoutTracking.distance
let quantityMiles = HKQuantity(unit: unitDistance,
@@ -273,6 +286,10 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
print(error)
}
workout?.setValue(quantityMiles, forKey: "totalDistance")
// Set total energy burned on the workout
let totalEnergy = WorkoutTracking.totalKcal > 0 ? WorkoutTracking.totalKcal : activeEnergyBurned
let totalEnergyQuantity = HKQuantity(unit: unit, doubleValue: totalEnergy)
workout?.setValue(totalEnergyQuantity, forKey: "totalEnergyBurned")
}
}
}
@@ -334,11 +351,15 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
print(error)
}
workout?.setValue(quantityMiles, forKey: "totalDistance")
// Set total energy burned on the workout
let totalEnergy = WorkoutTracking.totalKcal > 0 ? WorkoutTracking.totalKcal : activeEnergyBurned
let totalEnergyQuantity = HKQuantity(unit: unit, doubleValue: totalEnergy)
workout?.setValue(totalEnergyQuantity, forKey: "totalEnergyBurned")
}
}
}
} else {
// Guard to check if steps quantity type is available
guard let quantityTypeSteps = HKQuantityType.quantityType(
forIdentifier: .stepCount) else {
@@ -346,7 +367,7 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
}
let stepsQuantity = HKQuantity(unit: HKUnit.count(), doubleValue: Double(WorkoutTracking.steps))
// Create a sample for total steps
let sampleSteps = HKCumulativeQuantitySeriesSample(
type: quantityTypeSteps,
@@ -354,51 +375,59 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
start: startDate,
end: Date())
// Add the steps sample to workout builder
workoutBuilder.add([sampleSteps]) { (success, error) in
// Guard to check if distance quantity type is available
guard let quantityTypeDistance = HKQuantityType.quantityType(
forIdentifier: .distanceWalkingRunning) else {
return
}
let sampleDistance = HKCumulativeQuantitySeriesSample(type: quantityTypeDistance,
quantity: quantityMiles,
start: startDate,
end: Date())
// Create flights climbed sample if available
var samplesToAdd: [HKCumulativeQuantitySeriesSample] = [sampleSteps, sampleDistance]
if WorkoutTracking.flightsClimbed > 0 {
if let quantityTypeFlights = HKQuantityType.quantityType(forIdentifier: .flightsClimbed) {
let flightsQuantity = HKQuantity(unit: HKUnit.count(), doubleValue: WorkoutTracking.flightsClimbed)
let sampleFlights = HKCumulativeQuantitySeriesSample(
type: quantityTypeFlights,
quantity: flightsQuantity,
start: startDate,
end: Date())
samplesToAdd.append(sampleFlights)
print("WatchWorkoutTracking: Adding flights climbed to workout: \(WorkoutTracking.flightsClimbed)")
}
}
// Add all samples to the workout builder
workoutBuilder.add(samplesToAdd) { (success, error) in
if let error = error {
print(error)
}
// End the data collection
self.workoutBuilder.endCollection(withEnd: Date()) { (success, error) in
if let error = error {
print(error)
}
// Finish the workout and save total steps
// Finish the workout and save metrics
self.workoutBuilder.finishWorkout { (workout, error) in
if let error = error {
print(error)
}
workout?.setValue(stepsQuantity, forKey: "totalSteps")
}
}
}
guard let quantityTypeDistance = HKQuantityType.quantityType(
forIdentifier: .distanceWalkingRunning) else {
return
}
let sampleDistance = HKCumulativeQuantitySeriesSample(type: quantityTypeDistance,
quantity: quantityMiles,
start: startDate,
end: Date())
workoutBuilder.add([sampleDistance]) {(success, error) in
if let error = error {
print(error)
}
self.workoutBuilder.endCollection(withEnd: Date()) { (success, error) in
if let error = error {
print(error)
}
self.workoutBuilder.finishWorkout{ (workout, error) in
if let error = error {
print(error)
}
workout?.setValue(quantityMiles, forKey: "totalDistance")
// Set total energy burned on the workout
let totalEnergy = WorkoutTracking.totalKcal > 0 ? WorkoutTracking.totalKcal : activeEnergyBurned
let totalEnergyQuantity = HKQuantity(unit: unit, doubleValue: totalEnergy)
workout?.setValue(totalEnergyQuantity, forKey: "totalEnergyBurned")
// Reset flights climbed for next workout
WorkoutTracking.flightsClimbed = 0
}
}
}
@@ -413,7 +442,7 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
}
let startOfDay = Calendar.current.startOfDay(for: Date())
let predicate = HKQuery.predicateForSamples(withStart: startOfDay, end: Date(), options: .strictStartDate)
let query = HKStatisticsQuery(quantityType: stepCounts, quantitySamplePredicate: predicate, options: .cumulativeSum) { [weak self] (_, result, error) in
guard let weakSelf = self else {
return
@@ -423,7 +452,7 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
print("Failed to fetch steps rate")
return
}
if let sum = result.sumQuantity() {
resultCount = sum.doubleValue(for: HKUnit.count())
weakSelf.delegate?.didReceiveHealthKitStepCounts(resultCount)

View File

@@ -1,4 +1,4 @@
QT += gui bluetooth widgets xml positioning quick networkauth websockets texttospeech location multimedia
QT += gui bluetooth widgets xml positioning quick networkauth websockets texttospeech location multimedia sql
QTPLUGIN += qavfmediaplayer
QT+= charts

View File

@@ -10,7 +10,7 @@ These instructions build the app itself, not the test project.
```buildoutcfg
$ sudo apt update && sudo apt upgrade # this is very important on raspberry pi: you need the bluetooth firmware updated!
$ sudo apt install git qtquickcontrols2-5-dev libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtbase5-private-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 qt5-assistant libqt5networkauth5-dev libqt5websockets5-dev qml-module* libqt5texttospeech5-dev libqt5texttospeech5 libqt5location5-plugins qtlocation5-dev qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5 g++ make
$ sudo apt install git qtquickcontrols2-5-dev libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtbase5-private-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 qt5-assistant libqt5networkauth5-dev libqt5websockets5-dev qml-module* libqt5texttospeech5-dev libqt5texttospeech5 libqt5location5-plugins qtlocation5-dev qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5 g++ make qtbase5-dev libqt5sql5 libqt5sql5-mysql libqt5sql5-psql
$ git clone https://github.com/cagnulein/qdomyos-zwift.git
$ cd qdomyos-zwift
$ git submodule update --init src/smtpclient/
@@ -106,7 +106,7 @@ This operation takes a moment to complete.
#### Install qdomyos-zwift from sources
```bash
sudo apt install git libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtbase5-private-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 qt5-assistant libqt5networkauth5-dev libqt5websockets5-dev qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5 qtlocation5-dev qtquickcontrols2-5-dev libqt5texttospeech5-dev libqt5texttospeech5 g++ make
sudo apt install git libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtbase5-private-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 qt5-assistant libqt5networkauth5-dev libqt5websockets5-dev qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5 qtlocation5-dev qtquickcontrols2-5-dev libqt5texttospeech5-dev libqt5texttospeech5 g++ make qtbase5-dev libqt5sql5 libqt5sql5-mysql libqt5sql5-psql
git clone https://github.com/cagnulein/qdomyos-zwift.git
cd qdomyos-zwift
git submodule update --init src/smtpclient/

View File

@@ -9,6 +9,7 @@ ColumnLayout {
anchors.fill: parent
Settings {
id: settings
property int chart_display_mode: 0
}
WebView {
id: webView
@@ -19,6 +20,9 @@ ColumnLayout {
if (loadRequest.errorString) {
console.error(loadRequest.errorString);
console.error("port " + settings.value("template_inner_QZWS_port"));
} else if (loadRequest.status === WebView.LoadSucceededStatus) {
// Send chart display mode to the web view
sendDisplayModeToWebView();
}
}
onVisibleChanged: {
@@ -28,4 +32,22 @@ ColumnLayout {
}
}
}
// Watch for changes in chart display mode setting
Connections {
target: settings
function onChart_display_modeChanged() {
sendDisplayModeToWebView();
}
}
function sendDisplayModeToWebView() {
if (webView.loading === false) {
webView.runJavaScript("
if (window.setChartDisplayMode) {
window.setChartDisplayMode(" + settings.chart_display_mode + ");
}
");
}
}
}

View File

@@ -92,7 +92,7 @@ class BluetoothHandler : public QObject
void onKeyPressed(int keyCode)
{
qDebug() << "Key pressed:" << keyCode;
if (m_bluetooth && m_bluetooth->device() && m_bluetooth->device()->deviceType() == bluetoothdevice::BIKE) {
if (m_bluetooth && m_bluetooth->device() && m_bluetooth->device()->deviceType() == BIKE) {
if (keyCode == 115) // up
((bike*)m_bluetooth->device())->setGears(((bike*)m_bluetooth->device())->gears() + 1);
else if (keyCode == 114) // down

View File

@@ -13,22 +13,32 @@ ColumnLayout {
signal trainprogram_open_clicked(url name)
signal trainprogram_open_other_folder(url name)
signal trainprogram_preview(url name)
FileDialog {
id: fileDialogTrainProgram
title: "Please choose a file"
folder: shortcuts.home
onAccepted: {
console.log("You chose: " + fileDialogTrainProgram.fileUrl)
if(OS_VERSION === "Android") {
trainprogram_open_other_folder(fileDialogTrainProgram.fileUrl)
} else {
trainprogram_open_clicked(fileDialogTrainProgram.fileUrl)
Loader {
id: fileDialogLoader
active: false
sourceComponent: Component {
FileDialog {
title: "Please choose a file"
folder: shortcuts.home
visible: true
onAccepted: {
console.log("You chose: " + fileUrl)
if(OS_VERSION === "Android") {
trainprogram_open_other_folder(fileUrl)
} else {
trainprogram_open_clicked(fileUrl)
}
close()
// Destroy and recreate the dialog for next use
fileDialogLoader.active = false
}
onRejected: {
console.log("Canceled")
close()
// Destroy the dialog
fileDialogLoader.active = false
}
}
fileDialogTrainProgram.close()
}
onRejected: {
console.log("Canceled")
fileDialogTrainProgram.close()
}
}
@@ -263,7 +273,8 @@ ColumnLayout {
Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter
onClicked: {
console.log("folder is " + rootItem.getWritableAppDir() + 'gpx')
fileDialogTrainProgram.visible = true
// Create a fresh FileDialog instance
fileDialogLoader.active = true
}
anchors {
bottom: parent.bottom

View File

@@ -72,7 +72,19 @@ HomeForm {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("New lap started!")
}
}
}
}
MessageDialog {
id: stopConfirmationDialog
text: qsTr("Stop Workout")
informativeText: qsTr("Do you really want to stop the current workout?")
buttons: (MessageDialog.Yes | MessageDialog.No)
onYesClicked: {
close();
inner_stop();
}
onNoClicked: close()
}
Timer {
@@ -141,7 +153,11 @@ HomeForm {
start.onClicked: { start_clicked(); }
stop.onClicked: {
inner_stop();
if (rootItem.confirmStopEnabled()) {
stopConfirmationDialog.open();
} else {
inner_stop();
}
}
lap.onClicked: { lap_clicked(); popupLap.open(); popupLapAutoClose.running = true; }

View File

@@ -165,7 +165,7 @@ Page {
width: parent.width
anchors.top: row1.bottom
anchors.topMargin: 30
text: "This app should automatically connect to your bike/treadmill/rower. <b>If it doesn't, please check</b>:<br>1) your Echelon/Domyos App MUST be closed while qdomyos-zwift is running;<br>2) bluetooth and bluetooth permission MUST be on<br>3) your bike/treadmill/rower should be turned on BEFORE starting this app<br>4) try to restart your device<br><br>If your bike/treadmill disconnects every 30 seconds try to disable the 'virtual device' setting on the left bar.<br><br>In case of issues, please feel free to contact me at roberto.viola83@gmail.com.<br><br><b>Have a nice ride!</b><br/ ><i>QZ specifically disclaims liability for<br>incidental or consequential damages and assumes<br>no responsibility or liability for any loss<br>or damage suffered by any person as a result of<br>the use or misuse of the app.</i><br><br>Roberto Viola"
text: "This app should automatically connect to your bike/treadmill/rower. <b>If it doesn't, please check</b>:<br>1) your Echelon/Domyos App MUST be closed while qdomyos-zwift is running;<br>2) both Bluetooth and Bluetooth permissions MUST be enabled<br>3) your bike/treadmill/rower should be turned on BEFORE starting this app<br>4) try to restart your device<br><br>If your bike/treadmill disconnects every 30 seconds try to disable the 'virtual device' setting on the left bar.<br><br>In case of issues, please feel free to contact me at roberto.viola83@gmail.com.<br><br><b>Have a nice ride!</b><br/ ><i>QZ specifically disclaims liability for<br>incidental or consequential damages and assumes<br>no responsibility or liability for any loss<br>or damage suffered by any person as a result of<br>the use or misuse of the app.</i><br><br>Roberto Viola"
wrapMode: Label.WordWrap
visible: rootItem.labelHelp
}

51
src/PreviewChart.qml Normal file
View File

@@ -0,0 +1,51 @@
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.0
import Qt.labs.settings 1.0
import QtWebView 1.1
ColumnLayout {
signal popupclose()
id: column1
spacing: 10
anchors.fill: parent
Settings {
id: settings
}
WebView {
id: webView
anchors.fill: parent
url: "http://localhost:" + settings.value("template_inner_QZWS_port") + "/previewchart/chart.htm"
visible: true
onLoadingChanged: {
if (loadRequest.errorString) {
console.error(loadRequest.errorString);
console.error("port " + settings.value("template_inner_QZWS_port"));
}
}
}
Timer {
id: chartJscheckStartFromWeb
interval: 200; running: true; repeat: true
onTriggered: {if(rootItem.startRequested) {rootItem.startRequested = false; rootItem.stopRequested = false; stackView.pop(); }}
}
Button {
id: closeButton
height: 50
width: parent.width
text: "Close"
Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter
onClicked: {
popupclose();
}
anchors {
bottom: parent.bottom
}
}
Component.onCompleted: {
headerToolbar.visible = true;
}
}

View File

@@ -7,18 +7,28 @@ import QtQuick.Dialogs 1.0
ColumnLayout {
signal loadSettings(url name)
FileDialog {
id: fileDialogSettings
title: "Please choose a file"
folder: shortcuts.home
onAccepted: {
console.log("You chose: " + fileDialogSettings.fileUrl)
loadSettings(fileDialogSettings.fileUrl)
fileDialogSettings.close()
}
onRejected: {
console.log("Canceled")
fileDialogSettings.close()
Loader {
id: fileDialogLoader
active: false
sourceComponent: Component {
FileDialog {
title: "Please choose a file"
folder: shortcuts.home
visible: true
onAccepted: {
console.log("You chose: " + fileUrl)
loadSettings(fileUrl)
close()
// Destroy and recreate the dialog for next use
fileDialogLoader.active = false
}
onRejected: {
console.log("Canceled")
close()
// Destroy the dialog
fileDialogLoader.active = false
}
}
}
}
@@ -106,7 +116,8 @@ ColumnLayout {
Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter
onClicked: {
console.log("folder is " + rootItem.getWritableAppDir() + 'settings')
fileDialogSettings.visible = true
// Create a fresh FileDialog instance
fileDialogLoader.active = true
}
anchors {
bottom: parent.bottom

View File

@@ -11,22 +11,32 @@ ColumnLayout {
signal trainprogram_open_clicked(url name)
signal trainprogram_open_other_folder(url name)
signal trainprogram_preview(url name)
FileDialog {
id: fileDialogTrainProgram
title: "Please choose a file"
folder: shortcuts.home
onAccepted: {
console.log("You chose: " + fileDialogTrainProgram.fileUrl)
if(OS_VERSION === "Android") {
trainprogram_open_other_folder(fileDialogTrainProgram.fileUrl)
} else {
trainprogram_open_clicked(fileDialogTrainProgram.fileUrl)
Loader {
id: fileDialogLoader
active: false
sourceComponent: Component {
FileDialog {
title: "Please choose a file"
folder: shortcuts.home
visible: true
onAccepted: {
console.log("You chose: " + fileUrl)
if(OS_VERSION === "Android") {
trainprogram_open_other_folder(fileUrl)
} else {
trainprogram_open_clicked(fileUrl)
}
close()
// Destroy and recreate the dialog for next use
fileDialogLoader.active = false
}
onRejected: {
console.log("Canceled")
close()
// Destroy the dialog
fileDialogLoader.active = false
}
}
fileDialogTrainProgram.close()
}
onRejected: {
console.log("Canceled")
fileDialogTrainProgram.close()
}
}
@@ -296,7 +306,8 @@ ColumnLayout {
Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter
onClicked: {
console.log("folder is " + rootItem.getWritableAppDir() + 'training')
fileDialogTrainProgram.visible = true
// Create a fresh FileDialog instance
fileDialogLoader.active = true
}
anchors {
bottom: parent.bottom

View File

@@ -845,7 +845,6 @@ Page {
text: qsTr("Finish")
onClicked: {
settings.tile_gears_enabled = true;
settings.gears_gain = 0.5;
stackViewLocal.push(finalStepComponent);
}
}
@@ -904,7 +903,6 @@ Page {
text: qsTr("Finish")
onClicked: {
settings.tile_gears_enabled = true;
settings.gears_gain = 1;
stackViewLocal.push(finalStepComponent);
}
}

71
src/WorkoutTypeTag.qml Normal file
View File

@@ -0,0 +1,71 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
Rectangle {
id: root
property string workoutSource: "QZ"
property alias text: tagText.text
// Auto-size based on text
width: tagText.implicitWidth + 16
height: 24
radius: 12
// Color scheme based on workout source
color: {
switch(workoutSource.toUpperCase()) {
case "PELOTON": return "#ff6b35"
case "ZWIFT": return "#ff6900"
case "ERG": return "#8bc34a"
case "QZ": return "#2196f3"
case "MANUAL": return "#757575"
default: return "#9e9e9e"
}
}
// Subtle border for better definition
border.color: Qt.darker(color, 1.2)
border.width: 1
Text {
id: tagText
anchors.centerIn: parent
text: workoutSource.toUpperCase()
color: "white"
font.pixelSize: 10
font.bold: true
font.family: "Arial"
}
// Subtle shadow effect
Rectangle {
anchors.fill: parent
anchors.topMargin: 1
anchors.leftMargin: 1
radius: parent.radius
color: "#20000000"
z: -1
}
// Hover effect for interactivity feedback
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
parent.scale = 1.05
}
onExited: {
parent.scale = 1.0
}
Behavior on scale {
NumberAnimation {
duration: 150
easing.type: Easing.OutQuad
}
}
}
}

910
src/WorkoutsHistory.qml Normal file
View File

@@ -0,0 +1,910 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtCharts 2.15
import Qt.labs.calendar 1.0
Page {
id: workoutHistoryPage
// Signal for chart preview
signal fitfile_preview_clicked(var url)
// Helper function to wrap text with emoji font only on Android
function wrapEmoji(emoji) {
return Qt.platform.os === "android" ?
'<font face="' + fontManager.emojiFontFamily + '">' + emoji + '</font>' :
emoji;
}
// Sport type to icon mapping (using FIT_SPORT values)
function getSportIcon(sport) {
switch(parseInt(sport)) {
case 1: // FIT_SPORT_RUNNING
case 11: // FIT_SPORT_WALKING
return "🏃"; // Running/Walking
case 2: // FIT_SPORT_CYCLING
return "🚴"; // Cycling
case 4: // FIT_SPORT_FITNESS_EQUIPMENT (Elliptical)
return "⭕"; // Elliptical
case 15: // FIT_SPORT_ROWING
return "🚣"; // Rowing
case 84: // FIT_SPORT_JUMPROPE
return "🪢"; // Jump Rope
default:
return "💪"; // Generic workout
}
}
ColumnLayout {
anchors.fill: parent
spacing: 10
// Header
Rectangle {
Layout.fillWidth: true
height: 60
color: "#f5f5f5"
// Calendar Icon Button - positioned absolutely on the left
Button {
id: calendarButton
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 12
width: 48
height: 48
background: Rectangle {
radius: 8
color: calendarButton.pressed ? "#e0e0e0" : "#f0f0f0"
border.color: "#d0d0d0"
border.width: 1
}
contentItem: Text {
text: Qt.platform.os === "android" ?
wrapEmoji("📅") :
"📅"
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: {
calendarPopup.open()
}
}
// Title with filter status - centered
Column {
anchors.centerIn: parent
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: "Workout History"
font.pixelSize: 24
font.bold: true
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: workoutModel && workoutModel.isDateFiltered ?
"Filtered: " + workoutModel.filteredDate.toLocaleDateString() : ""
font.pixelSize: 12
color: "#666666"
visible: workoutModel && workoutModel.isDateFiltered
}
}
// Clear Filter Button - positioned absolutely on the right
Button {
id: clearFilterButton
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.rightMargin: 12
width: 100
height: 36
visible: workoutModel && workoutModel.isDateFiltered
background: Rectangle {
radius: 6
color: clearFilterButton.pressed ? "#ff6666" : "#ff8888"
border.color: "#ff4444"
border.width: 1
}
contentItem: Text {
text: "Clear Filter"
color: "white"
font.pixelSize: 12
font.bold: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: {
workoutModel.clearDateFilter()
}
}
}
// Loading indicator
BusyIndicator {
id: loadingIndicator
Layout.alignment: Qt.AlignHCenter
visible: workoutModel ? (workoutModel.isLoading || workoutModel.isDatabaseProcessing) : false
running: visible
}
// Database processing message
Text {
Layout.alignment: Qt.AlignHCenter
visible: workoutModel ? workoutModel.isDatabaseProcessing : false
text: "Processing workout files...\nThis may take a few moments on first startup."
horizontalAlignment: Text.AlignHCenter
color: "#666666"
font.pixelSize: 16
}
// Workout List
ListView {
id: workoutListView
Layout.fillWidth: true
Layout.fillHeight: true
Layout.bottomMargin: streakBanner.visible ? streakBanner.height + 10 : 10
model: workoutModel
spacing: 8
clip: true
onContentYChanged: {
// Hide banner when scrolling down, show when at top
streakBanner.visible = contentY <= 20
}
delegate: SwipeDelegate {
id: swipeDelegate
width: parent.width
height: 135
Component.onCompleted: {
console.log("Delegate data:", JSON.stringify({
sport: sport,
title: title,
date: date,
duration: duration,
distance: distance,
calories: calories,
id: id
}))
}
swipe.right: Rectangle {
width: parent.width
height: parent.height
color: "#FF4444"
clip: true
Row {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.rightMargin: 20
Text {
text: Qt.platform.os === "android" ?
wrapEmoji("🗑️") + " Delete" :
"🗑️ Delete"
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
color: "white"
font.pixelSize: 16
anchors.verticalCenter: parent.verticalCenter
}
}
}
swipe.onCompleted: {
// Show confirmation dialog
confirmDialog.workoutId = model.id
confirmDialog.workoutTitle = model.title
confirmDialog.open()
}
// Card-like container
Rectangle {
anchors.fill: parent
anchors.margins: 8
radius: 10
color: "white"
border.color: "#e0e0e0"
// Workout Type Tag - positioned absolutely in top-right
WorkoutTypeTag {
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 12
workoutSource: workoutModel ? workoutModel.getWorkoutSource(model.id) : "QZ"
}
// Action buttons - positioned absolutely in bottom-right
Row {
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 12
spacing: 8
// Peloton URL button
Button {
width: 40
height: 45
visible: workoutModel && workoutModel.getWorkoutSource(model.id) === "PELOTON" &&
workoutModel.getPelotonUrl(model.id) !== ""
background: Rectangle {
color: parent.pressed ? "#ff8855" : "#ff6b35"
radius: 6
border.color: "#cc5529"
border.width: 1
}
contentItem: Text {
text: Qt.platform.os === "android" ?
wrapEmoji("🌐") :
"🌐"
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
font.pixelSize: 16
color: "white"
anchors.centerIn: parent
}
onClicked: {
workoutModel.openPelotonUrl(model.id)
}
}
// Training Program button
Button {
width: 40
height: 45
visible: workoutModel && workoutModel.hasTrainingProgram(model.id)
background: Rectangle {
color: parent.pressed ? "#1976d2" : "#2196f3"
radius: 6
border.color: "#1565c0"
border.width: 1
}
contentItem: Text {
text: Qt.platform.os === "android" ?
wrapEmoji("📋") :
"📋"
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
font.pixelSize: 16
color: "white"
anchors.centerIn: parent
}
onClicked: {
var success = workoutModel.loadTrainingProgram(model.id)
if (success) {
trainingProgramDialog.title = "Success"
trainingProgramDialog.message = "Training program loaded successfully!"
trainingProgramDialog.isSuccess = true
} else {
trainingProgramDialog.title = "Error"
trainingProgramDialog.message = "Failed to load training program. Please check if the file exists."
trainingProgramDialog.isSuccess = false
}
trainingProgramDialog.open()
}
}
}
RowLayout {
anchors.fill: parent
anchors.margins: 12
spacing: 16
// Sport icon
Column {
Layout.alignment: Qt.AlignVCenter
Text {
text: Qt.platform.os === "android" ?
wrapEmoji(getSportIcon(sport)) :
getSportIcon(sport)
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
font.pixelSize: 32
}
}
// Workout info
ColumnLayout {
Layout.fillWidth: true
spacing: 4
// Title row (without tag) with auto-scrolling
Rectangle {
Layout.fillWidth: true
Layout.rightMargin: 80 // Reserve space for tag
Layout.preferredHeight: 24
clip: true
color: "transparent"
Text {
id: titleText
text: title
font.bold: true
font.pixelSize: 18
anchors.verticalCenter: parent.verticalCenter
// Auto-scroll animation for long titles
SequentialAnimation on x {
running: titleText.contentWidth > titleText.parent.width
loops: Animation.Infinite
NumberAnimation {
from: 0
to: -(titleText.contentWidth - titleText.parent.width + 20)
duration: Math.max(3000, titleText.contentWidth * 30)
}
PauseAnimation { duration: 1500 }
NumberAnimation {
from: -(titleText.contentWidth - titleText.parent.width + 20)
to: 0
duration: Math.max(3000, titleText.contentWidth * 30)
}
PauseAnimation { duration: 2000 }
}
}
}
Text {
text: date
color: "#666666"
}
// Stats row
RowLayout {
spacing: 16
Text {
text: "⏱ " + duration
}
Text {
text: "📏 " + distance.toFixed(2) + " km"
}
}
RowLayout {
spacing: 16
Text {
text: Qt.platform.os === "android" ?
wrapEmoji("🔥") + " " + Math.round(calories) + " kcal" :
"🔥 " + Math.round(calories) + " kcal"
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
}
}
}
}
}
onClicked: {
console.log("Workout clicked, ID:", model.id)
// Get workout details from the model
var details = workoutModel.getWorkoutDetails(model.id)
console.log("Workout details:", JSON.stringify(details))
// Emit signal with file URL for chart preview - same pattern as profiles.qml
console.log("Emitting fitfile_preview_clicked with path:", details.filePath)
// Convert to URL like profiles.qml does with FolderListModel
var fileUrl = "file://" + details.filePath
console.log("Converted to URL:", fileUrl)
workoutHistoryPage.fitfile_preview_clicked(fileUrl)
// Push the ChartJsTest view
stackView.push("PreviewChart.qml")
}
}
}
}
// Confirmation Dialog
Dialog {
id: confirmDialog
property int workoutId
property string workoutTitle
title: "Delete Workout"
modal: true
standardButtons: Dialog.Ok | Dialog.Cancel
x: (parent.width - width) / 2
y: (parent.height - height) / 2
Text {
text: "Are you sure you want to delete '" + confirmDialog.workoutTitle + "'?"
}
onAccepted: {
workoutModel.deleteWorkout(confirmDialog.workoutId)
swipeDelegate.swipe.close()
}
onRejected: {
swipeDelegate.swipe.close()
}
}
// Training Program Loading Dialog
Dialog {
id: trainingProgramDialog
property string message: ""
property bool isSuccess: true
modal: true
standardButtons: Dialog.Ok
x: (parent.width - width) / 2
y: (parent.height - height) / 2
background: Rectangle {
color: "white"
radius: 8
border.color: trainingProgramDialog.isSuccess ? "#4caf50" : "#f44336"
border.width: 2
}
header: Rectangle {
height: 50
color: trainingProgramDialog.isSuccess ? "#4caf50" : "#f44336"
radius: 8
Text {
anchors.centerIn: parent
text: trainingProgramDialog.title
color: "white"
font.pixelSize: 18
font.bold: true
}
}
contentItem: ColumnLayout {
spacing: 16
Text {
Layout.margins: 20
Layout.preferredWidth: 300
Layout.preferredHeight: 120
text: Qt.platform.os === "android" ?
wrapEmoji("🔥") + " " +
wrapEmoji(trainingProgramDialog.isSuccess ? '✅' : '❌') +
" " + trainingProgramDialog.message :
"🔥 " + (trainingProgramDialog.isSuccess ? '✅ ' : '❌ ') + trainingProgramDialog.message
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 14
}
}
}
// Streak Banner at the bottom
Rectangle {
id: streakBanner
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
height: 80
visible: workoutModel
Behavior on visible {
NumberAnimation {
properties: "opacity"
duration: 300
easing.type: Easing.InOutQuad
}
}
// Special pulsing effect for major milestones
SequentialAnimation on opacity {
running: workoutModel && workoutModel.currentStreak >= 30
loops: Animation.Infinite
NumberAnimation { from: 0.9; to: 1.0; duration: 1500; easing.type: Easing.InOutSine }
NumberAnimation { from: 1.0; to: 0.9; duration: 1500; easing.type: Easing.InOutSine }
}
gradient: Gradient {
GradientStop {
position: 0.0;
color: workoutModel && (workoutModel.currentStreak >= 365) ? "#FFD700" :
workoutModel && (workoutModel.currentStreak >= 180) ? "#9932CC" :
workoutModel && (workoutModel.currentStreak >= 90) ? "#FF1493" :
workoutModel && (workoutModel.currentStreak >= 30) ? "#FF4500" :
workoutModel && (workoutModel.currentStreak >= 7) ? "#FF6347" : "#FF6B35"
}
GradientStop {
position: 1.0;
color: workoutModel && (workoutModel.currentStreak >= 365) ? "#FFA500" :
workoutModel && (workoutModel.currentStreak >= 180) ? "#8A2BE2" :
workoutModel && (workoutModel.currentStreak >= 90) ? "#DC143C" :
workoutModel && (workoutModel.currentStreak >= 30) ? "#FF6B35" :
workoutModel && (workoutModel.currentStreak >= 7) ? "#FF4500" : "#F7931E"
}
}
Rectangle {
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: "#40FFFFFF" }
GradientStop { position: 1.0; color: "#00FFFFFF" }
}
}
ColumnLayout {
anchors.centerIn: parent
spacing: 4
// Current streak with count
RowLayout {
Layout.alignment: Qt.AlignHCenter
spacing: 15
// Fire emoji with animation
Text {
text: Qt.platform.os === "android" ? (
workoutModel && workoutModel.currentStreak >= 365 ? wrapEmoji("👑🔥") :
workoutModel && workoutModel.currentStreak >= 180 ? wrapEmoji("🎖️🔥") :
workoutModel && workoutModel.currentStreak >= 90 ? wrapEmoji("🦁🔥") :
workoutModel && workoutModel.currentStreak >= 30 ? wrapEmoji("🎊🔥") :
workoutModel && workoutModel.currentStreak >= 7 ? wrapEmoji("🏆🔥") : wrapEmoji("🔥")
) : (
workoutModel && workoutModel.currentStreak >= 365 ? "👑🔥" :
workoutModel && workoutModel.currentStreak >= 180 ? "🎖️🔥" :
workoutModel && workoutModel.currentStreak >= 90 ? "🦁🔥" :
workoutModel && workoutModel.currentStreak >= 30 ? "🎊🔥" :
workoutModel && workoutModel.currentStreak >= 7 ? "🏆🔥" : "🔥"
)
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
font.pixelSize: workoutModel && workoutModel.currentStreak >= 7 ? 28 : 24
SequentialAnimation on scale {
running: workoutModel && workoutModel.currentStreak > 0
loops: Animation.Infinite
NumberAnimation {
from: 1.0;
to: workoutModel && workoutModel.currentStreak >= 7 ? 1.4 : 1.2;
duration: workoutModel && workoutModel.currentStreak >= 365 ? 600 : 800;
easing.type: Easing.InOutSine
}
NumberAnimation {
from: workoutModel && workoutModel.currentStreak >= 7 ? 1.4 : 1.2;
to: 1.0;
duration: workoutModel && workoutModel.currentStreak >= 7 ? 600 : 800;
easing.type: Easing.InOutSine
}
}
// Special sparkle effect for year achievement
SequentialAnimation on rotation {
running: workoutModel && workoutModel.currentStreak >= 7
loops: Animation.Infinite
NumberAnimation { from: 0; to: 360; duration: 3000; easing.type: Easing.Linear }
}
}
// Current streak count
Text {
text: workoutModel ? workoutModel.currentStreak + " day" + (workoutModel.currentStreak !== 1 ? "s" : "") + " streak" : ""
font.pixelSize: 18
font.bold: true
color: "white"
visible: workoutModel
}
// Another fire emoji
Text {
text: Qt.platform.os === "android" ? (
workoutModel && workoutModel.currentStreak >= 365 ? wrapEmoji("🔥👑") :
workoutModel && workoutModel.currentStreak >= 180 ? wrapEmoji("🔥🎖️") :
workoutModel && workoutModel.currentStreak >= 90 ? wrapEmoji("🔥🦁") :
workoutModel && workoutModel.currentStreak >= 30 ? wrapEmoji("🔥🎊") :
workoutModel && workoutModel.currentStreak >= 7 ? wrapEmoji("🔥🏆") : wrapEmoji("🔥")
) : (
workoutModel && workoutModel.currentStreak >= 365 ? "🔥👑" :
workoutModel && workoutModel.currentStreak >= 180 ? "🔥🎖️" :
workoutModel && workoutModel.currentStreak >= 90 ? "🔥🦁" :
workoutModel && workoutModel.currentStreak >= 30 ? "🔥🎊" :
workoutModel && workoutModel.currentStreak >= 7 ? "🔥🏆" : "🔥"
)
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
font.pixelSize: workoutModel && workoutModel.currentStreak >= 365 ? 28 : 24
SequentialAnimation on scale {
running: workoutModel && workoutModel.currentStreak > 0
loops: Animation.Infinite
NumberAnimation {
from: 1.0;
to: workoutModel && workoutModel.currentStreak >= 7 ? 1.4 : 1.2;
duration: workoutModel && workoutModel.currentStreak >= 7 ? 700 : 1000;
easing.type: Easing.InOutSine
}
NumberAnimation {
from: workoutModel && workoutModel.currentStreak >= 7 ? 1.4 : 1.2;
to: 1.0;
duration: workoutModel && workoutModel.currentStreak >= 7 ? 700 : 1000;
easing.type: Easing.InOutSine
}
}
// Counter-rotation for variety
SequentialAnimation on rotation {
running: workoutModel && workoutModel.currentStreak >= 7
loops: Animation.Infinite
NumberAnimation { from: 0; to: -360; duration: 3500; easing.type: Easing.Linear }
}
}
}
// Motivational message
Text {
Layout.alignment: Qt.AlignHCenter
text: workoutModel ? workoutModel.streakMessage : ""
font.pixelSize: 14
font.italic: true
color: "white"
visible: workoutModel && workoutModel.streakMessage !== ""
opacity: 0.9
}
// Best streak (smaller text)
Text {
Layout.alignment: Qt.AlignHCenter
text: workoutModel ? "Personal best: " + workoutModel.longestStreak + " day" + (workoutModel.longestStreak !== 1 ? "s" : "") : ""
font.pixelSize: 12
color: "white"
visible: workoutModel && workoutModel.longestStreak > workoutModel.currentStreak && workoutModel.longestStreak > 0
opacity: 0.7
}
}
// Subtle shadow effect at the top
Rectangle {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: 2
gradient: Gradient {
GradientStop { position: 0.0; color: "#40000000" }
GradientStop { position: 1.0; color: "#00000000" }
}
}
}
// Calendar Popup
Popup {
id: calendarPopup
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: Math.min(parent.width * 0.9, 400)
height: Math.min(parent.height * 0.8, 500)
modal: true
focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
onOpened: {
// Refresh workout dates when calendar opens
if (workoutModel) {
calendar.workoutDates = workoutModel.getWorkoutDates()
console.log("Calendar opened, refreshed workout dates:", JSON.stringify(calendar.workoutDates))
}
}
background: Rectangle {
color: "white"
radius: 12
border.color: "#d0d0d0"
border.width: 1
// Shadow effect
Rectangle {
anchors.fill: parent
anchors.topMargin: 2
anchors.leftMargin: 2
radius: parent.radius
color: "#40000000"
z: -1
}
}
ColumnLayout {
anchors.fill: parent
anchors.margins: 16
spacing: 12
// Calendar Header
RowLayout {
Layout.fillWidth: true
Button {
text: "<"
onClicked: calendar.selectedDate = new Date(calendar.selectedDate.getFullYear(), calendar.selectedDate.getMonth() - 1, 1)
}
Text {
Layout.fillWidth: true
text: calendar.selectedDate.toLocaleDateString(Qt.locale(), "MMMM yyyy")
font.pixelSize: 18
font.bold: true
horizontalAlignment: Text.AlignHCenter
}
Button {
text: ">"
onClicked: calendar.selectedDate = new Date(calendar.selectedDate.getFullYear(), calendar.selectedDate.getMonth() + 1, 1)
}
}
// Calendar Grid
GridLayout {
id: calendar
Layout.fillWidth: true
Layout.fillHeight: true
columns: 7
property date selectedDate: new Date()
property var workoutDates: workoutModel ? workoutModel.getWorkoutDates() : []
// Debug: print workout dates when they change
onWorkoutDatesChanged: {
console.log("Calendar workout dates updated:", JSON.stringify(workoutDates))
}
// Day headers
Repeater {
model: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
Text {
Layout.fillWidth: true
Layout.preferredHeight: 30
text: modelData
font.bold: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "#666666"
}
}
// Calendar days
Repeater {
model: getCalendarDays()
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumHeight: 40
property date dayDate: modelData.date
property bool isCurrentMonth: modelData.currentMonth
property bool hasWorkout: modelData.hasWorkout
property bool isToday: dayDate.toDateString() === new Date().toDateString()
color: {
if (mouseArea.pressed) return "#e3f2fd"
if (isToday) return "#bbdefb"
if (!isCurrentMonth) return "#f5f5f5"
return "white"
}
border.color: isToday ? "#2196f3" : "#e0e0e0"
border.width: isToday ? 2 : 1
radius: 4
Column {
anchors.centerIn: parent
spacing: 2
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: dayDate.getDate()
color: isCurrentMonth ? "black" : "#cccccc"
font.pixelSize: 14
}
// Workout indicator dot
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: 8
height: 8
radius: 4
color: "#ff6b35"
visible: hasWorkout
border.width: 1
border.color: "#cc5529"
// Debug: log when a dot should be visible
Component.onCompleted: {
if (hasWorkout) {
console.log("Workout dot visible for date:", dayDate.toDateString())
}
}
}
}
MouseArea {
id: mouseArea
anchors.fill: parent
onClicked: {
if (isCurrentMonth) {
var year = dayDate.getFullYear();
var month = dayDate.getMonth() + 1; // i mesi JS sono 0-indicizzati
var day = dayDate.getDate();
var dateString = year + "-" + (month < 10 ? '0' + month : month) + "-" + (day < 10 ? '0' + day : day);
workoutModel.setDateFilter(dateString);
calendarPopup.close();
}
}
}
}
}
}
// Close button
Button {
Layout.alignment: Qt.AlignHCenter
text: "Close"
onClicked: calendarPopup.close()
}
}
}
// JavaScript functions for calendar
function getCalendarDays() {
var days = []
var firstDay = new Date(calendar.selectedDate.getFullYear(), calendar.selectedDate.getMonth(), 1)
var lastDay = new Date(calendar.selectedDate.getFullYear(), calendar.selectedDate.getMonth() + 1, 0)
var startDate = new Date(firstDay)
startDate.setDate(startDate.getDate() - firstDay.getDay()) // Go back to start of week
var workoutDates = calendar.workoutDates || []
console.log("getCalendarDays: workoutDates received:", JSON.stringify(workoutDates))
// workoutDates is now a QStringList (array of strings in format "yyyy-MM-dd")
var workoutDateStrings = workoutDates || []
console.log("Final workout date strings:", JSON.stringify(workoutDateStrings))
for (var i = 0; i < 42; i++) { // 6 rows x 7 days
var currentDate = new Date(startDate)
currentDate.setDate(startDate.getDate() + i)
// Costruisci la stringa YYYY-MM-DD dai componenti della data locale per evitare problemi di fuso orario
var year = currentDate.getFullYear();
var month = currentDate.getMonth() + 1; // i mesi JS sono 0-indicizzati
var day = currentDate.getDate();
var localDateString = year + "-" + (month < 10 ? '0' + month : month) + "-" + (day < 10 ? '0' + day : day);
var hasWorkout = workoutDateStrings.indexOf(localDateString) !== -1;
if (hasWorkout) {
// Questo console.log ora utilizza la stringa della data locale corretta per la corrispondenza
console.log("Found workout match for:", localDateString);
}
var isCurrentMonth = currentDate.getMonth() === calendar.selectedDate.getMonth()
days.push({
date: currentDate,
currentMonth: isCurrentMonth,
hasWorkout: hasWorkout
})
}
console.log("getCalendarDays: returning", days.length, "days")
return days
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="org.cagnulen.qdomyoszwift" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:versionName="2.20.4" android:versionCode="1126" android:installLocation="auto">
<manifest package="org.cagnulen.qdomyoszwift" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:versionName="2.20.15" android:versionCode="1210" android:installLocation="auto">
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
<!-- %%INSERT_PERMISSIONS -->

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -7,9 +7,13 @@ import android.content.IntentFilter;
import android.media.AudioManager;
import org.cagnulen.qdomyoszwift.QLog;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
public class MediaButtonReceiver extends BroadcastReceiver {
private static MediaButtonReceiver instance;
private static final int TARGET_VOLUME = 7; // Middle volume value for infinite gear changes
private static boolean restoringVolume = false; // Flag to prevent recursion
@Override
public void onReceive(Context context, Intent intent) {
@@ -21,8 +25,30 @@ public class MediaButtonReceiver extends BroadcastReceiver {
int currentVolume = intent.getIntExtra("android.media.EXTRA_VOLUME_STREAM_VALUE", -1);
int previousVolume = intent.getIntExtra("android.media.EXTRA_PREV_VOLUME_STREAM_VALUE", -1);
QLog.d("MediaButtonReceiver", "Volume changed. Current: " + currentVolume + ", Max: " + maxVolume);
QLog.d("MediaButtonReceiver", "Volume changed. Current: " + currentVolume + ", Previous: " + previousVolume + ", Max: " + maxVolume + ", Restoring: " + restoringVolume);
// If we're restoring volume, skip processing and reset flag
if (restoringVolume) {
QLog.d("MediaButtonReceiver", "Volume restore completed");
restoringVolume = false;
return;
}
// Process the gear change
nativeOnMediaButtonEvent(previousVolume, currentVolume, maxVolume);
// Auto-restore volume to middle value after a short delay to enable infinite gear changes
if (currentVolume != TARGET_VOLUME) {
final AudioManager am = audioManager;
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
QLog.d("MediaButtonReceiver", "Auto-restoring volume to: " + TARGET_VOLUME);
restoringVolume = true;
am.setStreamVolume(AudioManager.STREAM_MUSIC, TARGET_VOLUME, 0);
}
}, 100); // 100ms delay to ensure gear change is processed first
}
}
}
@@ -54,7 +80,25 @@ public class MediaButtonReceiver extends BroadcastReceiver {
}
}
QLog.d("MediaButtonReceiver", "Receiver registered successfully");
// Initialize volume to target value for gear control
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
if (audioManager != null) {
int currentVolume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
if (currentVolume != TARGET_VOLUME) {
QLog.d("MediaButtonReceiver", "Initializing volume to: " + TARGET_VOLUME);
restoringVolume = true;
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, TARGET_VOLUME, 0);
// Reset flag after initialization
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
restoringVolume = false;
}
}, 200);
}
}
} catch (IllegalArgumentException e) {
QLog.e("MediaButtonReceiver", "Invalid arguments for receiver registration: " + e.getMessage());
} catch (Exception e) {

View File

@@ -211,8 +211,9 @@ public class SDMChannelController {
payload[1] = (byte) (((lastTime % 256000) / 5) & 0xFF);
payload[2] = (byte) ((lastTime % 256000) / 1000);
payload[3] = (byte) 0x00;
payload[4] = (byte) speedM_s;
payload[5] = (byte) ((speedM_s - (double)((int)speedM_s)) / (1.0/256.0));
int speedFixed = (int) Math.round(speedM_s * 256.0);
payload[4] = (byte) (speedFixed & 0xFF); // low byte
payload[5] = (byte) ((speedFixed >> 8) & 0xFF); // high byte
payload[6] = (byte) stride_count++; // bad but it works on zwift
payload[7] = (byte) ((double)deltaTime * 0.03125);

View File

@@ -43,7 +43,11 @@ public class Usbserial {
static int lastReadLen = 0;
public static void open(Context context) {
QLog.d("QZ","UsbSerial open");
open(context, 2400); // Default baud rate for Computrainer
}
public static void open(Context context, int baudRate) {
QLog.d("QZ","UsbSerial open with baud rate: " + baudRate);
// Find all available drivers from attached devices.
UsbManager manager = (UsbManager) context.getSystemService(Context.USB_SERVICE);
List<UsbSerialDriver> availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(manager);
@@ -98,13 +102,12 @@ public class Usbserial {
port = driver.getPorts().get(0); // Most devices have just one port (port 0)
try {
port.open(connection);
port.setParameters(2400, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE);
port.setParameters(baudRate, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE);
QLog.d("QZ","UsbSerial port opened successfully at " + baudRate + " baud");
}
catch (IOException e) {
// Do something here
QLog.d("QZ","UsbSerial port open failed: " + e.getMessage());
}
QLog.d("QZ","UsbSerial port opened");
}
public static void write (byte[] bytes) {

View File

@@ -0,0 +1,6 @@
#ifndef BLUETOOTHDEVICETYPE_H
#define BLUETOOTHDEVICETYPE_H
enum BLUETOOTH_TYPE { UNKNOWN = 0, TREADMILL, BIKE, ROWING, ELLIPTICAL, JUMPROPE, STAIRCLIMBER };
#endif // BLUETOOTHDEVICETYPE_H

View File

@@ -5,7 +5,7 @@ CharacteristicNotifier2A53::CharacteristicNotifier2A53(bluetoothdevice *Bike, QO
: CharacteristicNotifier(0x2a53, parent), Bike(Bike) {}
int CharacteristicNotifier2A53::notify(QByteArray &value) {
bluetoothdevice::BLUETOOTH_TYPE dt = Bike->deviceType();
BLUETOOTH_TYPE dt = Bike->deviceType();
value.append(0x02); // total distance
uint16_t speed = Bike->currentSpeed().value() / 3.6 * 256;
uint32_t distance = Bike->odometer() * 10000.0;

View File

@@ -8,7 +8,7 @@ int CharacteristicNotifier2A63::notify(QByteArray &value) {
if (normalizeWattage < 0)
normalizeWattage = 0;
if (Bike->deviceType() == bluetoothdevice::BIKE) {
if (Bike->deviceType() == BIKE) {
/*
// set measurement
measurement[2] = power & 0xFF;

View File

@@ -7,9 +7,9 @@ CharacteristicNotifier2ACD::CharacteristicNotifier2ACD(bluetoothdevice *Bike, QO
: CharacteristicNotifier(0x2acd, parent), Bike(Bike) {}
int CharacteristicNotifier2ACD::notify(QByteArray &value) {
bluetoothdevice::BLUETOOTH_TYPE dt = Bike->deviceType();
if (dt == bluetoothdevice::TREADMILL || dt == bluetoothdevice::ELLIPTICAL) {
value.append(0x0C); // Inclination available and distance for peloton
BLUETOOTH_TYPE dt = Bike->deviceType();
if (dt == TREADMILL || dt == ELLIPTICAL) {
value.append(0x0E); // Inclination, distance and average speed available
//value.append((char)0x01); // heart rate available
value.append((char)0x05); // HeartRate(8) | ElapsedTime(10)
@@ -19,7 +19,26 @@ int CharacteristicNotifier2ACD::notify(QByteArray &value) {
QByteArray speedBytes;
speedBytes.append(b);
speedBytes.append(a);
// average speed in 0.01 km/h (distance from startup / elapsed time)
double elapsed_time_seconds = 0.0;
uint16_t averageSpeed = 0;
{
QTime sessionElapsedTime = Bike->elapsedTime();
elapsed_time_seconds = (double)sessionElapsedTime.hour() * 3600.0 +
(double)sessionElapsedTime.minute() * 60.0 +
(double)sessionElapsedTime.second() +
(double)sessionElapsedTime.msec() / 1000.0;
if (elapsed_time_seconds > 0) {
double distance_m = Bike->odometerFromStartup() * 1000.0;
double avg_kmh = (distance_m * 3.6) / elapsed_time_seconds;
averageSpeed = (uint16_t)qRound(avg_kmh * 100.0);
}
}
QByteArray averageSpeedBytes;
averageSpeedBytes.append(static_cast<char>(averageSpeed & 0xFF));
averageSpeedBytes.append(static_cast<char>((averageSpeed >> 8) & 0xFF));
// peloton wants the distance from the qz startup to handle stacked classes
// https://github.com/cagnulein/qdomyos-zwift/issues/2018
uint32_t normalizeDistance = (uint32_t)qRound(Bike->odometerFromStartup() * 1000);
@@ -46,7 +65,7 @@ int CharacteristicNotifier2ACD::notify(QByteArray &value) {
inclination /= gain;
}
if (dt == bluetoothdevice::TREADMILL)
if (dt == TREADMILL)
normalizeIncline = (uint32_t)qRound(inclination * 10);
a = (normalizeIncline >> 8) & 0XFF;
b = normalizeIncline & 0XFF;
@@ -54,28 +73,22 @@ int CharacteristicNotifier2ACD::notify(QByteArray &value) {
inclineBytes.append(b);
inclineBytes.append(a);
double ramp = 0;
if (dt == bluetoothdevice::TREADMILL)
if (dt == TREADMILL)
ramp = qRadiansToDegrees(qAtan(inclination / 100));
int16_t normalizeRamp = (int32_t)qRound(ramp * 10);
int16_t normalizeRamp = (int16_t)qRound(ramp * 10);
a = (normalizeRamp >> 8) & 0XFF;
b = normalizeRamp & 0XFF;
QByteArray rampBytes;
rampBytes.append(b);
rampBytes.append(a);
// Get session elapsed time - makes Runna calculations work
QTime sessionElapsedTime = Bike->elapsedTime();
double elapsed_time_seconds =
(double)sessionElapsedTime.hour() * 3600.0 +
(double)sessionElapsedTime.minute() * 60.0 +
(double)sessionElapsedTime.second() +
(double)sessionElapsedTime.msec() / 1000.0;
uint16_t ftms_elapsed_time_field = (uint16_t)qRound(elapsed_time_seconds);
QByteArray elapsedBytes;
elapsedBytes.append(static_cast<char>(ftms_elapsed_time_field & 0xFF));
elapsedBytes.append(static_cast<char>((ftms_elapsed_time_field >> 8) & 0xFF));
value.append(speedBytes); // Actual value.
value.append(averageSpeedBytes); // Average speed value.
value.append(distanceBytes); // Actual value.

View File

@@ -8,12 +8,12 @@ CharacteristicNotifier2AD2::CharacteristicNotifier2AD2(bluetoothdevice *Bike, QO
: CharacteristicNotifier(0x2ad2, parent), Bike(Bike) {}
int CharacteristicNotifier2AD2::notify(QByteArray &value) {
bluetoothdevice::BLUETOOTH_TYPE dt = Bike->deviceType();
BLUETOOTH_TYPE dt = Bike->deviceType();
QSettings settings;
bool virtual_device_rower =
settings.value(QZSettings::virtual_device_rower, QZSettings::default_virtual_device_rower).toBool();
bool rowerAsABike = !virtual_device_rower && dt == bluetoothdevice::ROWING;
bool rowerAsABike = !virtual_device_rower && dt == ROWING;
bool double_cadence = settings.value(QZSettings::powr_sensor_running_cadence_double, QZSettings::default_powr_sensor_running_cadence_double).toBool();
double cadence_multiplier = 2.0;
if (double_cadence)
@@ -24,7 +24,7 @@ int CharacteristicNotifier2AD2::notify(QByteArray &value) {
if (normalizeWattage < 0)
normalizeWattage = 0;
if (dt == bluetoothdevice::BIKE || rowerAsABike) {
if (dt == BIKE || rowerAsABike) {
uint16_t normalizeSpeed = (uint16_t)qRound(Bike->currentSpeed().value() * 100);
value.append((char)0x64); // speed, inst. cadence, resistance lvl, instant power
value.append((char)0x02); // heart rate
@@ -44,7 +44,7 @@ int CharacteristicNotifier2AD2::notify(QByteArray &value) {
value.append(char(Bike->currentHeart().value())); // Actual value.
value.append((char)0); // Bkool FTMS protocol HRM offset 1280 fix
return CN_OK;
} else if (dt == bluetoothdevice::TREADMILL || dt == bluetoothdevice::ELLIPTICAL || dt == bluetoothdevice::ROWING) {
} else if (dt == TREADMILL || dt == ELLIPTICAL || dt == ROWING) {
uint16_t normalizeSpeed = (uint16_t)qRound(Bike->currentSpeed().value() * 100);
value.append((char)0x64); // speed, inst. cadence, resistance lvl, instant power
value.append((char)0x02); // heart rate
@@ -53,11 +53,11 @@ int CharacteristicNotifier2AD2::notify(QByteArray &value) {
value.append((char)(normalizeSpeed >> 8) & 0xFF); // speed
uint16_t cadence = 0;
if (dt == bluetoothdevice::ELLIPTICAL)
if (dt == ELLIPTICAL)
cadence = ((elliptical *)Bike)->currentCadence().value();
else if (dt == bluetoothdevice::TREADMILL)
else if (dt == TREADMILL)
cadence = ((treadmill *)Bike)->currentCadence().value();
else if (dt == bluetoothdevice::ROWING)
else if (dt == ROWING)
cadence = ((rower *)Bike)->currentCadence().value();
value.append((char)((uint16_t)(cadence * cadence_multiplier) & 0xFF)); // cadence

View File

@@ -10,7 +10,7 @@ CharacteristicWriteProcessor::CharacteristicWriteProcessor(double bikeResistance
void CharacteristicWriteProcessor::changePower(uint16_t power) { Bike->changePower(power); }
void CharacteristicWriteProcessor::changeSlope(int16_t iresistance, uint8_t crr, uint8_t cw) {
bluetoothdevice::BLUETOOTH_TYPE dt = Bike->deviceType();
BLUETOOTH_TYPE dt = Bike->deviceType();
QSettings settings;
bool force_resistance =
settings.value(QZSettings::virtualbike_forceresistance, QZSettings::default_virtualbike_forceresistance)
@@ -64,7 +64,7 @@ void CharacteristicWriteProcessor::changeSlope(int16_t iresistance, uint8_t crr,
qDebug() << "changeSlope CRR = " << fCRR << CRR_offset << "CW = " << fCW;
if (dt == bluetoothdevice::BIKE) {
if (dt == BIKE) {
// if the bike doesn't have the inclination by hardware, i'm simulating inclination with the value received
// from Zwift
@@ -82,9 +82,9 @@ void CharacteristicWriteProcessor::changeSlope(int16_t iresistance, uint8_t crr,
Bike->changeResistance((resistance_t)(round(resistance * bikeResistanceGain)) + bikeResistanceOffset + 1 +
CRR_offset + CW_offset); // resistance start from 1
}
} else if (dt == bluetoothdevice::TREADMILL) {
} else if (dt == TREADMILL) {
emit changeInclination(grade, percentage);
} else if (dt == bluetoothdevice::ELLIPTICAL) {
} else if (dt == ELLIPTICAL) {
bool inclinationAvailableByHardware = ((elliptical *)Bike)->inclinationAvailableByHardware();
qDebug() << "inclinationAvailableByHardware" << inclinationAvailableByHardware << "erg_mode" << erg_mode;
emit changeInclination(grade, percentage);

View File

@@ -14,7 +14,7 @@ class CharacteristicWriteProcessor : public QObject {
public:
int8_t bikeResistanceOffset = 4;
double bikeResistanceGain = 1.0;
bluetoothdevice *Bike;
bluetoothdevice *Bike = nullptr;
explicit CharacteristicWriteProcessor(double bikeResistanceGain, int8_t bikeResistanceOffset,
bluetoothdevice *bike, QObject *parent = nullptr);

View File

@@ -31,7 +31,7 @@ CharacteristicWriteProcessor0003::VarintResult CharacteristicWriteProcessor0003:
}
double CharacteristicWriteProcessor0003::currentGear() {
if(zwiftGearReceived)
if(zwiftGearReceived || !((bike*)Bike))
return currentZwiftGear;
else
return ((bike*)Bike)->gears();

View File

@@ -13,8 +13,8 @@ CharacteristicWriteProcessor2AD9::CharacteristicWriteProcessor2AD9(double bikeRe
int CharacteristicWriteProcessor2AD9::writeProcess(quint16 uuid, const QByteArray &data, QByteArray &reply) {
if (data.size()) {
bluetoothdevice::BLUETOOTH_TYPE dt = Bike->deviceType();
if (dt == bluetoothdevice::BIKE) {
BLUETOOTH_TYPE dt = Bike->deviceType();
if (dt == BIKE || dt == ROWING) {
QSettings settings;
bool force_resistance =
settings.value(QZSettings::virtualbike_forceresistance, QZSettings::default_virtualbike_forceresistance)
@@ -82,7 +82,7 @@ int CharacteristicWriteProcessor2AD9::writeProcess(quint16 uuid, const QByteArra
reply.append((quint8)cmd);
reply.append((quint8)FTMS_NOT_SUPPORTED);
}
} else if (dt == bluetoothdevice::TREADMILL || dt == bluetoothdevice::ELLIPTICAL) {
} else if (dt == TREADMILL || dt == ELLIPTICAL) {
char a, b;
if ((char)data.at(0) == 0x02) {
// Set Target Speed
@@ -91,7 +91,7 @@ int CharacteristicWriteProcessor2AD9::writeProcess(quint16 uuid, const QByteArra
uint16_t uspeed = a + (((uint16_t)b) << 8);
double requestSpeed = (double)uspeed / 100.0;
if (dt == bluetoothdevice::TREADMILL) {
if (dt == TREADMILL) {
((treadmill *)Bike)->changeSpeed(requestSpeed);
}
qDebug() << QStringLiteral("new requested speed ") + QString::number(requestSpeed);
@@ -103,10 +103,10 @@ int CharacteristicWriteProcessor2AD9::writeProcess(quint16 uuid, const QByteArra
int16_t sincline = a + (((int16_t)b) << 8);
double requestIncline = (double)sincline / 10.0;
if (dt == bluetoothdevice::TREADMILL)
if (dt == TREADMILL)
((treadmill *)Bike)->changeInclination(requestIncline, requestIncline);
// Resistance as incline on Sole E95s Elliptical #419
else if (dt == bluetoothdevice::ELLIPTICAL) {
else if (dt == ELLIPTICAL) {
if(((elliptical *)Bike)->inclinationAvailableByHardware())
((elliptical *)Bike)->changeInclination(requestIncline, requestIncline);
else

View File

@@ -13,8 +13,8 @@ CharacteristicWriteProcessorE005::CharacteristicWriteProcessorE005(double bikeRe
int CharacteristicWriteProcessorE005::writeProcess(quint16 uuid, const QByteArray &data, QByteArray &reply) {
if (data.size()) {
bluetoothdevice::BLUETOOTH_TYPE dt = Bike->deviceType();
if (dt == bluetoothdevice::BIKE) {
BLUETOOTH_TYPE dt = Bike->deviceType();
if (dt == BIKE) {
char cmd = data.at(0);
emit ftmsCharacteristicChanged(QLowEnergyCharacteristic(), data);
if (cmd == wahookickrsnapbike::_setSimMode && data.count() >= 7) {
@@ -35,7 +35,7 @@ int CharacteristicWriteProcessorE005::writeProcess(quint16 uuid, const QByteArra
qDebug() << "erg mode" << watts;
changePower(watts);
}
} else if (dt == bluetoothdevice::TREADMILL || dt == bluetoothdevice::ELLIPTICAL) {
} else if (dt == TREADMILL || dt == ELLIPTICAL) {
}
reply.append((quint8)FTMS_RESPONSE_CODE);
reply.append((quint8)data.at(0));

View File

@@ -16,7 +16,7 @@ using namespace std::chrono_literals;
activiotreadmill::activiotreadmill(uint32_t pollDeviceTime, bool noConsole, bool noHeartService, double forceInitSpeed,
double forceInitInclination) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
this->noConsole = noConsole;
this->noHeartService = noHeartService;

View File

@@ -17,7 +17,7 @@
using namespace std::chrono_literals;
android_antbike::android_antbike(bool noWriteResistance, bool noHeartService, bool noVirtualDevice) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;

View File

@@ -17,7 +17,7 @@
using namespace std::chrono_literals;
antbike::antbike(bool noWriteResistance, bool noHeartService, bool noVirtualDevice) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;
@@ -132,7 +132,7 @@ void antbike::update() {
bool ios_peloton_workaround =
settings.value(QZSettings::ios_peloton_workaround, QZSettings::default_ios_peloton_workaround).toBool();
if (ios_peloton_workaround && cadence && h && firstStateChanged) {
h->virtualbike_setCadence(currentCrankRevolutions(), lastCrankEventTime());
h->virtualbike_setCadence(currentCrankRevolutions(), lastCrankEventTime());
h->virtualbike_setHeartRate((uint8_t)metrics_override_heartrate());
}
#endif

View File

@@ -14,7 +14,7 @@ using namespace std::chrono_literals;
apexbike::apexbike(bool noWriteResistance, bool noHeartService, int8_t bikeResistanceOffset,
double bikeResistanceGain) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;
@@ -146,11 +146,21 @@ void apexbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
lastPacket = newValue;
if (newValue.length() == 10 && newValue.at(2) == 0x31) {
Resistance = newValue.at(5);
// Invert resistance: bike resistance 1-32 maps to app display 32-1
uint8_t rawResistance = newValue.at(5);
Resistance = 33 - rawResistance; // Invert: 1->32, 32->1
emit resistanceRead(Resistance.value());
m_pelotonResistance = Resistance.value();
qDebug() << QStringLiteral("Current resistance: ") + QString::number(Resistance.value());
// Parse cadence from 5th byte (index 4) and multiply by 2
uint8_t rawCadence = newValue.at(4);
if (settings.value(QZSettings::cadence_sensor_name, QZSettings::default_cadence_sensor_name)
.toString()
.startsWith(QStringLiteral("Disabled"))) {
Cadence = rawCadence * 2;
}
qDebug() << QStringLiteral("Raw resistance: ") + QString::number(rawResistance) + QStringLiteral(", Inverted resistance: ") + QString::number(Resistance.value()) + QStringLiteral(", Raw cadence: ") + QString::number(rawCadence) + QStringLiteral(", Final cadence: ") + QString::number(Cadence.value());
}
if (newValue.length() != 10 || newValue.at(2) != 0x31) {
@@ -160,41 +170,13 @@ void apexbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
uint16_t distanceData = (newValue.at(7) << 8) | ((uint8_t)newValue.at(8));
double distance = ((double)distanceData);
if(distance != lastDistance) {
if(lastDistance != 0) {
double deltaDistance = distance - lastDistance;
double deltaTime = fabs(now.msecsTo(lastTS));
double timeHours = deltaTime / (1000.0 * 60.0 * 60.0);
double k = 0.005333;
if (!settings.value(QZSettings::speed_power_based, QZSettings::default_speed_power_based).toBool()) {
Speed = (deltaDistance *k) / timeHours; // Speed in distance units per hour
} else {
Speed = metric::calculateSpeedFromPower(
watts(), Inclination.value(), Speed.value(),
fabs(now.msecsTo(Speed.lastChanged()) / 1000.0), this->speedLimit());
}
if (settings.value(QZSettings::cadence_sensor_name, QZSettings::default_cadence_sensor_name)
.toString()
.startsWith(QStringLiteral("Disabled"))) {
Cadence = Speed.value() / 0.37497622;
}
}
lastDistance = distance;
lastTS = now;
qDebug() << "lastDistance" << lastDistance << "lastTS" << lastTS;
// Calculate speed using the same method as echelon bike
if (!settings.value(QZSettings::speed_power_based, QZSettings::default_speed_power_based).toBool()) {
Speed = 0.37497622 * ((double)Cadence.value());
} else {
// Check if speed and cadence should be reset due to timeout (2 seconds)
if (lastTS.msecsTo(now) > 2000) {
if (Speed.value() > 0) {
Speed = 0;
qDebug() << "Speed reset to 0 due to timeout";
}
if (Cadence.value() > 0) {
Cadence = 0;
qDebug() << "Cadence reset to 0 due to timeout";
}
lastTS = now;
}
Speed = metric::calculateSpeedFromPower(
watts(), Inclination.value(), Speed.value(),
fabs(now.msecsTo(Speed.lastChanged()) / 1000.0), this->speedLimit());
}
if (watts())
@@ -232,7 +214,7 @@ void apexbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
bool ios_peloton_workaround =
settings.value(QZSettings::ios_peloton_workaround, QZSettings::default_ios_peloton_workaround).toBool();
if (ios_peloton_workaround && cadence && h && firstStateChanged) {
h->virtualbike_setCadence(currentCrankRevolutions(), lastCrankEventTime());
h->virtualbike_setCadence(currentCrankRevolutions(), lastCrankEventTime());
h->virtualbike_setHeartRate((uint8_t)metrics_override_heartrate());
}
#endif
@@ -429,7 +411,98 @@ bool apexbike::connected() {
return m_control->state() == QLowEnergyController::DiscoveredState;
}
uint16_t apexbike::watts() { return wattFromHR(true); }
uint16_t apexbike::watts() {
double resistance = Resistance.value();
double cadence = Cadence.value();
if (cadence <= 0 || resistance <= 0) {
return 0;
}
// Power table based on user-provided data
// Format: resistance level (1-19), RPM (10-150 in steps of 10), power (watts)
static const int powerTable[19][15] = {
// Resistance 1: RPM 10,20,30,40,50,60,70,80,90,100,110,120,130,140,150
{12, 24, 36, 48, 61, 73, 85, 97, 109, 121, 133, 145, 157, 170, 182},
// Resistance 2
{13, 27, 40, 53, 67, 80, 93, 107, 120, 133, 147, 160, 173, 187, 200},
// Resistance 3
{15, 29, 44, 58, 73, 87, 102, 117, 131, 146, 160, 175, 189, 204, 219},
// Resistance 4
{16, 32, 48, 64, 80, 95, 111, 127, 143, 159, 175, 191, 207, 223, 239},
// Resistance 5
{17, 34, 51, 68, 85, 102, 118, 135, 152, 169, 186, 203, 220, 237, 254},
// Resistance 6
{18, 37, 55, 74, 92, 110, 129, 147, 165, 184, 202, 221, 239, 257, 276},
// Resistance 7
{19, 39, 58, 77, 97, 116, 136, 155, 174, 194, 213, 232, 252, 271, 291},
// Resistance 8
{21, 42, 62, 83, 104, 125, 146, 166, 187, 208, 229, 250, 271, 291, 312},
// Resistance 9
{22, 44, 66, 88, 110, 132, 154, 176, 198, 220, 242, 264, 286, 308, 330},
// Resistance 10
{23, 46, 69, 92, 116, 139, 162, 185, 208, 231, 254, 277, 300, 324, 347},
// Resistance 11
{24, 49, 73, 98, 122, 146, 171, 195, 219, 244, 268, 293, 317, 341, 366},
// Resistance 12
{26, 51, 77, 102, 128, 153, 179, 204, 230, 255, 281, 307, 332, 358, 383},
// Resistance 13
{27, 54, 80, 107, 134, 161, 188, 214, 241, 268, 295, 322, 348, 375, 402},
// Resistance 14
{28, 56, 83, 111, 139, 167, 195, 222, 250, 278, 306, 334, 362, 389, 417},
// Resistance 15
{29, 58, 87, 117, 146, 175, 204, 233, 262, 292, 321, 350, 379, 408, 437},
// Resistance 16
{30, 61, 91, 121, 152, 182, 212, 242, 273, 303, 333, 364, 394, 424, 455},
// Resistance 17
{32, 63, 95, 126, 158, 189, 221, 253, 284, 316, 347, 379, 410, 442, 473},
// Resistance 18
{33, 66, 99, 132, 165, 198, 231, 264, 297, 330, 363, 396, 429, 462, 495},
// Resistance 19
{34, 68, 102, 136, 171, 205, 239, 273, 307, 341, 375, 409, 443, 478, 512}
};
// Clamp resistance to valid range (1-19)
int res = qMax(1, qMin(19, (int)qRound(resistance)));
// Convert to array index (0-18)
int resIndex = res - 1;
// RPM ranges from 10 to 150 in steps of 10
// Find the two closest RPM values for interpolation
double rpm = qMax(1.0, cadence); // Ensure RPM is at least 1
if (rpm <= 10.0) {
// Below minimum RPM, extrapolate from first data point
double factor = rpm / 10.0;
return (uint16_t)qMax(0.0, powerTable[resIndex][0] * factor);
}
if (rpm >= 150.0) {
// Above maximum RPM, extrapolate from last data point
double factor = rpm / 150.0;
return (uint16_t)qMax(0.0, powerTable[resIndex][14] * factor);
}
// Find the two RPM values to interpolate between
// RPM values are: 10, 20, 30, ..., 150 (indices 0-14)
int lowerRpmIndex = ((int)rpm - 1) / 10; // Convert RPM to array index
if (lowerRpmIndex > 13) lowerRpmIndex = 13; // Ensure we don't go out of bounds
int upperRpmIndex = lowerRpmIndex + 1;
double lowerRpm = (lowerRpmIndex + 1) * 10.0; // Convert index back to RPM
double upperRpm = (upperRpmIndex + 1) * 10.0;
int lowerPower = powerTable[resIndex][lowerRpmIndex];
int upperPower = powerTable[resIndex][upperRpmIndex];
// Linear interpolation between the two power values
double ratio = (rpm - lowerRpm) / (upperRpm - lowerRpm);
double interpolatedPower = lowerPower + ratio * (upperPower - lowerPower);
return (uint16_t)qMax(0.0, interpolatedPower);
}
void apexbike::controllerStateChanged(QLowEnergyController::ControllerState state) {
qDebug() << QStringLiteral("controllerStateChanged") << state;

View File

@@ -19,7 +19,7 @@ using namespace std::chrono_literals;
bhfitnesselliptical::bhfitnesselliptical(bool noWriteResistance, bool noHeartService, int8_t bikeResistanceOffset,
double bikeResistanceGain) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;

View File

@@ -3,6 +3,7 @@
#include "qdebugfixup.h"
#include "homeform.h"
#include <QSettings>
#include <cmath>
bike::bike() { elapsed.setType(metric::METRIC_ELAPSED); }
@@ -70,6 +71,11 @@ void bike::changePower(int32_t power) {
settings.value(QZSettings::zwift_erg_filter, QZSettings::default_zwift_erg_filter).toDouble();
double erg_filter_lower =
settings.value(QZSettings::zwift_erg_filter_down, QZSettings::default_zwift_erg_filter_down).toDouble();
// Apply bike power offset
int bike_power_offset = settings.value(QZSettings::bike_power_offset, QZSettings::default_bike_power_offset).toInt();
power += bike_power_offset;
qDebug() << QStringLiteral("changePower: original power with offset applied: ") + QString::number(power) + QStringLiteral(" (offset: ") + QString::number(bike_power_offset) + QStringLiteral(")");
requestPower = power; // used by some bikes that have ERG mode builtin
@@ -115,27 +121,60 @@ void bike::setGears(double gears) {
gears -= gears_offset;
qDebug() << "setGears" << gears;
// Check for boundaries and emit failure signals
// Gear boundary handling with smart clamping logic:
// - If we're trying to set a gear outside valid range AND we're already at a valid gear,
// reject the change (normal case: user at gear 1 tries to go to 0.5, should fail)
// - If we're trying to set a gear outside valid range BUT we're currently below minimum,
// clamp to valid range (startup case: system starts at 0, first gearUp with 0.5 gain
// goes to 0.5, should be clamped to 1 to allow the system to reach valid state)
// This prevents the system from getting stuck below minGears due to fractional gains
// while preserving normal boundary rejection behavior for users at valid gear positions
if(gears_zwift_ratio && (gears > 24 || gears < 1)) {
qDebug() << "new gear value ignored because of gears_zwift_ratio setting!";
if(gears > 24) {
emit gearFailedUp();
if(m_gears >= 24) {
qDebug() << "new gear value ignored - already at zwift ratio maximum: 24";
emit gearFailedUp();
return;
} else {
qDebug() << "gear value clamped to zwift ratio maximum: 24";
gears = 24;
emit gearFailedUp();
}
} else {
emit gearFailedDown();
if(m_gears >= 1) {
qDebug() << "new gear value ignored - already at zwift ratio minimum: 1";
emit gearFailedDown();
return;
} else {
qDebug() << "gear value clamped to zwift ratio minimum: 1";
gears = 1;
emit gearFailedDown();
}
}
return;
}
if(gears > maxGears()) {
qDebug() << "new gear value ignored because of maxGears" << maxGears();
emit gearFailedUp();
return;
if(m_gears >= maxGears()) {
qDebug() << "new gear value ignored - already at maxGears" << maxGears();
emit gearFailedUp();
return;
} else {
qDebug() << "gear value clamped to maxGears" << maxGears();
gears = maxGears();
emit gearFailedUp();
}
}
if(gears < minGears()) {
qDebug() << "new gear value ignored because of minGears" << minGears();
emit gearFailedDown();
return;
if(m_gears >= minGears()) {
qDebug() << "new gear value ignored - already at or above minGears" << minGears();
emit gearFailedDown();
return;
} else {
qDebug() << "gear value clamped to minGears" << minGears();
gears = minGears();
emit gearFailedDown();
}
}
if(m_gears > gears) {
@@ -173,7 +212,7 @@ resistance_t bike::resistanceFromPowerRequest(uint16_t power) { return power / 1
void bike::cadenceSensor(uint8_t cadence) { Cadence.setValue(cadence); }
void bike::powerSensor(uint16_t power) { m_watt.setValue(power, false); }
bluetoothdevice::BLUETOOTH_TYPE bike::deviceType() { return bluetoothdevice::BIKE; }
BLUETOOTH_TYPE bike::deviceType() { return BIKE; }
void bike::clearStats() {
@@ -343,6 +382,8 @@ uint8_t bike::metrics_override_heartrate() {
bool bike::inclinationAvailableByHardware() { return false; }
bool bike::inclinationAvailableBySoftware() { return false; }
uint16_t bike::wattFromHR(bool useSpeedAndCadence) {
QSettings settings;
double watt = 0;
@@ -428,7 +469,136 @@ double bike::gearsZwiftRatio() {
case 23:
return 5.14;
case 24:
return 5.49;
return 5.49;
}
return 1;
}
// Sim mode support: Physics-based power calculation from slope gradient
double bike::computeSlopeTargetPower(double gradePercent, double speedKmh) {
QSettings settings;
const double riderWeight = settings.value(QZSettings::weight, QZSettings::default_weight).toDouble();
const double bikeWeight = settings.value(QZSettings::bike_weight, QZSettings::default_bike_weight).toDouble();
const double rollingCoeff = settings.value(QZSettings::rolling_resistance, QZSettings::default_rolling_resistance).toDouble();
double totalMass = riderWeight + bikeWeight;
if (!std::isfinite(totalMass) || totalMass < 1.0) {
totalMass = 75.0 + 10.0; // fallback to reasonable defaults
}
double speedMs = speedKmh / 3.6; // convert km/h to m/s
if (!std::isfinite(speedMs) || speedMs < 0.0) {
speedMs = 0.0;
}
// Calculate slope angle components
const double slope = gradePercent / 100.0;
const double denom = std::sqrt(1.0 + slope * slope);
const double sinTheta = (denom > 0.0) ? (slope / denom) : 0.0;
const double cosTheta = (denom > 0.0) ? (1.0 / denom) : 1.0;
const double g = 9.80665; // m/s² - gravitational acceleration
// 1. Gravitational resistance (climbing/descending)
double powerGravity = totalMass * g * speedMs * sinTheta;
// 2. Rolling resistance
double powerRolling = totalMass * g * rollingCoeff * speedMs * cosTheta;
// 3. Aerodynamic resistance
const double airDensity = 1.204; // kg/m³ at 20°C
const double dragCoefficient = 0.4; // Cd - typical cycling position
const double frontalArea = 1.0; // m² - approximate frontal area
double cda = dragCoefficient * frontalArea;
double powerAerodynamic = 0.5 * airDensity * cda * std::pow(std::max(0.0, speedMs), 3);
// Total power required
double totalPower = powerGravity + powerRolling + powerAerodynamic;
if (!std::isfinite(totalPower)) {
totalPower = 0.0;
}
if (totalPower < 0.0) {
totalPower = 0.0;
}
qDebug() << "computeSlopeTargetPower grade%:" << gradePercent
<< "speedKmh:" << speedKmh
<< "powerGravity:" << powerGravity
<< "powerRolling:" << powerRolling
<< "powerAero:" << powerAerodynamic
<< "total:" << totalPower;
return totalPower;
}
// Helper: get current speed for slope calculations with fallback to cadence-based estimation
double bike::getCurrentSpeedForSlope() {
double speedKmh = Speed.value();
if (!std::isfinite(speedKmh) || speedKmh < 0.0) {
speedKmh = 0.0;
}
// If speed is very low, estimate from cadence
if (speedKmh < 5.0) {
double cadence = Cadence.value();
if (std::isfinite(cadence) && cadence > 0.0) {
// Rough approximation: 90 RPM ≈ 27 km/h
speedKmh = std::max(0.5, cadence * 0.3);
}
}
return speedKmh;
}
// Update power target based on current slope and speed
void bike::updateSlopeTargetPower(bool force) {
qDebug() << "updateSlopeTargetPower called - force:" << force
<< "autoRes:" << autoResistance()
<< "slopeEnabled:" << m_slopeControlEnabled
<< "currentGrade:" << m_currentSlopePercent;
if (!autoResistance()) {
qDebug() << "updateSlopeTargetPower skipped: auto resistance disabled";
return;
}
if (!m_slopeControlEnabled && !force) {
qDebug() << "updateSlopeTargetPower skipped: slope control inactive";
return;
}
// Apply gear offset to grade (0.5 scaling factor)
double grade = m_currentSlopePercent + (gears() / 2.0);
// Get current speed (with fallback to cadence-based estimation)
double speedKmh = getCurrentSpeedForSlope();
// Compute required power using physics model
double targetPower = computeSlopeTargetPower(grade, speedKmh);
int powerValue = static_cast<int>(std::round(targetPower));
powerValue = qBound(0, powerValue, 2000);
// Hysteresis: avoid too frequent changes
if (!force) {
if (!m_slopePowerTimer.isValid()) {
m_slopePowerTimer.start();
}
if (m_slopePowerTimer.elapsed() < 500 &&
m_lastSlopeTargetPower >= 0 &&
std::abs(powerValue - m_lastSlopeTargetPower) < 3) {
qDebug() << "updateSlopeTargetPower skipped: within hysteresis"
<< powerValue << "vs" << m_lastSlopeTargetPower;
return;
}
}
// Apply power change
m_lastSlopeTargetPower = powerValue;
m_slopePowerTimer.restart();
m_slopePowerChangeInProgress = true;
qDebug() << "updateSlopeTargetPower -> changePower:" << powerValue;
changePower(powerValue);
m_slopePowerChangeInProgress = false;
}

View File

@@ -4,6 +4,7 @@
#include "devices/bluetoothdevice.h"
#include "virtualdevices/virtualbike.h"
#include <QObject>
#include <QElapsedTimer>
class bike : public bluetoothdevice {
@@ -31,7 +32,7 @@ class bike : public bluetoothdevice {
virtual resistance_t resistanceFromPowerRequest(uint16_t power);
virtual uint16_t powerFromResistanceRequest(resistance_t requestResistance);
virtual bool ergManagedBySS2K() { return false; }
bluetoothdevice::BLUETOOTH_TYPE deviceType() override;
BLUETOOTH_TYPE deviceType() override;
metric pelotonResistance();
void clearStats() override;
void setLap() override;
@@ -51,6 +52,7 @@ class bike : public bluetoothdevice {
*/
metric currentSteeringAngle() { return m_steeringAngle; }
virtual bool inclinationAvailableByHardware();
virtual bool inclinationAvailableBySoftware();
bool ergModeSupportedAvailableByHardware() { return ergModeSupported; }
virtual bool ergModeSupportedAvailableBySoftware() { return ergModeSupported; }
@@ -110,6 +112,25 @@ class bike : public bluetoothdevice {
double m_speedLimit = 0;
// Sim mode support: convert inclination to power for devices without native inclination
bool m_slopeControlEnabled = false;
double m_currentSlopePercent = 0.0;
int m_lastSlopeTargetPower = -1;
bool m_slopePowerChangeInProgress = false;
QElapsedTimer m_slopePowerTimer;
// Physics-based power calculation from slope
virtual double computeSlopeTargetPower(double gradePercent, double speedKmh);
// Update power based on current slope and speed (called periodically)
virtual void updateSlopeTargetPower(bool force = false);
// Check if device supports native inclination control
virtual bool supportsNativeInclination() const { return true; }
// Helper: get current speed for slope calculations
double getCurrentSpeedForSlope();
uint16_t wattFromHR(bool useSpeedAndCadence);
};

View File

@@ -17,7 +17,7 @@
using namespace std::chrono_literals;
bkoolbike::bkoolbike(bool noWriteResistance, bool noHeartService) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;
this->noHeartService = noHeartService;
@@ -49,7 +49,12 @@ void bkoolbike::writeCharacteristic(uint8_t *data, uint8_t data_len, const QStri
}
writeBuffer = new QByteArray((const char *)data, data_len);
gattCustomService->writeCharacteristic(gattWriteCharCustomId, *writeBuffer);
if (gattWriteCharCustomId.properties() & QLowEnergyCharacteristic::WriteNoResponse) {
gattCustomService->writeCharacteristic(gattWriteCharCustomId, *writeBuffer,
QLowEnergyService::WriteWithoutResponse);
} else {
gattCustomService->writeCharacteristic(gattWriteCharCustomId, *writeBuffer);
}
if (!disable_log) {
emit debug(QStringLiteral(" >> ") + writeBuffer->toHex(' ') +
@@ -61,19 +66,28 @@ void bkoolbike::writeCharacteristic(uint8_t *data, uint8_t data_len, const QStri
void bkoolbike::changePower(int32_t power) {
RequestedPower = power;
/*
if (power < 0)
power = 0;
uint8_t p[] = {0xa4, 0x09, 0x4e, 0x05, 0x31, 0xff, 0xff, 0xff, 0xff, 0xff, 0x14, 0x02, 0x00};
p[10] = (uint8_t)((power * 4) & 0xFF);
p[11] = (uint8_t)((power * 4) >> 8);
for (uint8_t i = 0; i < sizeof(p) - 1; i++) {
p[12] ^= p[i]; // the last byte is a sort of a checksum
}
writeCharacteristic(p, sizeof(p), QStringLiteral("changePower"), false, false);*/
if (power < 0) {
power = 0;
}
qDebug() << QStringLiteral("Changepower not implemented");
forcePower(power);
}
void bkoolbike::forcePower(int32_t power) {
// FE-C "Set Target Power" command (page 0x31)
// Power is sent in 1/4 watt units (0.25W resolution)
// Bytes: [0x31][0x25][0xFF][0xFF][0xFF][0xFF][power_low][power_high]
uint16_t power_quarter_watts = (uint16_t)(power * 4);
uint8_t power_cmd[] = {0x31, 0x25, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00};
power_cmd[6] = (uint8_t)(power_quarter_watts & 0xFF); // Low byte
power_cmd[7] = (uint8_t)((power_quarter_watts >> 8) & 0xFF); // High byte
writeCharacteristic(power_cmd, sizeof(power_cmd),
QStringLiteral("forcePower ") + QString::number(power) + QStringLiteral("W"),
false, false);
}
void bkoolbike::forceInclination(double inclination) {
@@ -115,13 +129,27 @@ void bkoolbike::update() {
uint8_t init1[] = {0x30, 0x25, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00};
uint8_t init2[] = {0x32, 0x25, 0xff, 0xff, 0xff, 0x1e, 0x7f, 0x00};
uint8_t init3[] = {0x33, 0x25, 0xff, 0xff, 0xff, 0x20, 0x4e, 0x00};
uint8_t init4[] = {0x37, 0x4c, 0x1d, 0xff, 0x80, 0x0c, 0x46, 0x21};
uint8_t init5[] = {0x37, 0xee, 0x16, 0xff, 0x80, 0x0c, 0x46, 0x21};
writeCharacteristic(init1, sizeof(init1), QStringLiteral("init1"), false, false);
writeCharacteristic(init2, sizeof(init2), QStringLiteral("init2"), false, false);
writeCharacteristic(init3, sizeof(init3), QStringLiteral("init3"), false, false);
writeCharacteristic(init4, sizeof(init4), QStringLiteral("init4"), false, true);
writeCharacteristic(init5, sizeof(init5), QStringLiteral("init5"), false, true);
if (bkool_fitness_bike) {
// BKOOLFITNESSBIKE specific init packets
uint8_t init4[] = {0x37, 0x4c, 0x1d, 0xff, 0x80, 0x0c, 0x46, 0x21};
uint8_t init5[] = {0x37, 0xc8, 0x19, 0xff, 0xe0, 0x0a, 0x46, 0x21};
uint8_t init6[] = {0x37, 0xc8, 0x19, 0xff, 0xe0, 0x0a, 0x46, 0x21};
uint8_t init7[] = {0x32, 0x25, 0xff, 0xff, 0xff, 0x25, 0x7f, 0x00};
writeCharacteristic(init4, sizeof(init4), QStringLiteral("init4"), false, true);
writeCharacteristic(init5, sizeof(init5), QStringLiteral("init5"), false, true);
writeCharacteristic(init6, sizeof(init6), QStringLiteral("init6"), false, true);
writeCharacteristic(init7, sizeof(init7), QStringLiteral("init7"), false, false);
} else {
// BKOOLSMARTPRO init packets
uint8_t init4[] = {0x37, 0x4c, 0x1d, 0xff, 0x80, 0x0c, 0x46, 0x21};
uint8_t init5[] = {0x37, 0xee, 0x16, 0xff, 0x80, 0x0c, 0x46, 0x21};
writeCharacteristic(init4, sizeof(init4), QStringLiteral("init4"), false, true);
writeCharacteristic(init5, sizeof(init5), QStringLiteral("init5"), false, true);
}
} else if (bluetoothDevice.isValid() &&
m_control->state() == QLowEnergyController::DiscoveredState //&&
@@ -137,6 +165,13 @@ void bkoolbike::update() {
// updateDisplay(elapsed);
}
// Send poll command for BKOOLFITNESSBIKE
/*
if (bkool_fitness_bike) {
uint8_t poll[] = {0x37, 0xc8, 0x19, 0xff, 0xe0, 0x0a, 0x46, 0x21};
writeCharacteristic(poll, sizeof(poll), QStringLiteral("poll"), false, false);
}*/
if (requestResistance != -1) {
if (requestResistance != currentResistance().value() || lastGearValue != gears()) {
emit debug(QStringLiteral("writing resistance ") + QString::number(requestResistance));
@@ -146,10 +181,15 @@ void bkoolbike::update() {
requestInclination = requestResistance / 10.0;
}
// forceResistance(requestResistance);;
}
lastGearValue = gears();
}
requestResistance = -1;
}
if(lastGearValue != gears() && requestInclination == -100) {
// if only gears changed, we need to update the inclination to match the gears
requestInclination = lastRawRequestedInclinationValue;
}
if (requestInclination != -100) {
emit debug(QStringLiteral("writing inclination ") + QString::number(requestInclination));
forceInclination(requestInclination + gears()); // since this bike doesn't have the concept of resistance,
@@ -157,6 +197,8 @@ void bkoolbike::update() {
requestInclination = -100;
}
lastGearValue = gears();
if (requestPower != -1) {
changePower(requestPower);
requestPower = -1;
@@ -677,6 +719,12 @@ void bkoolbike::deviceDiscovered(const QBluetoothDeviceInfo &device) {
{
bluetoothDevice = device;
// Check if this is BKOOLFITNESSBIKE model
if (device.name().toUpper().startsWith(QStringLiteral("BKOOLFITNESSBIKE"))) {
bkool_fitness_bike = true;
emit debug(QStringLiteral("BKOOLFITNESSBIKE model detected"));
}
m_control = QLowEnergyController::createCentral(bluetoothDevice, this);
connect(m_control, &QLowEnergyController::serviceDiscovered, this, &bkoolbike::serviceDiscovered);
connect(m_control, &QLowEnergyController::discoveryFinished, this, &bkoolbike::serviceScanDone);

View File

@@ -45,6 +45,7 @@ class bkoolbike : public bike {
bool wait_for_response = false);
void startDiscover();
void forceInclination(double inclination);
void forcePower(int32_t power);
uint16_t watts() override;
double bikeResistanceToPeloton(double resistance);
@@ -70,6 +71,8 @@ class bkoolbike : public bike {
bool noWriteResistance = false;
bool noHeartService = false;
bool bkool_fitness_bike = false;
uint16_t pollCounter = 0;
uint16_t oldLastCrankEventTime = 0;
uint16_t oldCrankRevs = 0;

View File

@@ -36,6 +36,10 @@ bluetooth::bluetooth(bool logs, const QString &deviceName, bool noWriteResistanc
QString nordictrack_2950_ip =
settings.value(QZSettings::nordictrack_2950_ip, QZSettings::default_nordictrack_2950_ip).toString();
bool fake_bike =
settings.value(QZSettings::applewatch_fakedevice, QZSettings::default_applewatch_fakedevice).toBool();
bool fake_treadmill =
settings.value(QZSettings::fakedevice_treadmill, QZSettings::default_fakedevice_treadmill).toBool();
if (settings.value(QZSettings::peloton_bike_ocr, QZSettings::default_peloton_bike_ocr).toBool() && !pelotonBike) {
pelotonBike = new pelotonbike(noWriteResistance, noHeartService);
@@ -47,7 +51,29 @@ bluetooth::bluetooth(bool logs, const QString &deviceName, bool noWriteResistanc
}
// this signal is not associated to anything in this moment, since the homeform is not loaded yet
this->signalBluetoothDeviceConnected(pelotonBike);
}
}/* else if (fake_bike) {
fakeBike = new fakebike(noWriteResistance, noHeartService, false);
emit deviceConnected(QBluetoothDeviceInfo());
connect(fakeBike, &bluetoothdevice::connectedAndDiscovered, this, &bluetooth::connectedAndDiscovered);
connect(fakeBike, &fakebike::debug, this, &bluetooth::debug);
if (this->discoveryAgent && !this->discoveryAgent->isActive()) {
emit searchingStop();
}
// this signal is not associated to anything in this moment, since the homeform is not loaded yet
this->signalBluetoothDeviceConnected(fakeBike);
return;
} else if (fake_treadmill) {
fakeTreadmill = new faketreadmill(noWriteResistance, noHeartService, false);
emit deviceConnected(QBluetoothDeviceInfo());
connect(fakeTreadmill, &bluetoothdevice::connectedAndDiscovered, this, &bluetooth::connectedAndDiscovered);
connect(fakeTreadmill, &faketreadmill::debug, this, &bluetooth::debug);
if (this->discoveryAgent && !this->discoveryAgent->isActive()) {
emit searchingStop();
}
// this signal is not associated to anything in this moment, since the homeform is not loaded yet
this->signalBluetoothDeviceConnected(fakeBike);
return;
}*/
#ifdef TEST
schwinnIC4Bike = (schwinnic4bike *)new bike();
@@ -115,6 +141,7 @@ void bluetooth::finished() {
settings.value(QZSettings::nordictrack_2950_ip, QZSettings::default_nordictrack_2950_ip).toString();
QString tdf_10_ip = settings.value(QZSettings::tdf_10_ip, QZSettings::default_tdf_10_ip).toString();
QString proform_elliptical_ip = settings.value(QZSettings::proform_elliptical_ip, QZSettings::default_proform_elliptical_ip).toString();
QString proform_rower_ip = settings.value(QZSettings::proform_rower_ip, QZSettings::default_proform_rower_ip).toString();
bool fake_bike =
settings.value(QZSettings::applewatch_fakedevice, QZSettings::default_applewatch_fakedevice).toBool();
bool fakedevice_elliptical =
@@ -123,7 +150,7 @@ void bluetooth::finished() {
bool fakedevice_treadmill =
settings.value(QZSettings::fakedevice_treadmill, QZSettings::default_fakedevice_treadmill).toBool();
// wifi devices on windows
if (!nordictrack_2950_ip.isEmpty() || !tdf_10_ip.isEmpty() || fake_bike || fakedevice_elliptical || fakedevice_rower || fakedevice_treadmill || !proform_elliptical_ip.isEmpty() || antbike || android_antbike) {
if (!nordictrack_2950_ip.isEmpty() || !tdf_10_ip.isEmpty() || fake_bike || fakedevice_elliptical || fakedevice_rower || fakedevice_treadmill || !proform_elliptical_ip.isEmpty() || !proform_rower_ip.isEmpty() || antbike || android_antbike) {
// faking a bluetooth device
qDebug() << "faking a bluetooth device for nordictrack_2950_ip";
deviceDiscovered(QBluetoothDeviceInfo());
@@ -423,7 +450,8 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
settings.value(QZSettings::toorx_srx_3500, QZSettings::default_toorx_srx_3500).toBool() ||
settings.value(QZSettings::hop_sport_hs_090h_bike, QZSettings::default_hop_sport_hs_090h_bike).toBool() ||
settings.value(QZSettings::toorx_bike_srx_500, QZSettings::default_toorx_bike_srx_500).toBool() ||
settings.value(QZSettings::hertz_xr_770, QZSettings::default_hertz_xr_770).toBool()) &&
settings.value(QZSettings::hertz_xr_770, QZSettings::default_hertz_xr_770).toBool() ||
settings.value(QZSettings::taurua_ic90, QZSettings::default_taurua_ic90).toBool()) &&
!toorx_ftms;
bool snode_bike = settings.value(QZSettings::snode_bike, QZSettings::default_snode_bike).toBool();
bool fitplus_bike = settings.value(QZSettings::fitplus_bike, QZSettings::default_fitplus_bike).toBool() ||
@@ -470,8 +498,11 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
settings.value(QZSettings::nordictrack_2950_ip, QZSettings::default_nordictrack_2950_ip).toString();
QString tdf_10_ip = settings.value(QZSettings::tdf_10_ip, QZSettings::default_tdf_10_ip).toString();
QString proform_elliptical_ip = settings.value(QZSettings::proform_elliptical_ip, QZSettings::default_proform_elliptical_ip).toString();
QString proform_rower_ip = settings.value(QZSettings::proform_rower_ip, QZSettings::default_proform_rower_ip).toString();
QString computrainerSerialPort =
settings.value(QZSettings::computrainer_serialport, QZSettings::default_computrainer_serialport).toString();
QString kettlerUsbSerialPort =
settings.value(QZSettings::kettler_usb_serialport, QZSettings::default_kettler_usb_serialport).toString();
QString csaferowerSerialPort = settings.value(QZSettings::csafe_rower, QZSettings::default_csafe_rower).toString();
QString csafeellipticalSerialPort =
settings.value(QZSettings::csafe_elliptical_port, QZSettings::default_csafe_elliptical_port).toString();
@@ -493,6 +524,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
QString ftms_rower = settings.value(QZSettings::ftms_rower, QZSettings::default_ftms_rower).toString();
QString ftms_bike = settings.value(QZSettings::ftms_bike, QZSettings::default_ftms_bike).toString();
QString ftms_treadmill = settings.value(QZSettings::ftms_treadmill, QZSettings::default_ftms_treadmill).toString();
QString ftms_elliptical = settings.value(QZSettings::ftms_elliptical, QZSettings::default_ftms_elliptical).toString();
bool saris_trainer = settings.value(QZSettings::saris_trainer, QZSettings::default_saris_trainer).toBool();
bool iconsole_elliptical = settings.value(QZSettings::iconsole_elliptical, QZSettings::default_iconsole_elliptical).toBool();
bool iconsole_rower = settings.value(QZSettings::iconsole_rower, QZSettings::default_iconsole_rower).toBool();
@@ -655,7 +687,19 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
filter = (b.name().compare(filterDevice, Qt::CaseInsensitive) == 0);
}
if (b.name().startsWith(QStringLiteral("M3")) && !m3iBike && filter) {
const QString deviceName = b.name();
const QString upperDeviceName = deviceName.toUpper();
bool isTrxAppGateUsbBikeTC = false;
if (upperDeviceName.startsWith(QStringLiteral("TC")) && deviceName.length() == 5) {
isTrxAppGateUsbBikeTC = true;
for (int idx = 2; idx < deviceName.length(); ++idx) {
if (!deviceName.at(idx).isDigit()) {
isTrxAppGateUsbBikeTC = false;
break;
}
}
}
if (deviceName.startsWith(QStringLiteral("M3")) && !m3iBike && filter) {
if (m3ibike::isCorrectUnit(b)) {
this->setLastBluetoothDevice(b);
@@ -777,6 +821,19 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
emit searchingStop();
}
this->signalBluetoothDeviceConnected(computrainerBike);
} else if (!kettlerUsbSerialPort.isEmpty() && !kettlerUsbBike) {
this->stopDiscovery();
kettlerUsbBike =
new kettlerusbbike(noWriteResistance, noHeartService, bikeResistanceOffset, bikeResistanceGain);
emit deviceConnected(b);
connect(kettlerUsbBike, &bluetoothdevice::connectedAndDiscovered, this,
&bluetooth::connectedAndDiscovered);
connect(kettlerUsbBike, &kettlerusbbike::debug, this, &bluetooth::debug);
kettlerUsbBike->deviceDiscovered(b);
if (this->discoveryAgent && !this->discoveryAgent->isActive()) {
emit searchingStop();
}
this->signalBluetoothDeviceConnected(kettlerUsbBike);
} else if (!csaferowerSerialPort.isEmpty() && !csafeRower) {
this->stopDiscovery();
csafeRower = new csaferower(noWriteResistance, noHeartService, false);
@@ -890,6 +947,20 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
emit searchingStop();
}
this->signalBluetoothDeviceConnected(nordictrackifitadbElliptical);
} else if (!proform_rower_ip.isEmpty() && !nordictrackifitadbRower) {
this->stopDiscovery();
nordictrackifitadbRower = new nordictrackifitadbrower(noWriteResistance, noHeartService,
bikeResistanceOffset, bikeResistanceGain);
emit deviceConnected(b);
connect(nordictrackifitadbRower, &bluetoothdevice::connectedAndDiscovered, this,
&bluetooth::connectedAndDiscovered);
connect(nordictrackifitadbRower, &nordictrackifitadbrower::debug, this, &bluetooth::debug);
// nordictrackifitadbRower->deviceDiscovered(b);
// connect(this, SIGNAL(searchingStop()), nordictrackifitadbRower, SLOT(searchingStop())); //NOTE: Commented due to #358
if (this->discoveryAgent && !this->discoveryAgent->isActive()) {
emit searchingStop();
}
this->signalBluetoothDeviceConnected(nordictrackifitadbRower);
} else if (((csc_as_bike && b.name().startsWith(cscName)) ||
b.name().toUpper().startsWith(QStringLiteral("JOROTO-BK-"))) &&
!cscBike && filter) {
@@ -957,7 +1028,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
}
this->signalBluetoothDeviceConnected(domyosRower);
} else if ((b.name().startsWith(QStringLiteral("Domyos-Bike")) && (!deviceHasService(b, QBluetoothUuid((quint16)0x1826)) || settings.value(QZSettings::domyosbike_notfmts, QZSettings::default_domyosbike_notfmts).toBool())) &&
!b.name().startsWith(QStringLiteral("DomyosBridge")) && !domyosBike && filter) {
!b.name().startsWith(QStringLiteral("DomyosBridge")) && !domyosBike && ftms_bike.contains(QZSettings::default_ftms_bike) && filter) {
this->setLastBluetoothDevice(b);
this->stopDiscovery();
domyosBike = new domyosbike(noWriteResistance, noHeartService, testResistance, bikeResistanceOffset,
@@ -972,7 +1043,8 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
emit searchingStop();
}
this->signalBluetoothDeviceConnected(domyosBike);
} else if (b.name().toUpper().startsWith(QStringLiteral("I-CONSOLE+")) && iconsole_rower &&
} else if ((b.name().toUpper().startsWith(QStringLiteral("MRK-R11S-")) ||
(b.name().toUpper().startsWith(QStringLiteral("I-CONSOLE+")) && iconsole_rower)) &&
!trxappgateusbRower && ftms_bike.contains(QZSettings::default_ftms_bike) && filter) {
this->setLastBluetoothDevice(b);
this->stopDiscovery();
@@ -991,7 +1063,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
this->signalBluetoothDeviceConnected(trxappgateusbRower);
} else if (((b.name().toUpper().startsWith(QStringLiteral("FAL-SPORTS")) && !toorx_bike) ||
(b.name().toUpper().startsWith(QStringLiteral("I-CONSOLE+")) && iconsole_elliptical)) &&
!trxappgateusbElliptical && ftms_bike.contains(QZSettings::default_ftms_bike) && filter) {
!trxappgateusbElliptical && ftms_bike.contains(QZSettings::default_ftms_bike) && ftms_elliptical.contains(QZSettings::default_ftms_elliptical) && filter) {
this->setLastBluetoothDevice(b);
this->stopDiscovery();
trxappgateusbElliptical = new trxappgateusbelliptical(noWriteResistance, noHeartService,
@@ -1026,14 +1098,17 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
this->signalBluetoothDeviceConnected(domyosElliptical);
} else if ((b.name().toUpper().startsWith(QStringLiteral("YPOO-U3-")) ||
b.name().toUpper().startsWith(QStringLiteral("SCH_590E")) ||
b.name().toUpper().startsWith(QStringLiteral("SCH411/510E")) ||
b.name().toUpper().startsWith(QStringLiteral("KETTLER ")) ||
b.name().toUpper().startsWith(QStringLiteral("FEIER-EM-")) ||
b.name().toUpper().startsWith(QStringLiteral("MX-AS ")) ||
(b.name().startsWith(QStringLiteral("Domyos-EL")) && settings.value(QZSettings::domyos_elliptical_fmts, QZSettings::default_domyos_elliptical_fmts).toBool()) ||
(b.name().toUpper().startsWith("SF-") && b.name().midRef(3).toInt() > 0) ||
b.name().toUpper().startsWith(QStringLiteral("MYELLIPTICAL ")) ||
b.name().toUpper().startsWith(QStringLiteral("CARDIOPOWER EEGO")) ||
(b.name().toUpper().startsWith(QStringLiteral("E35")) && deviceHasService(b, QBluetoothUuid((quint16)0x1826))) ||
(b.name().startsWith(QStringLiteral("FS-")) && iconsole_elliptical)) && !ypooElliptical && filter) {
(b.name().startsWith(QStringLiteral("FS-")) && iconsole_elliptical) ||
!b.name().compare(ftms_elliptical, Qt::CaseInsensitive)) && !ypooElliptical && !horizonTreadmill && ftms_bike.contains(QZSettings::default_ftms_bike) && filter) {
this->setLastBluetoothDevice(b);
this->stopDiscovery();
ypooElliptical =
@@ -1184,6 +1259,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
this->signalBluetoothDeviceConnected(soleElliptical);
} else if (b.name().startsWith(QStringLiteral("Domyos")) &&
!b.name().startsWith(QStringLiteral("DomyosBr")) &&
!b.name().toUpper().startsWith(QStringLiteral("DOMYOS-BIKE-")) &&
!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)) || settings.value(QZSettings::domyostreadmill_notfmts, QZSettings::default_domyostreadmill_notfmts).toBool()) &&
@@ -1330,6 +1406,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
b.name().toUpper().startsWith(QStringLiteral("TRX7.5")) ||
(b.name().toUpper().startsWith(QStringLiteral("S77")) && sole_inclination) ||
(b.name().toUpper().startsWith(QStringLiteral("F85")) && sole_inclination)) &&
ftms_treadmill.contains(QZSettings::default_ftms_treadmill) &&
!soleF80 && filter) {
this->setLastBluetoothDevice(b);
this->stopDiscovery();
@@ -1440,13 +1517,20 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
b.name().toUpper().startsWith(QStringLiteral("AB300S-")) ||
b.name().toUpper().startsWith(QStringLiteral("TF04-")) || // Sport Synology Z5 Treadmill #2415
(b.name().toUpper().startsWith(QStringLiteral("FIT-")) && !b.name().toUpper().startsWith(QStringLiteral("FIT-BK-"))) || // FIT-1596 and sports tech f37s treadmill #2412
b.name().toUpper().startsWith(QStringLiteral("FIT-TM-")) || // FIT-TM- treadmill with real inclination
b.name().toUpper().startsWith(QStringLiteral("LJJ-")) || // LJJ-02351A
b.name().toUpper().startsWith(QStringLiteral("WLT-EP-")) || // Flow elliptical
(b.name().toUpper().startsWith("SCHWINN 810")) ||
(b.name().toUpper().startsWith("MRK-T")) || // MERACH W50 TREADMILL
(b.name().toUpper().startsWith("SF-T")) || // Sunny Fitness Treadmill
b.name().toUpper().startsWith(QStringLiteral("KS-MC")) ||
b.name().toUpper().startsWith(QStringLiteral("FOCUS M3")) ||
b.name().toUpper().startsWith(QStringLiteral("ANPIUS-")) ||
b.name().toUpper().startsWith(QStringLiteral("KICKR RUN")) ||
b.name().toUpper().startsWith(QStringLiteral("SPERAX_RM-01")) ||
(b.name().toUpper().startsWith(QStringLiteral("TP1")) && b.name().length() == 3) ||
(b.name().toUpper().startsWith(QStringLiteral("KS-HD-Z1D"))) || // Kingsmith WalkingPad Z1
(b.name().toUpper().startsWith(QStringLiteral("KS-AP-"))) || // Kingsmith WalkingPad R3 Hybrid+
(b.name().toUpper().startsWith(QStringLiteral("NOBLEPRO CONNECT")) && deviceHasService(b, QBluetoothUuid((quint16)0x1826))) || // FTMS
(b.name().toUpper().startsWith(QStringLiteral("TT8")) && deviceHasService(b, QBluetoothUuid((quint16)0x1826))) ||
(b.name().toUpper().startsWith(QStringLiteral("ST90")) && deviceHasService(b, QBluetoothUuid((quint16)0x1826))) ||
@@ -1455,18 +1539,18 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
b.name().toUpper().startsWith(QStringLiteral("MOBVOI WMTP")) || // FTMS
b.name().toUpper().startsWith(QStringLiteral("LB600")) || // FTMS
b.name().toUpper().startsWith(QStringLiteral("TUNTURI T60-")) || // FTMS
b.name().toUpper().startsWith(QStringLiteral("TUNTURI T80-")) || // FTMS
b.name().toUpper().startsWith(QStringLiteral("TUNTURI T90-")) || // FTMS
b.name().toUpper().startsWith(QStringLiteral("KETTLER TREADMILL")) || // FTMS
b.name().toUpper().startsWith(QStringLiteral("ASSAULTRUNNER")) || // FTMS
b.name().toUpper().startsWith(QStringLiteral("CITYSPORTS-LINKER")) ||
(b.name().toUpper().startsWith(QStringLiteral("TP1")) && b.name().length() == 3) || // FTMS
(b.name().toUpper().startsWith(QStringLiteral("CTM")) && b.name().length() >= 15) || // FTMS
(b.name().toUpper().startsWith(QStringLiteral("CTM")) && b.name().length() >= 15 && ftms_bike.contains(QZSettings::default_ftms_bike)) || // FTMS
(b.name().toUpper().startsWith(QStringLiteral("F85")) && !sole_inclination) || // FMTS
(b.name().toUpper().startsWith(QStringLiteral("S77")) && !sole_inclination) || // FMTS
(b.name().toUpper().startsWith(QStringLiteral("F89")) && !sole_inclination) || // FMTS
(b.name().toUpper().startsWith(QStringLiteral("F80")) && !sole_inclination) || // FMTS
(b.name().toUpper().startsWith(QStringLiteral("ANPLUS-"))) // FTMS
(b.name().toUpper().startsWith(QStringLiteral("ANPLUS-"))) || // FTMS
b.name().toUpper().startsWith(QStringLiteral("TM XP_")) // FTMS
) &&
!horizonTreadmill && filter) {
this->setLastBluetoothDevice(b);
@@ -1660,6 +1744,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
(b.name().toUpper().startsWith("KETTLERBLE")) ||
(b.name().toUpper().startsWith("JAS_C3")) ||
(b.name().toUpper().startsWith("SCH_190U")) ||
(b.name().toUpper().startsWith("SCH_290R")) ||
(b.name().toUpper().startsWith("RAVE WHITE")) ||
(b.name().toUpper().startsWith("DOMYOS-BIKING-")) ||
(b.name().startsWith(QStringLiteral("Domyos-Bike")) && deviceHasService(b, QBluetoothUuid((quint16)0x1826)) && !settings.value(QZSettings::domyosbike_notfmts, QZSettings::default_domyosbike_notfmts).toBool()) ||
@@ -1702,22 +1787,30 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
(b.name().toUpper().startsWith("SL010-")) ||
(b.name().toUpper().startsWith("EXPERT-SX9")) ||
(b.name().toUpper().startsWith("MRK-S26S-")) ||
(b.name().toUpper().startsWith("MRK-S26C-")) ||
(b.name().toUpper().startsWith("ROBX")) ||
(b.name().toUpper().startsWith("ORLAUF_ARES")) ||
(b.name().toUpper().startsWith("SPEEDMAGPRO")) ||
(b.name().toUpper().startsWith("XCX-")) ||
(b.name().toUpper().startsWith("SMARTBIKE-")) ||
(b.name().toUpper().startsWith("D500V2")) ||
(b.name().toUpper().startsWith("NEO BIKE PLUS ")) ||
(b.name().toUpper().startsWith(QStringLiteral("PM5")) && !b.name().toUpper().endsWith(QStringLiteral("SKI")) && !b.name().toUpper().endsWith(QStringLiteral("ROW"))) ||
(b.name().toUpper().startsWith("L-") && b.name().length() == 11) ||
(b.name().toUpper().startsWith("DMASUN-") && b.name().toUpper().endsWith("-BIKE")) ||
(b.name().toUpper().startsWith(QStringLiteral("FIT-BK-"))) ||
(b.name().toUpper().startsWith("VFSPINBIKE")) ||
(b.name().toUpper().startsWith("GLT") && deviceHasService(b, QBluetoothUuid((quint16)0x1826))) ||
(b.name().toUpper().startsWith("SPORT01-") && deviceHasService(b, QBluetoothUuid((quint16)0x1826))) || // Labgrey Magnetic Exercise Bike https://www.amazon.co.uk/dp/B0CXMF1NPY?_encoding=UTF8&psc=1&ref=cm_sw_r_cp_ud_dp_PE420HA7RD7WJBZPN075&ref_=cm_sw_r_cp_ud_dp_PE420HA7RD7WJBZPN075&social_share=cm_sw_r_cp_ud_dp_PE420HA7RD7WJBZPN075&skipTwisterOG=1
(b.name().toUpper().startsWith("FS-YK-")) ||
(b.name().toUpper().startsWith(QStringLiteral("HT")) && (b.name().length() == 10)) ||
(b.name().toUpper().startsWith("ZUMO")) || (b.name().toUpper().startsWith("XS08-")) ||
(b.name().toUpper().startsWith("B94")) || (b.name().toUpper().startsWith("STAGES BIKE")) ||
(b.name().toUpper().startsWith("SUITO")) || (b.name().toUpper().startsWith("D2RIDE")) ||
(b.name().toUpper().startsWith("DIRETO X")) || (b.name().toUpper().startsWith("MERACH-667-")) ||
!b.name().compare(ftms_bike, Qt::CaseInsensitive) || (b.name().toUpper().startsWith("SMB1")) ||
(b.name().toUpper().startsWith("UBIKE FTMS")) || (b.name().toUpper().startsWith("INRIDE"))) &&
(b.name().toUpper().startsWith("UBIKE FTMS")) || (b.name().toUpper().startsWith("INRIDE")) ||
(b.name().toUpper().startsWith("YPBM") && b.name().length() == 10)) &&
ftms_rower.contains(QZSettings::default_ftms_rower) &&
!ftmsBike && !ftmsRower && !snodeBike && !fitPlusBike && !stagesBike && filter) {
this->setLastBluetoothDevice(b);
@@ -1733,6 +1826,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
b.name().toUpper().startsWith("KICKR ROLLR") ||
b.name().toUpper().startsWith("KICKR CORE") ||
(b.name().toUpper().startsWith("KICKR MOVE ")) ||
(b.name().toUpper().startsWith("HOI FRAME ")) ||
(b.name().toUpper().startsWith("HAMMER ") && saris_trainer) ||
(b.name().toUpper().startsWith("WAHOO KICKR"))) &&
!wahooKickrSnapBike && !ftmsBike && filter) {
@@ -1747,7 +1841,8 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
connect(wahooKickrSnapBike, &wahookickrsnapbike::debug, this, &bluetooth::debug);
wahooKickrSnapBike->deviceDiscovered(b);
this->signalBluetoothDeviceConnected(wahooKickrSnapBike);
} else if (b.name().toUpper().startsWith("BIKE ") && b.name().midRef(5).toInt() > 0 &&
} else if (((b.name().toUpper().startsWith("BIKE ") && b.name().midRef(5).toInt() > 0) ||
b.name().toUpper().startsWith("MYCYCLING")) &&
!technogymBike && filter) {
this->setLastBluetoothDevice(b);
this->stopDiscovery();
@@ -1799,6 +1894,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
(b.name().toUpper().startsWith(QStringLiteral("RM")) && b.name().length() == 2) ||
(b.name().toUpper().startsWith(QStringLiteral("DR")) && b.name().length() == 2) ||
(b.name().toUpper().startsWith(QStringLiteral("DFC")) && b.name().length() == 3) ||
(b.name().toUpper().startsWith(QStringLiteral("THINK A")) && b.name().length() == 18) ||
(b.name().toUpper().startsWith(QStringLiteral("ASSIOMA")) &&
powerSensorName.startsWith(QStringLiteral("Disabled")))) &&
!stagesBike && !ftmsBike && filter) {
@@ -1854,6 +1950,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
b.name().toUpper().startsWith(QStringLiteral("I-ROWER")) ||
b.name().toUpper().startsWith(QStringLiteral("YOROTO-RW-")) ||
b.name().toUpper().startsWith(QStringLiteral("SF-RW")) ||
b.name().toUpper().startsWith(QStringLiteral("NORDLYS")) ||
b.name().toUpper().startsWith(QStringLiteral("ROWER ")) ||
b.name().toUpper().startsWith(QStringLiteral("ROGUE CONSOLE ")) ||
b.name().toUpper().startsWith(QStringLiteral("DFIT-L-R")) ||
@@ -2010,7 +2107,9 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
connect(apexBike, &bluetoothdevice::connectedAndDiscovered, this, &bluetooth::connectedAndDiscovered);
apexBike->deviceDiscovered(b);
this->signalBluetoothDeviceConnected(apexBike);
} else if (b.name().toUpper().startsWith(QStringLiteral("BKOOLSMARTPRO")) && !bkoolBike && filter) {
} else if ((b.name().toUpper().startsWith(QStringLiteral("BKOOLSMARTPRO")) ||
b.name().toUpper().startsWith(QStringLiteral("BKOOLFBIKE")) ||
b.name().toUpper().startsWith(QStringLiteral("BKOOLFITNESSBIKE"))) && !bkoolBike && filter) {
this->setLastBluetoothDevice(b);
this->stopDiscovery();
bkoolBike = new bkoolbike(noWriteResistance, noHeartService);
@@ -2338,7 +2437,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
toorx->deviceDiscovered(b);
this->signalBluetoothDeviceConnected(toorx);
} else if (((b.name().toUpper().startsWith(QStringLiteral("BH DUALKIT")) && !b.name().toUpper().startsWith(QStringLiteral("BH DUALKIT TREAD"))) ||
b.name().toUpper().startsWith(QStringLiteral("BH-"))) && !iConceptBike &&
b.name().toUpper().startsWith(QStringLiteral("BH-"))) && !iConceptBike && !toorx &&
!iconcept_elliptical && filter) {
this->setLastBluetoothDevice(b);
this->stopDiscovery();
@@ -2390,16 +2489,17 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
connect(activioTreadmill, &activiotreadmill::debug, this, &bluetooth::debug);
activioTreadmill->deviceDiscovered(b);
this->signalBluetoothDeviceConnected(activioTreadmill);
} else if (((b.name().startsWith(QStringLiteral("TOORX"))) ||
(b.name().startsWith(QStringLiteral("V-RUN"))) ||
(b.name().toUpper().startsWith(QStringLiteral("K80_"))) ||
(b.name().toUpper().startsWith(QStringLiteral("I-CONSOLE+"))) ||
(b.name().toUpper().startsWith(QStringLiteral("ICONSOLE+"))) ||
(b.name().toUpper().startsWith(QStringLiteral("I-RUNNING"))) ||
(b.name().toUpper().startsWith(QStringLiteral("DKN RUN"))) ||
(b.name().toUpper().startsWith(QStringLiteral("ADIDAS "))) ||
(b.name().toUpper().startsWith(QStringLiteral("REEBOK")))) &&
!trxappgateusb && !trxappgateusbBike && !toorx_bike && !toorx_ftms && !toorx_ftms_treadmill && !iconsole_elliptical && !iconsole_rower &&
} else if (((deviceName.startsWith(QStringLiteral("TOORX"))) ||
(deviceName.startsWith(QStringLiteral("V-RUN"))) ||
(upperDeviceName.startsWith(QStringLiteral("K80_"))) ||
(upperDeviceName.startsWith(QStringLiteral("I-CONSOLE+"))) ||
(upperDeviceName.startsWith(QStringLiteral("ICONSOLE+"))) ||
(upperDeviceName.startsWith(QStringLiteral("I-RUNNING"))) ||
(upperDeviceName.startsWith(QStringLiteral("DKN RUN"))) ||
(upperDeviceName.startsWith(QStringLiteral("ADIDAS "))) ||
(upperDeviceName.startsWith(QStringLiteral("REEBOK")))) &&
!trxappgateusb && !trxappgateusbBike && !toorx_bike && !toorx_ftms && !toorx_ftms_treadmill && !iconsole_elliptical && !iconsole_rower && ftms_elliptical.contains(QZSettings::default_ftms_elliptical) &&
ftms_bike.contains(QZSettings::default_ftms_bike) &&
filter) {
this->setLastBluetoothDevice(b);
this->stopDiscovery();
@@ -2411,24 +2511,25 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
connect(trxappgateusb, &trxappgateusbtreadmill::debug, this, &bluetooth::debug);
trxappgateusb->deviceDiscovered(b);
this->signalBluetoothDeviceConnected(trxappgateusb);
} else if ((b.name().toUpper().startsWith(QStringLiteral("TUN ")) ||
b.name().toUpper().startsWith(QStringLiteral("FITHIWAY")) ||
b.name().toUpper().startsWith(QStringLiteral("FIT HI WAY")) ||
b.name().toUpper().startsWith(QStringLiteral("BIKZU_")) ||
b.name().toUpper().startsWith(QStringLiteral("PASYOU-")) ||
b.name().toUpper().startsWith(QStringLiteral("VIRTUFIT")) ||
b.name().toUpper().startsWith(QStringLiteral("IBIKING+")) ||
((b.name().startsWith(QStringLiteral("TOORX")) ||
b.name().toUpper().startsWith(QStringLiteral("I-CONSOIE+")) ||
b.name().toUpper().startsWith(QStringLiteral("I-CONSOLE+")) ||
b.name().toUpper().startsWith(QStringLiteral("ICONSOLE+")) ||
b.name().toUpper().startsWith(QStringLiteral("VIFHTR2.1")) ||
(b.name().toUpper().startsWith(QStringLiteral("REEBOK"))) ||
b.name().toUpper().contains(QStringLiteral("CR011R")) ||
(b.name().toUpper().startsWith(QStringLiteral("FAL-SPORTS")) && toorx_bike) ||
b.name().toUpper().startsWith(QStringLiteral("DKN MOTION"))) &&
} else if (isTrxAppGateUsbBikeTC ||
(upperDeviceName.startsWith(QStringLiteral("TUN ")) ||
upperDeviceName.startsWith(QStringLiteral("FITHIWAY")) ||
upperDeviceName.startsWith(QStringLiteral("FIT HI WAY")) ||
upperDeviceName.startsWith(QStringLiteral("BIKZU_")) ||
upperDeviceName.startsWith(QStringLiteral("PASYOU-")) ||
upperDeviceName.startsWith(QStringLiteral("VIRTUFIT")) ||
upperDeviceName.startsWith(QStringLiteral("IBIKING+")) ||
((deviceName.startsWith(QStringLiteral("TOORX")) ||
upperDeviceName.startsWith(QStringLiteral("I-CONSOIE+")) ||
upperDeviceName.startsWith(QStringLiteral("I-CONSOLE+")) ||
upperDeviceName.startsWith(QStringLiteral("ICONSOLE+")) ||
upperDeviceName.startsWith(QStringLiteral("VIFHTR2.1")) ||
(upperDeviceName.startsWith(QStringLiteral("REEBOK"))) ||
upperDeviceName.contains(QStringLiteral("CR011R")) ||
(upperDeviceName.startsWith(QStringLiteral("FAL-SPORTS")) && toorx_bike) ||
upperDeviceName.startsWith(QStringLiteral("DKN MOTION"))) &&
(toorx_bike))) &&
!trxappgateusb && !toorx_ftms && !toorx_ftms_treadmill && !trxappgateusbBike && filter && !iconsole_elliptical && !iconsole_rower) {
!trxappgateusb && !toorx_ftms && !toorx_ftms_treadmill && !trxappgateusbBike && filter && !iconsole_elliptical && !iconsole_rower && ftms_elliptical.contains(QZSettings::default_ftms_elliptical) && !csc_as_bike) {
this->setLastBluetoothDevice(b);
this->stopDiscovery();
trxappgateusbBike =
@@ -2532,7 +2633,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
} else if (((b.name().startsWith(QStringLiteral("FS-")) && fitplus_bike) ||
(b.name().toUpper().startsWith("H9110 OSAKA")) ||
b.name().startsWith(QStringLiteral("MRK-"))) &&
!fitPlusBike && !ftmsBike && !ftmsRower && !snodeBike && filter) {
!fitPlusBike && !ftmsBike && !ftmsRower && !snodeBike && !horizonTreadmill && filter) {
this->setLastBluetoothDevice(b);
this->stopDiscovery();
fitPlusBike =
@@ -2564,6 +2665,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
(b.name().startsWith(QStringLiteral("SW")) && b.name().length() == 14 &&
!b.name().contains('(') && !b.name().contains(')') && !deviceHasService(b, QBluetoothUuid((quint16)0x1826))) ||
(b.name().toUpper().startsWith(QStringLiteral("WINFITA"))) || // also FTMS
b.name().toUpper().startsWith(QStringLiteral("TUNTURI T80-")) || // FTMS
(b.name().toUpper().startsWith(QStringLiteral("SW-BLE"))) || // FTMS
(b.name().startsWith(QStringLiteral("BF70")))) &&
!fitshowTreadmill && !iconsole_elliptical && !horizonTreadmill && filter) {
@@ -2678,11 +2780,11 @@ void bluetooth::connectedAndDiscovered() {
settings.value(QZSettings::fitmetria_fanfit_enable, QZSettings::default_fitmetria_fanfit_enable).toBool();
// only at the first very connection, setting the user default resistance
if (device() && firstConnected && device()->deviceType() == bluetoothdevice::BIKE &&
if (device() && firstConnected && device()->deviceType() == BIKE &&
settings.value(QZSettings::bike_resistance_start, QZSettings::default_bike_resistance_start).toUInt() != 1) {
qobject_cast<bike *>(device())->changeResistance(
settings.value(QZSettings::bike_resistance_start, QZSettings::default_bike_resistance_start).toUInt());
} else if (device() && firstConnected && device()->deviceType() == bluetoothdevice::ELLIPTICAL &&
} else if (device() && firstConnected && device()->deviceType() == ELLIPTICAL &&
settings.value(QZSettings::bike_resistance_start, QZSettings::default_bike_resistance_start).toUInt() !=
1) {
qobject_cast<elliptical *>(device())->changeResistance(
@@ -2850,7 +2952,7 @@ void bluetooth::connectedAndDiscovered() {
#else
settings.setValue(QZSettings::power_sensor_address, b.deviceUuid().toString());
#endif
if (device() && device()->deviceType() == bluetoothdevice::BIKE) {
if (device() && device()->deviceType() == BIKE) {
powerSensor = new stagesbike(false, false, true);
// connect(heartRateBelt, SIGNAL(disconnected()), this, SLOT(restart()));
@@ -2859,7 +2961,7 @@ void bluetooth::connectedAndDiscovered() {
connect(powerSensor, &bluetoothdevice::cadenceChanged, this->device(),
&bluetoothdevice::cadenceSensor);
powerSensor->deviceDiscovered(b);
} else if (device() && device()->deviceType() == bluetoothdevice::TREADMILL) {
} else if (device() && device()->deviceType() == TREADMILL) {
powerSensorRun = new strydrunpowersensor(false, false, true);
// connect(heartRateBelt, SIGNAL(disconnected()), this, SLOT(restart()));
@@ -2916,7 +3018,7 @@ void bluetooth::connectedAndDiscovered() {
for (const QBluetoothDeviceInfo &b : qAsConst(devices)) {
if (((b.name().startsWith(eliteSterzoSmartName))) && !eliteSterzoSmart &&
!eliteSterzoSmartName.startsWith(QStringLiteral("Disabled")) && this->device() &&
this->device()->deviceType() == bluetoothdevice::BIKE) {
this->device()->deviceType() == BIKE) {
settings.setValue(QZSettings::elite_sterzo_smart_lastdevice_name, b.name());
#ifndef Q_OS_IOS
@@ -2938,7 +3040,7 @@ void bluetooth::connectedAndDiscovered() {
if(settings.value(QZSettings::sram_axs_controller, QZSettings::default_sram_axs_controller).toBool()) {
for (const QBluetoothDeviceInfo &b : qAsConst(devices)) {
if (((b.name().toUpper().startsWith("SRAM "))) && !sramAXSController && this->device() &&
this->device()->deviceType() == bluetoothdevice::BIKE) {
this->device()->deviceType() == BIKE) {
sramAXSController = new sramaxscontroller();
// connect(heartRateBelt, SIGNAL(disconnected()), this, SLOT(restart()));
@@ -2957,7 +3059,7 @@ void bluetooth::connectedAndDiscovered() {
if(settings.value(QZSettings::zwift_click, QZSettings::default_zwift_click).toBool()) {
for (const QBluetoothDeviceInfo &b : qAsConst(devices)) {
if (((b.name().toUpper().startsWith("ZWIFT CLICK"))) && !zwiftClickRemote && this->device() &&
this->device()->deviceType() == bluetoothdevice::BIKE) {
this->device()->deviceType() == BIKE) {
if(b.manufacturerData(2378).size() > 0) {
qDebug() << "this should be 9. is it? " << int(b.manufacturerData(2378).at(0));
@@ -2982,7 +3084,7 @@ void bluetooth::connectedAndDiscovered() {
if(settings.value(QZSettings::zwift_play, QZSettings::default_zwift_play).toBool()) {
for (const QBluetoothDeviceInfo &b : qAsConst(devices)) {
if (((b.name().toUpper().startsWith("SQUARE"))) && !eliteSquareController && this->device() &&
this->device()->deviceType() == bluetoothdevice::BIKE) {
this->device()->deviceType() == BIKE) {
eliteSquareController = new elitesquarecontroller(this->device());
// connect(heartRateBelt, SIGNAL(disconnected()), this, SLOT(restart()));
@@ -3002,7 +3104,7 @@ void bluetooth::connectedAndDiscovered() {
bool zwiftplay_swap = settings.value(QZSettings::zwiftplay_swap, QZSettings::default_zwiftplay_swap).toBool();
for (const QBluetoothDeviceInfo &b : qAsConst(devices)) {
if ((((b.name().toUpper().startsWith("ZWIFT PLAY"))) || b.name().toUpper().startsWith("ZWIFT RIDE") || b.name().toUpper().startsWith("ZWIFT SF2")) && zwiftPlayDevice.size() < 2 && this->device() &&
this->device()->deviceType() == bluetoothdevice::BIKE) {
this->device()->deviceType() == BIKE) {
if(b.manufacturerData(2378).size() > 0) {
qDebug() << "this should be 3 or 2. is it? " << int(b.manufacturerData(2378).at(0));
@@ -3045,8 +3147,8 @@ void bluetooth::connectedAndDiscovered() {
settings.value(QZSettings::ant_cadence, QZSettings::default_ant_cadence).toBool(),
settings.value(QZSettings::ant_heart, QZSettings::default_ant_heart).toBool(),
settings.value(QZSettings::ant_garmin, QZSettings::default_ant_garmin).toBool(),
device()->deviceType() == bluetoothdevice::TREADMILL ||
device()->deviceType() == bluetoothdevice::ELLIPTICAL,
device()->deviceType() == TREADMILL ||
device()->deviceType() == ELLIPTICAL,
settings.value(QZSettings::android_antbike, QZSettings::default_android_antbike).toBool(),
settings.value(QZSettings::technogym_group_cycle, QZSettings::default_technogym_group_cycle).toBool(),
settings.value(QZSettings::ant_bike_device_number, QZSettings::default_ant_bike_device_number).toInt(),
@@ -3338,6 +3440,11 @@ void bluetooth::restart() {
delete nordictrackifitadbElliptical;
nordictrackifitadbElliptical = nullptr;
}
if (nordictrackifitadbRower) {
delete nordictrackifitadbRower;
nordictrackifitadbRower = nullptr;
}
if (powerBike) {
delete powerBike;
@@ -3634,6 +3741,11 @@ void bluetooth::restart() {
delete computrainerBike;
computrainerBike = nullptr;
}
if (kettlerUsbBike) {
delete kettlerUsbBike;
kettlerUsbBike = nullptr;
}
if (csafeRower) {
delete csafeRower;
@@ -3812,6 +3924,8 @@ bluetoothdevice *bluetooth::device() {
return android_antBike;
} else if (nordictrackifitadbTreadmill) {
return nordictrackifitadbTreadmill;
} else if (nordictrackifitadbRower) {
return nordictrackifitadbRower;
} else if (nordictrackifitadbBike) {
return nordictrackifitadbBike;
} else if (nordictrackifitadbElliptical) {
@@ -3987,6 +4101,8 @@ bluetoothdevice *bluetooth::device() {
#ifndef Q_OS_IOS
} else if (computrainerBike) {
return computrainerBike;
} else if (kettlerUsbBike) {
return kettlerUsbBike;
} else if (csafeRower) {
return csafeRower;
} else if (csafeElliptical) {
@@ -4052,7 +4168,7 @@ void bluetooth::stateFileUpdate() {
if (!device()) {
return;
}
if (device()->deviceType() != bluetoothdevice::TREADMILL) {
if (device()->deviceType() != TREADMILL) {
return;
}

View File

@@ -34,6 +34,7 @@
#include "devices/coresensor/coresensor.h"
#ifndef Q_OS_IOS
#include "devices/computrainerbike/computrainerbike.h"
#include "devices/kettlerusbbike/kettlerusbbike.h"
#include "devices/csaferower/csaferower.h"
#include "devices/csafeelliptical/csafeelliptical.h"
#endif
@@ -89,6 +90,7 @@
#include "devices/nordictrackelliptical/nordictrackelliptical.h"
#include "devices/nordictrackifitadbbike/nordictrackifitadbbike.h"
#include "devices/nordictrackifitadbelliptical/nordictrackifitadbelliptical.h"
#include "devices/nordictrackifitadbrower/nordictrackifitadbrower.h"
#include "devices/nordictrackifitadbtreadmill/nordictrackifitadbtreadmill.h"
#include "devices/npecablebike/npecablebike.h"
#include "devices/octaneelliptical/octaneelliptical.h"
@@ -191,6 +193,7 @@ class bluetooth : public QObject, public SignalHandler {
focustreadmill *focusTreadmill = nullptr;
#ifndef Q_OS_IOS
computrainerbike *computrainerBike = nullptr;
kettlerusbbike *kettlerUsbBike = nullptr;
csaferower *csafeRower = nullptr;
csafeelliptical *csafeElliptical = nullptr;
#endif
@@ -222,6 +225,7 @@ class bluetooth : public QObject, public SignalHandler {
nordictrackifitadbtreadmill *nordictrackifitadbTreadmill = nullptr;
nordictrackifitadbbike *nordictrackifitadbBike = nullptr;
nordictrackifitadbelliptical *nordictrackifitadbElliptical = nullptr;
nordictrackifitadbrower *nordictrackifitadbRower = nullptr;
octaneelliptical *octaneElliptical = nullptr;
octanetreadmill *octaneTreadmill = nullptr;
pelotonbike *pelotonBike = nullptr;

View File

@@ -20,7 +20,7 @@ bluetoothdevice::~bluetoothdevice() {
}
}
bluetoothdevice::BLUETOOTH_TYPE bluetoothdevice::deviceType() { return bluetoothdevice::UNKNOWN; }
BLUETOOTH_TYPE bluetoothdevice::deviceType() { return UNKNOWN; }
void bluetoothdevice::start() { requestStart = 1; lastStart = QDateTime::currentMSecsSinceEpoch(); }
void bluetoothdevice::stop(bool pause) {
requestStop = 1;
@@ -109,7 +109,52 @@ QTime bluetoothdevice::maxPace() {
double bluetoothdevice::odometerFromStartup() { return Distance.valueRaw(); }
double bluetoothdevice::odometer() { return Distance.value(); }
double bluetoothdevice::lapOdometer() { return Distance.lapValue(); }
metric bluetoothdevice::calories() { return KCal; }
metric bluetoothdevice::calories() {
QSettings settings;
bool activeOnly = settings.value(QZSettings::calories_active_only, QZSettings::default_calories_active_only).toBool();
bool fromHR = settings.value(QZSettings::calories_from_hr, QZSettings::default_calories_from_hr).toBool();
if (fromHR && Heart.value() > 0) {
// Calculate calories based on heart rate
double totalHRKCal = metric::calculateKCalfromHR(Heart.average(), elapsed.value());
hrKCal.setValue(totalHRKCal);
if (activeOnly) {
activeKCal.setValue(metric::calculateActiveKCal(hrKCal.value(), elapsed.value()));
return activeKCal;
} else {
return hrKCal;
}
} else {
// Power-based calculation (current behavior)
if (activeOnly) {
activeKCal.setValue(metric::calculateActiveKCal(KCal.value(), elapsed.value()));
return activeKCal;
} else {
return KCal;
}
}
}
metric bluetoothdevice::totalCalories() {
QSettings settings;
bool fromHR = settings.value(QZSettings::calories_from_hr, QZSettings::default_calories_from_hr).toBool();
if (fromHR && Heart.value() > 0) {
return hrKCal; // Return HR-based total calories
} else {
return KCal; // Return power-based total calories
}
}
metric bluetoothdevice::activeCalories() {
return activeKCal;
}
metric bluetoothdevice::hrCalories() {
return hrKCal;
}
metric bluetoothdevice::jouls() { return m_jouls; }
uint8_t bluetoothdevice::fanSpeed() { return FanSpeed; };
bool bluetoothdevice::changeFanSpeed(uint8_t speed) {
@@ -132,7 +177,17 @@ bool bluetoothdevice::changeFanSpeed(uint8_t speed) {
}
bool bluetoothdevice::connected() { return false; }
metric bluetoothdevice::elevationGain() { return elevationAcc; }
void bluetoothdevice::heartRate(uint8_t heart) { Heart.setValue(heart); }
void bluetoothdevice::heartRate(uint8_t heart) {
Heart.setValue(heart);
#ifdef Q_OS_IOS
#ifndef IO_UNDER_QT
// Write heart rate from Bluetooth to Apple Health during workout
lockscreen h;
if(heart > 0)
h.setHeartRate(heart);
#endif
#endif
}
void bluetoothdevice::coreBodyTemperature(double coreBodyTemperature) { CoreBodyTemperature.setValue(coreBodyTemperature); }
void bluetoothdevice::skinTemperature(double skinTemperature) { SkinTemperature.setValue(skinTemperature); }
void bluetoothdevice::heatStrainIndex(double heatStrainIndex) { HeatStrainIndex.setValue(heatStrainIndex); }
@@ -192,7 +247,7 @@ void bluetoothdevice::update_metrics(bool watt_calc, const double watts, const b
!power_as_bike && !power_as_treadmill)
watt_calc = false;
if(deviceType() == bluetoothdevice::BIKE && !from_accessory) // append only if it's coming from the bike, not from the power sensor
if(deviceType() == BIKE && !from_accessory) // append only if it's coming from the bike, not from the power sensor
_ergTable.collectData(Cadence.value(), m_watt.value(), Resistance.value());
if (!_firstUpdate && !paused) {
@@ -234,6 +289,9 @@ void bluetoothdevice::update_metrics(bool watt_calc, const double watts, const b
_lastTimeUpdate = current;
_firstUpdate = false;
// Update iOS Live Activity with throttling
update_ios_live_activity();
}
void bluetoothdevice::update_hr_from_external() {
@@ -254,7 +312,17 @@ void bluetoothdevice::update_hr_from_external() {
#ifndef IO_UNDER_QT
lockscreen h;
long appleWatchHeartRate = h.heartRate();
h.setKcal(KCal.value());
QSettings settings;
bool activeOnly = settings.value(QZSettings::calories_active_only, QZSettings::default_calories_active_only).toBool();
if (activeOnly) {
// When active calories setting is enabled, send both total and active calories
h.setKcal(calories().value()); // This will be active calories
h.setTotalKcal(totalCalories().value()); // This will be total calories
} else {
// When disabled, send total calories as before
h.setKcal(calories().value()); // This will be total calories
}
h.setDistance(Distance.value());
h.setSpeed(Speed.value());
h.setPower(m_watt.value());
@@ -271,6 +339,29 @@ void bluetoothdevice::update_hr_from_external() {
}
#endif
}
// Note: workoutTrackingUpdate is now called from update_ios_live_activity() with throttling
}
void bluetoothdevice::update_ios_live_activity() {
#ifdef Q_OS_IOS
#ifndef IO_UNDER_QT
static QDateTime lastUpdate;
QDateTime current = QDateTime::currentDateTime();
// Throttle updates: only update if at least 1 second has passed since last update
if (!lastUpdate.isValid() || lastUpdate.msecsTo(current) >= 1000) {
QSettings settings;
lockscreen h;
double kcal = calories().value();
if(kcal < 0)
kcal = 0;
bool useMiles = settings.value(QZSettings::miles_unit, QZSettings::default_miles_unit).toBool();
h.workoutTrackingUpdate(Speed.value(), Cadence.value(), (uint16_t)m_watt.value(), kcal, StepCount.value(), deviceType(), odometer() * 1000.0, totalCalories().value(), useMiles);
lastUpdate = current;
}
#endif
#endif
}
void bluetoothdevice::clearStats() {
@@ -279,6 +370,8 @@ void bluetoothdevice::clearStats() {
moving.clear(true);
Speed.clear(false);
KCal.clear(true);
hrKCal.clear(true);
activeKCal.clear(true);
Distance.clear(true);
Distance1s.clear(true);
Heart.clear(false);
@@ -304,6 +397,8 @@ void bluetoothdevice::setPaused(bool p) {
elapsed.setPaused(p);
Speed.setPaused(p);
KCal.setPaused(p);
hrKCal.setPaused(p);
activeKCal.setPaused(p);
Distance.setPaused(p);
Distance1s.setPaused(p);
Heart.setPaused(p);
@@ -327,6 +422,8 @@ void bluetoothdevice::setLap() {
elapsed.setLap(true);
Speed.setLap(false);
KCal.setLap(true);
hrKCal.setLap(true);
activeKCal.setLap(true);
Distance.setLap(true);
Distance1s.setLap(true);
Heart.setLap(false);

View File

@@ -1,6 +1,7 @@
#ifndef BLUETOOTHDEVICE_H
#define BLUETOOTHDEVICE_H
#include "bluetoothdevicetype.h"
#include "definitions.h"
#include "metric.h"
#include "qzsettings.h"
@@ -108,11 +109,19 @@ class bluetoothdevice : public QObject {
/**
* @brief calories Gets a metric object to get and set the amount of energy expended.
* Default implementation returns the protected KCal property. Units: kcal
* Default implementation returns the protected KCal property, potentially adjusted for active calories. Units: kcal
* Other implementations could have different units.
* @return
*/
virtual metric calories();
virtual metric activeCalories();
virtual metric hrCalories();
/**
* @brief totalCalories Gets total calories (including BMR) regardless of active calories setting.
* @return Total calories metric
*/
virtual metric totalCalories();
/**
* @brief jouls Gets a metric object to get and set the number of joules expended. Units: joules
@@ -443,7 +452,6 @@ class bluetoothdevice : public QObject {
*/
void setTargetPowerZone(double pz) { TargetPowerZone = pz; }
enum BLUETOOTH_TYPE { UNKNOWN = 0, TREADMILL, BIKE, ROWING, ELLIPTICAL, JUMPROPE, STAIRCLIMBER };
enum WORKOUT_EVENT_STATE { STARTED = 0, PAUSED = 1, RESUMED = 2, STOPPED = 3 };
/**
@@ -548,6 +556,8 @@ class bluetoothdevice : public QObject {
* @brief KCal The number of kilocalories expended in the session. Units: kcal
*/
metric KCal;
metric activeKCal;
metric hrKCal;
/**
* @brief Speed The simulated speed of the device. Units: km/h
@@ -777,6 +787,11 @@ class bluetoothdevice : public QObject {
*/
void update_hr_from_external();
/**
* @brief update_ios_live_activity Updates iOS Live Activity with throttling (max 1 update per second)
*/
void update_ios_live_activity();
/**
* @brief calculateMETS Calculate the METS (Metabolic Equivalent of Tasks)
* Units: METs (1 MET is approximately 3.5mL of Oxygen consumed per kg of body weight per minute)

View File

@@ -23,7 +23,7 @@ bowflext216treadmill::bowflext216treadmill(uint32_t pollDeviceTime, bool noConso
QZ_EnableDiscoveryCharsAndDescripttors = true;
#endif
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
this->noConsole = noConsole;
this->noHeartService = noHeartService;

View File

@@ -23,7 +23,7 @@ bowflextreadmill::bowflextreadmill(uint32_t pollDeviceTime, bool noConsole, bool
QZ_EnableDiscoveryCharsAndDescripttors = true;
#endif
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
this->noConsole = noConsole;
this->noHeartService = noHeartService;

View File

@@ -16,7 +16,7 @@ using namespace std::chrono_literals;
//#include <QtBluetooth/private/qlowenergyserviceprivate_p.h>
chronobike::chronobike(bool noWriteResistance, bool noHeartService) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
t_timeout = new QTimer(this);

View File

@@ -947,12 +947,30 @@ int Computrainer::rawRead(uint8_t bytes[], int size) {
}
QAndroidJniEnvironment env;
while (fullLen < size) {
int timeout = 0;
int maxRetries = 100; // Maximum number of retries (100 * 50ms = 5 seconds timeout)
int retryCount = 0;
while (fullLen < size && retryCount < maxRetries) {
QAndroidJniObject dd =
QAndroidJniObject::callStaticObjectMethod("org/cagnulen/qdomyoszwift/Usbserial", "read", "()[B");
jint len = QAndroidJniObject::callStaticMethod<jint>("org/cagnulen/qdomyoszwift/Usbserial", "readLen", "()I");
jbyteArray d = dd.object<jbyteArray>();
jbyte *b = env->GetByteArrayElements(d, 0);
// Check if we got any data
if (len <= 0) {
// No data available, release memory and retry after a short sleep
env->ReleaseByteArrayElements(d, b, 0);
qDebug() << "No data available, retry" << retryCount + 1 << "of" << maxRetries;
CTsleeper::msleep(50); // Sleep for 50ms before retrying
retryCount++;
continue;
}
// Reset retry counter when we get data
retryCount = 0;
if (len + fullLen > size) {
QByteArray tmpDebug;
qDebug() << "buffer overflow! Truncate from" << len + fullLen << "requested" << size;
@@ -970,6 +988,9 @@ int Computrainer::rawRead(uint8_t bytes[], int size) {
}
qDebug() << len + fullLen - size << "bytes to the rxBuf" << tmpDebug.toHex(' ');
qDebug() << size << QByteArray((const char *)b, size).toHex(' ');
// Release JNI memory before returning
env->ReleaseByteArrayElements(d, b, 0);
return size;
}
for (int i = fullLen; i < len + fullLen; i++) {
@@ -977,6 +998,15 @@ int Computrainer::rawRead(uint8_t bytes[], int size) {
}
qDebug() << len << QByteArray((const char *)b, len).toHex(' ');
fullLen += len;
// Release JNI memory after processing
env->ReleaseByteArrayElements(d, b, 0);
}
// Check if we timed out
if (retryCount >= maxRetries) {
qDebug() << "rawRead timeout: no data after" << maxRetries << "retries";
return -1; // Timeout error
}
qDebug() << "FULL BUFFER RX: << " << fullLen << QByteArray((const char *)bytes, size).toHex(' ');

View File

@@ -16,7 +16,7 @@ using namespace std::chrono_literals;
computrainerbike::computrainerbike(bool noWriteResistance, bool noHeartService, int8_t bikeResistanceOffset,
double bikeResistanceGain) {
QSettings settings;
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
target_watts.setType(metric::METRIC_WATT);
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);

View File

@@ -20,7 +20,7 @@
using namespace std::chrono_literals;
concept2skierg::concept2skierg(bool noWriteResistance, bool noHeartService) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;

View File

@@ -23,7 +23,7 @@ crossrope::crossrope(uint32_t pollDeviceTime, bool noConsole, bool noHeartServic
QZ_EnableDiscoveryCharsAndDescripttors = true;
#endif
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
this->noConsole = noConsole;
this->noHeartService = noHeartService;

View File

@@ -4,7 +4,7 @@ using namespace std::chrono_literals;
csafeelliptical::csafeelliptical(bool noWriteResistance, bool noHeartService, bool noVirtualDevice,
int8_t bikeResistanceOffset, double bikeResistanceGain) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;
@@ -284,7 +284,7 @@ void csafeelliptical::update() {
bool ios_peloton_workaround =
settings.value(QZSettings::ios_peloton_workaround, QZSettings::default_ios_peloton_workaround).toBool();
if (ios_peloton_workaround && cadence && h && firstStateChanged) {
h->virtualbike_setCadence(currentCrankRevolutions(), lastCrankEventTime());
h->virtualbike_setCadence(currentCrankRevolutions(), lastCrankEventTime());
h->virtualbike_setHeartRate((uint8_t)metrics_override_heartrate());
}
#endif

View File

@@ -3,7 +3,7 @@
using namespace std::chrono_literals;
csaferower::csaferower(bool noWriteResistance, bool noHeartService, bool noVirtualDevice) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;

View File

@@ -17,7 +17,7 @@
using namespace std::chrono_literals;
cscbike::cscbike(bool noWriteResistance, bool noHeartService, bool noVirtualDevice) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;
@@ -207,6 +207,22 @@ void cscbike::characteristicChanged(const QLowEnergyCharacteristic &characterist
emit debug(QStringLiteral("Current Crank Event Time: ") + QString::number(_LastCrankEventTime));
}
// CSC Combo Sensor Fallback Logic
//
// Some combo sensors (e.g., Giant Combo) advertise both speed and cadence capabilities
// by setting CrankPresent=true in the CSC flags byte, but only transmit valid wheel data
// while sending crank data as zeros. This happens when:
// 1. The sensor supports dual mode (speed+cadence) but only speed sensor is mounted
// 2. The cadence sensor is not activated/calibrated
// 3. Firmware always sets CrankPresent flag regardless of actual crank sensor status
//
// In these cases, we use wheel revolutions as a fallback to calculate cadence.
// This works when the wheel circumference is set to a small value (e.g., 20cm for
// indoor trainers), which effectively converts wheel RPM to a cadence-like metric.
//
// Note: When using wheel revs as cadence, the calculated RPM can exceed 256 (the
// typical limit for real crank cadence). For example, with 20cm wheel circumference
// at 12.5 km/h, wheel RPM ≈ 1000. The validation logic below accounts for this.
if ((!CrankPresent || _CrankRevs == 0) && WheelPresent) {
CrankRevs = _WheelRevs;
LastCrankEventTime = _LastWheelEventTime;
@@ -222,7 +238,23 @@ void cscbike::characteristicChanged(const QLowEnergyCharacteristic &characterist
if (CrankRevs != oldCrankRevs && deltaT) {
double cadence = ((CrankRevs - oldCrankRevs) / deltaT) * 1024 * 60;
if ((cadence >= 0 && cadence < 256 && CrankPresent) || (!CrankPresent && WheelPresent))
// Cadence Validation Logic
//
// Normal cadence validation applies a 256 RPM limit for real crank sensors (no human
// can pedal faster than 256 RPM). However, when using wheel revs as fallback
// (_CrankRevs == 0), we bypass this limit because:
// - Wheel RPM with small circumferences (e.g., 20cm) can legitimately exceed 256
// - Example: 12.5 km/h with 20cm circumference = ~1042 wheel RPM
// - This high RPM represents wheel rotation rate, not actual pedaling cadence
//
// The condition breakdown:
// Part 1: (cadence >= 0 && (cadence < 256 || _CrankRevs == 0) && CrankPresent)
// - For real crank data: applies 256 RPM limit
// - For wheel fallback: no limit when _CrankRevs == 0
// Part 2: (!CrankPresent && WheelPresent)
// - Pure speed sensors with no crank capability
if ((cadence >= 0 && (cadence < 256 || _CrankRevs == 0) && CrankPresent) || (!CrankPresent && WheelPresent))
Cadence = cadence;
lastGoodCadence = now;
} else if (lastGoodCadence.msecsTo(now) > 2000) {

View File

@@ -17,7 +17,7 @@
using namespace std::chrono_literals;
cycleopsphantombike::cycleopsphantombike(bool noWriteResistance, bool noHeartService) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;
this->noHeartService = noHeartService;
@@ -738,7 +738,7 @@ void cycleopsphantombike::characteristicChanged(const QLowEnergyCharacteristic &
bool ios_peloton_workaround =
settings.value(QZSettings::ios_peloton_workaround, QZSettings::default_ios_peloton_workaround).toBool();
if (ios_peloton_workaround && cadence && h && firstStateChanged) {
h->virtualbike_setCadence(currentCrankRevolutions(), lastCrankEventTime());
h->virtualbike_setCadence(currentCrankRevolutions(), lastCrankEventTime());
h->virtualbike_setHeartRate((uint8_t)currentHeart().value());
}
#endif

View File

@@ -16,7 +16,7 @@ using namespace std::chrono_literals;
deerruntreadmill::deerruntreadmill(uint32_t pollDeviceTime, bool noConsole, bool noHeartService, double forceInitSpeed,
double forceInitInclination) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
this->noConsole = noConsole;
this->noHeartService = noHeartService;
@@ -75,6 +75,14 @@ void deerruntreadmill::writeCharacteristic(const QLowEnergyCharacteristic charac
}
}
void deerruntreadmill::waitForAPacket() {
QEventLoop loop;
QTimer timeout;
connect(this, &deerruntreadmill::packetReceived, &loop, &QEventLoop::quit);
timeout.singleShot(3000, &loop, SLOT(quit()));
loop.exec();
}
void deerruntreadmill::writeUnlockCharacteristic(uint8_t *data, uint8_t data_len, const QString &info, bool disable_log) {
QEventLoop loop;
QTimer timeout;
@@ -122,18 +130,70 @@ uint8_t deerruntreadmill::calculateXOR(uint8_t arr[], size_t size) {
return result;
}
uint8_t deerruntreadmill::calculatePitPatChecksum(uint8_t arr[], size_t size) {
uint8_t result = 0;
if (size < 5) {
qDebug() << QStringLiteral("array too small for PitPat checksum");
return 0;
}
// For PitPat protocol:
// 1. XOR from byte 5 to byte (size - 3) for long messages (>= 7 bytes)
// or from byte 2 to byte (size - 3) for short messages (< 7 bytes)
// 2. XOR the result with byte 1
size_t startIdx = (size < 7) ? 2 : 5;
for (size_t i = startIdx; i <= size - 3; i++) {
result ^= arr[i];
}
// XOR with byte 1 (command byte)
result ^= arr[1];
return result;
}
void deerruntreadmill::forceSpeed(double requestSpeed) {
QSettings settings;
uint8_t writeSpeed[] = {0x4d, 0x00, 0xc9, 0x17, 0x6a, 0x17, 0x02, 0x00, 0x06, 0x40, 0x04, 0x4c, 0x01, 0x00, 0x50, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x85, 0x11, 0xd8, 0x43};
writeSpeed[2] = pollCounter;
writeSpeed[10] = ((int)((requestSpeed * 100)) >> 8) & 0xFF;
writeSpeed[11] = ((int)((requestSpeed * 100))) & 0xFF;
writeSpeed[25] = calculateXOR(writeSpeed, sizeof(writeSpeed));
if (pitpat) {
// PitPat speed template
// Pattern: 6a 17 00 00 00 00 [speed_high] [speed_low] 01 00 8a 00 04 00 00 00 00 00 12 2e 0c [checksum] 43
// Speed encoding: speed value * 1000 (e.g., 2.0 km/h = 2000 = 0x07d0)
uint8_t writeSpeed[] = {0x6a, 0x17, 0x00, 0x00, 0x00, 0x00, 0x07, 0x6c, 0x01, 0x00, 0x8a, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x2e, 0x0c, 0xc3, 0x43};
writeCharacteristic(gattWriteCharacteristic, writeSpeed, sizeof(writeSpeed),
QStringLiteral("forceSpeed speed=") + QString::number(requestSpeed), false, false);
uint16_t speed = (uint16_t)(requestSpeed * 1000.0);
writeSpeed[6] = (speed >> 8) & 0xFF; // High byte
writeSpeed[7] = speed & 0xFF; // Low byte
writeSpeed[21] = calculatePitPatChecksum(writeSpeed, sizeof(writeSpeed)); // Checksum at byte 21
writeCharacteristic(gattWriteCharacteristic, writeSpeed, sizeof(writeSpeed),
QStringLiteral("forceSpeed PitPat speed=") + QString::number(requestSpeed), false, true);
} else if (superun_ba04) {
// Superun BA04 speed template
uint8_t writeSpeed[] = {0x4d, 0x00, 0x14, 0x17, 0x6a, 0x17, 0x00, 0x00, 0x00, 0x00, 0x04, 0x4c, 0x01, 0x00, 0x50, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xb5, 0x7c, 0xdb, 0x43};
writeSpeed[2] = pollCounter;
writeSpeed[10] = ((int)((requestSpeed * 100)) >> 8) & 0xFF;
writeSpeed[11] = ((int)((requestSpeed * 100))) & 0xFF;
writeSpeed[25] = calculateXOR(writeSpeed, sizeof(writeSpeed));
writeCharacteristic(gattWriteCharacteristic, writeSpeed, sizeof(writeSpeed),
QStringLiteral("forceSpeed BA04 speed=") + QString::number(requestSpeed), false, false);
} else {
// Default speed template
uint8_t writeSpeed[] = {0x4d, 0x00, 0xc9, 0x17, 0x6a, 0x17, 0x02, 0x00, 0x06, 0x40, 0x04, 0x4c, 0x01, 0x00, 0x50, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x85, 0x11, 0xd8, 0x43};
writeSpeed[2] = pollCounter;
writeSpeed[10] = ((int)((requestSpeed * 100)) >> 8) & 0xFF;
writeSpeed[11] = ((int)((requestSpeed * 100))) & 0xFF;
writeSpeed[25] = calculateXOR(writeSpeed, sizeof(writeSpeed));
writeCharacteristic(gattWriteCharacteristic, writeSpeed, sizeof(writeSpeed),
QStringLiteral("forceSpeed speed=") + QString::number(requestSpeed), false, false);
}
}
void deerruntreadmill::forceIncline(double requestIncline) {
@@ -216,8 +276,7 @@ void deerruntreadmill::update() {
}
if (pitpat) {
uint8_t startData[] = {0x6a, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x93, 0x43};
writeCharacteristic(gattWriteCharacteristic, startData, sizeof(startData), QStringLiteral("pitpat start"), false, true);
forceSpeed(1.0);
} else {
// should be:
// 0x49 = inited
@@ -240,13 +299,16 @@ void deerruntreadmill::update() {
emit tapeStarted();
} else if (requestStop != -1) {
emit debug(QStringLiteral("stopping... ") + paused);
/*if (lastState == PAUSED) {
uint8_t pause[] = {0x05, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x07};
writeCharacteristic(gattWriteCharacteristic, pause, sizeof(pause), QStringLiteral("pause"), false,
true);
} else*/ {
if (pitpat) {
uint8_t stop[] = {
0x6a, 0x17, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x05, 0x00,
0x8a, 0x00, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x12, 0x2e,
0x0c, 0xaa, 0x43};
writeCharacteristic(gattWriteCharacteristic, stop, sizeof(stop), QStringLiteral("stop"), false, true);
} else {
uint8_t stop[] = {0x4d, 0x00, 0x48, 0x17, 0x6a, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x50, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x85, 0x11, 0xd6, 0x43};
stop[2] = pollCounter;
@@ -392,15 +454,37 @@ void deerruntreadmill::btinit(bool startTape) {
// PitPat treadmill initialization sequence
uint8_t initData1[] = {0x6a, 0x05, 0xfd, 0xf8, 0x43};
writeCharacteristic(gattWriteCharacteristic, initData1, sizeof(initData1), QStringLiteral("pitpat init 1"), false, true);
uint8_t unlockData[] = {0x6b, 0x05, 0x9d, 0x98, 0x43};
writeUnlockCharacteristic(unlockData, sizeof(unlockData), QStringLiteral("pitpat unlock"), false);
uint8_t initData2[] = {0x6a, 0x05, 0xd7, 0xd2, 0x43};
writeCharacteristic(gattWriteCharacteristic, initData2, sizeof(initData2), QStringLiteral("pitpat init 2"), false, true);
uint8_t startData[] = {0x6a, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x93, 0x43};
writeCharacteristic(gattWriteCharacteristic, startData, sizeof(startData), QStringLiteral("pitpat start"), false, true);
} else if (superun_ba04) {
// Superun BA04 treadmill initialization sequence
// Wait for initial packet from treadmill before sending init
emit debug(QStringLiteral("BA04: waiting for initial packet..."));
waitForAPacket();
// Init 1: pollCounter = 0
uint8_t initData1[] = {0x4d, 0x00, 0x00, 0x05, 0x6a, 0x05, 0xfd, 0xf8, 0x43};
initData1[2] = 0; // pollCounter = 0
writeCharacteristic(gattWriteCharacteristic, initData1, sizeof(initData1), QStringLiteral("BA04 init 1"), false, true);
uint8_t initData2[] = {0x4d, 0x00, 0x00, 0x05, 0x6a, 0x05, 0xfd, 0xf8, 0x43};
initData1[2] = 1; // pollCounter = 0
writeCharacteristic(gattWriteCharacteristic, initData2, sizeof(initData2), QStringLiteral("BA04 init 2"), false, true);
// Init 2: pollCounter = 1
uint8_t initData3[] = {0x4d, 0x00, 0x01, 0x17, 0x6a, 0x17, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe8, 0x05, 0x00, 0x50, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xb5, 0x7c, 0x7c, 0x43};
initData3[2] = 2; // pollCounter = 1
writeCharacteristic(gattWriteCharacteristic, initData3, sizeof(initData3), QStringLiteral("BA04 init 3"), false, true);
// Start pollCounter from 2 after init
pollCounter = 3;
}
initDone = true;
}
@@ -413,6 +497,8 @@ void deerruntreadmill::stateChanged(QLowEnergyService::ServiceState state) {
QBluetoothUuid _gattNotifyCharacteristicId((quint16)0xfff2);
QBluetoothUuid _pitpatWriteCharacteristicId((quint16)0xfba1);
QBluetoothUuid _pitpatNotifyCharacteristicId((quint16)0xfba2);
QBluetoothUuid _superunWriteCharacteristicId((quint16)0xff01);
QBluetoothUuid _superunNotifyCharacteristicId((quint16)0xff02);
QBluetoothUuid _unlockCharacteristicId((quint16)0x2b2a);
QMetaEnum metaEnum = QMetaEnum::fromType<QLowEnergyService::ServiceState>();
@@ -427,7 +513,7 @@ void deerruntreadmill::stateChanged(QLowEnergyService::ServiceState state) {
qDebug() << QStringLiteral("unlock char uuid") << c.uuid() << QStringLiteral("handle") << c.handle()
<< c.properties();
}
unlock_characteristic = unlock_service->characteristic(_unlockCharacteristicId);
if (unlock_characteristic.isValid()) {
emit debug(QStringLiteral("unlock characteristic found"));
@@ -445,6 +531,9 @@ void deerruntreadmill::stateChanged(QLowEnergyService::ServiceState state) {
if (pitpat) {
gattWriteCharacteristic = gattCommunicationChannelService->characteristic(_pitpatWriteCharacteristicId);
gattNotifyCharacteristic = gattCommunicationChannelService->characteristic(_pitpatNotifyCharacteristicId);
} else if (superun_ba04) {
gattWriteCharacteristic = gattCommunicationChannelService->characteristic(_superunWriteCharacteristicId);
gattNotifyCharacteristic = gattCommunicationChannelService->characteristic(_superunNotifyCharacteristicId);
} else {
gattWriteCharacteristic = gattCommunicationChannelService->characteristic(_gattWriteCharacteristicId);
gattNotifyCharacteristic = gattCommunicationChannelService->characteristic(_gattNotifyCharacteristicId);
@@ -488,6 +577,7 @@ void deerruntreadmill::characteristicWritten(const QLowEnergyCharacteristic &cha
void deerruntreadmill::serviceScanDone(void) {
QBluetoothUuid _gattCommunicationChannelServiceId((quint16)0xfff0);
QBluetoothUuid _pitpatServiceId((quint16)0xfba0);
QBluetoothUuid _superunServiceId((quint16)0xffff);
QBluetoothUuid _unlockServiceId((quint16)0x1801);
emit debug(QStringLiteral("serviceScanDone"));
@@ -503,6 +593,11 @@ void deerruntreadmill::serviceScanDone(void) {
emit debug(QStringLiteral("Detected pitpat treadmill variant"));
gattCommunicationChannelService = m_control->createServiceObject(_pitpatServiceId);
unlock_service = m_control->createServiceObject(_unlockServiceId);
} else if (services_list.contains(_superunServiceId)) {
superun_ba04 = true;
pitpat = false;
emit debug(QStringLiteral("Detected Superun BA04 treadmill variant"));
gattCommunicationChannelService = m_control->createServiceObject(_superunServiceId);
} else {
pitpat = false;
gattCommunicationChannelService = m_control->createServiceObject(_gattCommunicationChannelServiceId);

View File

@@ -41,6 +41,7 @@ class deerruntreadmill : public treadmill {
double forceInitSpeed = 0.0, double forceInitInclination = 0.0);
bool connected() override;
double minStepInclination() override;
double minStepSpeed() override { return 0.1; }
private:
void forceSpeed(double requestSpeed);
@@ -49,8 +50,10 @@ class deerruntreadmill : public treadmill {
void writeCharacteristic(const QLowEnergyCharacteristic characteristic, uint8_t *data, uint8_t data_len,
const QString &info, bool disable_log = false, bool wait_for_response = false);
void writeUnlockCharacteristic(uint8_t *data, uint8_t data_len, const QString &info, bool disable_log = false);
void waitForAPacket();
void startDiscover();
uint8_t calculateXOR(uint8_t arr[], size_t size);
uint8_t calculatePitPatChecksum(uint8_t arr[], size_t size);
bool noConsole = false;
bool noHeartService = false;
uint32_t pollDeviceTime = 200;
@@ -70,8 +73,9 @@ class deerruntreadmill : public treadmill {
QLowEnergyService *unlock_service = nullptr;
QLowEnergyCharacteristic unlock_characteristic;
bool pitpat = false;
bool superun_ba04 = false;
bool initDone = false;
bool initRequest = false;

View File

@@ -43,7 +43,7 @@ using namespace std::chrono_literals;
DP_PROCESS_WRITE_NULL, P1, P2, P3) \
OP(FITNESS_MACHINE_CYCLE, 0x2AD6, DPKT_CHAR_PROP_FLAG_READ, DM_BT("\x0A\x00\x96\x00\x0A\x00"), \
DP_PROCESS_WRITE_NULL, P1, P2, P3) \
OP(FITNESS_MACHINE_CYCLE, 0x2AD9, DPKT_CHAR_PROP_FLAG_WRITE, DM_BT("\x00"), DP_PROCESS_WRITE_2AD9, P1, P2, P3) \
OP(FITNESS_MACHINE_CYCLE, 0x2AD9, DPKT_CHAR_PROP_FLAG_WRITE | DPKT_CHAR_PROP_FLAG_INDICATE, DM_BT("\x00"), DP_PROCESS_WRITE_2AD9, P1, P2, P3) \
OP(FITNESS_MACHINE_CYCLE, 0xE005, DPKT_CHAR_PROP_FLAG_WRITE, DM_BT("\x00"), DP_PROCESS_WRITE_E005, P1, P2, P3) \
OP(FITNESS_MACHINE_CYCLE, 0x2AD2, DPKT_CHAR_PROP_FLAG_NOTIFY, DM_BT("\x00"), DP_PROCESS_WRITE_NULL, P1, P2, P3) \
OP(FITNESS_MACHINE_CYCLE, 0x2AD3, DPKT_CHAR_PROP_FLAG_READ, DM_BT("\x00\x01"), DP_PROCESS_WRITE_NULL, P1, P2, P3) \
@@ -51,7 +51,7 @@ using namespace std::chrono_literals;
DP_PROCESS_WRITE_NULL, P1, P2, P3) \
OP(FITNESS_MACHINE_TREADMILL, 0x2AD6, DPKT_CHAR_PROP_FLAG_READ, DM_BT("\x0A\x00\x96\x00\x0A\x00"), \
DP_PROCESS_WRITE_NULL, P1, P2, P3) \
OP(FITNESS_MACHINE_TREADMILL, 0x2AD9, DPKT_CHAR_PROP_FLAG_WRITE, DM_BT("\x00"), DP_PROCESS_WRITE_2AD9T, P1, P2, \
OP(FITNESS_MACHINE_TREADMILL, 0x2AD9, DPKT_CHAR_PROP_FLAG_WRITE | DPKT_CHAR_PROP_FLAG_INDICATE, DM_BT("\x00"), DP_PROCESS_WRITE_2AD9T, P1, P2, \
P3) \
OP(FITNESS_MACHINE_TREADMILL, 0x2ACD, DPKT_CHAR_PROP_FLAG_NOTIFY, DM_BT("\x00"), DP_PROCESS_WRITE_NULL, P1, P2, \
P3) \
@@ -171,9 +171,9 @@ DirconManager::DirconManager(bluetoothdevice *Bike, int8_t bikeResistanceOffset,
QSettings settings;
DirconProcessorService *service;
QList<DirconProcessorService *> services, proc_services;
bluetoothdevice::BLUETOOTH_TYPE dt = Bike->deviceType();
BLUETOOTH_TYPE dt = Bike->deviceType();
bt = Bike;
uint8_t type = dt == bluetoothdevice::TREADMILL || dt == bluetoothdevice::ELLIPTICAL ? DM_MACHINE_TYPE_TREADMILL
uint8_t type = dt == TREADMILL || dt == ELLIPTICAL ? DM_MACHINE_TYPE_TREADMILL
: DM_MACHINE_TYPE_BIKE;
qDebug() << "Building Dircom Manager";
uint16_t server_base_port =
@@ -236,7 +236,7 @@ double DirconManager::currentGear() {
QSettings settings;
if(settings.value(QZSettings::zwift_play_emulator, QZSettings::default_zwift_play_emulator).toBool() && writeP0003)
return writeP0003->currentGear();
else if(bt && bt->deviceType() == bluetoothdevice::BIKE)
else if(bt && bt->deviceType() == BIKE)
return ((bike*)bt)->gears();
return 0;
}

View File

@@ -96,11 +96,11 @@ int DirconPacket::parse(const QByteArray &buf, int last_seq_number) {
} else
return DPKT_PARSE_ERROR - rembuf;
} else if (this->Identifier == DPKT_MSGID_ENABLE_CHARACTERISTIC_NOTIFICATIONS) {
if (this->Length == 16 || this->Length == 17) {
if (this->Length >= 16) {
quint16 uuid = ((quint16)buf.at(DPKT_MESSAGE_HEADER_LENGTH + DPKT_POS_SH8)) << 8;
uuid |= ((quint16)buf.at(DPKT_MESSAGE_HEADER_LENGTH + DPKT_POS_SH0)) & 0x00FF;
this->uuid = uuid;
if (this->Length == 17) {
if (this->Length >= 17) {
this->isRequest = true;
this->additional_data = buf.mid(DPKT_MESSAGE_HEADER_LENGTH + 16, 1);
}
@@ -117,6 +117,12 @@ int DirconPacket::parse(const QByteArray &buf, int last_seq_number) {
return rembuf;
} else
return DPKT_PARSE_ERROR - rembuf;
} else if (this->Identifier == DPKT_MSGID_UNKNOWN_0x07) {
if (this->Length == 0) {
this->isRequest = this->checkIsRequest(last_seq_number);
return DPKT_MESSAGE_HEADER_LENGTH;
} else
return DPKT_PARSE_ERROR - rembuf;
} else
return DPKT_PARSE_ERROR - rembuf;
} else
@@ -182,6 +188,10 @@ QByteArray DirconPacket::encode(int last_seq_number) {
}
}
}
} else if (this->Identifier == DPKT_MSGID_UNKNOWN_0x07) {
// Unknown message 0x07 - always respond with empty payload
this->Length = 0;
byteout.append(2, 0);
} else if (this->Identifier == DPKT_MSGID_DISCOVER_CHARACTERISTICS && !this->isRequest) {
this->Length = 16 + this->uuids.size() * 17;
byteout.append((char)(this->Length >> 8)).append((char)(this->Length));

View File

@@ -25,6 +25,7 @@
#define DPKT_MSGID_WRITE_CHARACTERISTIC 0x04
#define DPKT_MSGID_ENABLE_CHARACTERISTIC_NOTIFICATIONS 0x05
#define DPKT_MSGID_UNSOLICITED_CHARACTERISTIC_NOTIFICATION 0x06
#define DPKT_MSGID_UNKNOWN_0x07 0x07
#define DPKT_RESPCODE_SUCCESS_REQUEST 0x00
#define DPKT_RESPCODE_UNKNOWN_MESSAGE_TYPE 0x01
#define DPKT_RESPCODE_UNEXPECTED_ERROR 0x02

View File

@@ -187,7 +187,7 @@ DirconPacket DirconProcessor::processPacket(DirconProcessorClient *client, const
foreach (cc, service->chars) {
if (cc->uuid == pkt.uuid) {
cfound = true;
if (cc->type & DPKT_CHAR_PROP_FLAG_NOTIFY) {
if (cc->type & (DPKT_CHAR_PROP_FLAG_NOTIFY | DPKT_CHAR_PROP_FLAG_INDICATE)) {
int idx;
char notif = pkt.additional_data.at(0);
out.uuid = pkt.uuid;
@@ -208,6 +208,9 @@ DirconPacket DirconProcessor::processPacket(DirconProcessorClient *client, const
}
if (!cfound)
out.ResponseCode = DPKT_RESPCODE_CHARACTERISTIC_NOT_FOUND;
} else if (pkt.Identifier == DPKT_MSGID_UNKNOWN_0x07) {
// Unknown message 0x07 - respond with success
out.ResponseCode = DPKT_RESPCODE_SUCCESS_REQUEST;
}
}
return out;

View File

@@ -3,6 +3,8 @@
#include "keepawakehelper.h"
#endif
#include "virtualdevices/virtualbike.h"
#include "homeform.h"
#include "qzsettings.h"
#include <QBluetoothLocalDevice>
#include <QDateTime>
#include <QFile>
@@ -15,7 +17,7 @@ using namespace std::chrono_literals;
domyosbike::domyosbike(bool noWriteResistance, bool noHeartService, bool testResistance, int8_t bikeResistanceOffset,
double bikeResistanceGain) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
@@ -593,6 +595,22 @@ void domyosbike::serviceScanDone(void) {
QBluetoothUuid _gattCommunicationChannelServiceId(QStringLiteral("49535343-fe7d-4ae5-8fa9-9fafd205e455"));
gattCommunicationChannelService = m_control->createServiceObject(_gattCommunicationChannelServiceId);
if(!gattCommunicationChannelService) {
// Main service not found, check if FTMS service is available
QBluetoothUuid ftmsServiceId((quint16)0x1826);
QLowEnergyService *ftmsService = m_control->createServiceObject(ftmsServiceId);
if(ftmsService) {
QSettings settings;
settings.setValue(QZSettings::ftms_bike, bluetoothDevice.name());
qDebug() << "forcing FTMS bike since it has FTMS service but not the main domyos service";
if(homeform::singleton())
homeform::singleton()->setToastRequested("FTMS bike found, restart the app to apply the change");
delete ftmsService;
}
return;
}
connect(gattCommunicationChannelService, &QLowEnergyService::stateChanged, this, &domyosbike::stateChanged);
gattCommunicationChannelService->discoverDetails();
}
@@ -601,6 +619,8 @@ void domyosbike::errorService(QLowEnergyService::ServiceError err) {
QMetaEnum metaEnum = QMetaEnum::fromType<QLowEnergyService::ServiceError>();
qDebug() << QStringLiteral("domyosbike::errorService") + QString::fromLocal8Bit(metaEnum.valueToKey(err)) +
m_control->errorString();
m_control->disconnectFromDevice();
}
void domyosbike::error(QLowEnergyController::Error err) {

View File

@@ -17,7 +17,7 @@ using namespace std::chrono_literals;
domyoselliptical::domyoselliptical(bool noWriteResistance, bool noHeartService, bool testResistance,
int8_t bikeResistanceOffset, double bikeResistanceGain) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);

View File

@@ -18,7 +18,7 @@ using namespace std::chrono_literals;
domyosrower::domyosrower(bool noWriteResistance, bool noHeartService, bool testResistance, int8_t bikeResistanceOffset,
double bikeResistanceGain) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);

View File

@@ -56,7 +56,7 @@ domyostreadmill::domyostreadmill(uint32_t pollDeviceTime, bool noConsole, bool n
#ifdef Q_OS_IOS
QZ_EnableDiscoveryCharsAndDescripttors = true;
#endif
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
this->noConsole = noConsole;
this->noHeartService = noHeartService;

View File

@@ -23,7 +23,7 @@ echelonconnectsport::echelonconnectsport(bool noWriteResistance, bool noHeartSer
#ifdef Q_OS_IOS
QZ_EnableDiscoveryCharsAndDescripttors = true;
#endif
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;
@@ -150,6 +150,11 @@ void echelonconnectsport::update() {
initDone) {
update_metrics(true, watts());
// Continuous ERG mode support - recalculate resistance as cadence changes when using power zone tiles
if (RequestedPower.value() > 0) {
changePower(RequestedPower.value());
}
// sending poll every 2 seconds
if (sec1Update++ >= (2000 / refresh->interval())) {
sec1Update = 0;

View File

@@ -23,7 +23,7 @@ echelonrower::echelonrower(bool noWriteResistance, bool noHeartService, int8_t b
#ifdef Q_OS_IOS
QZ_EnableDiscoveryCharsAndDescripttors = true;
#endif
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
speedRaw.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);

View File

@@ -15,7 +15,7 @@ using namespace std::chrono_literals;
echelonstairclimber::echelonstairclimber(uint32_t pollDeviceTime, bool noConsole, bool noHeartService, double forceInitSpeed,
double forceInitInclination) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
this->noConsole = noConsole;
this->noHeartService = noHeartService;

View File

@@ -15,7 +15,7 @@ using namespace std::chrono_literals;
echelonstride::echelonstride(uint32_t pollDeviceTime, bool noConsole, bool noHeartService, double forceInitSpeed,
double forceInitInclination) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
this->noConsole = noConsole;
this->noHeartService = noHeartService;

View File

@@ -16,7 +16,7 @@
using namespace std::chrono_literals;
eliterizer::eliterizer(bool noWriteResistance, bool noHeartService) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;

View File

@@ -15,7 +15,7 @@
using namespace std::chrono_literals;
elitesterzosmart::elitesterzosmart(bool noWriteResistance, bool noHeartService) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;

View File

@@ -22,11 +22,15 @@ void elliptical::update_metrics(bool watt_calc, const double watts) {
WeightLoss = metric::calculateWeightLoss(KCal.value());
WattKg = m_watt.value() / settings.value(QZSettings::weight, QZSettings::default_weight).toFloat();
} else if (m_watt.value() > 0) {
m_watt = 0;
if (watt_calc) {
m_watt = 0;
}
WattKg = 0;
}
} else if (m_watt.value() > 0) {
m_watt = 0;
if (watt_calc) {
m_watt = 0;
}
WattKg = 0;
}
@@ -36,6 +40,9 @@ void elliptical::update_metrics(bool watt_calc, const double watts) {
_lastTimeUpdate = current;
_firstUpdate = false;
// Update iOS Live Activity with throttling
update_ios_live_activity();
}
resistance_t elliptical::resistanceFromPowerRequest(uint16_t power) { return power / 10; } // in order to have something
@@ -137,7 +144,7 @@ metric elliptical::currentInclination() { return Inclination; }
uint8_t elliptical::fanSpeed() { return FanSpeed; }
bool elliptical::connected() { return false; }
bluetoothdevice::BLUETOOTH_TYPE elliptical::deviceType() { return bluetoothdevice::ELLIPTICAL; }
BLUETOOTH_TYPE elliptical::deviceType() { return ELLIPTICAL; }
void elliptical::clearStats() {
moving.clear(true);

View File

@@ -24,7 +24,7 @@ class elliptical : public bluetoothdevice {
virtual int pelotonToEllipticalResistance(int pelotonResistance);
virtual bool inclinationAvailableByHardware();
virtual bool inclinationSeparatedFromResistance();
bluetoothdevice::BLUETOOTH_TYPE deviceType() override;
BLUETOOTH_TYPE deviceType() override;
void clearStats() override;
void setPaused(bool p) override;
void setLap() override;

View File

@@ -71,7 +71,7 @@ class CRC8
eslinkertreadmill::eslinkertreadmill(uint32_t pollDeviceTime, bool noConsole, bool noHeartService,
double forceInitSpeed, double forceInitInclination) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
this->noConsole = noConsole;
this->noHeartService = noHeartService;

View File

@@ -17,7 +17,7 @@
using namespace std::chrono_literals;
fakebike::fakebike(bool noWriteResistance, bool noHeartService, bool noVirtualDevice) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;
@@ -65,6 +65,14 @@ void fakebike::update() {
speedLimit());
}
double weight = settings.value(QZSettings::weight, QZSettings::default_weight).toFloat();
if (watts())
KCal +=
((((0.048 * ((double)watts()) + 1.19) * weight * 3.5) / 200.0) /
(60000.0 / ((double)lastRefreshCharacteristicChanged.msecsTo(
QDateTime::currentDateTime())))); //(( (0.048* Output in watts +1.19) * body weight in
// kg * 3.5) / 200 ) / 60
if (Cadence.value() > 0) {
CrankRevs++;
LastCrankEventTime += (uint16_t)(1024.0 / (((double)(Cadence.value())) / 60.0));

View File

@@ -16,7 +16,7 @@
using namespace std::chrono_literals;
fakeelliptical::fakeelliptical(bool noWriteResistance, bool noHeartService, bool noVirtualDevice) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;

View File

@@ -18,7 +18,7 @@
using namespace std::chrono_literals;
fakerower::fakerower(bool noWriteResistance, bool noHeartService, bool noVirtualDevice) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;
@@ -31,14 +31,36 @@ fakerower::fakerower(bool noWriteResistance, bool noHeartService, bool noVirtual
void fakerower::update() {
QSettings settings;
QDateTime now = QDateTime::currentDateTime();
QString heartRateBeltName =
settings.value(QZSettings::heart_rate_belt_name, QZSettings::default_heart_rate_belt_name).toString();
update_metrics(false, watts());
if (RequestedPower.value() != -1) {
m_watt = (double)RequestedPower.value() * (1.0 + (((double)rand() / RAND_MAX) * 0.4 - 0.2));
if(RequestedPower.value())
Cadence = 50 + (static_cast<double>(rand()) / RAND_MAX) * 50;
else
Cadence = 0;
StrokesCount += (Cadence.value()) *
((double)lastRefreshCharacteristicChanged.msecsTo(now)) / 60000;
emit debug(QStringLiteral("writing power ") + QString::number(RequestedPower.value()));
//requestPower = -1;
// bepo70: Disregard the current inclination for calculating speed. When the video
// has a high inclination you have to give many power to get the desired playback speed,
// if inclination is very low little more power gives a quite high speed jump.
// Speed = metric::calculateSpeedFromPower(m_watt.value(), Inclination.value(),
// Speed.value(),fabs(QDateTime::currentDateTime().msecsTo(Speed.lastChanged()) / 1000.0), speedLimit());
Speed = metric::calculateSpeedFromPower(
m_watt.value(), 0, Speed.value(), fabs(QDateTime::currentDateTime().msecsTo(Speed.lastChanged()) / 1000.0), 0);
}
Distance += ((Speed.value() / (double)3600.0) /
((double)1000.0 / (double)(lastRefreshCharacteristicChanged.msecsTo(QDateTime::currentDateTime()))));
lastRefreshCharacteristicChanged = QDateTime::currentDateTime();
lastRefreshCharacteristicChanged = now;
// ******************************************* virtual bike init *************************************
if (!firstStateChanged && !this->hasVirtualDevice() && !noVirtualDevice

View File

@@ -17,7 +17,7 @@
using namespace std::chrono_literals;
faketreadmill::faketreadmill(bool noWriteResistance, bool noHeartService, bool noVirtualDevice) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;

View File

@@ -30,7 +30,7 @@ fitplusbike::fitplusbike(bool noWriteResistance, bool noHeartService, int8_t bik
QZ_EnableDiscoveryCharsAndDescripttors = true;
}
#endif
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;

View File

@@ -19,7 +19,7 @@ fitshowtreadmill::fitshowtreadmill(uint32_t pollDeviceTime, bool noConsole, bool
double forceInitInclination) {
Q_UNUSED(noConsole)
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
this->noHeartService = noHeartService;
@@ -299,7 +299,7 @@ void fitshowtreadmill::serviceDiscovered(const QBluetoothUuid &gatt) {
qDebug() << "adding" << gatt.toString() << "as the default service";
serviceId = gatt; // NOTE: clazy-rule-of-tow
}
if(gatt == QBluetoothUuid((quint16)0x1826) && !fs_connected) {
if(gatt == QBluetoothUuid((quint16)0x1826) && !fs_connected && !tunturi_t80_connected) {
QSettings settings;
settings.setValue(QZSettings::ftms_treadmill, bluetoothDevice.name());
qDebug() << "forcing FTMS treadmill since it has FTMS";
@@ -845,6 +845,9 @@ void fitshowtreadmill::deviceDiscovered(const QBluetoothDeviceInfo &device) {
qDebug() << "NOBLEPRO FIX!";
minStepInclinationValue = 0.5;
noblepro_connected = true;
} else if (device.name().toUpper().startsWith(QStringLiteral("TUNTURI T80-"))) {
qDebug() << "TUNTURI T80 detected - ignoring FTMS forcing";
tunturi_t80_connected = true;
}
{

View File

@@ -153,6 +153,7 @@ class fitshowtreadmill : public treadmill {
double minStepInclinationValue = 1.0;
bool noblepro_connected = false;
bool fs_connected = false;
bool tunturi_t80_connected = false;
metric rawInclination;

View File

@@ -15,7 +15,7 @@
using namespace std::chrono_literals;
flywheelbike::flywheelbike(bool noWriteResistance, bool noHeartService) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;

View File

@@ -24,7 +24,7 @@ focustreadmill::focustreadmill(uint32_t pollDeviceTime, bool noConsole, bool noH
QZ_EnableDiscoveryCharsAndDescripttors = false;
#endif
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
this->noConsole = noConsole;
this->noHeartService = noHeartService;

View File

@@ -26,7 +26,7 @@ using namespace std::chrono_literals;
ftmsbike::ftmsbike(bool noWriteResistance, bool noHeartService, int8_t bikeResistanceOffset,
double bikeResistanceGain) {
QSettings settings;
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;
@@ -130,7 +130,7 @@ void ftmsbike::init() {
if (initDone)
return;
if(ICSE) {
if(ICSE || HAMMER) {
uint8_t write[] = {FTMS_REQUEST_CONTROL};
bool ret = writeCharacteristic(write, sizeof(write), "requestControl", false, true);
write[0] = {FTMS_RESET};
@@ -194,7 +194,7 @@ void ftmsbike::zwiftPlayInit() {
}
void ftmsbike::forcePower(int16_t requestPower) {
if(resistance_lvl_mode || TITAN_7000) {
if((resistance_lvl_mode || TITAN_7000) && !MAGNUS && !SS2K) {
forceResistance(resistanceFromPowerRequest(requestPower));
} else {
uint8_t write[] = {FTMS_SET_TARGET_POWER, 0x00, 0x00};
@@ -216,6 +216,7 @@ uint16_t ftmsbike::wattsFromResistance(double resistance) {
return _ergTable.estimateWattage(Cadence.value(), resistance);
}
resistance_t ftmsbike::resistanceFromPowerRequest(uint16_t power) {
return _ergTable.resistanceFromPowerRequest(power, Cadence.value(), max_resistance);
}
@@ -231,6 +232,10 @@ void ftmsbike::forceResistance(resistance_t requestResistance) {
double fr = (((double)requestResistance) * bikeResistanceGain) + ((double)bikeResistanceOffset);
if(ergModeNotSupported) {
if(requestResistance < 0) {
qDebug() << "Negative resistance detected:" << requestResistance << "using fallback value 1";
requestResistance = 1;
}
requestResistance = _inclinationResistanceTable.estimateInclination(requestResistance) * 10.0;
qDebug() << "ergMode Not Supported so the resistance will be" << requestResistance;
} else {
@@ -246,10 +251,16 @@ void ftmsbike::forceResistance(resistance_t requestResistance) {
writeCharacteristic(write, sizeof(write),
QStringLiteral("forceResistance ") + QString::number(requestResistance));
} else {
if(SL010)
if(requestResistance < 0) {
qDebug() << "Negative resistance detected:" << requestResistance << "using fallback value 1";
requestResistance = 1;
}
if(SL010 || SPORT01)
Resistance = requestResistance;
if(JFBK5_0 || DIRETO_XR) {
if(JFBK5_0 || DIRETO_XR || YPBM || FIT_BK) {
uint8_t write[] = {FTMS_SET_TARGET_RESISTANCE_LEVEL, 0x00, 0x00};
write[1] = ((uint16_t)requestResistance * 10) & 0xFF;
write[2] = ((uint16_t)requestResistance * 10) >> 8;
@@ -266,6 +277,26 @@ void ftmsbike::forceResistance(resistance_t requestResistance) {
}
}
void ftmsbike::forceInclination(double requestInclination) {
// FTMS SET_INDOOR_BIKE_SIMULATION_PARAMS command
// Byte 0: OpCode
// Byte 1-2: Wind Speed (sint16, 0.001 m/s)
// Byte 3-4: Grade/Inclination (sint16, 0.01%)
// Byte 5-6: Coefficient of Rolling Resistance (uint8, 0.0001)
uint8_t write[] = {FTMS_SET_INDOOR_BIKE_SIMULATION_PARAMS, 0x00, 0x00, 0x00, 0x00, 0x28, 0x19};
// Convert inclination to FTMS format (multiply by 100 for 0.01% units)
int16_t inclination = (int16_t)(requestInclination * 100.0);
// Pack Grade in bytes 3-4 as little-endian sint16
write[3] = ((uint16_t)inclination) & 0xFF;
write[4] = ((uint16_t)inclination) >> 8;
writeCharacteristic(write, sizeof(write),
QStringLiteral("forceInclination ") + QString::number(requestInclination));
}
void ftmsbike::update() {
QSettings settings;
@@ -277,8 +308,6 @@ void ftmsbike::update() {
if (initRequest) {
zwiftPlayInit();
if(ICSE)
requestResistance = 1; // to force the engine to send every second a target inclination
// when we are emulating the zwift protocol, zwift doesn't senf the start simulation frames, so we have to send them
if(settings.value(QZSettings::zwift_play_emulator, QZSettings::default_zwift_play_emulator).toBool())
@@ -335,10 +364,23 @@ void ftmsbike::update() {
forceResistance(rR);
}
}
if(!ICSE)
requestResistance = -1;
requestResistance = -1;
}
// gpx scenario for example
if(!virtualBike || !virtualBike->ftmsDeviceConnected()) {
if ((requestInclination != -100 || lastGearValue != gears())) {
emit debug(QStringLiteral("writing inclination ") + QString::number(requestInclination));
forceInclination(requestInclination + gears()); // since this bike doesn't have the concept of resistance,
// i'm using the gears in the inclination
requestInclination = -100;
} else if(lastGearValue != gears() && lastRawRequestedInclinationValue != -100) {
// in order to send the new gear value ASAP
forceInclination(lastRawRequestedInclinationValue + gears()); // since this bike doesn't have the concept of resistance,
// i'm using the gears in the inclination
}
}
if((virtualBike && virtualBike->ftmsDeviceConnected()) && lastGearValue != gears() && lastRawRequestedInclinationValue != -100 && lastPacketFromFTMS.length() >= 7) {
qDebug() << "injecting fake ftms frame in order to send the new gear value ASAP" << lastPacketFromFTMS.toHex(' ');
ftmsCharacteristicChanged(QLowEnergyCharacteristic(), lastPacketFromFTMS);
@@ -396,8 +438,15 @@ void ftmsbike::update() {
lastGearValue = gears();
// if a classic request of power from zwift or any other platform is coming, will be transfereed on the ftmsCharacteristicChanged applying the gear mod too
if (requestPower != -1 && (!virtualBike || !virtualBike->ftmsDeviceConnected() || (zwiftPlayService != nullptr && gears_zwift_ratio))) {
// Power request routing logic:
// 1. No virtualBike: route directly to bike
// 2. VirtualBike not connected to FTMS: route directly to bike
// 3. ZwiftPlay with gear ratio: route directly to bike
// 4. ErgMode supported + power sensor: use delta power system (bypass FTMS routing)
bool power_sensor = !settings.value(QZSettings::power_sensor_name, QZSettings::default_power_sensor_name)
.toString()
.startsWith(QStringLiteral("Disabled"));
if (requestPower != -1 && (!virtualBike || !virtualBike->ftmsDeviceConnected() || (zwiftPlayService != nullptr && gears_zwift_ratio) || (ergModeSupported && power_sensor))) {
qDebug() << QStringLiteral("writing power") << requestPower;
init();
forcePower(requestPower);
@@ -531,7 +580,7 @@ void ftmsbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
};
// clean time in case for a long period we don't receive values
if(lastRefreshCharacteristicChanged2AD2.secsTo(now) > 5) {
if(lastRefreshCharacteristicChanged2AD2.secsTo(now) > secondsToResetTimer) {
qDebug() << "clearing lastRefreshCharacteristicChanged2AD2" << lastRefreshCharacteristicChanged2AD2 << now;
lastRefreshCharacteristicChanged2AD2 = now;
}
@@ -562,6 +611,13 @@ void ftmsbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
100.0;
index += 2;
emit debug(QStringLiteral("Current Average Speed: ") + QString::number(avgSpeed));
// Use average speed if instant speed is not available (moreData flag set)
if (Flags.moreData) {
if (!settings.value(QZSettings::speed_power_based, QZSettings::default_speed_power_based).toBool()) {
Speed = avgSpeed;
emit debug(QStringLiteral("Current Speed (from average): ") + QString::number(Speed.value()));
}
}
}
if (Flags.instantCadence) {
@@ -583,6 +639,15 @@ void ftmsbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
2.0;
index += 2;
emit debug(QStringLiteral("Current Average Cadence: ") + QString::number(avgCadence));
// Use average cadence if instant cadence is not available
if (!Flags.instantCadence) {
if (settings.value(QZSettings::cadence_sensor_name, QZSettings::default_cadence_sensor_name)
.toString()
.startsWith(QStringLiteral("Disabled"))) {
Cadence = avgCadence;
emit debug(QStringLiteral("Current Cadence (from average): ") + QString::number(Cadence.value()));
}
}
}
if (Flags.totDistance) {
@@ -610,7 +675,7 @@ void ftmsbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
if(BIKE_)
d = d / 10.0;
// for this bike, i will use the resistance that I set directly because the bike sends a different ratio.
if(!SL010 && !TITAN_7000)
if(!SL010 && !TITAN_7000 && !SPORT01)
Resistance = d;
emit debug(QStringLiteral("Current Resistance: ") + QString::number(Resistance.value()));
emit resistanceRead(Resistance.value());
@@ -626,18 +691,25 @@ void ftmsbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
double cr = 97.62165482;
if (Cadence.value() && m_watt.value()) {
if(YS_G1MPLUS) {
m_pelotonResistance = Resistance.value(); // 1:1 ratio
double res =
(((sqrt(pow(br, 2.0) - 4.0 * ar *
(cr - (m_watt.value() * 132.0 /
(ac * pow(Cadence.value(), 2.0) + bc * Cadence.value() + cc)))) -
br) /
(2.0 * ar)) *
settings.value(QZSettings::peloton_gain, QZSettings::default_peloton_gain).toDouble()) +
settings.value(QZSettings::peloton_offset, QZSettings::default_peloton_offset).toDouble();
if (isnan(res)) {
if (Cadence.value() > 0) {
// let's keep the last good value
} else {
m_pelotonResistance = 0;
}
} else {
m_pelotonResistance =
(((sqrt(pow(br, 2.0) - 4.0 * ar *
(cr - (m_watt.value() * 132.0 /
(ac * pow(Cadence.value(), 2.0) + bc * Cadence.value() + cc)))) -
br) /
(2.0 * ar)) *
settings.value(QZSettings::peloton_gain, QZSettings::default_peloton_gain).toDouble()) +
settings.value(QZSettings::peloton_offset, QZSettings::default_peloton_offset).toDouble();
m_pelotonResistance = res;
}
if (!resistance_received && !DU30_bike && !SL010) {
Resistance = m_pelotonResistance;
emit resistanceRead(Resistance.value());
@@ -651,14 +723,47 @@ void ftmsbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
if(DU30_bike) {
m_watt = wattsFromResistance(Resistance.value());
emit debug(QStringLiteral("Current Watt: ") + QString::number(m_watt.value()));
} else if (SPORT01) {
// Custom power calculation for SPORT01
// Resistance multipliers for levels 1-10
const double k[10] = {0.60, 0.75, 0.85, 0.95, 1.00, 1.18, 1.40, 1.70, 2.00, 2.40};
// Baseline power curve coefficients (MyWhoosh cadence-power at resistance 5)
double ac = 0.01243107769;
double bc = 1.145964912;
double cc = -23.50977444;
// Calculate baseline power from cadence (resistance level 5 baseline)
double baseline_watt = ac * pow(Cadence.value(), 2.0) + bc * Cadence.value() + cc;
// Get current resistance level (1-10) and apply multiplier
int resistance_level = (int)Resistance.value();
if(resistance_level < 1) resistance_level = 1;
if(resistance_level > 10) resistance_level = 10;
// Apply resistance multiplier
m_watt = baseline_watt * k[resistance_level - 1];
if(m_watt.value() < 0) m_watt = 0;
emit debug(QStringLiteral("Current Watt (SPORT01 formula - R%1 x%2): %3")
.arg(resistance_level).arg(k[resistance_level - 1]).arg(m_watt.value()));
} else if (MRK_S26C) {
m_watt = Cadence.value() * (Resistance.value() * 1.16);
emit debug(QStringLiteral("Current Watt (MRK-S26C formula): ") + QString::number(m_watt.value()));
} else if (LYDSTO && watt_ignore_builtin) {
m_watt = wattFromHR(true);
emit debug(QStringLiteral("Current Watt: ") + QString::number(m_watt.value()));
} else if (settings.value(QZSettings::power_sensor_name, QZSettings::default_power_sensor_name)
.toString()
.startsWith(QStringLiteral("Disabled")))
m_watt = ((double)(((uint16_t)((uint8_t)newValue.at(index + 1)) << 8) |
} else {
double ftms_watt = ((double)(((uint16_t)((uint8_t)newValue.at(index + 1)) << 8) |
(uint16_t)((uint8_t)newValue.at(index))));
m_rawWatt = ftms_watt; // Always update rawWatt from FTMS bike data
if (settings.value(QZSettings::power_sensor_name, QZSettings::default_power_sensor_name)
.toString()
.startsWith(QStringLiteral("Disabled"))) {
m_watt = ftms_watt; // Only update watt if no external power sensor
}
}
index += 2;
emit debug(QStringLiteral("Current Watt: ") + QString::number(m_watt.value()));
} else if(DOMYOS) {
@@ -673,6 +778,15 @@ void ftmsbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
(uint16_t)((uint8_t)newValue.at(index))));
index += 2;
emit debug(QStringLiteral("Current Average Watt: ") + QString::number(avgPower));
// Use average power if instant power is zero or not available
if ((!Flags.instantPower || m_watt.value() == 0) && avgPower > 0) {
if (settings.value(QZSettings::power_sensor_name, QZSettings::default_power_sensor_name)
.toString()
.startsWith(QStringLiteral("Disabled"))) {
m_watt = avgPower;
emit debug(QStringLiteral("Current Watt (from average): ") + QString::number(m_watt.value()));
}
}
}
if (Flags.expEnergy && newValue.length() > index + 1) {
@@ -736,14 +850,15 @@ void ftmsbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
uint16_t time_division = 1024;
uint8_t index = 4;
if (settings.value(QZSettings::power_sensor_name, QZSettings::default_power_sensor_name)
.toString()
.startsWith(QStringLiteral("Disabled"))) {
if (newValue.length() > 3) {
m_watt = (((uint16_t)((uint8_t)newValue.at(3)) << 8) | (uint16_t)((uint8_t)newValue.at(2)));
if (newValue.length() > 3) {
double ftms_watt = (((uint16_t)((uint8_t)newValue.at(3)) << 8) | (uint16_t)((uint8_t)newValue.at(2)));
m_rawWatt = ftms_watt; // Always update rawWatt from FTMS bike data
if (settings.value(QZSettings::power_sensor_name, QZSettings::default_power_sensor_name)
.toString()
.startsWith(QStringLiteral("Disabled"))) {
m_watt = ftms_watt; // Only update watt if no external power sensor
emit powerChanged(m_watt.value());
}
emit powerChanged(m_watt.value());
emit debug(QStringLiteral("Current watt: ") + QString::number(m_watt.value()));
}
@@ -1017,7 +1132,7 @@ void ftmsbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
double cr = 97.62165482;
if (Cadence.value() && m_watt.value()) {
m_pelotonResistance =
double res =
(((sqrt(pow(br, 2.0) - 4.0 * ar *
(cr - (m_watt.value() * 132.0 /
(ac * pow(Cadence.value(), 2.0) + bc * Cadence.value() + cc)))) -
@@ -1025,17 +1140,31 @@ void ftmsbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
(2.0 * ar)) *
settings.value(QZSettings::peloton_gain, QZSettings::default_peloton_gain).toDouble()) +
settings.value(QZSettings::peloton_offset, QZSettings::default_peloton_offset).toDouble();
if (isnan(res)) {
if (Cadence.value() > 0) {
// let's keep the last good value
} else {
m_pelotonResistance = 0;
}
} else {
m_pelotonResistance = res;
}
Resistance = m_pelotonResistance;
emit resistanceRead(Resistance.value());
}
}
if (Flags.instantPower) {
double ftms_watt = ((double)(((uint16_t)((uint8_t)newValue.at(index + 1)) << 8) |
(uint16_t)((uint8_t)newValue.at(index))));
m_rawWatt = ftms_watt; // Always update rawWatt from FTMS bike data
if (settings.value(QZSettings::power_sensor_name, QZSettings::default_power_sensor_name)
.toString()
.startsWith(QStringLiteral("Disabled")))
m_watt = ((double)(((uint16_t)((uint8_t)newValue.at(index + 1)) << 8) |
(uint16_t)((uint8_t)newValue.at(index))));
.startsWith(QStringLiteral("Disabled"))) {
m_watt = ftms_watt; // Only update watt if no external power sensor
}
emit debug(QStringLiteral("Current Watt: ") + QString::number(m_watt.value()));
index += 2;
}
@@ -1114,8 +1243,14 @@ void ftmsbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
update_hr_from_external();
}
if(resistance_received && requestPower == -1)
_inclinationResistanceTable.collectData(Inclination.value(), Resistance.value(), m_watt.value());
if(resistance_received && requestPower == -1) {
// Apply the same gears modification as in ftmsCharacteristicChanged
double gears_modified_inclination = Inclination.value();
if (gears() != 0) {
gears_modified_inclination += (gears() * GEARS_SLOPE_MULTIPLIER / 100.0);
}
_inclinationResistanceTable.collectData(gears_modified_inclination, Resistance.value(), m_watt.value());
}
#ifdef Q_OS_IOS
#ifndef IO_UNDER_QT
@@ -1123,7 +1258,7 @@ void ftmsbike::characteristicChanged(const QLowEnergyCharacteristic &characteris
bool ios_peloton_workaround =
settings.value(QZSettings::ios_peloton_workaround, QZSettings::default_ios_peloton_workaround).toBool();
if (ios_peloton_workaround && cadence && h && firstStateChanged) {
h->virtualbike_setCadence(currentCrankRevolutions(), lastCrankEventTime());
h->virtualbike_setCadence(currentCrankRevolutions(), lastCrankEventTime());
h->virtualbike_setHeartRate((uint8_t)metrics_override_heartrate());
}
#endif
@@ -1182,7 +1317,7 @@ void ftmsbike::stateChanged(QLowEnergyService::ServiceState state) {
}
}
if (settings.value(QZSettings::hammer_racer_s, QZSettings::default_hammer_racer_s).toBool() || SCH_190U || DOMYOS || SMB1 || FIT_BK) {
if (settings.value(QZSettings::hammer_racer_s, QZSettings::default_hammer_racer_s).toBool() || SCH_190U || SCH_290R || DOMYOS || SMB1 || FIT_BK) {
QBluetoothUuid ftmsService((quint16)0x1826);
if (s->serviceUuid() != ftmsService) {
qDebug() << QStringLiteral("hammer racer bike wants to be subscribed only to FTMS service in order "
@@ -1262,7 +1397,7 @@ void ftmsbike::stateChanged(QLowEnergyService::ServiceState state) {
}
if (gattFTMSService && gattWriteCharControlPointId.isValid() &&
(settings.value(QZSettings::hammer_racer_s, QZSettings::default_hammer_racer_s).toBool() || SMB1 || FIT_BK)) {
(settings.value(QZSettings::hammer_racer_s, QZSettings::default_hammer_racer_s).toBool() || SCH_290R || SMB1 || FIT_BK)) {
init();
}
@@ -1306,15 +1441,27 @@ void ftmsbike::stateChanged(QLowEnergyService::ServiceState state) {
void ftmsbike::ftmsCharacteristicChanged(const QLowEnergyCharacteristic &characteristic, const QByteArray &newValue) {
QSettings settings;
bool power_sensor = !settings.value(QZSettings::power_sensor_name, QZSettings::default_power_sensor_name)
.toString()
.startsWith(QStringLiteral("Disabled"));
bool ergModeNotSupported = (requestPower > 0 && !ergModeSupported);
if (!autoResistance() || resistance_lvl_mode || ergModeNotSupported) {
bool isPowerCommand = (newValue.length() > 0 && (uint8_t)newValue.at(0) == FTMS_SET_TARGET_POWER);
// FTMS routing filter logic:
// - Block simulation commands (0x11) when resistance_lvl_mode=true
// - Allow power commands (0x05) only when no external power sensor (delta power system handles external sensors)
bool allowPowerRouting = (!power_sensor && ergModeSupported && isPowerCommand);
if (!autoResistance() || (resistance_lvl_mode && !allowPowerRouting) || ergModeNotSupported) {
qDebug() << "ignoring routing FTMS packet to the bike from virtualbike because of auto resistance OFF or resistance lvl mode is on or ergModeNotSupported"
<< characteristic.uuid() << newValue.toHex(' ') << ergModeNotSupported << resistance_lvl_mode;
<< characteristic.uuid() << newValue.toHex(' ') << "ergModeNotSupported:" << ergModeNotSupported
<< "resistance_lvl_mode:" << resistance_lvl_mode << "power_sensor:" << power_sensor << "isPowerCommand:" << isPowerCommand;
return;
}
QByteArray b = newValue;
QSettings settings;
bool gears_zwift_ratio = settings.value(QZSettings::gears_zwift_ratio, QZSettings::default_gears_zwift_ratio).toBool();
if (gattWriteCharControlPointId.isValid()) {
@@ -1335,7 +1482,7 @@ void ftmsbike::ftmsCharacteristicChanged(const QLowEnergyCharacteristic &charact
int16_t slope = (((uint8_t)b.at(3)) + (b.at(4) << 8));
if (gears() != 0) {
slope += (gears() * 50);
slope += (gears() * GEARS_SLOPE_MULTIPLIER);
}
if(min_inclination > (((double)slope) / 100.0)) {
@@ -1390,6 +1537,20 @@ void ftmsbike::ftmsCharacteristicChanged(const QLowEnergyCharacteristic &charact
} else if(b.at(0) == FTMS_SET_TARGET_POWER && ((zwiftPlayService != nullptr && gears_zwift_ratio) || !ergModeSupported)) {
qDebug() << "discarding";
return;
} else if(b.at(0) == FTMS_SET_TARGET_POWER && b.length() > 2) {
// handling watt gain and offset for erg mode
double watt_gain = settings.value(QZSettings::watt_gain, QZSettings::default_watt_gain).toDouble();
double watt_offset = settings.value(QZSettings::watt_offset, QZSettings::default_watt_offset).toDouble();
if (watt_gain != 1.0 || watt_offset != 0) {
uint16_t powerRequested = (((uint8_t)b.at(1)) + (b.at(2) << 8));
qDebug() << "applying watt_gain/watt_offset from" << powerRequested;
powerRequested = ((powerRequested / watt_gain) - watt_offset);
qDebug() << "to" << powerRequested;
b[1] = powerRequested & 0xFF;
b[2] = powerRequested >> 8;
}
}
// gears on erg mode is quite useless and it's confusing
/* else if(b.at(0) == FTMS_SET_TARGET_POWER && b.length() > 2) {
@@ -1411,10 +1572,14 @@ void ftmsbike::ftmsCharacteristicChanged(const QLowEnergyCharacteristic &charact
}
void ftmsbike::descriptorWritten(const QLowEnergyDescriptor &descriptor, const QByteArray &newValue) {
static bool connectedAndDiscoveredOk = false;
emit debug(QStringLiteral("descriptorWritten ") + descriptor.name() + QStringLiteral(" ") + newValue.toHex(' '));
initRequest = true;
emit connectedAndDiscovered();
if(!connectedAndDiscoveredOk) {
connectedAndDiscoveredOk = true;
emit connectedAndDiscovered();
}
}
void ftmsbike::descriptorRead(const QLowEnergyDescriptor &descriptor, const QByteArray &newValue) {
@@ -1489,7 +1654,9 @@ void ftmsbike::deviceDiscovered(const QBluetoothDeviceInfo &device) {
max_resistance = 16;
} else if ((bluetoothDevice.name().toUpper().startsWith("MAGNUS "))) {
qDebug() << QStringLiteral("MAGNUS found");
resistance_lvl_mode = true;
MAGNUS = true;
resistance_lvl_mode = true;
ergModeSupported = true;
} else if ((bluetoothDevice.name().toUpper().startsWith("DU30-"))) {
qDebug() << QStringLiteral("DU30 found");
max_resistance = 32;
@@ -1497,9 +1664,13 @@ void ftmsbike::deviceDiscovered(const QBluetoothDeviceInfo &device) {
} else if ((bluetoothDevice.name().toUpper().startsWith("ICSE") && bluetoothDevice.name().length() == 4)) {
qDebug() << QStringLiteral("ICSE found");
ICSE = true;
secondsToResetTimer = 15;
autoResistanceEnable = false; // Disable auto resistance for ICSE bikes
qDebug() << QStringLiteral("ICSE: autoResistance disabled by default");
} else if ((bluetoothDevice.name().toUpper().startsWith("DOMYOS"))) {
qDebug() << QStringLiteral("DOMYOS found");
resistance_lvl_mode = true;
ergModeSupported = false;
DOMYOS = true;
} else if ((bluetoothDevice.name().toUpper().startsWith("3G Cardio RB"))) {
qDebug() << QStringLiteral("_3G_Cardio_RB found");
@@ -1508,6 +1679,10 @@ void ftmsbike::deviceDiscovered(const QBluetoothDeviceInfo &device) {
qDebug() << QStringLiteral("SCH_190U found");
SCH_190U = true;
max_resistance = 100;
} else if((bluetoothDevice.name().toUpper().startsWith("SCH_290R"))) {
qDebug() << QStringLiteral("SCH_290R found");
SCH_290R = true;
max_resistance = 100;
} else if(bluetoothDevice.name().toUpper().startsWith("D2RIDE")) {
qDebug() << QStringLiteral("D2RIDE found");
D2RIDE = true;
@@ -1523,6 +1698,7 @@ void ftmsbike::deviceDiscovered(const QBluetoothDeviceInfo &device) {
} else if(bluetoothDevice.name().toUpper().startsWith("JFBK5.0") || bluetoothDevice.name().toUpper().startsWith("JFBK7.0")) {
qDebug() << QStringLiteral("JFBK5.0 found");
resistance_lvl_mode = true;
ergModeSupported = false;
JFBK5_0 = true;
} else if((bluetoothDevice.name().toUpper().startsWith("BIKE-"))) {
qDebug() << QStringLiteral("BIKE- found");
@@ -1533,6 +1709,7 @@ void ftmsbike::deviceDiscovered(const QBluetoothDeviceInfo &device) {
} else if ((bluetoothDevice.name().toUpper().startsWith("SPAX-BK-"))) {
qDebug() << QStringLiteral("SPAX-BK found");
resistance_lvl_mode = true;
ergModeSupported = false;
} else if ((bluetoothDevice.name().toUpper().startsWith("LYDSTO"))) {
qDebug() << QStringLiteral("LYDSTO found");
LYDSTO = true;
@@ -1541,11 +1718,13 @@ void ftmsbike::deviceDiscovered(const QBluetoothDeviceInfo &device) {
SL010 = true;
max_resistance = 25;
resistance_lvl_mode = true;
ergModeSupported = false;
} else if ((bluetoothDevice.name().toUpper().startsWith("REEBOK"))) {
qDebug() << QStringLiteral("REEBOK found");
REEBOK = true;
max_resistance = 32;
resistance_lvl_mode = true;
ergModeSupported = false;
} else if ((bluetoothDevice.name().toUpper().startsWith("TITAN 7000"))) {
qDebug() << QStringLiteral("Titan 7000 found");
TITAN_7000 = true;
@@ -1576,8 +1755,35 @@ void ftmsbike::deviceDiscovered(const QBluetoothDeviceInfo &device) {
max_resistance = 32;
resistance_lvl_mode = true;
ergModeSupported = false; // this bike doesn't have ERG mode natively
} else if(device.name().toUpper().startsWith("VANRYSEL-HT")) {
qDebug() << QStringLiteral("VANRYSEL-HT found");
VANRYSEL_HT = true;
} else if(device.name().toUpper().startsWith("MRK-S26C-")) {
qDebug() << QStringLiteral("MRK-S26C found");
MRK_S26C = true;
} else if(device.name().toUpper().startsWith("HAMMER")) {
qDebug() << QStringLiteral("HAMMER found");
HAMMER = true;
} else if(device.name().toUpper().startsWith("YPBM") && device.name().length() == 10) {
qDebug() << QStringLiteral("YPBM found");
YPBM = true;
resistance_lvl_mode = true;
ergModeSupported = false;
max_resistance = 32;
} else if(device.name().toUpper().startsWith("SPORT01")) {
qDebug() << QStringLiteral("SPORT01 found");
SPORT01 = true;
resistance_lvl_mode = true;
ergModeSupported = false;
max_resistance = 10;
Resistance = 1; // Initialize resistance to 1 for SPORT01
} else if(device.name().toUpper().startsWith("FS-YK-")) {
qDebug() << QStringLiteral("FS-YK- found");
FS_YK = true;
ergModeSupported = false; // this bike doesn't have ERG mode natively
}
if(settings.value(QZSettings::force_resistance_instead_inclination, QZSettings::default_force_resistance_instead_inclination).toBool()) {
resistance_lvl_mode = true;
}
@@ -1634,7 +1840,7 @@ void ftmsbike::setWheelDiameter(double diameter) {
}
uint16_t ftmsbike::watts() {
if (currentCadence().value() == 0) {
if (currentCadence().value() == 0 && !VANRYSEL_HT) {
return 0;
}

View File

@@ -81,6 +81,7 @@ class ftmsbike : public bike {
// true because or the bike supports it by hardware or because QZ is emulating this in this module
bool ergModeSupportedAvailableBySoftware() override { return true; }
bool inclinationAvailableBySoftware() override { return !resistance_lvl_mode; }
private:
bool writeCharacteristic(uint8_t *data, uint8_t data_len, const QString &info, bool disable_log = false,
@@ -94,9 +95,13 @@ class ftmsbike : public bike {
void init();
void forceResistance(resistance_t requestResistance);
void forcePower(int16_t requestPower);
void forceInclination(double requestInclination);
uint16_t wattsFromResistance(double resistance);
QTimer *refresh;
// Gear modification constants
static constexpr int GEARS_SLOPE_MULTIPLIER = 50;
QList<QLowEnergyService *> gattCommunicationChannelService;
QLowEnergyCharacteristic gattWriteCharControlPointId;
@@ -135,6 +140,7 @@ class ftmsbike : public bike {
bool DOMYOS = false;
bool _3G_Cardio_RB = false;
bool SCH_190U = false;
bool SCH_290R = false;
bool D2RIDE = false;
bool WATTBIKE = false;
bool VFSPINBIKE = false;
@@ -154,6 +160,15 @@ class ftmsbike : public bike {
bool PM5 = false;
bool THINK_X = false;
bool WLT8828 = false;
bool VANRYSEL_HT = false;
bool MAGNUS = false;
bool MRK_S26C = false;
bool HAMMER = false;
bool YPBM = false;
bool SPORT01 = false;
bool FS_YK = false;
uint8_t secondsToResetTimer = 5;
int16_t T2_lastGear = 0;

View File

@@ -1,6 +1,7 @@
#include "devices/ftmsrower/ftmsrower.h"
#include "devices/ftmsbike/ftmsbike.h"
#include "virtualdevices/virtualbike.h"
#include "virtualdevices/virtualtreadmill.h"
#include <QBluetoothLocalDevice>
#include <QDateTime>
#include <QFile>
@@ -19,7 +20,7 @@
using namespace std::chrono_literals;
ftmsrower::ftmsrower(bool noWriteResistance, bool noHeartService) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;
@@ -62,12 +63,11 @@ void ftmsrower::writeCharacteristic(uint8_t *data, uint8_t data_len, const QStri
void ftmsrower::forceResistance(resistance_t requestResistance) {
uint8_t write[] = {FTMS_SET_INDOOR_BIKE_SIMULATION_PARAMS, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
write[3] = ((uint16_t)requestResistance * 100) & 0xFF;
write[4] = ((uint16_t)requestResistance * 100) >> 8;
uint8_t write[] = {FTMS_SET_TARGET_RESISTANCE_LEVEL, 0x00};
write[1] = ((uint8_t)(requestResistance * 10));
writeCharacteristic(write, sizeof(write), QStringLiteral("forceResistance ") + QString::number(requestResistance));
if(NORDLYS)
Resistance = requestResistance; // Nordlys does not report back the resistance so we set it here
}
void ftmsrower::update() {
@@ -143,6 +143,123 @@ void ftmsrower::serviceDiscovered(const QBluetoothUuid &gatt) {
emit debug(QStringLiteral("serviceDiscovered ") + gatt.toString());
}
void ftmsrower::parseConcept2Data(const QLowEnergyCharacteristic &characteristic, const QByteArray &newValue) {
QDateTime now = QDateTime::currentDateTime();
QSettings settings;
QString charUuid = characteristic.uuid().toString();
if (charUuid == QStringLiteral("{ce060031-43e5-11e4-916c-0800200c9a66}")) {
// Parse characteristic CE060031 - Based on go-row implementation
if (newValue.length() >= 10) {
// Extract RowState from byte 9 - this indicates if user is actively rowing
pm5RowState = (uint8_t)newValue.at(9);
emit debug(QStringLiteral("PM5 CE060031 RAW: ") + newValue.toHex(' ') +
QStringLiteral(" RowState: ") + QString::number(pm5RowState));
}
}
else if (charUuid == QStringLiteral("{ce060032-43e5-11e4-916c-0800200c9a66}")) {
// Parse characteristic CE060032 - Based on go-row implementation
if (newValue.length() >= 7) {
// Extract cadence (SPM) from byte 5
uint8_t spm = (uint8_t)newValue.at(5);
if (spm > 0) {
Cadence = spm;
lastStroke = now;
}
// Extract speed from bytes 3-4 (little endian) in 0.001m/s
uint16_t speedRaw = ((uint8_t)newValue.at(4) << 8) | (uint8_t)newValue.at(3);
if (speedRaw > 0) {
Speed = (speedRaw * 0.001) * 3.6; // Convert m/s to km/h
}
emit debug(QStringLiteral("PM5 CE060032 RAW: ") + newValue.toHex(' ') +
QStringLiteral(" Cadence: ") + QString::number(Cadence.value()) +
QStringLiteral(" Speed: ") + QString::number(Speed.value()) +
QStringLiteral(" RowState: ") + QString::number(pm5RowState));
}
}
else if (charUuid == QStringLiteral("{ce060033-43e5-11e4-916c-0800200c9a66}")) {
// Parse characteristic CE060033 - Additional data
if (newValue.length() >= 20) {
emit debug(QStringLiteral("PM5 CE060033 RAW: ") + newValue.toHex(' '));
}
}
else if (charUuid == QStringLiteral("{ce060036-43e5-11e4-916c-0800200c9a66}")) {
// Parse characteristic CE060036 - Power and stroke count (based on go-row implementation)
if (newValue.length() >= 9) {
// Extract stroke count from bytes 7-8 (little endian)
uint16_t strokeCount = ((uint8_t)newValue.at(8) << 8) | (uint8_t)newValue.at(7);
if (strokeCount != StrokesCount.value()) {
StrokesCount = strokeCount;
lastStroke = now;
}
// Extract power from bytes 3-4 (little endian)
uint16_t power = ((uint8_t)newValue.at(4) << 8) | (uint8_t)newValue.at(3);
if (power > 0) {
m_watt = power;
}
emit debug(QStringLiteral("PM5 CE060036 RAW: ") + newValue.toHex(' ') +
QStringLiteral(" Power: ") + QString::number(m_watt.value()) +
QStringLiteral(" Stroke Count: ") + QString::number(StrokesCount.value()) +
QStringLiteral(" RowState: ") + QString::number(pm5RowState));
}
}
else if (charUuid == QStringLiteral("{ce060035-43e5-11e4-916c-0800200c9a66}")) {
// Parse characteristic CE060035 - Stroke data including drive length (stroke length)
if (newValue.length() >= 7) {
// Extract drive length (stroke length) from byte 6 - 0.01 meters LSB, max 2.55m
uint8_t driveLengthRaw = (uint8_t)newValue.at(6);
if (driveLengthRaw > 0) {
// Convert from 0.01m units to meters
double strokeLengthMeters = driveLengthRaw * 0.01;
StrokesLength = strokeLengthMeters;
}
emit debug(QStringLiteral("PM5 CE060035 RAW: ") + newValue.toHex(' ') +
QStringLiteral(" Stroke Length: ") + QString::number(StrokesLength.value()) +
QStringLiteral("m RowState: ") + QString::number(pm5RowState));
}
}
// Update calories based on power if available
if (m_watt.value() > 0) {
KCal += ((((0.048 * ((double)m_watt.value()) + 1.19) *
settings.value(QZSettings::weight, QZSettings::default_weight).toFloat() * 3.5) /
200.0) /
(60000.0 / ((double)lastRefreshCharacteristicChanged.msecsTo(now))));
}
// Update crank revolutions for virtual device compatibility
if (Cadence.value() > 0) {
CrankRevs++;
LastCrankEventTime += (uint16_t)(1024.0 / (((double)(Cadence.value())) / 60.0));
}
lastRefreshCharacteristicChanged = now;
// Apply RowState logic after all characteristics processing
if (PM5 && pm5RowState == 0) {
m_watt = 0;
Cadence = 0;
Speed = 0;
}
// Update metrics for virtual device
update_metrics(false, m_watt.value());
emit debug(QStringLiteral("PM5 Metrics - Cadence: ") + QString::number(Cadence.value()) +
QStringLiteral(" Speed: ") + QString::number(Speed.value()) +
QStringLiteral(" Power: ") + QString::number(m_watt.value()) +
QStringLiteral(" Distance: ") + QString::number(Distance.value()) +
QStringLiteral(" Calories: ") + QString::number(KCal.value()) +
QStringLiteral(" RowState: ") + QString::number(pm5RowState));
}
void ftmsrower::characteristicChanged(const QLowEnergyCharacteristic &characteristic, const QByteArray &newValue) {
QDateTime now = QDateTime::currentDateTime();
@@ -156,6 +273,17 @@ void ftmsrower::characteristicChanged(const QLowEnergyCharacteristic &characteri
qDebug() << QStringLiteral(" << ") << characteristic.uuid() << " " << newValue.toHex(' ');
// Handle Concept2 PM5 characteristics as fallback when FTMS is not available
if (PM5 && (characteristic.uuid() == QBluetoothUuid(QStringLiteral("ce060031-43e5-11e4-916c-0800200c9a66")) ||
characteristic.uuid() == QBluetoothUuid(QStringLiteral("ce060032-43e5-11e4-916c-0800200c9a66")) ||
characteristic.uuid() == QBluetoothUuid(QStringLiteral("ce060033-43e5-11e4-916c-0800200c9a66")) ||
characteristic.uuid() == QBluetoothUuid(QStringLiteral("ce060035-43e5-11e4-916c-0800200c9a66")) ||
characteristic.uuid() == QBluetoothUuid(QStringLiteral("ce060036-43e5-11e4-916c-0800200c9a66")))) {
parseConcept2Data(characteristic, newValue);
return;
}
if (characteristic.uuid() != QBluetoothUuid((quint16)0x2AD1)) {
return;
}
@@ -232,10 +360,17 @@ void ftmsrower::characteristicChanged(const QLowEnergyCharacteristic &characteri
}
if (Flags.totDistance) {
Distance = ((double)((((uint32_t)((uint8_t)newValue.at(index + 2)) << 16) |
(uint32_t)((uint8_t)newValue.at(index + 1)) << 8) |
(uint32_t)((uint8_t)newValue.at(index)))) /
1000.0;
if (ICONSOLE_PLUS || FITSHOW) {
// For ICONSOLE+, always calculate distance from speed instead of using characteristic data
Distance += ((Speed.value() / 3600000.0) *
((double)lastRefreshCharacteristicChanged.msecsTo(now)));
} else {
// For other devices, use the distance from characteristic data
Distance = ((double)((((uint32_t)((uint8_t)newValue.at(index + 2)) << 16) |
(uint32_t)((uint8_t)newValue.at(index + 1)) << 8) |
(uint32_t)((uint8_t)newValue.at(index)))) /
1000.0;
}
index += 3;
} else {
Distance += ((Speed.value() / 3600000.0) *
@@ -253,8 +388,10 @@ void ftmsrower::characteristicChanged(const QLowEnergyCharacteristic &characteri
emit debug(QStringLiteral("Current Pace: ") + QString::number(instantPace));
if((DFIT_L_R && Cadence.value() > 0) || !DFIT_L_R) {
Speed = (60.0 / instantPace) *
30.0; // translating pace (min/500m) to km/h in order to match the pace function in the rower.cpp
if(instantPace == 0)
Speed = 0;
else
Speed = (60.0 / instantPace) * 30.0; // translating pace (min/500m) to km/h in order to match the pace function in the rower.cpp
}
emit debug(QStringLiteral("Current Speed: ") + QString::number(Speed.value()));
}
@@ -493,6 +630,8 @@ void ftmsrower::stateChanged(QLowEnergyService::ServiceState state) {
settings.value(QZSettings::virtual_device_enabled, QZSettings::default_virtual_device_enabled).toBool();
bool virtual_device_rower =
settings.value(QZSettings::virtual_device_rower, QZSettings::default_virtual_device_rower).toBool();
bool virtual_device_force_treadmill =
settings.value(QZSettings::virtual_device_force_treadmill, QZSettings::default_virtual_device_force_treadmill).toBool();
#ifdef Q_OS_IOS
#ifndef IO_UNDER_QT
bool cadence =
@@ -510,7 +649,13 @@ void ftmsrower::stateChanged(QLowEnergyService::ServiceState state) {
#endif
{
if (virtual_device_enabled) {
if (!virtual_device_rower) {
if (virtual_device_force_treadmill) {
emit debug(QStringLiteral("creating virtual treadmill interface..."));
auto virtualTreadmill = new virtualtreadmill(this, noHeartService);
connect(virtualTreadmill, &virtualtreadmill::debug, this, &ftmsrower::debug);
this->setVirtualDevice(virtualTreadmill, VIRTUAL_DEVICE_MODE::PRIMARY);
} else if (!virtual_device_rower) {
emit debug(QStringLiteral("creating virtual bike interface..."));
auto virtualBike = new virtualbike(this, noWriteResistance, noHeartService);
@@ -569,6 +714,36 @@ void ftmsrower::serviceScanDone(void) {
#endif
auto services_list = m_control->services();
bool hasFTMSService = false;
bool hasConcept2Services = false;
// Check if FTMS service (0x1826) is available
QBluetoothUuid ftmsService((quint16)0x1826);
for (const QBluetoothUuid &s : qAsConst(services_list)) {
if (s == ftmsService) {
hasFTMSService = true;
break;
}
}
// If no FTMS service, check for Concept2 PM5 services
if (!hasFTMSService && PM5) {
QBluetoothUuid concept2InfoService(QStringLiteral("ce060010-43e5-11e4-916c-0800200c9a66"));
QBluetoothUuid concept2ControlService(QStringLiteral("ce060020-43e5-11e4-916c-0800200c9a66"));
QBluetoothUuid concept2RowingService(QStringLiteral("ce060030-43e5-11e4-916c-0800200c9a66"));
for (const QBluetoothUuid &s : qAsConst(services_list)) {
if (s == concept2InfoService || s == concept2ControlService || s == concept2RowingService) {
hasConcept2Services = true;
break;
}
}
if (hasConcept2Services) {
emit debug(QStringLiteral("PM5 without FTMS service detected, using Concept2 protocol"));
}
}
for (const QBluetoothUuid &s : qAsConst(services_list)) {
gattCommunicationChannelService.append(m_control->createServiceObject(s));
connect(gattCommunicationChannelService.constLast(), &QLowEnergyService::stateChanged, this,
@@ -619,6 +794,15 @@ void ftmsrower::deviceDiscovered(const QBluetoothDeviceInfo &device) {
} else if (device.name().toUpper().startsWith(QStringLiteral("PM5"))) {
PM5 = true;
qDebug() << "PM5 found!";
} else if (device.name().toUpper().startsWith(QStringLiteral("NORDLYS"))) {
NORDLYS = true;
qDebug() << "NORDLYS found!";
} else if (device.name().toUpper().startsWith(QStringLiteral("ICONSOLE+"))) {
ICONSOLE_PLUS = true;
qDebug() << "ICONSOLE+ found!";
} else if (device.name().toUpper().startsWith(QStringLiteral("FS-"))) {
FITSHOW = true;
qDebug() << "FITSHOW found!";
}
m_control = QLowEnergyController::createCentral(bluetoothDevice, this);

View File

@@ -46,6 +46,7 @@ class ftmsrower : public rower {
void startDiscover();
uint16_t watts() override;
void forceResistance(resistance_t requestResistance);
void parseConcept2Data(const QLowEnergyCharacteristic &characteristic, const QByteArray &newValue);
QTimer *refresh;
@@ -69,6 +70,9 @@ class ftmsrower : public rower {
bool WHIPR = false;
bool KINGSMITH = false;
bool PM5 = false;
bool NORDLYS = false;
bool ICONSOLE_PLUS = false;
bool FITSHOW = false;
bool WATER_ROWER = false;
bool DFIT_L_R = false;
@@ -76,6 +80,9 @@ class ftmsrower : public rower {
bool ROWER = false;
QDateTime lastStroke = QDateTime::currentDateTime();
double lastStrokesCount = 0;
// PM5 specific variables
uint8_t pm5RowState = 0;
#ifdef Q_OS_IOS
lockscreen *h = 0;

View File

@@ -64,11 +64,25 @@ void heartratebelt::disconnectBluetooth() {
void heartratebelt::characteristicChanged(const QLowEnergyCharacteristic &characteristic, const QByteArray &newValue) {
// qDebug() << "characteristicChanged" << characteristic.uuid() << newValue << newValue.length();
Q_UNUSED(characteristic);
emit packetReceived();
emit debug(QStringLiteral(" << ") + newValue.toHex(' '));
// Handle Battery Service
if (characteristic.uuid() == QBluetoothUuid((quint16)0x2A19)) {
if(newValue.length() > 0) {
uint8_t battery = (uint8_t)newValue.at(0);
if(battery != battery_level) {
if(homeform::singleton())
homeform::singleton()->setToastRequested(bluetoothDevice.name() + QStringLiteral(" Battery Level ") + QString::number(battery) + " %");
}
battery_level = battery;
qDebug() << QStringLiteral("battery: ") << battery;
}
return;
}
// Handle Heart Rate Measurement
if (newValue.length() > 1) {
Heart = (uint8_t)newValue[1];
emit heartRate((uint8_t)Heart.value());
@@ -82,6 +96,35 @@ void heartratebelt::stateChanged(QLowEnergyService::ServiceState state) {
emit debug(QStringLiteral("BTLE stateChanged ") + QString::fromLocal8Bit(metaEnum.valueToKey(state)));
if (state == QLowEnergyService::ServiceDiscovered) {
// Check if this is the Battery Service
QLowEnergyService* service = qobject_cast<QLowEnergyService*>(sender());
if (service && service == gattBatteryService) {
// Handle Battery Service
auto characteristics_list = gattBatteryService->characteristics();
for (const QLowEnergyCharacteristic &c : qAsConst(characteristics_list)) {
emit debug(QStringLiteral("battery characteristic ") + c.uuid().toString());
}
connect(gattBatteryService, &QLowEnergyService::characteristicChanged, this,
&heartratebelt::characteristicChanged);
connect(gattBatteryService,
static_cast<void (QLowEnergyService::*)(QLowEnergyService::ServiceError)>(&QLowEnergyService::error),
this, &heartratebelt::errorService);
// Enable notifications for battery level
for (const QLowEnergyCharacteristic &c : qAsConst(characteristics_list)) {
if ((c.properties() & QLowEnergyCharacteristic::Notify) == QLowEnergyCharacteristic::Notify) {
QByteArray descriptor;
descriptor.append((char)0x01);
descriptor.append((char)0x00);
gattBatteryService->writeDescriptor(
c.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration), descriptor);
}
}
return;
}
// Original code for Heart Rate Service
auto characteristics_list = gattCommunicationChannelService->characteristics();
for (const QLowEnergyCharacteristic &c : qAsConst(characteristics_list)) {
emit debug(QStringLiteral("characteristic ") + c.uuid().toString());
@@ -134,7 +177,13 @@ void heartratebelt::serviceScanDone(void) {
connect(gattCommunicationChannelService, &QLowEnergyService::stateChanged, this,
&heartratebelt::stateChanged);
gattCommunicationChannelService->discoverDetails();
return;
}
else if (s == QBluetoothUuid::BatteryService) {
QBluetoothUuid _gattBatteryServiceId(QBluetoothUuid::BatteryService);
gattBatteryService = m_control->createServiceObject(_gattBatteryServiceId);
connect(gattBatteryService, &QLowEnergyService::stateChanged, this,
&heartratebelt::stateChanged);
gattBatteryService->discoverDetails();
}
}
}

View File

@@ -37,10 +37,12 @@ class heartratebelt : public treadmill {
private:
QLowEnergyService *gattCommunicationChannelService = nullptr;
QLowEnergyService *gattBatteryService = nullptr;
QLowEnergyCharacteristic gattNotifyCharacteristic;
QDateTime connectingTime; // Timestamp when entering connecting state
static const int CONNECTION_TIMEOUT = 10000; // 10 seconds in milliseconds
QTimer* updateTimer; // Timer for periodic updates
uint8_t battery_level = 0;
signals:
void disconnected();

View File

@@ -18,7 +18,7 @@ using namespace std::chrono_literals;
horizongr7bike::horizongr7bike(bool noWriteResistance, bool noHeartService, int8_t bikeResistanceOffset,
double bikeResistanceGain) {
m_watt.setType(metric::METRIC_WATT);
m_watt.setType(metric::METRIC_WATT, deviceType());
Speed.setType(metric::METRIC_SPEED);
refresh = new QTimer(this);
this->noWriteResistance = noWriteResistance;

Some files were not shown because too many files have changed in this diff Show More