qdomyos-zwift icon indicating copy to clipboard operation
qdomyos-zwift copied to clipboard

NordicTrack Commercial 2950 iFit Embedded Wifi Treadmill (2021 model)

Open cagnulein opened this issue 2 years ago • 130 comments

iFit-Wolf Experimental iFit Workout Data Capture For NordicTrack Commercial 2950 iFit Embedded Wifi Treadmill (2021 model) NOTE: The NordicTrack C2950 iFit Embedded Wifi Treadmill is not a "smart treadmill" in the sense that it does not have iFit Bluetooth-enabled technology. That is, it does not transmit speed and inclination data via Bluetooth to applications such as Zwift. Nor does it use WebSockets to communicate over Wifi as older NordicTrack treadmills have.

The NT C2950 treadmill, and perhaps other NT iFit-embredded treadmills (I've only tested the C2950 model), record individual workouts to a local text log in a sequential streaming format. Workout data is recorded to a single log file for each day and is easily identified by the filename – e.g. 2022-05-24_logs.txt. Each days log file contains data for all workouts for that given day. The file naming scheme is therefore: YYYY-MM-DD_logs.txt. Each logged workout event is identified in a single or multiple lines by a unique ID and timestamp derived from the time/date settings within the users iFit configuration. Workout events, including changes to speed and inclination, are recorded in real-time to the log file and can be parsed to isolate current speed and inclination for use in applications such as Zwift. For example, the log file 2022-05-24_logs.txt can contain real-time speed and inclination events which can be identified as follows:

[11] 1758734 14:01:58.8047 [Trace:FitPro] Changed KPH to: 2.1 [7] 1759006 14:01:59.0763 [Trace:FitnessConsole] Kph changed from 2 to 2.1 [10] 1783494 14:02:23.5646 [Trace:FitPro] Changed Grade to: 0.5 [12] 1783763 14:02:23.8342 [Trace:FitnessConsole] Grade changed from 0 to 0.5 The NT C2950 treadmills embedded iFit console runs Android (currently v9 on my model). The workout logs are located in: \sdcard.wolflogs. An example of the full workout log path for a given day is as follows:

\sdcard.wolflogs\2022-05-24_logs.txt Workout events are recorded sequentially as they occur - top to bottom. To obtain the most recent speed and inclination values, look for the last occurrence of the events towards the bottom of the log file.

I've written a Windows VBscript which accesses the latest workout log and displays the real-time speed and inclination values in a MS Edge browser window. The log is accessed via an ADB connection to the treadmill. The VBscript assumes an ADB connection has already been established with the treadmill, and proceeds to copy the log, parse the current speed and inclination values, and display and refresh the real-time values in Edge. My testing environment is a Surface Book 2 running Windows 11 Pro.

I’ve not included documentation here on how to configure the NT C2950 treadmill for ADB communication, but it involves accessing the machines “Privileged Mode”, turning on “Developer Options” in Android settings, and enabling “USB Debugging” mode. Accessing Privileged Mode is well documented on many websites, dependent on the treadmill model, and version of Android and iFit.

adb-connect.bat (commands to initiate an ADB connection with the treadmill – change the IP to that of the treadmill) get-speed-incline.vbs (VBscript) cscript_get-speed-incline.bat (commands to launch VBscript in CScript window) Not included – ADB ADB stands for Android Debug Bridge used by developers to connect their development computer with an Android device via a USB cable (and over Wifi in this case). If you don't have Android SDK installed on your PC, ADB may not be recognized. It's recommended you download the latest version.

Obviously, this Windows ADB solution is not ideal and real-time feedback is a bit slow. With this documentation and code, it is hoped that it can be used as a basis to write faster processes to access the treadmills local workout logs and parse the speed and inclination values for transmit to Zwift and other applications.

Files included: bas files.zip

Reference: https://github.com/victorypoint/iFit-Wolf?fbclid=IwAR01U6QNAU14hP7DPi9rsJI3mzwoBL0p5gIA2CwMHkyrZubAYDglFvGj_xo

@victorypoint

cagnulein avatar May 26 '22 06:05 cagnulein

adb lib, interesting! https://github.com/Jaywalker/libadb

cagnulein avatar May 26 '22 06:05 cagnulein

this is the one! https://github.com/cagnulein/libadb-client.qt

cagnulein avatar May 26 '22 07:05 cagnulein

Test results - QZ log attached

debug-Thu_May_26_07_27_49_2022.log

victorypoint avatar May 26 '22 11:05 victorypoint

Test results while connected to Polar Sense BT HRM - QZ log attached

debug-Thu_May_26_11_01_06_2022.log

Windows error report log attached

Report.txt

victorypoint avatar May 26 '22 14:05 victorypoint

Separate test results - Polar HR monitor connected, Stryd footpod connected, nothing connected

debug-Thu_May_26_12_08_01_2022.log debug-Thu_May_26_12_09_37_2022.log debug-Thu_May_26_12_10_12_2022.log

victorypoint avatar May 26 '22 15:05 victorypoint

thanks @victorypoint i will try with an adb simulator now first to submit a new release for you ;)

cagnulein avatar May 26 '22 15:05 cagnulein

@victorypoint i tried with a android emulator and it works fine to me :( could you please try to clone this project https://github.com/cagnulein/libadb-client.qt and install qt creator and run it? you need to change the ip of your treadmill here https://github.com/cagnulein/libadb-client.qt/blob/f184c5b39f089db6abbde967f116ef7436decfc4/adbclient.cpp#L11

let me know

cagnulein avatar May 27 '22 07:05 cagnulein

@victorypoint download qt from here https://www.qt.io/download-qt-installer?hsCtaTracking=99d9dd4f-5681-48d2-b096-470725510d34%7C074ddad0-fdef-4e53-8aa8-5e8a876d6ab4 and when you need to install a qt version use the 5.15.2 branch so you will use the same qt version that i'm using myself

cagnulein avatar May 27 '22 09:05 cagnulein

libadb-client.qt test results:

test results.txt

victorypoint avatar May 30 '22 17:05 victorypoint

@victorypoint ok so the issue is

adb_connect return false

i will check tomorrow the cause of this thanks

cagnulein avatar May 30 '22 17:05 cagnulein

@victorypoint new commit added to the https://github.com/cagnulein/libadb-client.qt please pull it and run it. This is my log during a session on a emulator, they should run in a similar way, let me know

doAdbPipe "shell:ls "
adb_connect shell:ls
adb_connect 9
adb_connect 0009
switch_socket_transport
switch_socket_transport host:transport-any
switch_socket_transport 18
switch_socket_transport 0012
_writex 0x6bfb4f 4
_writex return true
_writex 0x6bfb54 18
_writex return true
_writex 0x6bfc4f 4
_writex return true
_writex 0x10e09b8 9
_writex return true
adb_connect OK
doAdbPipe true
doAdbShell 0x10d0048
doAdbShell "acct        config         dev              metadata  res         vendor\nadb_keys    d              etc              mnt       sdcard\napex        data           init             odm       storage\nbin         data_mirror    init.environ.rc  oem       sys\nbugreports  debug_ramdisk  linkerconfig     proc      system\ncache       default.prop   lost+found       product   system_ext\n"
adb shell "acct        config         dev              metadata  res         vendor\nadb_keys    d              etc              mnt       sdcard\napex        data           init             odm       storage\nbin         data_mirror    init.environ.rc  oem       sys\nbugreports  debug_ramdisk  linkerconfig     proc      system\ncache       default.prop   lost+found       product   system_ext"

cagnulein avatar May 31 '22 08:05 cagnulein

Ok, here is the results of testing your latest libadb-client.qt

13:39:36: Starting C:\Temp\build-adb-client-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\adb-client.exe... doAdbPipe "shell:ls " adb_connect shell:ls adb_connect 9 adb_connect 0009 switch_socket_transport switch_socket_transport host:transport-any switch_socket_transport 18 switch_socket_transport 0012 _writex 0x6cf7eb 4 _writex return false 0 -1 switch_socket_transport "write failure during connection" adb_connect return false doAdbPipe false doAdbShell 0x0 adb shell "" 13:39:45: C:\Temp\build-adb-client-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\adb-client.exe exited with code 0

test results 05-31-2022.txt

victorypoint avatar May 31 '22 16:05 victorypoint

@victorypoint i added a debug in the constructor because the issue is in the tcp connection. Are you sure you're still changing the IP in the adbclient.cpp? are you sure the port is right? (it should match the one using from the adb.exe) With the last commit we should see the error returning from the tcp. Let me know, I guess we're near

cagnulein avatar Jun 01 '22 06:06 cagnulein

Hi. Yes, I'm changing the treadmill IP in adbclient.cpp to 10.0.0.124. Here is command-line output when I run adb.exe:

adb connect 10.0.0.124

  • daemon not running; starting now at tcp:5037
  • daemon started successfully connected to 10.0.0.124:5555

Note that the treadmill daemon starts on tcp port 5037 which is what we're using in adbclient.cpp. Also note that the adb connection is over port 5555.

I pulled and tested the new libadb-client.qt. Here's the application output when using IP 10.0.0.124 on port 5037:

19:58:39: Starting C:\Temp\build-adb-client-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\adb-client.exe... AdbClient() QAbstractSocket::UnconnectedState QAbstractSocket::ConnectionRefusedError AdbClient() QAbstractSocket::UnconnectedState QAbstractSocket::ConnectionRefusedError doAdbPipe "shell:ls " adb_connect shell:ls adb_connect 9 adb_connect 0009 switch_socket_transport switch_socket_transport host:transport-any switch_socket_transport 18 switch_socket_transport 0012 _writex 0x6cf7eb 4 _writex return false 0 -1 switch_socket_transport "write failure during connection" adb_connect return false doAdbPipe false doAdbShell 0x0 adb shell "" 19:58:48: C:\Temp\build-adb-client-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\adb-client.exe exited with code 0

And here is the application output when using IP 10.0.0.124 on port 5555:

20:11:24: Starting C:\Temp\build-adb-client-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\adb-client.exe... AdbClient() QAbstractSocket::ConnectedState QAbstractSocket::UnknownSocketError AdbClient() QAbstractSocket::ConnectedState QAbstractSocket::UnknownSocketError doAdbPipe "shell:ls " adb_connect shell:ls adb_connect 9 adb_connect 0009 switch_socket_transport switch_socket_transport host:transport-any switch_socket_transport 18 switch_socket_transport 0012 _writex 0x6cf7eb 4 _writex return true _writex 0x6cf7f0 18 _writex return true adb_connect return false doAdbPipe false doAdbShell 0x0 adb shell "" 20:11:55: C:\Temp\build-adb-client-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\adb-client.exe exited with code 0

victorypoint avatar Jun 01 '22 23:06 victorypoint

Ok, here is latest libadb-client.qt test results:

Application output when using IP 10.0.0.124 on port 5037:

12:27:28: Starting C:\Temp\build-adb-client-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\adb-client.exe... AdbClient() QAbstractSocket::UnconnectedState QAbstractSocket::ConnectionRefusedError AdbClient() QAbstractSocket::UnconnectedState QAbstractSocket::ConnectionRefusedError doAdbPipe "shell:ls " adb_connect shell:ls adb_connect 9 adb_connect 0009 switch_socket_transport switch_socket_transport host:transport-any switch_socket_transport 18 switch_socket_transport 0012 _writex 0x6cf7eb 4 _writex return false 0 -1 switch_socket_transport "write failure during connection" adb_connect return false doAdbPipe false doAdbShell 0x0 adb shell "" 12:27:37: C:\Temp\build-adb-client-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\adb-client.exe exited with code 0

Application output when using IP 10.0.0.124 on port 5555:

12:30:52: Starting C:\Temp\build-adb-client-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\adb-client.exe... AdbClient() QAbstractSocket::ConnectedState QAbstractSocket::UnknownSocketError AdbClient() QAbstractSocket::ConnectedState QAbstractSocket::UnknownSocketError doAdbPipe "shell:ls " adb_connect shell:ls adb_connect 9 adb_connect 0009 switch_socket_transport switch_socket_transport host:transport-any switch_socket_transport 18 switch_socket_transport 0012 _writex 0x6cf7eb 4 _writex return true _writex 0x6cf7f0 18 _writex return true readx return false adb_status return false "protocol fault (no status)" adb_connect return false doAdbPipe false doAdbShell 0x0 adb shell "" 12:31:23: C:\Temp\build-adb-client-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\adb-client.exe exited with code 0

victorypoint avatar Jun 02 '22 15:06 victorypoint

@victorypoint i guess we need to change the approach because, digging a little more, this adb library requires the daemon on the pc. So we have 2 different ways:

  1. create a small android service to install to the console of your treadmill that simple reads the file and it will stream the contents to QZ
  2. use adb.exe on windows

I really like the first one, so I will try to create a simple project to test it out if you agree.

cagnulein avatar Jun 03 '22 07:06 cagnulein

@victorypoint good news! I just created the apk for the companion app. Project link: https://github.com/cagnulein/QZCompanionNordictrackTreadmill APK: https://github.com/cagnulein/QZCompanionNordictrackTreadmill/raw/master/app/build/outputs/apk/debug/app-debug.apk

For now just check if the apk works on your treadmill console. Install it and grant file permission to this apk in the settings of your console (i hope it will be easy to do as in a phone, in case let me know). Then open it and with wireshark on your pc you should be able to see broadcast udp frames from your console on port 8002. This apk, when it starts, it open a service in background that get the latest file from the /sdcard.wolflogs/ and stream it contents over and over on this udp port. If it works, it will be easy to implement on QZ replacing the adb thing.

Let me know

cagnulein avatar Jun 03 '22 08:06 cagnulein

Testing new QZ build that communicates with QZ companion apk running on treadmill:

  • Launched apk on treadmill - "QZ Companion Nordictrack Treadmill"
  • Confirmed treadmill was sending data over UDP port 8002 with Wireshark
  • Launched new QZ build on PC - confirmed correct IP was entered for Nordictrack 2950 - no connection to treadmill
  • Launched iFit on treadmill and ran manual workout with speed and incline changes - still no QZ connection established

Attached: Wireshark output & QZ log:

qz-test.zip debug-Sat_Jun_4_14_38_34_2022.log

victorypoint avatar Jun 04 '22 17:06 victorypoint

QZ log with a BT device attached to PC (Stryd footpod) - got Windows Firewall alert first:

debug-Sat_Jun_4_15_20_34_2022.log

victorypoint avatar Jun 04 '22 18:06 victorypoint

QZ log with BT device attached and Windows Firewall totally disabled:

debug-Sat_Jun_4_15_22_41_2022.log

victorypoint avatar Jun 04 '22 18:06 victorypoint

QZ logs:

debug-Sun_Jun_5_12_06_09_2022.log - apk running on treadmill and launched iFit to dashboard screen debug-Sun_Jun_5_12_09_13_2022.log - apk running, iFit manual workout running with several speed and incline changes

debug-Sun_Jun_5_12_06_09_2022.log debug-Sun_Jun_5_12_09_13_2022.log

victorypoint avatar Jun 05 '22 15:06 victorypoint

Wolflog for above testing attached

2022-06-05_logs.txt :

victorypoint avatar Jun 05 '22 15:06 victorypoint

@victorypoint i analyzed again the logs with a fresh mind :) Everything seems to work on the https://github.com/cagnulein/qdomyos-zwift/files/8840216/debug-Sun_Jun_5_12_09_13_2022.log Infact i saw also a speed changing from 0 to 2. The problem is that all the major changing in the https://github.com/cagnulein/qdomyos-zwift/files/8840231/2022-06-05_logs.txt weren't reported because the session on QZ was closed. Maybe you closed because you didn't see any changes in the tile?

for example:

Sun Jun 5 12:08:34 2022 1654441714445 Debug: nordictrackifitadbtreadmill.cpp void nordictrackifitadbtreadmill::processPendingDatagrams() Message ::  "[9] 4176325 12:07:48.5770 [Trace:FitPro] Changed KPH to: 2"
Sun Jun 5 12:08:34 2022 1654441714461 Debug: nordictrackifitadbtreadmill.cpp void nordictrackifitadbtreadmill::processPendingDatagrams() "[9] 4176325 12:07:48.5770 [Trace:FitPro] Changed KPH to: 2"
Sun Jun 5 12:08:34 2022 1654441714476 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Inclination: 0"
Sun Jun 5 12:08:34 2022 1654441714490 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 2"

the last log line from qz is

Sun Jun 5 12:09:04 2022 1654441744510 Debug: nordictrackifitadbtreadmill.cpp void nordictrackifitadbtreadmill::processPendingDatagrams() "[9] 4251736 12:09:03.9885 [Trace:FitPro] Changed CurrentTime to: 104"

but you changed the speed on the treadmill after

[17] 4284869 12:09:37.1208 [Trace:FitPro] Changed KPH to: 4.82
[35] 4285120 12:09:37.3722 [Trace:FitnessConsole] Kph changed from 2 to 4.82
[1] 4287068 12:09:39.3197 [Trace:FitnessConsole] Clamped Kph from 4.82 to 4.82.
BitField: Kph
FitnessValue: Kph
[1] 4287075 12:09:39.3246 [Trace:FitnessConsole] List: [BitFieldCommItem: BitField=WorkoutMode, RequestData=Running, IsCmd=False, IsWrite=True, Tcs=System.Threading.Tasks.TaskCompletionSource`1[System.Object]],[BitFieldCommItem: BitField=Kph, RequestData=4.82, IsCmd=False, IsWrite=True, Tcs=System.Threading.Tasks.TaskCompletionSource`1[System.Object]]
[35] 4293941 12:09:46.1934 [Trace:FitPro] Changed KPH to: 8.04
[16] 4294186 12:09:46.4360 [Trace:FitnessConsole] Kph changed from 4.82 to 8.04
[18] 4306906 12:09:59.1582 [Trace:FitPro] Changed KPH to: 3.21
[20] 4321687 12:10:13.9386 [Trace:FitPro] Changed KPH to: 1.6
[6] 4321910 12:10:14.1620 [Trace:FitnessConsole] Kph changed from 3.21 to 1.6
[18] 4334489 12:10:26.7406 [Trace:FitPro] Changed KPH to: 0
[18] 4334701 12:10:26.9532 [Trace:FitnessConsole] Kph changed from 1.6 to 0

