Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
eMadman opened this issue Nov 17, 2021 · 430 comments
Open
Assignees
Labels
bug Something isn't working pinned smartspin2k
Milestone

Comments

@eMadman
Copy link

eMadman commented Nov 17, 2021

Describe the bug

  • Partway into the ride, either SS2k stops updating resistance or it's not updating enough to cause the stepper motor to turn.
  • Gear +/- buttons in QZ don't have any impact

Power, speed and cadence continue to appear in zwift

To Reproduce
Setup:

  • SS2K - latest from auto-update
  • QZ beta channel
  • Samsung Galaxy S21
  • Zwift on Windows 10
  • Bowflex C6

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

  • SS2k resistance updating to match incline in roads
  • Gear +/- buttons interacting with SS2k

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

@eMadman eMadman added the bug Something isn't working label Nov 17, 2021
@cagnulein cagnulein added this to the 2.8 milestone Nov 17, 2021
@cagnulein
Copy link
Owner

hi @eMadman i checked the log. The main issue is this one:
when ss2k starts in an echelon setup, i'm sending the current resistance value got from the bike to the ss2k in order to init its resistance value. from that moment on, echelon and ss2k will be aligned on the same resistance value even if the user rotates the knob.

ok now let's talk about the schwinn setup:
the schwinn bikes doesn't send the resistance by bluetooth. The resistance is derived from wattage and cadence in QZ. This means that at the startup phase, the resistance level is 0 and so i'm sending 0 to SS2k despite the real value in the bike.

In the log i saw that all the resistance values that comes from the ss2k during the ride are all negative value and i think this is releated to the startup issue (also the gear one).

So i guess, we can try to do a thing just to have a simplier setup: start the QZ session with your bike resistance set to 1. In this way the SS2K and QZ should be more or less aligned and let's see if it will go better.

@marklogan17 @kadaan what do you think?

@cagnulein
Copy link
Owner

also a question @eMadman : zwift is paired with QZ or with the SS2k? in this scenario it has to be linked with QZ

@eMadman
Copy link
Author

eMadman commented Nov 18, 2021

@cagnulein
a resistance of 0 on my bike appears as '5' on QZ. To compensate for this, I tried to set "resistance at startup" to 5 in order to match it.

This did work with SS2k for a while, but I'm noticing that the resistance gains are very small. Partway through the ride, it sent resistance up past 90 which was very unexpected.

QZ is paired with SS2k and the IC4
Zwift is paired with QZ and my HRM

@cagnulein
Copy link
Owner

@eMadman ok I need always the debug log every time you did a try to understand the behavior

@eMadman
Copy link
Author

eMadman commented Nov 19, 2021

Apologies - I thought I included the log yesterday! Here you go

@cagnulein
Copy link
Owner

cagnulein commented Nov 19, 2021

Ok probably it's all releated to "Shift Step" setting in QZ. You have to found a step number that matches with your bike know.

You can find it empirically putting the knob to 0, and then manually rotating it to the max. If your step setting is ok you should see on QZ the value that you have to the bike. If the resistance value on QZ is too big (as is now) means that you have to decrease this setting (for example you can start from a 400 instead of 900).

Every change of this setting requires a QZ restart.

Let me know @eMadman

P.S. the 900 actual value is refereed to the echelon bike

@cagnulein
Copy link
Owner

@eMadman did you solve this?

@eMadman
Copy link
Author

eMadman commented Dec 3, 2021

@cagnulein I haven't been able to give this the time to generate the log files. My last attempt, the shift step setting didn't change anything. Best I can describe it as is that it appeared to me that QZ wasn't sending updates to SS2k - either at all or in a timely way (I'd need the logs to help figure that out).

When I lower shift steps to around 400 on the SS2k (eliminating QZ from the equation), I find the erg responses to be too slow. Shifting up or down, for example only changes the watts by ~5-10. Bigger steps should make more drastic changes but perhaps I'm misunderstanding how that works.

I do wonder if, QZ not reporting a '0' value for resistance to SS2k has anything to do with it. Lowest I can get with my knob fully zeroed out is 5 on the QZ dashboard.

To date, I haven't tried the peloton integration due to the time needed to test it properly. I'll try for a few hours on Sunday to capture logs for Zwift and for peloton for you.

@cagnulein
Copy link
Owner

@eMadman eliminating QZ from the equation, you should find a shift step value that allow you to change only 1 resistance point to your bike when you use the plus/minus button on the SS2K. If you find this, then you have to fill this value in QZ and it should work properly.
Of course send me the debug log if it doesn't because you're the first one who is using SS2k with the schwinn :)

@marklogan17
Copy link

@eMadman maybe on the SS2K forums people are using it with schwinn (without QZ)? If so, you could ask them what their shift step value is. As Roberto pointed out, its really meant to give SS2K the information it needs so that it can add one level of resistance.

@eMadman
Copy link
Author

eMadman commented Dec 3, 2021

@marklogan17 , @cagnulein - this is eye-opening! I'll get back to you guys this weekend. Will try to get an SS2k into my buddy's hands for next week as well - he's got an IC4 as well and can help with testing.

@rjbutler
Copy link
Contributor

rjbutler commented Dec 5, 2021

@cagnulein @marklogan17
I wrote too soon over on Facebook. I did a full class just know and the resistance stopped updating somewhere between 5 and 8 minutes into the ride. Before that it was updating but was consistently 1-2 levels below the Peloton target.

Setup: IC4, SS2k, Peloton Conversion Offset = -10, Schwinn calculation On. LMK if you need other settings

I had the shift step set to 300, although I did try changing that to 400 late in the ride to no effect. I also unplugged and replugged the SS2K at some point and it seemed to connect again (the blue LED stopped blinking anyways). The shifter b
uttons worked the whole time but the gears tile stopped at the same time as auto shifting. Gears also didn't start working until the class started for whatever that's worth.

QZ log attached. I didn't get an SS2K log unfortunately

debug-Sat_Dec_4_15_34_47_2021.log
.

@rjbutler
Copy link
Contributor

rjbutler commented Dec 5, 2021

This looks suspicious:
Sat Dec 4 15:51:19 2021 1638661879573 Debug: /Users/cagnulein/qdomyos-zwift/src/smartspin2k.cpp void smartspin2k::characteristicChanged(const QLowEnergyCharacteristic &, const QByteArray &) Resistance received from SS2k: ### -257

@cagnulein
Copy link
Owner

@rjbutler there is a major issue on this log: at the time 15:41:25 the SS2K disconnects from the QZ app and it doesn't connect anymore. Maybe a bluetooth glitch?
You can see this from these kind of lines:

Sat Dec 4 15:41:25 2021 1638661285503 Debug: /Users/cagnulein/qdomyos-zwift/src/smartspin2k.cpp void smartspin2k::controllerStateChanged(QLowEnergyController::ControllerState) "trying to connect back again..."

also about the -257 thing: i fixed this because SS2k was sending -1. Anyway the issue is that SS2K was probably in the middle of 2 resistance levels. Infact QZ wrote to reset but the SS2K answered back with -1. Anyway i fixed the wrong -257 thing but it was completely unrelated from the disconnection issue.

cagnulein added a commit that referenced this issue Dec 5, 2021
@rjbutler
Copy link
Contributor

rjbutler commented Dec 5, 2021

@cagnulein I tried power cycling the SS2K at some point during that log and initiated a bluetooth scan but it didn’t reconnect. Should it have?

@cagnulein
Copy link
Owner

Yes qz after is connected to ss2k will try forever to connect to it if it lost the connection.

If it happens again let's annotate the time of the events. So we can understand more.
Thanks

@rjbutler
Copy link
Contributor

rjbutler commented Dec 5, 2021

@cagnulein Another couple of logs, both QZ and SS2K this time. It disconnected again at I think 15:29, from the SS2K side it looks like it immediately reconnected again but QZ never adjusted the resistance again. I tried powercycling the SS2K a couple of times a little later but no luck

It's also pretty consistently overshooting the target resistance. I'm set for the midpoint of the Peloton range and when it's working it's setting the the resistance level so the Schwinn calculated resistance is 3-5 points higher than the Peloton target tile.
debug-Sun_Dec_5_15_15_20_2021.log
20211205 SS2K Logs.txt

@cagnulein
Copy link
Owner

@rjbutler didn't use the newest version that i send you yesterday?
Anyway good news: thanks to your log i fixed a reconnection issue (of course you should understand why in your setup, you're seeing SS2K disconnections...maybe the SS2K has some bluetooth issue?) @marklogan17 didn't have this issue as i know.
The version with this fix will be 2.8.136

About the overshooting: the calculated schwinn resistance is a metric calculated from your wattage so i guess you should try to look at the actual resistance level in the display of your bike. Anyway in the log the target resistance and the resistance on the SS2K always matches, so for sure it's not an issue of the chain peloton->qz->ss2k and that's a good start :)

