Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
Ensure checksum is 2 digits (#143)
Browse files Browse the repository at this point in the history
Fix bug where some L76 messages are ignored due to the checksum being one digit long (i.e. 'F') vs. the expected 2 digit length ('0F')
  • Loading branch information
Lukanite authored Apr 12, 2021
1 parent 29c580d commit f4845e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shields/lib/L76GNSS.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def _checksum(self, nmeadata):
calc_cksum = 0
for s in nmeadata:
calc_cksum ^= ord(s)
return('{:X}'.format(calc_cksum))
return('{:02X}'.format(calc_cksum))

def write(self, data):
self.i2c.writeto(GPS_I2CADDR, '${}*{}\r\n'.format(data, self._checksum(data)) )

0 comments on commit f4845e6

Please sign in to comment.