so please repeat the test and keep attention to leave everything running, thanks!

cagnulein avatar Jun 06 '22 07:06 cagnulein

Ok, I did some detailed testing and came across the following behaviors:

  • When iFit treadmill app was in foreground (required to start manual workout), QZ did not record any speed or incline changes. QZ Companion app appears to stop streaming the live wolflog data when running in the background.
  • When QZ Companion app was in foreground, QZ log recorded all speed and incline changes. Also the cursor changed to hourglass/spinning while QZ processed the stream of incoming data (at first I thought it froze/crashed). QZ stayed in this "processing" state until several minutes after the manual workout stopped (almost 10-12 minutes in the last test).
  • At no point did the QZ app display any tile information during the manual workout (speed, incline, cadence, etc)

Logs from treadmill (wolflog) and are QZ attached: testing logs Jun 6 2022.zip

Testing workflow:

  • Launch iFit on treadmill
  • Start a manual workout on treadmill
  • Launch QZ Companion app on treadmill (QZ Companion Nordictrack Treadmill)
  • Connect & powerup Polar BT HRM
  • Launch QZ on PC - tiles appear, Polar HRM is connected, no tile information appears (speed, incline, cadence, etc)
  • Test QZ while changing forground/background state of iFit and QZ Companion apps

Test results:

Treadmill manual workout events (wolflog) - 2022-06-06_logs.txt

iFit in foreground

[20] 233203 08:54:16.6710 [Trace:Workout] Starting Manual Workout [1] 243257 08:54:26.7255 [Trace:FitnessConsole] Clamped Kph from 2 to 2. [1] 243259 08:54:26.7255 [Trace:FitnessConsole] Clamped Grade from 0 to 0. [10] 383657 08:56:47.1253 [Trace:FitPro] Changed KPH to: 4.82 [19] 394042 08:56:57.5105 [Trace:FitPro] Changed Grade to: 3 [22] 402572 08:57:06.0400 [Trace:FitPro] Changed KPH to: 8.04 [19] 414688 08:57:18.1566 [Trace:FitPro] Changed Grade to: -3 [23] 425077 08:57:28.5450 [Trace:FitPro] Changed KPH to: 3.21 [21] 434752 08:57:38.2203 [Trace:FitPro] Changed Grade to: 0 [6] 441032 08:57:44.5006 [Trace:FitPro] Changed KPH to: 1.6 [21] 448694 08:57:52.1618 [Trace:FitPro] Changed KPH to: 0

QZ log - debug-Mon_Jun_6_08_55_48_2022.log

Mon Jun 6 08:56:05 2022 1654516565245 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 0" Mon Jun 6 08:56:05 2022 1654516565223 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Inclination: 0" Last log entry - Mon Jun 6 08:59:10 2022 1654516750008 Debug: virtualtreadmill.cpp void virtualtreadmill::treadmillProvider() "virtualtreadmill connection error"