@marklogan17
Copy link

I haven't had any bluetooth disconnections at all but my SS2K version is fairly out of date now. If I get some time later this week I'll build the new QZ version and give it a try. I'm nervous about updating SS2K since its been stable.

@cagnulein
Copy link
Owner

@marklogan17 i don't think it's reletated to QZ. SS2K just disconnects itself. Maybe it's better if @rjbutler could try with your old firmware just to understand if it's hardware or not ;)

@marklogan17
Copy link

@marklogan17 i don't think it's reletated to QZ. SS2K just disconnects itself. Maybe it's better if @rjbutler could try with your old firmware just to understand if it's hardware or not ;)

I'm in LA until Wednesday. When I'm home I can send the firmware I'm using.

@rjbutler
Copy link
Contributor

rjbutler commented Dec 6, 2021

@cagnulein the new version didn’t show up in Test Flight, not sure why.

On the overshooting, I’m comparing the Peloton Resistance tile to the Target Peloton Resistance tile. The Peloton Resistance tile is 3-5 points higher. I’ll note the time and values next workout and compare to the logs.

@cagnulein
Copy link
Owner

@rjbutler write me to roberto.viola83 at gmail.com your email. maybe i sent it to another one :D
On the overshooting: hah ok, so probably there is a mismatch with all these conversions. Peloton resistance and SS2K resistance are both calculated, so a minimum difference creates the issue that you're seeing i guess.

@eMadman
Copy link
Author

eMadman commented Dec 6, 2021

@cagnulein - apologies for my absence on this ticket. I finally managed to get some testing time in last night as well. I managed to get resistance to auto follow in a peloton power zone ride for perhaps the first 5-10 minutes in this ride, but I found that it stayed out of sync with the callouts in the ride (possibly an issue with the ride's metadata?) and needed to be corrected upwards throughout the ride with the shift up buttons in QZ. Towards the last ~5 minutes or so of this log, I realized it wasn't adjusting resistance down at all

debug-Sun_Dec_5_17_53_04_2021.log

I hope it's useful.

@cagnulein
Copy link
Owner

cagnulein commented Dec 6, 2021 via email

@cagnulein
Copy link
Owner

cagnulein commented Apr 6, 2022

@doudar i totally agree but i don't know if it will be another battle with a closed source app :) anyway this is the log from my morning ride
debug-mer_apr_6_08_05_18_2022.log.zip
i tried till 8:22 with HR after then, I understood that it was the HR from the SS2K the issue and i shutdown the SS2K completely

Do you have any tag to quickly find something coming from bluetooth (ifit) ?

EDIT: in the meanwhile i'm also contacting iFit app to understand if it's possibile to turn that off somehow

@rjbutler
Copy link
Contributor

#774 (comment)

Link to a log file where the SS2K stopped tracking a PZ ride. I did try to reboot the SS2K without success. I'm not sure if it's supposed to reconnect and start working again in ERG mode ?

@cagnulein
Copy link
Owner

@rjbutler in that log i saw:

here is the last good frame from SS2K

Tue Apr 19 17:54:37 2022 1650416077621 Debug: /Users/cagnulein/qdomyos-zwift/src/schwinnic4bike.cpp virtual void schwinnic4bike::resistanceFromFTMSAccessory(int8_t) "resistanceFromFTMSAccessory" 1

then there is no events until

Tue Apr 19 17:55:11 2022 1650416111279 Debug: /Users/cagnulein/qdomyos-zwift/src/bluetooth.cpp void bluetooth::debug(const QString &) "smartspin2k::errorServiceCharacteristicWriteError"
Tue Apr 19 17:55:11 2022 1650416111280 Debug: /Users/cagnulein/qdomyos-zwift/src/bluetooth.cpp void bluetooth::debug(const QString &) "smartspin2k::errorAuthorizationErrorFailed to authorize on the remote device"

from this moment on, QZ should tried to reconnect to it but I can't see it. I added a force disconnection when this happens. Let me know if it happens again.

cagnulein added a commit that referenced this issue Apr 21, 2022
@doudar
Copy link
Contributor

doudar commented Apr 21, 2022

I just looked at the log as well. Unfortunately not much else info. For some reason the BLE stack keeps locking up and we need to figure out the root cause. It's probably tweakable in the SS2k code somewhere........

The only other thing to do would be to detect this in SS2k and re-init the BLE stack.

@h2zero, is there an easy method to determine if BLE is halted/unresponsive?

@cagnulein
Copy link
Owner

i just had a perfect 75 minutes ride with qz and vzfit. what did i changed? the only thing that i done is tightening up the ss2k to my bike because i saw that it was a little "soft".
is it possible that the motor torques rise up and blocked the cpu somehow due to an high current requests?
It's the only explanation that comes into my mind

@rjbutler
Copy link
Contributor

Most of my rides work fine. I think I had 8 successful rides before the most recent failure. Typically 45 minutes, some 30.

@h2zero
Copy link

h2zero commented Apr 23, 2022

is there an easy method to determine if BLE is halted/unresponsive?

@doudar The stack resets itself when this occurs, there is a callback that is handled by the library but I have not exposed it (TODO). If you want to experiment you could modify the code in NimBLEDevice.cpp for testing: https://github.com/h2zero/NimBLE-Arduino/blob/fc746b173ae4759d55f862fff2ee28537ad98c3b/src/NimBLEDevice.cpp#L759

@cagnulein
Copy link
Owner

another 85 minutes without issues! So I'm quite sure that my issue was mechanical instead of software! I will keep you posted!

@stale
Copy link

stale bot commented May 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label May 8, 2022
@cagnulein cagnulein added pinned and removed wontfix This will not be worked on labels May 8, 2022
@rjbutler
Copy link
Contributor

FWIW, I've been doing 45 minute training programs from TrainerDay 4-5 times a week for several weeks with no major issues. Just a couple of things I've noticed that could be improved

  1. If I stop or slow pedaling during a workout, it will crank the resistance up. I wonder if it would be worth adding something so that at low RPMs it pauses auto-resistance.

  2. At the end of the workout, I was thinking it would be nice to reset the target zone to 1.0 or to set the resistance down to 1 so it's prepared for the next ride.

But overall, it's been fantastic. Thanks for all the effort @cagnulein, @doudar and everyone else who has worked on this.

@cagnulein
Copy link
Owner

  1. If I stop or slow pedaling during a workout, it will crank the resistance up. I wonder if it would be worth adding something so that at low RPMs it pauses auto-resistance.

is this happen on ERG mode? If so i don't know if @doudar would like to do it directly on the firmware or it's better to do this on QZ side. Probably both

  1. At the end of the workout, I was thinking it would be nice to reset the target zone to 1.0 or to set the resistance down to 1 so it's prepared for the next ride.

mmm I don't know: usually when I finish a workout, i have the habit to keep pushing at that rate until I decided to stop and manually decreasing it...I think this behaviour will break the legacy compatibility with the userbase....maybe a setting?

But overall, it's been fantastic. Thanks for all the effort @cagnulein, @doudar and everyone else who has worked on this.

Great! In the last period I'm bike commuting every day, 4 times a day so I'm running the most of the time in my spare time, that's why I didn't post any news about this :)

@cagnulein
Copy link
Owner

I added 2 new settings for min and max resistance allowed to the SS2K. It happened, during a GPX ride, that QZ tried to set a too high restance to SS2K leading to a crash.

@doudar
Copy link
Contributor

doudar commented Jun 24, 2022

Awesome!

@doudar
Copy link
Contributor

doudar commented Jun 26, 2022

New release of SS2K implementing LittleFS and more app support.

Manual install is probably required.

https://github.com/doudar/SmartSpin2k/releases/download/2.6.26/firmware.bin

@cagnulein
Copy link
Owner

cagnulein commented Jun 26, 2022 via email

@cagnulein
Copy link
Owner

updated now, i'm giving a try. Sorry for the delay!

@cagnulein
Copy link
Owner

@doudar @rjbutler I just did a 1:15h session with the new firmware and the last qz 2.10 and everything works perfectly! Good job!

@janabouc
Copy link

janabouc commented Jul 17, 2022 via email

@cagnulein
Copy link
Owner

@janabouc connect to the ip of the SS2K via browser and follow the last lines of this #500 (comment)

@doudar
Copy link
Contributor

doudar commented Jul 17, 2022

It sounds like it’s time for me to give it another try. (I gave up after only a few tries because of too many times losing connection). Are there instructions available for updating to the new firmware? Thanks, Jana
On Sun, Jul 17, 2022 at 2:36 AM Roberto Viola @.> wrote: @doudar https://github.com/doudar @rjbutler https://github.com/rjbutler I just did a 1:15h session with the new firmware and the last qz 2.10 and everything works perfectly! Good job! — Reply to this email directly, view it on GitHub <#500 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AONHDMIEWFEKVCWVUTVOVK3VUPH2VANCNFSM5IFX5PDQ . You are receiving this because you commented.Message ID: @.>
-- Jana Bouc Website and Blog http://janabouc.com Instagram https://www.instagram.com/janabouc/ Facebook https://www.facebook.com/jana.bouc

This link on the wiki should help you.

https://github.com/doudar/SmartSpin2k/wiki/Loading-Software#updating-your-existing-firmware

I'd recommend looking at the releases section on SmartSpin2k and uploading the newest firmware.bin

@marklogan17
Copy link

This link on the wiki should help you.

https://github.com/doudar/SmartSpin2k/wiki/Loading-Software#updating-your-existing-firmware

I'd recommend looking at the releases section on SmartSpin2k and uploading the newest firmware.bin

@doudar I see in releases newer than 2.6.26 that there is a LittleFS.bin included. Is the installation method any different with those?

@doudar
Copy link
Contributor

doudar commented Sep 5, 2022

This link on the wiki should help you.

https://github.com/doudar/SmartSpin2k/wiki/Loading-Software#updating-your-existing-firmware

I'd recommend looking at the releases section on SmartSpin2k and uploading the newest firmware.bin

@doudar I see in releases newer than 2.6.26 that there is a LittleFS.bin included. Is the installation method any different with those?

Everything should be the same. The newer binaries will automatically reformat to littlefs. I would recommend the binary from this morning though as we fixed a problem with ERG mode that could affect stepper position limiting.

@marklogan17
Copy link

This link on the wiki should help you.

https://github.com/doudar/SmartSpin2k/wiki/Loading-Software#updating-your-existing-firmware

I'd recommend looking at the releases section on SmartSpin2k and uploading the newest firmware.bin

@doudar I see in releases newer than 2.6.26 that there is a LittleFS.bin included. Is the installation method any different with those?

Everything should be the same. The newer binaries will automatically reformat to littlefs. I would recommend the binary from this morning though as we fixed a problem with ERG mode that could affect stepper position limiting.

So just flash firmware.bin and ignore the littlefs.bin?

@doudar
Copy link
Contributor

doudar commented Sep 5, 2022

This link on the wiki should help you.

https://github.com/doudar/SmartSpin2k/wiki/Loading-Software#updating-your-existing-firmware

I'd recommend looking at the releases section on SmartSpin2k and uploading the newest firmware.bin

@doudar I see in releases newer than 2.6.26 that there is a LittleFS.bin included. Is the installation method any different with those?

Everything should be the same. The newer binaries will automatically reformat to littlefs. I would recommend the binary from this morning though as we fixed a problem with ERG mode that could affect stepper position limiting.

So just flash firmware.bin and ignore the littlefs.bin?

Yes. It should download the files from the internet after flashing.

@doudar
Copy link
Contributor

doudar commented Sep 5, 2022

Newest binary (22.9.5) is now live on the OTA (automatic update) server as well.

@marklogan17
Copy link

Newest binary (22.9.5) is now live on the OTA (automatic update) server as well.

I tried out the latest build from this morning with QZ on my Echelon. Was 'ok'. Lost sync a bunch of times. I had to stop auto resistance and start it again a few times to get QZ and SS2K to re-sync what the current resistance was. Made it through the 30 minutes but had to play around four or five times. It felt like maybe the motor wasn't turning as much as SS2K was telling it to. I'm not going to create an issue at this point as I want to go through and make sure all my settings are correct, find the best config, etc and make sure I've got time stamps in the logs to track it down if its still happening. I did a quick test with shift steps at 950 instead of 900 and in the minute or so of changing resistance up and down it seemed to be more consistent. I'm out of town until Saturday now so will likely be Monday before I try it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pinned smartspin2k
Projects
None yet
Development

No branches or pull requests

9 participants