Skip to content
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

Issue with checksum calculation #15

Open
jonsinfinity1 opened this issue Jul 14, 2020 · 1 comment
Open

Issue with checksum calculation #15

jonsinfinity1 opened this issue Jul 14, 2020 · 1 comment

Comments

@jonsinfinity1
Copy link

Using TFMini v1.8 device the frame size is 7. The code that calculates the checksum adds all positions that are less than frame size - 2. I found that the checksum was always 9 greater than the calculation. Position 5 is always 9 but not included in the calculation.

This caused the following error:
TF Mini error: too many measurement attempts
Last error:
ERROR_SERIAL_BADCHECKSUM
65535 cm sigstr: 65535

After changing the calculation to include position 5 like so:
if (i < TFMINI_FRAME_SIZE-1) { checksum += frame[i]; }

instead of:
if (i < TFMINI_FRAME_SIZE-2) { checksum += frame[i]; }

Things are now working.

I'm not sure what the frame size is of other TF Devices. Are they different? Maybe older versions have a frame size of 8? Anyway, just wanted to report what I found.

@PeterAJansen
Copy link
Contributor

Hmmm, that's very interesting. It's certainly possible that they've changed the protocol slightly in the latest revisions of their devices.

Would you like to submit a pull request that:

  1. Adds a version parameter passed to the class constructor, and some defines (e.g. VER_1_0, VER_1_8) for the version
  2. Performs the checksum calculation based on the version
  3. Includes the parameter in the example?

delassiter pushed a commit to delassiter/tfmini that referenced this issue Nov 30, 2022
…ctor to allow for TFMini V1.8

Signed-off-by: Dennis Lassiter <dennis@lassiter.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants