cagnulein / qdomyos-zwift

Zwift bridge for smart treadmills and bike/cyclette
https://www.qzfitness.com/
GNU General Public License v3.0
367 stars 109 forks source link

[BUG] Schwinn/Bowflex + SS2k + QZ - inconsistent auto-resistance in Zwift #500

Open eMadman opened 2 years ago

eMadman commented 2 years ago

Describe the bug

Power, speed and cadence continue to appear in zwift

To Reproduce Setup:

Steps to reproduce the behavior:

  1. Power on SS2k - HRM & power meter settings disabled
  2. Turn pedals on bike
  3. Start QZ
  4. Start zwift and pair Galaxy S21 as the power meter, cadence, speed, and trainer
  5. Pair heart rate monitor with zwift
  6. Start ride (watopia, I think)
  7. for initial few minutes, resistance updates automatically
  8. At some point into the ride, it just stops. Resistance stays static - even on 8% inclines
  9. Press the Gear +/- buttons in QZ at any point in the ride - resistance stays static

Expected behavior

Log FIle https://drive.google.com/file/d/1EAYfuIV3rmlQK09TAkf3xEW-s5HDHWtv/view?usp=sharing

rjbutler commented 2 years ago

@cagnulein I think it's working using the gears. Here are some examples. I zeroed it out. Schwinn calculation on. Offset -10.

Before gears, actual Schwinn resistance was 3: image

After gears at the next transition, actual resistance was 12. image

And next transition actual resistance was 25 image

It's working but I'm curious about Target R and Resistance -- should they be the same? Or differ by the gears value?

Anyways. Thanks for the help getting this working! I'll try a power zone class next

cagnulein commented 2 years ago

Great @rjbutler ! Let's do some workout in this way and let's see if I can do something to improve your setup!

rjbutler commented 2 years ago

@cagnulein I did a power zone ride and have a couple of observations:

It does seem to track correctly, although I gave it a bit of a challenge by accidentally knocking out the power cord on the SS2K part way through. I had to tweak the gears after that to get it back in sync. But it did continue to track after that.

But I see one issue: It seems to only adjust the level when the target power zone changes and it seems to adjust it based on my current cadence. But in power zone rides, they can keep the same zone for a long duration and switch songs, and the new songs can have a different beat so the cadence I want to pedal can change. QZ doesn't adjust the resistance when I speed up and slow down.

I actually think this might be a challenge to do right, since the warmups have spin ups and you wouldn't want to change the resistance during those even if the cadence goes up.

One though I had is maybe tapping the target power zone tile could adjust the resistance to bring the power zone to the right level for the current cadence?

cagnulein commented 2 years ago

@rjbutler QZ changes every second the resistance accordingly to your cadence on PZ workout. So if it doesn't it's a bug. So i need the debug log of course to understand :)

rjbutler commented 2 years ago

Let me know if this works or if you want me to do a session where I intentionally vary the cadence by more debug-Fri_Dec_10_15_27_31_2021 2.log.zip .

cagnulein commented 2 years ago

@rjbutler got the issue! i need to add the function resistanceFromPowerRequest to the schwinn module! it wasn't there because till now there is no way to do erg mode on a schwinn! :D i will try to add this tomorrow!

doudar commented 2 years ago

Would it be possible to add it to bikes dynamically when an SS2K is detected as the SS2K can be used with most spin bikes that don’t have automatic resistance control, not just the IC4.

On Sat, Dec 11, 2021 at 9:59 AM Roberto Viola @.***> wrote:

@rjbutler https://github.com/rjbutler got the issue! i need to add the function resistanceFromPowerRequest to the schwinn module! it wasn't there because till now there is no way to do erg mode on a schwinn! :D i will try to add this tomorrow!

— You are receiving this because you were mentioned. Reply to this email directly, vie it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/500#issuecomment-991711918, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEEO2KGWZYMAYP5VU2WPY33UQN7P7ANCNFSM5IFX5PDQ .

--

---------------------- Anthony Doud

cagnulein commented 2 years ago

@doudar it's already done in this way :)

doudar commented 2 years ago

Awesome!

cagnulein commented 2 years ago

@rjbutler done! i'm uploading now version 2.8.143 ! please test it when you have it, i just write the code, no test at all

eMadman commented 2 years ago

I'm on beta channel and still on .142. Will test once I see it downloaded on my end!

cagnulein commented 2 years ago

@eMadman i will compile it for Android today. I would like to have a confirmation from @rjbutler first ;)

rjbutler commented 2 years ago

I didn't get a chance yesterday but will test today

rjbutler commented 2 years ago

@cagnulein

I had some difficulty getting these logs, QZ wasn't connecting to the SS2K, the Bike or both and I had to keep restarting/power cycling. Then when I got a good example of the problem I realized I had somehow turned off debug logs when looking at the settings. Anyways...

QZ drives the resistance up to 100 right away (and keeps going unless stopped). The most recent log in the attached should show that.

SS2K+BT connectivity.zip The other two logs might show the connectivity problems I was having. I'm not sure if that was QZ or something else. I am wondering if maybe one of my neighbors accidentally hijacked my bike since it was showing heart rate even when I didn't have an HRM on. So maybe nothing to do with QZ.

cagnulein commented 2 years ago

@rjbutler maybe another qz user around you? :) Anyway I will check the log tomorrow, maybe it's just a stupid error (probably it is :) ) I will check it tomorrow morning Have a nice evening!

cagnulein commented 2 years ago

@rjbutler thanks! fixed this in the 2.8.144 I will try to build this in 12 hours or so!

cagnulein commented 2 years ago

@rjbutler sent a new one 10 hours ago (more or less :D )

cagnulein commented 2 years ago

@eMadman new version also for android :)

eMadman commented 2 years ago

Awesome! I'll do a test ride after work... sounds like a PZ class is likely the way to go for collecting data on this? I'll DM @rjbutler to share notes before I test

cagnulein commented 2 years ago

@eMadman yes, PZ class is the best way.

Zutroy23 commented 2 years ago

I'm beta testing @eMadman's build, and tried to run a PZ class in Peloton, but the SS2K didn't adjust the resistance at all, even though QZ saw the device and linked to it. Could someone share the settings required in either SS2K or QZ to get this to work? I linked my bike and HRM to QZ and received the prompt from QZ if I wanted to follow the resistance, and the app showed the expected wattage output as required, but no response at all from SS2K.

cagnulein commented 2 years ago

@Zutroy23 which version of qz are you running?

Zutroy23 commented 2 years ago

@Zutroy23 which version of qz are you running?

2.8.146

cagnulein commented 2 years ago

@Zutroy23 share a debug log and tomorrow I will check it. Ss2k works in a non pz ride? Are you starting qz and your bike from resistance 1?

doudar commented 2 years ago

Following in case you need more info from me.

The SS2k's custom characteristic code (made for QZ) begins here: https://github.com/doudar/SmartSpin2k/blob/6501084d291c4df8bec11148f4511bde1a13c192/src/BLE_Server.cpp#L588

Zutroy23 commented 2 years ago

@Zutroy23 share a debug log and tomorrow I will check it. Ss2k works in a non pz ride? Are you starting qz and your bike from resistance 1?

SS2K worked great connected directly to an iPad running Zwift and my IC4. I set my bike resistance to 0 before turning on the SS2K for the PZ ride. I think I had debug mode on - if so I'll upload a logfile. If not, I'll find time this weekend to test it again.

In the meantime, are there specific settings that need to be turned on/off in SS2K when connected to QZ that may be different when using it directly with Zwift?

cagnulein commented 2 years ago

The step setting it's important in the ss2k section @rjbutler post his value before here

Do you see the popup about auto resistance in qz? Does the resistance change if you press the plus/minus buttons in the resistance tiles?

doudar commented 2 years ago

@Zutroy23 share a debug log and tomorrow I will check it. Ss2k works in a non pz ride? Are you starting qz and your bike from resistance 1?

SS2K worked great connected directly to an iPad running Zwift and my IC4. I set my bike resistance to 0 before turning on the SS2K for the PZ ride. I think I had debug mode on - if so I'll upload a logfile. If not, I'll find time this weekend to test it again.

In the meantime, are there specific settings that need to be turned on/off in SS2K when connected to QZ that may be different when using it directly with Zwift?

The custom characteristic for SS2K is always accepting connections.

In the SS2k's BLE scanner HTML page, setting both heart rate and power BLE devices to "NONE"(and press save dropdowns) will ensure the SS2K doesn't try to steal your BLE devices from QZ.

Also, if you look at the logging from the SS2K, you should see "Custom Request Received" anytime QZ reads or writes to the custom characteristic. If needed I can expand on the logging there. You can either get those logs via the Smartspin debugging page or via UDP port 10000. (or view it with the newest smartspin flasher https://github.com/SmartSpin2K/SmartSpin2kFlasher/releases/tag/v0.0.4)

Zutroy23 commented 2 years ago

The step setting it's important in the ss2k section @rjbutler post his value before here

Do you see the popup about auto resistance in qz? Does the resistance change if you press the plus/minus buttons in the resistance tiles?

Normally I get the popup but just now I tried 5 different classes, restarting the process each time (shutting down SS2K and QZ, starting up QZ and connect bike, power up SS2K, start Peloton class) and I didn't get the popup at all. I've run out of time for the day. Will try again tomorrow.

cagnulein commented 2 years ago

@Zutroy23 the class should be at least 1 month old if a pz. Hfb site are behind of their work :)

rjbutler commented 2 years ago

@cagnulein I finally got a chance to test the new version. Mixed results

  1. I zeroed the resistance and was just free pedaling as I got the class set up and QZ started turning the resistance up for some reason. I stopped pedaling and re-zeroed.
  2. Initially things seemed to be working ok during the intro portion of the class where the target zone is set to 1.9. I had to tweak the gears a little since QZ was putting me at 2.0-2.1, but it seemed OK.
  3. During the spinup portion of the warmup you don't really target a zone even though the class data has one. QZ turned the resistance all the way down as I sped up (I guess that's expected) so I disabled auto-resistance and manually bumped the resistance a bit since I was pedaling fast.
  4. When the spinups were done, I re-enabled auto-resistance but QZ didn't seem to get back in sync. I tried adjusting with gears but it didn't work. And then it drove the resistance up and up again. I quit the class at that point. I'm going to try a regular class now debug-Fri_Dec_17_13_38_06_2021.log.zip .
rjbutler commented 2 years ago

@cagnulein I'm not sure if you want to deal with two things at once.. I did a regular class, and it tracked fine. But I think there's something slightly off with the conversion. There are two things I noticed:

  1. As the resistance gets higher, the class target and the peloton r% get further apart -- the auto-resistance sets the peloton R% correctly (tuned by gears) at the lower resistance levels, but overshoots by an increasing amount as the target resistance increases.
  2. The Schwinn conversion algorithm is wrong once the resistance is over 50. Or maybe the power reported by the bike is wrong. But once the converted resistance (Peloton R%) is over 50, the Schwinn resistance as shown on the bike is much higher than it should be.

It mostly works great, it just gets a more difficult than I think is intended at the higher resistances.

Maybe I should just get power pedals debug-Fri_Dec_17_15_22_49_2021.log.zip

cagnulein commented 2 years ago

@cagnulein I'm not sure if you want to deal with two things at once.. I did a regular class, and it tracked fine. But I think there's something slightly off with the conversion. There are two things I noticed:

@rjbutler for this one, it's better to create a new issue about the schwinn conversion. If you want you can generate a new formula based on https://github.com/cagnulein/qdomyos-zwift/issues/141#issuecomment-783148509 and i will add a separate profile in the schwinn settings. What do you think?

cagnulein commented 2 years ago
  1. I zeroed the resistance and was just free pedaling as I got the class set up and QZ started turning the resistance up for some reason. I stopped pedaling and re-zeroed.

@rjbutler my fault, when the cadence is 0, i have an overflow. i'm fixing it right now! thanks!

cagnulein commented 2 years ago

3. During the spinup portion of the warmup you don't really target a zone even though the class data has one. QZ turned the resistance all the way down as I sped up (I guess that's expected) so I disabled auto-resistance and manually bumped the resistance a bit since I was pedaling fast.

yes that's why HFB doesn't have data for warmup, with a PZP premium you will have this

cagnulein commented 2 years ago

4. When the spinups were done, I re-enabled auto-resistance but QZ didn't seem to get back in sync. I tried adjusting with gears but it didn't work. And then it drove the resistance up and up again. I quit the class at that point. I'm going to try a regular class now

