kaegi/kdri

Raspberry PI - Kettler Run-S

Opened this issue ยท 15 comments

Hi,

I compiled the cli.rs file on my raspberry pi3.

I pair my Run-S with the Raspberry PI and get following message:

Paired successfully, but this device has no services which can be used with Raspberry Pi.

Running the program on the Raspberry Pi gives following error:

Search for devices...
thread 'main' panicked at 'No devices found', /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/libcore/option.rs:705
note: Run with RUST_BACKTRACE=1 for a backtrace.

Any idea?

kaegi commented

The name in bluetooth settings is 'RUN S', so that can't be it.

Any other ideas?

Thanks for the fast reply!

kaegi commented

Ok, got a step further :-)

Connecting is a bit random, takes a while before it detects the treadmill, so i need to restart the cli.rs app a few times.

Now I get following output. Any guidance where I should start looking?

Search for devices...
Connect to "RUN S" ("2F:21:2D:52:DE:8C")...
Connected!
E: unsupported value integer 1
E: wrong CRC received:8A:76 vs computed:8A:18 in package:00:22:03:00:02:00:0A:8A:76
E: wrong CRC received:D3:66 vs computed:EA:C4 in package:00:10:03:00:02:00:00:D3:66
E: wrong CRC received:D7:4D vs computed:0F:54 in package:00:0F:03:00:02:00:00:00:00:D7:4D
E: wrong CRC received:D3:66 vs computed:9B:9A in package:00:10:03:00:02:00:03:00:02:00:00:D3:66
E: wrong CRC received:C9:D6 vs computed:35:4B in package:00:1F:02:C9:D6
E: wrong CRC received:8A:18 vs computed:19:D9 in package:22:00:0A:8A:18
E: wrong CRC received:76:95 vs computed:11:89 in package:00:01:76:95
E: wrong CRC received:A1:07 vs computed:11:89 in package:00:01:A1:07
E: wrong CRC received:D3:66 vs computed:EA:C4 in package:00:10:03:00:02:00:00:D3:66
E: wrong CRC received:8E:33 vs computed:A9:B9 in package:00:1E:03:00:02:00:00:0A:8E:33
E: wrong CRC received:AC:E0 vs computed:71:5A in package:00:23:03:00:02:00:02:00:04:AC:E0
E: wrong CRC received:D7:4D vs computed:2C:FF in package:00:0F:03:00:02:00:00:00:D7:4D
E: wrong CRC received:8E:06 vs computed:8E:33 in package:00:23:03:00:02:00:0A:8E:06
E: wrong CRC received:D3:66 vs computed:EA:C4 in package:00:10:03:00:02:00:00:D3:66
E: wrong CRC received:8A:18 vs computed:44:BD in package:00:08:03:00:02:00:00:0A:8A:18

kaegi commented

Ok, can't explain why I had the CRC errors, but they are gone.

CLI app works fine now. Will further play around with it. My goal is to write a small program, which reads a file containing interval training and then adjusts speed/incline for set durations.

As you seem to be quite familiar with rust + bluetooth, you wouldn't have an example of connecting and retrieving HR data from a polar bluetooth HR sensor?

I know the treadmill also returns pulse, but it is extremely inaccurate on my Run S.

Cheers

kaegi commented

This might have to do with the quality of the connection, though I'm not quite sure. I quick checked and the CRC errors indeed came from invalid packets (most of them have too many bytes/missing a byte). When testing I had the feeling the greater the distance the more invalid packets.

Well I wrote the bluetooth-serial-port library, but that only handles serial Bluetooth (="old bluetooth protocol"). A HR sensor probably uses Bluetooth low energy, which periodically sends all information to all devices in its range. I'm not familiar with that type and it needs a different crate (blurz looks promising).

Just a note: The RUN 7 receives pulse values from BLE signals and sends them to the computer (drastically improving the accuracy), so you might be able to query them with this library and the "pulse" value without more work.

Distance may have had to do with it.

Are you sure the Run 7 receives BLE signals? The HR transmitter which got delivered with the device is a 5khz "traditional" transmitter, not bluetooth. Will check it out this evening if it really picks up BLE as well, but then why would it come with a traditional sensor?

Will check out blurz as well.

Cheers

kaegi commented
kaegi commented
kaegi commented

Connect via SPP/appropriate RFCOMM channel. After that you can proceed on the "send bytes" level.

First step: Send handshake bytes (reverse engineered from my RUN 7 - probably works with all device types), after that the connection is acknowledged by the device and won't disappear anymore [blinking BT symbol -> steady BT symbol on RUN 7].

kaegi commented

The uncommented bytes undergo a process in send_bytes to make it into a real packet (sequence start/end bytes, escape bytes, add CRC). The bytes in the comment are the resulting real bytes which are then send to the device (these were used when send_bytes didn't have the necessary capabilities).