-
Notifications
You must be signed in to change notification settings - Fork 40
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
Detect Keiser bike version and set stats timeout accordingly. #63
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ptx2 This should be ready for merging
const major = data.readUInt8(KEISER_VALUE_IDX_VER_MAJOR); | ||
const minor = data.readUInt8(KEISER_VALUE_IDX_VER_MINOR); | ||
version = major.toString(16) + "." + minor.toString(16); | ||
if ((major === 6) && (minor >= parseInt(KEISER_STATS_NEWVER_MINOR, 16))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want FW 7.00+ to use the shorter timeout too -- it looks like it will go back to the longer timeout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should only be a version 6.xx based on the Keiser Dev documentation. Some of their examples completely ignore any data packages that don't have a Major of 0x06.
Therefore just in case we ever encounter something like that, we treat it as unknown and play it safe with the 7 sec timeout. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems reasonable to me :-)
Nice one! |
anything needing testing @chriselsen @ptx2 ? |
Sure. More testing is always a good idea. Although here the hope is that you won't notice a functional difference. As this has been merged into 'main' now, you can try this via: To try this out: Start with current Gymnasticon Pi image
When your Keiser bike is detected, it should show the bike's version ID as well as the internally used stats timeout. Other than that, you should not see any changes. |
worked fine! |
Keiser changed the broadcast interval in firmware revision 6.30 from ~ 2 seconds to ~ 0.3 seconds. As a result bikes before version 6.30 (old) need to use a higher stats timeout value of 7 seconds to detect a communication failure, while bikes starting with version 6.30 (new) can use a lower stats timeout value of 1 second.
This change determines the bikes firmware version on first discovery and sets the stats timeout value accordingly.
For unknown firmware versions (e.g. 5.12, which doesn't exist) a "safe" stats timeout value of 7 seconds is considered.