Very Long Configuration CSAFE Commands

Post questions and issues with Concept2 PM3 SDK
Post Reply
tussocky
Paddler
Posts: 6
Joined: December 4th, 2021, 5:14 am

Very Long Configuration CSAFE Commands

Post by tussocky » March 9th, 2022, 5:12 am

I have an app for the C2 that is in a very late state of development. My CSAFE over BT stack works flawlessly in configuring workouts with one exception- utilizing the C2 proprietary wrapper to configure variable interval workouts. Whenever the frame size goes over 120 bytes (I'm aware that is the limit), which is very easy to do considering the number of bytes each interval takes in the frame, the command fails.

I know that other apps have overcome this limitation because most of the time they exclusively use the variable interval framework for all types of intervals, in some cases up to 50. I'm assuming they do this by stringing together the configuration command over multiple frames. Whenever I try this I cannot get it to work and there is nothing in the C2 BT definition documentation saying how it should be done. Any ideas how to structure these frames?

serhii.h.serhii
Paddler
Posts: 4
Joined: August 14th, 2024, 7:44 am

Re: Very Long Configuration CSAFE Commands

Post by serhii.h.serhii » August 21st, 2024, 5:05 am

Hi tussocky,

I've faced a similar challenge when working with the Concept2 PM5 and CSAFE over Bluetooth, particularly when trying to configure variable interval workouts that exceed the 120-byte limit. After some trial and error, I found a solution that might help you.

Solution Overview:

When configuring a workout with multiple intervals that exceeds 120 bytes, you need to split the configuration command into multiple frames (or chunks). Each chunk should be structured as a complete CSAFE command, including the checksum and C2 proprietary wrapper. The key is to treat each interval as a separate command chunk, and then send these chunks sequentially. Only the final chunk includes the screen state configuration to finalize the setup.

Example of Chunked Command Structure:

Code: Select all

// Chunk 1 (Interval 1)
[241, 118, 29, 24, 1, 0, 1, 1, 8, 23, 1, 4, 3, 5, 128, 0, 0, 0, 100, 4, 2, 0, 0, 6, 4, 0, 0, 39, 16, 20, 1, 1, 173, 242]

// Chunk 2 (Interval 2)
[241, 118, 26, 24, 1, 1, 23, 1, 4, 3, 5, 128, 0, 0, 0, 100, 4, 2, 0, 0, 6, 4, 0, 0, 39, 16, 20, 1, 1, 163, 242]

// Chunk 3 (Interval 3)
[241, 118, 26, 24, 1, 2, 23, 1, 4, 3, 5, 128, 0, 0, 0, 100, 4, 2, 0, 0, 6, 4, 0, 0, 39, 16, 20, 1, 1, 160, 242]

// Chunk 4 (Interval 4)
[241, 118, 26, 24, 1, 3, 23, 1, 4, 3, 5, 128, 0, 0, 0, 100, 4, 2, 0, 0, 6, 4, 0, 0, 39, 16, 20, 1, 1, 161, 242]

// Chunk 5 (Interval 5)
[241, 118, 26, 24, 1, 4, 23, 1, 4, 3, 5, 128, 0, 0, 0, 100, 4, 2, 0, 0, 6, 4, 0, 0, 39, 16, 20, 1, 1, 166, 242]

// Chunk 6 (Interval 6 + Screen State Configuration)
[241, 118, 40, 24, 1, 5, 23, 1, 4, 3, 5, 128, 0, 0, 0, 100, 4, 2, 0, 0, 6, 4, 0, 0, 39, 16, 20, 1, 1, 1, 1, 9, 5, 5, 128, 0, 0, 0, 0, 19, 2, 1, 1, 13, 242]

Key Points:
  • Checksum: Each chunk must include a correct checksum before the stop flag (242).
  • C2 Proprietary Wrapper: Ensure that the C2 proprietary wrapper (76) and the Wrapper command byte count are recalculated and correct for each chunk.
  • Final Chunk: The final chunk includes any necessary commands to finalize the workout, such as screen state configuration.
    This approach allows you to send large configurations without exceeding the byte limit, ensuring that each interval is properly configured and the workout is completed as expected
Best of luck with your app development!

Post Reply