[chirp_devel] [PATCH] [ft2900] Fix issues entering channels via UI #2385
Richard Cochran
Tue Mar 10 21:20:16 PDT 2015
# HG changeset patch
# User Richard Cochran <ag6qr at sonic.net>
# Date 1426047156 25200
# Tue Mar 10 21:12:36 2015 -0700
# Node ID c3fc5e82afa38f5958c18c8ccb44f2e3bd318933
# Parent 4fe527771a5b2ca49bbf1ecb2915e4f58990084a
[ft2900] Fix issues entering channels via UI #2385
This patch fixes problems when entering memories to the FT-2900
via the CHIRP UI. The set_memory function was leaving "unknown"
areas of the memory unset, which caused intermittent problems,
depending on what had been in those fields before. Fix is to
initialize all unknown fields to 0, mimicing what the radio would
do if creating new channel via the radio's front panel. Also,
we re-order the power levels to make the default "Hi", again
to mimic the radio's front panel behavior.
diff -r 4fe527771a5b -r c3fc5e82afa3 chirp/drivers/ft2900.py
--- a/chirp/drivers/ft2900.py Mon Mar 09 21:03:29 2015 +0100
+++ b/chirp/drivers/ft2900.py Tue Mar 10 21:12:36 2015 -0700
@@ -218,10 +218,10 @@
MODES = ["FM", "NFM"]
TMODES = ["", "Tone", "TSQL", "DTCS", "TSQL-R"]
DUPLEX = ["", "-", "+", ""]
-POWER_LEVELS = [chirp_common.PowerLevel("Low1", watts=5),
+POWER_LEVELS = [chirp_common.PowerLevel("Hi", watts=75),
+ chirp_common.PowerLevel("Low3", watts=30),
chirp_common.PowerLevel("Low2", watts=10),
- chirp_common.PowerLevel("Low3", watts=30),
- chirp_common.PowerLevel("Hi", watts=75),
+ chirp_common.PowerLevel("Low1", watts=5),
]
CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ +-/?C[] _"
@@ -242,8 +242,8 @@
def _encode_name(mem):
- if(mem == " " or mem == ""):
- return [0x7f, 0xff, 0xff, 0xff, 0xff, 0xff]
+ if(mem.strip() == ""):
+ return [0xff]*6
name = [None]*6
for i in range(0, 6):
@@ -356,7 +356,7 @@
mem.mode = _mem.isnarrow and "NFM" or "FM"
mem.skip = pskip and "P" or skip and "S" or ""
- mem.power = POWER_LEVELS[_mem.power]
+ mem.power = POWER_LEVELS[3 - _mem.power]
return mem
@@ -396,12 +396,21 @@
_flag["%s_pskip" % nibble] = mem.skip == "P"
_flag["%s_skip" % nibble] = mem.skip == "S"
if mem.power:
- _mem.power = POWER_LEVELS.index(mem.power)
+ _mem.power = 3 - POWER_LEVELS.index(mem.power)
else:
_mem.power = 3
_mem.name = _encode_name(mem.name)
+ # set all unknown areas of the memory map to 0
+ _mem.unknown0 = 0
+ _mem.unknown1 = 0
+ _mem.unknown2 = 0
+ _mem.unknown3 = 0
+ _mem.unknown4 = 0
+ _mem.unknown5 = 0
+ _mem.unknown6 = 0
+
LOG.debug("encoded mem\n%s\n" % (util.hexprint(_mem.get_raw()[0:20])))
@classmethod
More information about the chirp_devel
mailing list