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

DMR GPS Location Parsing Error #1661

Closed
DSheirer opened this issue Oct 4, 2023 · 0 comments · Fixed by #1662
Closed

DMR GPS Location Parsing Error #1661

DSheirer opened this issue Oct 4, 2023 · 0 comments · Fixed by #1662
Labels

Comments

@DSheirer
Copy link
Owner

DSheirer commented Oct 4, 2023

sdrtrunk Version
master.

Describe the bug
The GPS latitude and longitude values are parsed incorrectly. The ICD indicates the value is stored in two's complement presentation and the BinaryMessage.getTwosComplement() method is not calculating the value correctly. It should be:

    public int getTwosComplement(int start, int end)
    {
        if(get(start))
        {
            //Negative value - flip and add one
            BinaryMessage sub = getSubMessage(start, end);
            sub.flip(0, sub.size());
            return sub.getInt(1, sub.size()) + 1;
        }
        else
        {
            //Positive value - return the contents.
            return getInt(start + 1, end);
        }
    }

@DSheirer DSheirer added the bug label Oct 4, 2023
DSheirer pushed a commit that referenced this issue Oct 5, 2023
DSheirer added a commit that referenced this issue Oct 5, 2023
…error

#1661 DMR Talker GPS Lat/Long Values Incorrect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant