[chirp_devel] [PATCH] [ic2730] Support frequencies requiring a tuning step of 6.25 kHz. Fixes #6457
Rhett Robinson
Mon Feb 18 16:11:50 PST 2019
# HG changeset patch
# User Rhett Robinson <rrhett at gmail.com>
# Date 1550534826 28800
# Mon Feb 18 16:07:06 2019 -0800
# Node ID 90b4b9e47859a9623d4861f7f1021ba40d870eb2
# Parent b4e8134947c6447fb464d9de662dfc729affde9f
[ic2730] Support frequencies requiring a tuning step of 6.25 kHz. Fixes #6457
This radio stores some flags indicating the tuning step of the frequency, and the
frequency as a multiple of the tuning step. This patch adds support for a
frequency that is a multiple of 6.25 kHz for both the frequency and offset.
Still missing is support for a multiple of 25/3 kHz.
diff -r b4e8134947c6 -r 90b4b9e47859 chirp/drivers/ic2730.py
--- a/chirp/drivers/ic2730.py Sun Feb 17 20:30:59 2019 -0800
+++ b/chirp/drivers/ic2730.py Mon Feb 18 16:07:06 2019 -0800
@@ -25,11 +25,12 @@
# - weather channel alert
MEM_FORMAT = """
struct {
- u24 freq;
+ u24 freq_flags:6
+ freq:18;
u16 offset;
u8 tune_step:4,
- unknown5:3,
- mode:1;
+ unknown5:2,
+ mode:2;
u8 unknown6:2,
rtone:6;
u8 unknown7:2,
@@ -86,7 +87,7 @@
TMODES = ["", "Tone", "??0", "TSQL", "??1", "DTCS", "TSQL-R", "DTCS-R",
"DTC.OFF", "TON.DTC", "DTC.TSQ", "TON.TSQ"]
DUPLEX = ["", "-", "+"]
-MODES = ["FM", "NFM"]
+MODES = ["FM", "NFM", "AM", "NAM"]
DTCSP = ["NN", "NR", "RN", "RR"]
AUTOREPEATER = ["OFF", "DUP", "DUP.TON"]
@@ -209,9 +210,19 @@
mem.empty = True
return mem
- # Frequencies are stored as kHz/5
- mem.freq = int(_mem.freq) * 5000
- mem.offset = int(_mem.offset) * 5000
+ # _mem.freq is stored as a multiple of a tuning step
+ frequency_flags = int(_mem.freq_flags)
+ frequency_multiplier = 5000
+ offset_multiplier = 5000
+ if frequency_flags & 0x08:
+ frequency_multiplier = 6250
+ if frequency_flags & 0x01:
+ offset_multiplier = 6250
+ # flag of 0x10 is related to tuning step of 25./3, but it is not exact,
+ # so skip this for now
+
+ mem.freq = int(_mem.freq) * frequency_multiplier
+ mem.offset = int(_mem.offset) * offset_multiplier
mem.rtone = chirp_common.TONES[_mem.rtone]
mem.ctone = chirp_common.TONES[_mem.ctone]
mem.tmode = TMODES[_mem.tmode]
@@ -257,8 +268,18 @@
if was_empty:
_wipe_memory(_mem, "\x00")
- _mem.freq = mem.freq / 5000
- _mem.offset = mem.offset / 5000
+ frequency_flags = 0x00
+ frequency_multiplier = 5000
+ offset_multiplier = 5000
+ if mem.freq % 5000 != 0 and mem.freq % 6250 == 0:
+ frequency_flags |= 0x08
+ frequency_multiplier = 6250
+ if mem.offset % 5000 != 0 and mem.offset % 6250 == 0:
+ frequency_flags |= 0x01
+ offset_multiplier = 6250
+ _mem.freq = mem.freq / frequency_multiplier
+ _mem.offset = mem.offset / offset_multiplier
+ _mem.freq_flags = frequency_flags
_mem.rtone = chirp_common.TONES.index(mem.rtone)
_mem.ctone = chirp_common.TONES.index(mem.ctone)
_mem.tmode = TMODES.index(mem.tmode)
More information about the chirp_devel
mailing list