*** I was was able to close QZ


Treadmill manual workout events (wolflog) - 2022-06-06_logs.txt

[21] 4288776 10:01:52.2443 [Trace:Workout] Starting Manual Workout

QZ Companion app in foreground

[19] 4289043 10:01:52.5117 [Trace:FitnessConsole] Clamped Kph from 2 to 2. [19] 4289045 10:01:52.5130 [Trace:FitnessConsole] Clamped Grade from 0 to 0.

[16] 4289604 10:01:53.0690 [Trace:FitPro] Changed KPH to: 2 .. 2.9 [5] 4413153 10:03:56.6212 [Trace:FitPro] Changed KPH to: 8.04 [8] 4419961 10:04:03.4291 [Trace:FitPro] Changed Grade to: 3

iFit in foreground

4] 4432650 10:04:16.1179 [Trace:FitPro] Changed KPH to: 1.6 .. 3 [17] 4437009 10:04:20.4771 [Trace:FitPro] Changed Grade to: 0 [17] 4478992 10:05:02.4592 [Trace:FitPro] Changed Grade to: -3

QZ Companion app in foreground

[37] 4486517 10:05:09.9854 [Trace:FitPro] Changed KPH to: 8.04 [8] 4493191 10:05:16.6588 [Trace:FitPro] Changed KPH to: 1.6 [5] 4495802 10:05:19.2703 [Trace:FitPro] Changed Grade to: 0

QZ Companion app in foreground

[6] 4507904 10:05:31.3723 [Trace:FitPro] Changed KPH to: 4.82 [5] 4515996 10:05:39.4643 [Trace:FitPro] Changed KPH to: 3.21 [8] 4518833 10:05:42.3012 [Trace:FitPro] Changed KPH to: 1.6 [17] 4523273 10:05:46.7415 [Trace:FitPro] Changed KPH to: 0

QZ log - debug-Mon_Jun_6_10_03_04_2022.log

Mon Jun 6 10:03:23 2022 1654520603797 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Inclination: 0" Mon Jun 6 10:03:23 2022 1654520603821 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 0" Mon Jun 6 10:03:37 2022 1654520617516 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 2.1" .. Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 2.1 .. 2.9 .. Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 8.04 .. Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 1.6 .. 3 Mon Jun 6 10:06:10 2022 1654520770193 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 3"

*** QZ appears to have locked-up/crashed at this point (Mon Jun 6 10:06:10 2022) - cursor spinning, app did not respond to clicks, I was able to close QZ


Treadmill manual workout events (wolflog) - 2022-06-06_logs.txt

iFit in foreground

[20] 7188864 10:50:12.3319 [Trace:Workout] Starting Manual Workout [19] 7189837 10:50:13.3047 [Trace:FitPro] Changed KPH to: 2 .. 4 [7] 7274810 10:51:38.2786 [Trace:FitPro] Changed KPH to: 1.6 [19] 7290197 10:51:53.6652 [Trace:FitPro] Changed KPH to: 0

QZ log - debug-Mon_Jun_6_10_50_37_2022.log

Mon Jun 6 10:50:53 2022 1654523453918 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 0" Mon Jun 6 10:50:54 2022 1654523454108 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 0"

*** I was was able to close QZ


Treadmill manual workout events (wolflog) - 2022-06-06_logs.txt

[34] 7393188 10:53:36.6564 [Trace:Workout] Starting Manual Workout

QZ Companion app in foreground

[19] 7393683 10:53:37.1492 [Trace:FitPro] Changed KPH to: 2 .. 3 [4] 7472443 10:54:55.9088 [Trace:FitPro] Changed KPH to: 0

QZ log - debug-Mon_Jun_6_10_54_12_2022.log

Mon Jun 6 10:54:29 2022 1654523669039 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 0" Mon Jun 6 10:54:39 2022 1654523679059 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 2.1 .. 3 Mon Jun 6 10:54:59 2022 1654523699031 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 0"

*** At first QZ appears to have locked-up/crashed but it eventually responded after a few minutes after the workout stopped and the cursor stopped spinning, I was able to stop and close QZ


Treadmill manual workout events (wolflog) - 2022-06-06_logs.txt

[10] 7516717 10:55:40.1848 [Trace:Workout] Starting Manual Workout

QZ Companion app in foreground

[11] 7517117 10:55:40.5840 [Trace:FitPro] Changed KPH to: 2 .. 3 [65] 7596567 10:57:00.0320 [Trace:FitPro] Changed KPH to: 0

QZ log - debug-Mon_Jun_6_10_56_04_2022.log

Mon Jun 6 10:56:21 2022 1654523781155 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 0" Mon Jun 6 10:56:27 2022 1654523787424 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 2.1 .. 3 Mon Jun 6 10:57:22 2022 1654523842472 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "Current Speed: 0" Last log entry - Mon Jun 6 11:12:29 2022 1654524749406 Debug: virtualtreadmill.cpp void virtualtreadmill::treadmillProvider() "virtualtreadmill connection error"

*** QZ was busy and eventually responded after several minutes after the workout stopped and the cursor stopped spinning at approximately 11:10:00, was able to stop and close QZ

victorypoint avatar Jun 06 '22 14:06 victorypoint

thanks @victorypoint for this very detailed debug!

i tried to replicate the QZ frozen issue but i wasn't able. Also i'm seeing metrics in the tile when I send them via UDP using your log file as a reference. So there is something different on your setup but I can't understand which is

The load on the cpu is very small for all the frames, maybe in the meantime, you can try disabling the debug log from QZ. This could speed up QZ. Remember to restart it after this change.

So I guess the main issue is about the Windows build somehow: in order to understand if I'm right, I will build an ios/android version for this. Are you on iOS or Android? I don't remember :)

Also I was thinking another thing: we can also have a standalone QZ version that read information directly from the tablet itself without the companion :D But let's finish this first and then we will move on

Now i'm checking the "background thing" on the companion app.

cagnulein avatar Jun 07 '22 07:06 cagnulein

@victorypoint good news! I managed the background service on the companion. Download it from here https://github.com/cagnulein/QZCompanionNordictrackTreadmill/blob/master/app/build/outputs/apk/debug/app-debug.apk

Remember to double check that the file permission is ok

You should see a toast every 500ms that is telling you that the service is running

Let me know

cagnulein avatar Jun 07 '22 08:06 cagnulein

thanks @victorypoint for this very detailed debug!

i tried to replicate the QZ frozen issue but i wasn't able. Also i'm seeing metrics in the tile when I send them via UDP using your log file as a reference. So there is something different on your setup but I can't understand which is

The load on the cpu is very small for all the frames, maybe in the meantime, you can try disabling the debug log from QZ. This could speed up QZ. Remember to restart it after this change.

I just tried the QZ PC app without logging turned on. I'm still seeing no tile information but the lag from processing the data stream seems to be gone.

So I guess the main issue is about the Windows build somehow: in order to understand if I'm right, I will build an ios/android version for this. Are you on iOS or Android? I don't remember :)

I can use both. I have a 2020 iPad Pro with latest iPadOS and also an Android phone, the treadmill runs Android, and have several Windows PCs.

Also I was thinking another thing: we can also have a standalone QZ version that read information directly from the tablet itself without the companion :D But let's finish this first and then we will move on

The treadmill should have enough ram and storage to run QZ but I haven't tried an install yet.

Now i'm checking the "background thing" on the companion app.

victorypoint avatar Jun 07 '22 12:06 victorypoint

Testing notes from 15K run in Zwift today:

  • Used QZ Companion app running on treadmill in background with iFit in foreground using manual workout mode

    • Noted that this app still takes a few minutes to allow app switch to iFit (Android displays 'close app' or wait when attempting to switch). Toast message appears when app is ready to switch
    • If this app is the solution going forward, it would be good to add an option to autostart with treadmill powerup, and remove toast message or change to less obtrusive indicator
  • Used QZ iOS on iPad Pro

    • QZ doesn't know initial treadmill speed until a speed change is made
    • Was confused as to which is best Zwift device pairing option to use. Options are:
      • QZ device - iOS Peleton workaround, iOS heart caching, virtual device and virtual bluetooth must be enabled
      • Domyosbr device - virtual device and virtual bluetooth must be enabled
      • Wahoo tread device - Dircon, virtual device and virtual bluetooth must be enabled
    • Communication of treadmill speed between treadmill, QZ (iOS), and Zwift (Windows 11) was rock solid throughout run. I made several speed changes and ran long segments with pace leader who was running a consistent 11 kph. It was nice to finally stay with the pack where everyone ran the same speed
  • Used Zwift Companion app on android phone. If QZ is used in background while Zwift Companion app is in foreground, Android stops data communication. Is there any way to run QZ in background and keep data communication alive?

  • QZ Windows continues to not show live tile data - not sure why

victorypoint avatar Jun 08 '22 20:06 victorypoint

  • Noted that this app still takes a few minutes to allow app switch to iFit (Android displays 'close app' or wait when attempting to switch). Toast message appears when app is ready to switch

hah ok i know the reason. It's the parsing of the whole file. I can skip directly the whole file and put me on the last line. What do you think?

  • If this app is the solution going forward, it would be good to add an option to autostart with treadmill powerup, and remove toast message or change to less obtrusive indicator

Indeed. Autostart should be easy to do, let's open a ticket about this in the companion app project. Also, instead of the toast message, a updated notification would be better. What do you think?

  • QZ doesn't know initial treadmill speed until a speed change is made

I still don't get it why you need this :D I mean, from my point of view, if the app will start with the treadmill, we should be aligned, isn't it? This will simplify everything I guess.

  • Wahoo tread device - Dircon, virtual device and virtual bluetooth must be enabled

from my point of view, this is the best way. Dircon is always better than bluetooth for apps that have Dircon of course :)

  • It was nice to finally stay with the pack where everyone ran the same speed

Great!

  • Is there any way to run QZ in background and keep data communication alive?

nope, this is not possible on android without a full QZ rewriting #84 . So I guess you need 3 devices to run everything :)

  • QZ Windows continues to not show live tile data - not sure why

can you try if also this one has the same issue? https://github.com/cagnulein/qdomyos-zwift/suites/6857877281/artifacts/264951437

Thanks!

cagnulein avatar Jun 09 '22 08:06 cagnulein

  • Noted that this app still takes a few minutes to allow app switch to iFit (Android displays 'close app' or wait when attempting to switch). Toast message appears when app is ready to switch

hah ok i know the reason. It's the parsing of the whole file. I can skip directly the whole file and put me on the last line. What do you think?

Yes, perfect!

  • If this app is the solution going forward, it would be good to add an option to autostart with treadmill powerup, and remove toast message or change to less obtrusive indicator

Indeed. Autostart should be easy to do, let's open a ticket about this in the companion app project. Also, instead of the toast message, a updated notification would be better. What do you think?

When using iFit (manual workout mode), notifications are not visible as are any components of the Android interface. iFit takes up the entire screen. The toast works well but could be less obtrusive - or perhaps just remove it as we assume the service is running.

  • QZ doesn't know initial treadmill speed until a speed change is made

I still don't get it why you need this :D I mean, from my point of view, if the app will start with the treadmill, we should be aligned, isn't it? This will simplify everything I guess.

Sorry, I should have explained this better. Often I will be in a manual iFit manual workout (e.g. walking or warming-up) before entering Zwift. Once Zwift is launched I often accept the device screen go straight to a route (e.g. May Loop 400m). Once there, I go to device pairing screen and connect devices I'm using for that Zwift workout (in this case an HRM for heart-rate, a Stryd footpod for cadence, and QZ for speed & incline). So launching QZ at this point, it shows an initial speed of 0 even though the treadmill is moving at walking or warmup speed. This is a very minor issue and can be ignored/dropped if it's difficult to implement.

  • Wahoo tread device - Dircon, virtual device and virtual bluetooth must be enabled

from my point of view, this is the best way. Dircon is always better than bluetooth for apps that have Dircon of course :)

Okay, good to know. I tried to find information about the Domyosbr and QZ bluetooth devices that QZ exposes but couldn't find anything. Are they documented somewhere?

  • It was nice to finally stay with the pack where everyone ran the same speed

Great!

  • Is there any way to run QZ in background and keep data communication alive?

nope, this is not possible on android without a full QZ rewriting #84 . So I guess you need 3 devices to run everything :)

  • QZ Windows continues to not show live tile data - not sure why

can you try if also this one has the same issue? https://github.com/cagnulein/qdomyos-zwift/suites/6857877281/artifacts/264951437

Okay, will test this morning and report back.

victorypoint avatar Jun 09 '22 11:06 victorypoint