ajs123 / KBikeBLE

Arduino-based replacement computer for a Keiser M3 spin bike, with industry-standard Bluetooth services and simple display
19 stars 4 forks source link

Zwift on IOS requires disabling FTMS #7

Open chanyork opened 2 years ago

chanyork commented 2 years ago

I am having trouble to connect to zwift on ipad. Can connect to the power via bluetooth but when click on cadence it found nothing.

ajs123 commented 2 years ago

Hi @chanyork,

A couple of questions...

  1. Do you have both power and cadence showing on the display?
  2. Does the power reading show up correctly in Zwift?
chanyork commented 2 years ago

On the display yes. Zwift shows connected to the power but always shows 0. Zwift unable to connect to Cadence.

when I disable the CPS measurement it seems to be easier to connect.

//setupCPS();

Cheers, York Chan

On Wed, Mar 9, 2022 at 1:05 AM ajs123 @.***> wrote:

Hi @chanyork https://github.com/chanyork,

A couple of questions...

  1. Do you have both power and cadence showing on the display?
  2. Does the power reading show up correctly in Zwift?

— Reply to this email directly, view it on GitHub https://github.com/ajs123/KBikeBLE/issues/7#issuecomment-1061813449, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG37QONKLS5NAMQKD2G7XHLU65NCVANCNFSM5QGM6TTQ . You are receiving this because you were mentioned.Message ID: @.***>

ajs123 commented 2 years ago

Hi,

Can you see what happens if you disable FTMS instead of disabling CPS? FTMS doesn’t provide a cadence; it provides a crank count and time and leaves it for the app to calculate cadence. And the speed (Km/hr) provided with FTMS is not correct.

Let me know!

Alan

chanyork commented 2 years ago

let me try that this few days.

ajs123 commented 2 years ago

Thanks.

Actually, when using FTMS KBikeBLE should provide a cadence. It is for CPS that a crank count and time are provided. Sorry about that! But the speed provided with FTMS is just a placeholder, and most apps using FTMS expect to control the resistance (which would require a motor on the magnet assembly). I’ve thought about removing FTMS code but left it in just in case someone had reason to use it.

Almost all of the testing has been done with CPS, so do give that a try!

chanyork commented 2 years ago

Hello Alan,

Testing results as follow. Device: Ipad Mini Device: Iphone 13 Software: Zwift FTMS enabled and CPS enabled - Cadence can not connect even bluetooth name not updated in Power but connected FTMS enabled CPS disabled - OK FTMS disabled and CPS enabled - Cadence can not connect even bluetooth name not updated in Power but connected FTMS enabled and CPS enabled - Cadence can not connect even bluetooth name not updated in Power but connected

Software: Rouvy FTMS enabled and CPS enabled - All Good.

I am not too sure what system Zwift is using but seems like it has issue with CPS.

ajs123 commented 2 years ago

To be sure I understand…

Everything works in Rouvy - both power and cadence coming through correctly?

When Zwift connects for power, is it still reading zero?

thanks!

chanyork commented 2 years ago

Correct.

On Fri, Mar 11, 2022 at 12:18 AM ajs123 @.***> wrote:

To be sure I understand…

Everything works in Rouvy - both power and cadence coming through correctly?

When Zwift connects for power, is it still reading zero?

thanks!

— Reply to this email directly, view it on GitHub https://github.com/ajs123/KBikeBLE/issues/7#issuecomment-1064049048, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG37QOJD7RHSOTR4PDYY5D3U7HZA5ANCNFSM5QGM6TTQ . You are receiving this because you were mentioned.Message ID: @.***>

ajs123 commented 2 years ago

Hmmm...

My first guess was that Zwift looks only for FTMS and something is wrong in how the FTMS data are formatted. Most testing of FTMS has been by inspection of the data in Nordic nrfConnect and Adafruit Bluefruit Connect apps and comparison with the spec. On the other hand, you're getting the same behavior when disabling FTMS.

Let's be certain that FTMS is really being disabled. In addition to

// setupFTMS();

at KBikeBLE.ino line 615,

try

// Bluefruit.Advertising.addService(svc_ftms, svc_cps); // Advertise the services Bluefruit.Advertising.addService(svc_cps); // Advertise only the cps service

at line 311.

chanyork commented 2 years ago

Yes, the below works for all the apps i have. I even removed the adddata part as well.

// setupFTMS();

at KBikeBLE.ino line 615,

try

// Bluefruit.Advertising.addService(svc_ftms, svc_cps); // Advertise the services // Bluefruit.Advertising.addData(0x16, FTMS_Adv_Data, 5); // Required data field for FTMS Bluefruit.Advertising.addService(svc_cps); // Advertise only the cps service

ajs123 commented 2 years ago

Just to be sure - Zwift works now? If so, I'll disable FTMS at least temporarily.

chanyork commented 2 years ago

Yeap Zwift and all other works.

ajs123 commented 2 years ago

Great!

I may have found the problem. The Fitness Machine Feature characteristic has Resistance level supported unset (because the app can't change the resistance like it could with a trainer). But in the Indoor Bike Data characteristic Resistance level present is set and the resistance is included among the data fields. I'd thought that it was OK to report the resistance even if the app can't change it.

As I re-read the spec, the resistance shouldn't be included in the Bike Data. I can give it a try, maybe this weekend.

ajs123 commented 2 years ago

I just committed changes to remove the resistance from the Bike Data characteristic. Not tested yet!

chanyork commented 2 years ago

I just tried the new code. It work for a short period and was back to the same situation.

ajs123 commented 2 years ago

A dumb question maybe… Were you pedaling, at least occasionally? BLE will disconnect and stop advertising after 15 minutes (changeable in options.h line 61). This was done because someone could walk away and if their device remained within range they could tie up the bike. Different apps handle that differently.

Or you can disable FTMS again. I'm not sure what could be wrong but there's been so little testing with FTMS.

I'm working on properly-implemented options for which services to provide.

And thanks!

On Fri, Mar 11, 2022 at 8:56 AM chanyork @.***> wrote:

I just tried the new code. It work for a short period and was back to the same situation.

— Reply to this email directly, view it on GitHub https://github.com/ajs123/KBikeBLE/issues/7#issuecomment-1065136121, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABC4G2OLMNGHNC4A2KJZIU3U7NGHTANCNFSM5QGM6TTQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

ajs123 commented 2 years ago

The latest commit provides options (options.h, around line 98) to separately enable CPS and FTMS services. On my test system (iPad), I have to disable FTMS to work with Zwift.

Using CPS, Zwift sees both power and cadence and it calculates speed.

chanyork commented 2 years ago

yes I was pedaling occasionally to keep the Arduino on. So at the moment I disable the FTMS.

ajs123 commented 2 years ago

For the benefit of others with this issue, I changed the title.

ajs123 commented 1 year ago

So everything now works with Zwift?

On Thu, Mar 10, 2022 at 6:31 PM chanyork @.***> wrote:

Yes, the below works. I even removed the adddata part as well.

// setupFTMS();

at KBikeBLE.ino line 615,

try

// Bluefruit.Advertising.addService(svc_ftms, svc_cps); // Advertise the services // Bluefruit.Advertising.addData(0x16, FTMS_Adv_Data, 5); // Required data field for FTMS Bluefruit.Advertising.addService(svc_cps); // Advertise only the cps service

— Reply to this email directly, view it on GitHub https://github.com/ajs123/KBikeBLE/issues/7#issuecomment-1064620840, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABC4G2JA4SAX2UIMGXWCQADU7KA4RANCNFSM5QGM6TTQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

chanyork commented 1 year ago

Just tried the new code. Does not seem to work on my side. Still the same results.

On Fri, Mar 11, 2022 at 12:21 PM ajs123 @.***> wrote:

I just committed changes to remove the resistance from the Bike Data characteristic. Not tested yet!

— Reply to this email directly, view it on GitHub https://github.com/ajs123/KBikeBLE/issues/7#issuecomment-1064677465, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG37QOMJLPFQT45IQPM5HW3U7KNZZANCNFSM5QGM6TTQ . You are receiving this because you were mentioned.Message ID: @.***>

chanyork commented 1 year ago

Yes with the removal on the line that was advices.

On Tue, 11 Oct 2022 at 15:41, ajs123 @.***> wrote:

So everything now works with Zwift?

On Thu, Mar 10, 2022 at 6:31 PM chanyork @.***> wrote:

Yes, the below works. I even removed the adddata part as well.

// setupFTMS();

at KBikeBLE.ino line 615,

try

// Bluefruit.Advertising.addService(svc_ftms, svc_cps); // Advertise the services // Bluefruit.Advertising.addData(0x16, FTMS_Adv_Data, 5); // Required data field for FTMS Bluefruit.Advertising.addService(svc_cps); // Advertise only the cps service

— Reply to this email directly, view it on GitHub https://github.com/ajs123/KBikeBLE/issues/7#issuecomment-1064620840, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABC4G2JA4SAX2UIMGXWCQADU7KA4RANCNFSM5QGM6TTQ

. Triage notifications on the go with GitHub Mobile for iOS < https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675

or Android < https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/ajs123/KBikeBLE/issues/7#issuecomment-1274231850, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG37QONI4MIG7ICYC3GXEPTWCUK3VANCNFSM5QGM6TTQ . You are receiving this because you were mentioned.Message ID: @.***>

-- Cheers, York Tel: +852 98662380

ajs123 commented 1 year ago

Thanks. That's good to know. At least for now, it seems that FTMS will need to be disabled to work with Zwift.

On Tue, Oct 11, 2022 at 4:02 AM chanyork @.***> wrote:

Just tried the new code. Does not seem to work on my side. Still the same results.

On Fri, Mar 11, 2022 at 12:21 PM ajs123 @.***> wrote:

I just committed changes to remove the resistance from the Bike Data characteristic. Not tested yet!

— Reply to this email directly, view it on GitHub https://github.com/ajs123/KBikeBLE/issues/7#issuecomment-1064677465, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AG37QOMJLPFQT45IQPM5HW3U7KNZZANCNFSM5QGM6TTQ

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/ajs123/KBikeBLE/issues/7#issuecomment-1274260542, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABC4G2PD55PWS3W3PUJUE2TWCUNJFANCNFSM5QGM6TTQ . You are receiving this because you commented.Message ID: @.***>