Open rjlee opened 1 month ago
thanks, im traveling, i will check this tomorrow
Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud
Il giorno dom 21 lug 2024 alle 21:24 Robert Lee @.***> ha scritto:
Assigned #2467 https://github.com/cagnulein/qdomyos-zwift/issues/2467 to @cagnulein https://github.com/cagnulein.
— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2467#event-13593428033, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWACAQPBIFNVAGGQ2ZDZNQDHRAVCNFSM6AAAAABLHDHTSOVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTGU4TGNBSHAYDGMY . You are receiving this because you were assigned.Message ID: @.***>
hi @rjlee first of all one question: when you use QZ standalone, if you press the plus on the inclination tile, do you see the inclination goes up on your bike? this is the starting point Let me know
Yes both the incline and decline work when clicking on the tile in the qz app
hi @rjlee I checked both logs and I can see only 2 requests from ifit on each file. Let's try to understand this: if, on ifit, you run a manual workout, and you change manually on the ifit app the resistace, do you see the bike change also the inclination?
so ifit app change the resistance --> sent to qz --> qz translates it into a new inclination to the bike --> the bike will change the inclination
Can you confirm that this path works?
I can confirm that on a manual workout when you make a change to the resistance in the iFit app, the incline changes on the bike. The incline seems very steep for the resistance level and when setting the resistance back to '1' in the app, the incline doesn't go back to zero.
Screenshots at different resistance levels:
The last screenshot shows the incline not returning to '0' when resistance is '1'
Debug Log:
yes that's normal because qz calculates the inclination using the zwift resistance offset that by default is 4. Set it to -1 and you will have the desired effect. Let me know
I've set Zwift Resistance Offset
to -1
under Bike Options
. I've restarted the app and when changing resistance from 1 to 2 in the iFit app under manual workout mode, the incline on the bike rose to 20%, so I don't think that worked.
Debug log:
fixed! https://github.com/cagnulein/qdomyos-zwift/actions/runs/10045351363
Google is very slow in these days, reviewing the app on the store, even the beta ones. For this reason, in order to check right now if the patch that I did is right, you can use the android build in the link (check at the bottom of the page in about 1 hour). In order to test it you need first to remove the current QZ version on your phone, install the one that you downloaded. This version is a 15 minutes trial (you can restart it as many times as you want) and I can unlock it if you want, send me an email to roberto.viola83@gmail.com mentioning this ticket and that you are on android. Let me know if you have any questions
Thanks, I'll try that build later and let you know.
I've tried the development build and can confirm the scaling of resistance to incline seems to work better now. For each increment of 1 resistance it scaled 2 incline. Of note, when I jumped back down from a resistance of 4 to 1, the incline didn't reset to 0 but was left at 1.5 - when I went down in single increments however it seemed to reduce correctly, so I'm not sure it's working correctly when you move in increments larger than 1, certainly it didn't when I jumped down an increment larger than 1.
I'll try this build with some real workouts tomorrow.
Debug Log: debug-Mon_Jul_22_21_55_03_2024.log
unfortunately the log is truncated and i can see only these change requests
Mon Jul 22 21:56:44 2024 1721681804690 Debug: virtualdevices/virtualbike.cpp void virtualbike::characteristicChanged(const QLowEnergyCharacteristic &, const QByteArray &) "requested iFit resistance 4"
Mon Jul 22 21:56:52 2024 1721681812949 Debug: virtualdevices/virtualbike.cpp void virtualbike::characteristicChanged(const QLowEnergyCharacteristic &, const QByteArray &) "requested iFit resistance 7"
Mon Jul 22 21:57:00 2024 1721681820198 Debug: virtualdevices/virtualbike.cpp void virtualbike::characteristicChanged(const QLowEnergyCharacteristic &, const QByteArray &) "requested iFit resistance 9"
Mon Jul 22 21:57:06 2024 1721681826580 Debug: virtualdevices/virtualbike.cpp void virtualbike::characteristicChanged(const QLowEnergyCharacteristic &, const QByteArray &) "requested iFit resistance 11"
Mon Jul 22 21:57:14 2024 1721681834495 Debug: virtualdevices/virtualbike.cpp void virtualbike::characteristicChanged(const QLowEnergyCharacteristic &, const QByteArray &) "requested iFit resistance 9"
Mon Jul 22 21:57:20 2024 1721681840018 Debug: virtualdevices/virtualbike.cpp void virtualbike::characteristicChanged(const QLowEnergyCharacteristic &, const QByteArray &) "requested iFit resistance 2"
can you do another debug log in order to collect the 0 error? thanks
Here is another log. Interestingly, this time, I went in increments of 1-2-3 - the incline didn't seem to scale the same as previously. The same observation was seen when jumping down more than 1 unit of resistance down to '1', with the incline not resetting back to 0.
in this log i see ifit request resistance are: 4-7-14-2-2
is it what you did? also i don't know why your logs are always truncated at the top, i can see only the last part of the file. are you editing it?
I've done a video and a fresh log below. I don't edit the log, so unsure why they are being truncated.
https://github.com/user-attachments/assets/152c1a53-9f13-4e3a-907f-1bc601030f5e
it seems that ADB is not working. I guess also the manual inclination from QZ doesn't work either now, right? Did you change something? Maybe ADB was turned off automatically on your bike?
I had to re-setup my profile when I installed the debug version. Things I've enabled/set:
Let me know if there is anything missing there, but think that's correct ?
I've just tested and adb connect from a linux box on the same network and it connects fine. I've just tried the +/- inclination tile in the QZ app and that is working fine at the moment.
yes they are correct. but maybe the problem is the scaling of the inclination : if you push manually the inclinazion on qz, do you see the inclination goes 1 by 1 also on the bike, or it's jumping? if it's jumping we have to map the coordinate of your bike I suggest
I can only increment in the QZ app in 0.5 increments, but they seem to map correctly when doing 0.5 increments (i.e. after a delay what is shown in the QZ app is what is reflected on the bike). I wonder if doing a larger jump (e.g. going from 1 to 5) in the iFit app is causing an issue with the mapping.
Happy to try mapping the co-ordinates if you let me know how.
In the treadmill seection (right in the treadmill section) there is a Inclination Step: setting. Set it to 5 instead of 0.5 Let's see if it reflects correctly then on the bike Let me know if it works well, there is something else, if not, it means i have to fix the coordinates
I've set Inclination Step
as 5 under Treadmill and restarted the app, but it still increments in 0.5 increments I'm afraid.
yes sorry my fault, i will check the log again to see if there is something else that i can do
Here is another log if it helps. I went from 1-5 resistance in 1 unit increments and saw the incline go up by 3 each time. Then I went to 10 and saw the incline go to 20. Finally I went back to 1 and the incline went down to 2.5.
unfortunately from the log i don't see anything, it's keeping removing a lot of useful information. Just to be sure: are you closing qz before sending the debug log?
Anyway I got an idea to debug this. From your linux box, let's try to validate the current coordinates
int x1 = 75;
int y2 = (int)(616.18 - (17.223 * inc));
int y1Resistance = (int)(616.18 - (17.223 * currentInclination().value()));
"adb shell input swipe " + x1 + " " + y1Resistance + " " + x1 + " " + y2 + " 200"
this is the current implementation, this means that if you would like to go to from currentinclination 0 to 1 the line is
adb shell input swipe 75 616 75 599 200
can you try to validate if it's working correct in all the scenario?
On the logs, no I'm not closing the app, so I'll do that next time.
On the command - that works fine from 1-4, but on 5 it resets to 0 inclination.
On the logs, no I'm not closing the app, so I'll do that next time.
ok perfect
On the command - that works fine from 1-4, but on 5 it resets to 0 inclination.
so what's the command that you were sending?
adb shell input swipe 75 546 75 529 200
?
are you able to find the algorithm to match correctly the inclination on your bike?
Sorry, had to pop out. So I was just repeating that adb shell
command. I've just written a quick script to test it with your algorithm:
#!/usr/bin/env ruby
#int x1 = 75;
#int y2 = (int)(616.18 - (17.223 * inc));
#int y1Resistance = (int)(616.18 - (17.223 * currentInclination().value()));
#"adb shell input swipe " + x1 + " " + y1Resistance + " " + x1 + " " + y2 + " 200"
ip="s22i"
x1=75
currentInclination=0
incline = [1,2,3,4,5,8,10,12,15,18,20]
incline.each { |inc|
y2 = 616.18 - (17.223 * inc)
y1Resistance = (616.18 - (17.223 * currentInclination))
currentInclination = inc
puts "Setting incline to #{inc}"
command = "adb connect #{ip}:5555 && adb shell input swipe #{x1} #{y1Resistance.to_i} #{x1} #{y2.to_i}"
puts command
system(command)
sleep 5
}
It works ok until it gets to 18 and then the values don't match. Video:
https://github.com/user-attachments/assets/171b3d27-118d-4a74-862a-60e429d31b12
probably the sliders are not linear, anyway it seems a different issue from the one that you saw in qz.
can you try to do also some jumps in the script like
0 to 4 to 8 to 3 something like this?
Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud
Il giorno mar 23 lug 2024 alle 20:28 Robert Lee @.***> ha scritto:
Sorry, had to pop out. So I was just repeating that adb shell command. I've just written a quick script to test it with your algorithm:
!/usr/bin/env ruby
int x1 = 75;
int y2 = (int)(616.18 - (17.223 * inc));
int y1Resistance = (int)(616.18 - (17.223 * currentInclination().value()));
"adb shell input swipe " + x1 + " " + y1Resistance + " " + x1 + " " + y2 + " 200"
ip="s22i" x1=75 currentInclination=0 incline = [1,2,3,4,5,8,10,12,15,18,20]
incline.each { |inc| y2 = 616.18 - (17.223 inc) y1Resistance = (616.18 - (17.223 currentInclination)) currentInclination = inc puts "Setting incline to #{inc}" command = "adb connect #{ip}:5555 && adb shell input swipe #{x1} #{y1Resistance.to_i} #{x1} #{y2.to_i}" puts command system(command) sleep 5 }
It works ok until it gets to 18 and then the values don't match. Video:
— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2467#issuecomment-2245956435, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWCKZBLGRBOF3YGWU63ZN2OEFAVCNFSM6AAAAABLHDHTSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBVHE2TMNBTGU . You are receiving this because you were mentioned.Message ID: @.***>
With incline=[4,8,3,0]
It definitely looks to struggle with those settings.
https://github.com/user-attachments/assets/cb691023-1bfa-4c4d-b503-85a56a496b4d
I'll try and capture a full debug log by closing the qz app now.
Example using iFit app, hopefully a complete debug log: debug-Tue_Jul_23_19_53_54_2024.log
Video: https://github.com/user-attachments/assets/246ca460-42f4-4a27-9ae3-e3f8a03584bb
ok i got the issue. when ifit requests on the screen the resistance 7 for example, to qz sends 15! so you can try to fix this using the value 0.5 to the zwift resistance gain. it should be better. anyway don't focus too much on the comparation between inclination and resistance, you will never have a precise value.also i guess the resistance 7 or similar in ifit it's like the 0% inclination on the bike. so you have to play with zwift resistance offset and gain to have an experience that you like
let me know
Thanks, I can confirm with that setting, it's a much closer match (i.e the incline doesn't move to a severe value).
A few questions to follow up with:
- The iFit app only does resistance (versus incline) and for the spin workouts it would be better to change the resistance. Would it be possible to add a toggle in qz to have the resistance changed rather than the incline for the NordicTrack bikes ? I can add it as a separate feature request separately, but wasn't sure if it was possible.
yes it's possible, you have only to tell me the new coordinates and so the new algorithm to calculate the resistance levels on your treadmill. are you able to do this? (you have to change the X coordinate of course)
- The iFit workouts don't finish - I think this was noted in the previous bug ticket I referenced in the discussion. It would be great if this could be fixed - I'm happy to provide logs etc ... Shall I raise this as a separate bug ticket ?
don't finish, do you mean that when you press stop ifit doesn't receive the ack from QZ? yes it should be fixable. do you know which is the log that you are referring to?
- I've just tried an iFit workout with the new settings and the incline sets to a sensible value - but after that there are no further resistance/incline changes shown in the iFit app - so it just sets one value and then never changes- when you start the workout and don't pair with qz the IFit app does have changes to resistance. I wonder if this is due to the qz app not syncing changes properly with the iFit app ?
i guess it's because qz answer back to ifit the resistance that stays at 0 in the bike. I can send it back the inclination if you agree.
Thanks. For 1 & 2 I'll provide coordinates and a fresh qz debug log tomorrow evening.
For 3 - I think that makes sense.
ok i will try to do asap
Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud
Il giorno mar 23 lug 2024 alle 22:23 Robert Lee @.***> ha scritto:
Thanks. For 1 & 2 I'll provide coordinates and a fresh qz debug log tomorrow evening.
For 3 - I think that makes sense.
— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2467#issuecomment-2246246160, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWFMALUZOZNMP27RKCDZN23V5AVCNFSM6AAAAABLHDHTSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBWGI2DMMJWGA . You are receiving this because you were mentioned.Message ID: @.***>
3. I've just tried an iFit workout with the new settings and the incline sets to a sensible value - but after that there are no further resistance/incline changes shown in the iFit app - so it just sets one value and then never changes- when you start the workout and don't pair with qz the IFit app does have changes to resistance. I wonder if this is due to the qz app not syncing changes properly with the iFit app ?
I just checked and I already did what I porposed as a solution yesterday. Are you able to show me a debug log which this issue is visible? Thanks
Back to this ...
Debug log attached. It should cover points 2 & 3.
The workout when it's not paired with qz starts at resistance 3 and then moves to resistance 4 about 5 minutes in. When paired to qz, the incline moves to 3 at the start of the ride (with the new qa build), shows resistance as 4 and then doesn't change until I stop the workout, where the incline resets to o and the resistance is shown as 1. The workout never completes and it just 'hangs' on a black screen in iFit until it eventually errors.
debug-Wed_Jul_24_20_18_15_2024.log
Will have a look at coordinates next.
adb shell wm size
Physical size: 1920x1080
So x1=1920-75
I've just tested this with my script and it seems to work.
this is for the X, but the Y? We need the ratio for the Y to match the resistance values :)
Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud
Il giorno mer 24 lug 2024 alle ore 21:37 Robert Lee < @.***> ha scritto:
adb shell wm size Physical size: 1920x1080
So x1=1920-75
I've just tested this with my script and it seems to work.
— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2467#issuecomment-2248763622, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWFNKBQ3RW2QUOUYPSDZN77AFAVCNFSM6AAAAABLHDHTSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBYG43DGNRSGI . You are receiving this because you were mentioned.Message ID: @.***>
Ah, that's not so easy ! How did you calculate those for the incline ?
getting the max value of Y for the resistance and the minimum and doing a proportion :) you can get easily with a screenshot of the ifit manual workout window using the adb screenshot batch file
Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud
Il giorno mer 24 lug 2024 alle ore 21:54 Robert Lee < @.***> ha scritto:
Ah, that's not so easy ! How did you calculate those for the incline ?
— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2467#issuecomment-2248788772, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWB6TFIFMCC5O3ZDPFDZOAA7JAVCNFSM6AAAAABLHDHTSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBYG44DQNZXGI . You are receiving this because you were mentioned.Message ID: @.***>
Thanks !
MinY = 248 MaxY = 803
ok now calculate the proportion and try to see if it works correctly and tell me which algorithm did you use, like i did it for the inclination
Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud
Il giorno mer 24 lug 2024 alle ore 22:19 Robert Lee < @.***> ha scritto:
Thanks !
screen.png (view on web) https://github.com/user-attachments/assets/eb667848-5f90-465c-8037-32105260940c
MinY = 248 MaxY = 803
— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2467#issuecomment-2248827594, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWBILHTPB6E2T4AC4NDZOAD43AVCNFSM6AAAAABLHDHTSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBYHAZDONJZGQ . You are receiving this because you were mentioned.Message ID: @.***>
Thanks - I'm not sure what you mean by the proportion is it simply 803/248 or something else ?
i mean i need this
for the resistance :) otherwise I can do this for you (it's only math) but I will do in the next days
If you could - I'm not sure how to calculate the equivalent 17.223 value. Happy to test it once I have that, thanks.
MinY = 248 MaxY = 803
so
and the resistance goes from 1 to 24
so
803 - 248 = 555 / 24 = 23,125
can you try if it's working ok?
So with a little trial and error this proportion works exactly for the slider values on screen for resistance:
#!/usr/bin/env ruby
#int x1 = 75;
#int y2 = (int)(616.18 - (17.223 * inc));
#int y1Resistance = (int)(616.18 - (17.223 * currentInclination().value()));
#"adb shell input swipe " + x1 + " " + y1Resistance + " " + x1 + " " + y2 + " 200"
ip="s22i"
x1=1920-75
currentResistance=1
resistance=[1,3,5,7,9,11,13,14,16,18,20,22,24]
proportion=23.777
resistance.each { |res|
y2 = 803 - (proportion * res)
y1Resistance = (803 - (proportion * currentResistance))
currentResistance = res
puts "Setting resistance to #{res}"
command = "adb connect #{ip}:5555 && adb shell input swipe #{x1} #{y1Resistance.to_i} #{x1} #{y2.to_i}"
puts command
system(command)
sleep 5
}
I did the same exercise for incline as well and this proportion works exactly for the slider values on screen for incline:
#!/usr/bin/env ruby
#int x1 = 75;
#int y2 = (int)(616.18 - (17.223 * inc));
#int y1Resistance = (int)(616.18 - (17.223 * currentInclination().value()));
#"adb shell input swipe " + x1 + " " + y1Resistance + " " + x1 + " " + y2 + " 200"
ip="s22i"
x1=75
proportion = 18.5
currentInclination=0
incline = [-10,-8,-5,-2,0,2,5,8,10,12,15,18,20]
incline.each { |inc|
y2 = 616.18 - (proportion * inc)
y1Resistance = (616.18 - (proportion * currentInclination))
currentInclination = inc
puts "Setting incline to #{inc}"
command = "adb connect #{ip}:5555 && adb shell input swipe #{x1} #{y1Resistance.to_i} #{x1} #{y2.to_i}"
puts command
system(command)
sleep 5
}
perfect! i was thinking what it should be the best way to add this: I would like to add a new setting under the nordictrack bike settings, called "Use Resistance" to force QZ to handle Resistance instead of inclination. So with this setting disabled (default), it will work as it does already, when you enable this, it will change the resistance instead. What do you think? I have always to keep an eye to the legacy of the app ;)
I think that makes sense - keep the existing default.
One follow-up question, thinking ahead a little.
For something like zwift, which I assume provides both resistance and incline (?) - Is it feasible to now set both resistance and incline in line with the zwift provided settings or does it not work that way ?
For something like zwift, which I assume provides both resistance and incline (?) - Is it feasible to now set both resistance and incline in line with the zwift provided settings or does it not work that way ?
it's what already does with the qz version that you have now. Since incline affects also the resistance, qz changes the inclination following the zwift one ;)
I think that makes sense - keep the existing default.
ok let me try to do this. when you will have this, remember to enable this new setting and to put the zwift resistance offset to 0 and the zwift resistance gain to 1 since we are know aligned to the ifit requests
Describe the bug
Following on from: https://github.com/cagnulein/qdomyos-zwift/discussions/2464
When using the Virtual iFit functionality, the auto-resistance/incline doesn't appear to work or is faulty. I'm not sure of the correct behaviour but there are no changes during a workout once the device is paired with the iFit app.
To Reproduce Steps to reproduce the behavior:
Expected behavior As the workout progresses changes to incline and resistance are observed on the bike. This doesn't happen. When the workout begins, the Bike makes one incline change - it's typically a very severe incline that gets set and then no further changes happen during the workout.
I've tried this with two workouts (debug logs attached) - one was interval training and the other was a mountain workout, on both, other than an initial severe incline being set, there are no subsequent changes.
Screenshots If applicable, add screenshots to help explain your problem.
This screenshot shows the difference in resistance on the bike versus the app (and also the severe incline set):![1](https://github.com/user-attachments/assets/f40b24f3-e694-4692-9a95-4a23c1a8d94b)
This screenshot shows the resistance on the same workout, when not paired with the bike.![2](https://github.com/user-attachments/assets/2aacca7d-b275-463e-8d09-6d45c65c41f5)
Equipment qz app running on Samsung Android Phone - v 2.16.55 iFit app running on Lenovo M11 Tab Tablet NordicTrack S22i running companion app
Append a debug log
This is the log for the interval workout: debug-Sun_Jul_21_19_29_51_2024.log
This is the log for the mountain workout: debug-Sun_Jul_21_19_49_33_2024.log