CSAFE over Bluetooth is broken (PM5 firmware 19)

Post bug reports or anomolous operation here
Post Reply
dxpack
Paddler
Posts: 13
Joined: July 5th, 2015, 1:59 am

CSAFE over Bluetooth is broken (PM5 firmware 19)

Post by dxpack » July 8th, 2015, 12:51 am

The CSAFE State Machine on the PM5 (firmware 19), as queried over Bluetooth, appears to be broken.

Specifically, it appears as though Bluetooth on the PM5 does not have access to the currently active CSAFE State Machine, perhaps instantiating a new State Machine with each separate Bluetooth CSAFE command the PM5 receives. That may not be precisely the cause of the issue, but that explanation matches the symptom: any individual set of CSAFE commands sent in one Bluetooth update are treated as operating on the same State Machine, whereas CSAFE commands sent over distinct Bluetooth updates are treated as operating on a State Machine that always starts in the Ready state regardless of prior Bluetooth-delivered CSAFE commands or even the active status of a workout.

The CSAFE State Machine should be reporting it's current state during Empty Frame (or CSAFE_GETSTATUS_CMD) messages. Instead, it always reports it is in the Ready State, even when a workout is active.

Code: Select all

send Empty Frame:
--> [0xF1, 0x00, 0xF2]
response is "Ready state":
<-- [0xF1, 0x01, 0x01, 0xF2]  or  [0xF1, 0x81, 0x81, 0xF2]

(start any workout via the PM5 screen, row some)

send Empty Frame:
--> [0xF1, 0x00, 0xF2]
response is "Ready state", which is invalid:
<-- [0xF1, 0x01, 0x01, 0xF2]  or  [0xF1, 0x81, 0x81, 0xF2]

should have received In Use status:
[0xF1, 0x05, 0x05, 0xF2]  or  [0xF1, 0x85, 0x85, 0xF2]
The biggest issue this presents is using the Bluetooth master device to get a PM5 that is In Use to enter the Finished state:

Code: Select all

(start any workout, row some)

send CSAFE_GOFINISHED_CMD:
--> [0xF1, 0x86, 0x86, 0xF2]
response is "the last command was ignored as it was not applicable to the current state, which is Ready":
<-- [0xF1, 0x11, 0x11, 0xF2]  or  [0xF1, 0x91, 0x91, 0xF2]
It is possible to send a combined command to go to In Use state + go to Finished state, which will cause the active workout to end:

Code: Select all

(start any workout, row some)

send CSAFE_GOINUSE_CMD + CSAFE_GOFINISHED_CMD:
--> [0xF1, 0x85, 0x86, 0x03, 0xF2]
response "current state is Finished":
<-- [0xF1, 0x07, 0x07, 0xF2]  or  [0xF1, 0x87, 0x87, 0xF2]

(active workout ends)
But that leads to further cascading issues.

Overall, this issue makes app development relying on Bluetooth connections to the PM5 effectively useless for any functionality that attempts to control the rower.

User avatar
Citroen
SpamTeam
Posts: 8010
Joined: March 16th, 2006, 3:28 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: CSAFE over Bluetooth is broken (PM5 firmware 19)

Post by Citroen » July 8th, 2015, 6:39 am

You should write up your problem with a detailed test case and email it to rowing@concept2.com

Post Reply