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

Checksum should not be calculated with STX #1

Closed
jkirk opened this issue May 13, 2023 · 0 comments · Fixed by #2
Closed

Checksum should not be calculated with STX #1

jkirk opened this issue May 13, 2023 · 0 comments · Fixed by #2
Assignees
Labels
bug Something isn't working

Comments

@jkirk
Copy link
Owner

jkirk commented May 13, 2023

We agreed to calculate the checksum using only the Gauge Code and Gauge Value (and
without STX (0x02)). Currently c172hc-fsmaster still uses STX to calculate the
checksum. I believe this is the code in question:

for (int i = 0; i < numReceived - 2; i++)
{
sum += receivedBytes[i]; // add all bytes in Array
}

The sum should start with i = 1. I can provide a PR.

@jkirk jkirk self-assigned this May 13, 2023
@jkirk jkirk added the bug Something isn't working label May 13, 2023
jkirk added a commit that referenced this issue May 13, 2023
We have agreed to calculate the checksum using only the Gauge Code and
Gauge Value which basically means that the first byte should be omitted
when calculating the sum.

The checksum is then the 2's complement of the sum of bytes.

Closes: #1
jkirk added a commit that referenced this issue May 13, 2023
We have agreed to calculate the checksum using only the Gauge Code and
Gauge Value which basically means that the first byte should be omitted
when calculating the sum.

The checksum is then the 2's complement of the sum of bytes.

Closes: #1
SimPilot47 pushed a commit that referenced this issue May 14, 2023
We have agreed to calculate the checksum using only the Gauge Code and
Gauge Value which basically means that the first byte should be omitted
when calculating the sum.

The checksum is then the 2's complement of the sum of bytes.

Also updated the version string.

Closes: #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant