[chirp_devel] [ft2900] Fix checksum calc for Euro version of FT-2900/FT-1900 (#2501)

Richard Cochran
Mon Apr 27 20:49:20 PDT 2015


# HG changeset patch
# User Richard Cochran <ag6qr at sonic.net>
# Date 1430192545 25200
#      Mon Apr 27 20:42:25 2015 -0700
# Node ID cb249df8d5744091c373d0a887ac3b148f1e65a1
# Parent  673eef6f99ad71ba4efc1a3a067068d91210b2d4
[ft2900] Fix checksum calc for Euro version of FT-2900/FT-1900 (#2501)
This patch fixes the checksum calculation for the European versions
of the FT-2900/FT-1900 radio.  The US and Euro versions have different
IDBLOCK strings.  It turns out that the radio's checksum algorithm
includes the IDBLOCK data as it calculates the checksum, but the
original CHIRP ft2900 driver code hadn't taken this into account.
The differences in the IDBLOCK strings were causing checksum
mismatch.

diff -r 673eef6f99ad -r cb249df8d574 chirp/drivers/ft2900.py
--- a/chirp/drivers/ft2900.py	Tue Apr 07 21:20:31 2015 -0700
+++ b/chirp/drivers/ft2900.py	Mon Apr 27 20:42:25 2015 -0700
@@ -35,7 +35,7 @@
     LOG.debug("got echo\n%s\n" % util.hexprint(echo))
 
 ACK = "\x06"
-INITIAL_CHECKSUM = 73
+INITIAL_CHECKSUM = 0
 
 
 def _download(radio):
@@ -100,9 +100,12 @@
 
     # compute checksum
     cs = INITIAL_CHECKSUM
+    for byte in radio.IDBLOCK:
+        cs += ord(byte)
     for byte in data:
         cs += ord(byte)
     LOG.debug("calculated checksum is %x\n" % (cs & 0xff))
+    LOG.debug("Radio sent checksum is %x\n" % ord(chunk[0]))
 
     if (cs & 0xff) != ord(chunk[0]):
         raise Exception("Failed checksum on read.")
@@ -133,6 +136,8 @@
 
     block = 0
     cs = INITIAL_CHECKSUM
+    for byte in radio.IDBLOCK:
+        cs += ord(byte)
 
     while block < (radio.get_memsize() / 32):
         data = radio.get_mmap()[block*32:(block+1)*32]




More information about the chirp_devel mailing list