you mean that also the target watt tile was not in sync? if so, did you try to play with the peloton offset tile looking the "time to next tile" ?

rjbutler commented 2 years ago

@cagnulein I meant that I had manually adjusted the resistance while auto-resistance was disabled and when I re-enabled auto-resistance QZ didn't seem to be able to correctly set the resistance any more. I'm not sure if it was just the disable/enable, the manual change, or both.

cagnulein commented 2 years ago

@rjbutler but did you see the right target wattage?

rjbutler commented 2 years ago

@cagnulein, the issue with zero cadence seems to be resolved. The target during the warmup was way off though, it put me in the middle of zone 4 when I should have been at 1.9. See attached debug-Sun_Dec_19_14_51_54_2021.zip d

cagnulein commented 2 years ago

@rjbutler you're definitely right! i did a stupid thing! i was asking to SS2K to set the peloton resistance, not the schwinn resistance! My mistake! Fixed and i will build another one today. Thanks again for you help!

Zutroy23 commented 2 years ago

Running QZ version 2.9.10, loaded a 20 min PZ class and got the follow prompt. The target resistance tile was totally off in timing and, it seems, levels, and the SS2K didn't follow either the instructors prompts or the QZ target levels at all. I've attached the log file from QZ here debug-Mon_Dec_20_12_08_45_2021.log .

cagnulein commented 2 years ago

@Zutroy23 i have to release a new one because I found a bug this morning thanks to @rjbutler

Zutroy23 commented 2 years ago

Oh, ok. I saw a new release this morning and thought maybe it was from your comment above. I'll hold off then until a new release :)

cagnulein commented 2 years ago

@Zutroy23 i'm uploading version 2.9.11 for android with that fix. Let me know how it will perform. Also be sure to disable the auto resistance during the warmup because HFB doesn't provide warmup metrics. Thanks

Zutroy23 commented 2 years ago

Just did a PZ workout in Peloton, running QZ v. 2.9.11. Turned off auto-resistance for the warm-up and turned it on after. The T.Power tile showed the accurate W that I was supposed to be on, but the SS2K didn't budge at all during the entire workout. Using the shift buttons worked as expected, but otherwise no movement at all on its own. Not sure if the -/+ buttons on the Resistance(%) tile is supposed to do anything when pressed, but for me they don't. SmartPsin2k device is showing in the Accessories options, with a Shift Step of 300.

Possibly unrelated, but the number on the Resistance (%) tile fluctuates +/- 2 values at random times when the resistance knob isn't touched. This makes the output W fluctuate quite a bit, even though the physical knob isn't moving. Just wanted to point that out. I've attached the zipped log for this ride debug-Tue_Dec_21_16_07_53_2021.zip .

cagnulein commented 2 years ago

@Zutroy23 hi, in the log the SS2K wasn't in advertising mode, probably it was already connected somewhere else. You need to be sure that all your other devices are disconnected from it before running QZ.

So the resistance fluctuates because it wasn't reading the real resistance value from the SS2K :)

Please redo the test. Maybe you can test the connection, using the resistance plus/minus buttons on QZ before starting a peloton PZ workout.

Let me know

Zutroy23 commented 2 years ago

The resistance +/- buttons have never worked with the SS2K, nor has the gear tile. I suspect there's something physically wrong with my unit, so I'm going to swap it out for another one from @eMadman and try again.

doudar commented 2 years ago

@cagnulein , would it help if you had a SS2K unit to test/use? Send an email to smartspin2k@gmail.com if you’re interested.

cagnulein commented 2 years ago

The resistance +/- buttons have never worked with the SS2K, nor has the gear tile. I suspect there's something physically wrong with my unit, so I'm going to swap it out for another one from @eMadman and try again.

Could you please send me a debug log where you try to push that buttons? Because they work for echelon as far as I know, right @marklogan17 ?

cagnulein commented 2 years ago

@cagnulein , would it help if you had a SS2K unit to test/use? Send an email to smartspin2k@gmail.com if you’re interested.

I have a disdora dumb bike so the mount is completely different. The actual @Zutroy23 issue is about Bluetooth (in the last log I can't see the ss2k at all). So I guess we are very close to schwinn full implementation. I will try to build the iOS version for @rjbutler tonight

I will tell you @doudar if I need it, thanks