summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--PKG-INFO2
-rw-r--r--chirp.egg-info/PKG-INFO2
-rw-r--r--chirp.egg-info/SOURCES.txt1
-rw-r--r--chirp/__init__.py2
-rw-r--r--chirp/chirp_common.py4
-rw-r--r--chirp/drivers/__init__.py4
-rw-r--r--chirp/drivers/ft8100.py79
-rw-r--r--chirp/drivers/tdh8.py7
-rw-r--r--chirp/drivers/uv5r.py389
-rw-r--r--setup.py2
-rw-r--r--tests/Python3_Driver_Testing.md4
-rw-r--r--tests/images/Yaesu_FT-8100.imgbin0 -> 3201 bytes
-rw-r--r--tests/py3_driver_testers.txt1
-rwxr-xr-xtools/check_commit.sh5
14 files changed, 251 insertions, 251 deletions
diff --git a/PKG-INFO b/PKG-INFO
index 693752e..29943d4 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: chirp
-Version: 20231016
+Version: 20231027
Summary: A cross-platform cross-radio programming tool
Home-page: https://chirp.danplanet.com
Requires-Python: >=3.7,<4
diff --git a/chirp.egg-info/PKG-INFO b/chirp.egg-info/PKG-INFO
index 693752e..29943d4 100644
--- a/chirp.egg-info/PKG-INFO
+++ b/chirp.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: chirp
-Version: 20231016
+Version: 20231027
Summary: A cross-platform cross-radio programming tool
Home-page: https://chirp.danplanet.com
Requires-Python: >=3.7,<4
diff --git a/chirp.egg-info/SOURCES.txt b/chirp.egg-info/SOURCES.txt
index acf2745..e476990 100644
--- a/chirp.egg-info/SOURCES.txt
+++ b/chirp.egg-info/SOURCES.txt
@@ -528,6 +528,7 @@ tests/images/Yaesu_FT-65R.img
tests/images/Yaesu_FT-70D.img
tests/images/Yaesu_FT-7100M.img
tests/images/Yaesu_FT-7800_7900.img
+tests/images/Yaesu_FT-8100.img
tests/images/Yaesu_FT-817.img
tests/images/Yaesu_FT-817ND.img
tests/images/Yaesu_FT-817ND_US.img
diff --git a/chirp/__init__.py b/chirp/__init__.py
index b60d59b..47569c8 100644
--- a/chirp/__init__.py
+++ b/chirp/__init__.py
@@ -1 +1 @@
-CHIRP_VERSION = "next-20231016"
+CHIRP_VERSION = "next-20231027"
diff --git a/chirp/chirp_common.py b/chirp/chirp_common.py
index 3b81cc2..12bd1b7 100644
--- a/chirp/chirp_common.py
+++ b/chirp/chirp_common.py
@@ -85,6 +85,10 @@ CROSS_MODES = (
"Tone->"
)
+# This is the "master" list of modes, and in general things should not be
+# added here without significant consideration. These must remain stable and
+# universal to allow importing memories between different radio vendors and
+# models.
MODES = ("WFM", "FM", "NFM", "AM", "NAM", "DV", "USB", "LSB", "CW", "RTTY",
"DIG", "PKT", "NCW", "NCWR", "CWR", "P25", "Auto", "RTTYR",
"FSK", "FSKR", "DMR", "DN")
diff --git a/chirp/drivers/__init__.py b/chirp/drivers/__init__.py
index ff7562b..846e04e 100644
--- a/chirp/drivers/__init__.py
+++ b/chirp/drivers/__init__.py
@@ -157,7 +157,7 @@ from chirp.drivers import wouxun_common
from chirp.drivers import yaesu_clone
from chirp.drivers import iradio_uv_5118plus
from chirp.drivers import kenwood_d7
-from chirp.drivers import tdh8
from chirp.drivers import mml_jc8810
from chirp.drivers import uvk5
-__all__ = ['__init__', 'bj9900', 'anytone', 'anytone778uv', 'anytone_ht', 'anytone_iii', 'ap510', 'baofeng_common', 'baofeng_uv3r', 'baofeng_wp970i', 'bjuv55', 'boblov_x3plus', 'btech', 'fake', 'fd268', 'ft1500m', 'ft1802', 'ft1d', 'ft2900', 'ft2d', 'ft4', 'ft2800', 'ft450d', 'ft50', 'ft60', 'ft70', 'ft7100', 'ft7800', 'ft8100', 'ft817', 'ft818', 'ft857', 'ft90', 'ftlx011', 'ftm3200d', 'ftm350', 'ftm7250d', 'ga510', 'generic_csv', 'generic_tpe', 'gmrsuv1', 'gmrsv2', 'h777', 'hf90', 'bf_t1', 'ic208', 'hg_uv98', 'hobbypcb', 'ic2300', 'ic2100', 'ic2200', 'ic2720', 'ic2730', 'ic9x_icf', 'ic2820', 'ic9x', 'ic9x_ll', 'ic9x_icf_ll', 'icf', 'icomciv', 'icp7', 'ict8', 'icq7', 'ict70', 'ict7h', 'icv80', 'id31', 'icv86', 'icw32', 'icx8x', 'icx90', 'id5100', 'id51', 'id51plus', 'id880', 'id800', 'idrp', 'kg935g', 'iradio_uv_5118', 'kenwood_hmk', 'kenwood_itm', 'kenwood_live', 'kguv8d', 'kguv980p', 'kguv8dplus', 'kguv8e', 'kguv920pa', 'kguv9dplus', 'leixen', 'kyd', 'kyd_IP620', 'lt725uv', 'mursv1', 'alinco', 'puxing', 'puxing_px888k', 'radioddity_r2', 'radtel_t18', 'retevis_rb15', 'retevis_rb17p', 'retevis_rb28', 'retevis_rt1', 'retevis_rt21', 'retevis_rt22', 'retevis_rt23', 'retevis_rt26', 'retevis_rt76p', 'retevis_rt87', 'retevis_rt98', 'bf_t8', 'rh5r_v2', 'tdxone_tdq8a', 'template', 'tg_uv2p', 'th350', 'th7800', 'th9000', 'th9800', 'th_uv3r', 'th_uv3r25', 'th_uv8000', 'th_uv88', 'th_uvf8d', 'thd72', 'thd74', 'thuv1f', 'tk270', 'tk3140', 'tk760', 'tk760g', 'tk8102', 'tk8160', 'tk8180', 'tmd710', 'tmv71', 'tmv71_ll', 'ts2000', 'ts480', 'ts590', 'ts850', 'uv5r', 'uv5x3', 'uv6r', 'uvb5', 'vgc', 'vx170', 'vx2', 'vx3', 'vx5', 'vx510', 'vx6', 'vx7', 'vx8', 'vxa700', 'wouxun', 'wouxun_common', 'yaesu_clone', 'iradio_uv_5118plus', 'kenwood_d7', 'tdh8', 'mml_jc8810', 'uvk5']
+from chirp.drivers import tdh8
+__all__ = ['__init__', 'bj9900', 'anytone', 'anytone778uv', 'anytone_ht', 'anytone_iii', 'ap510', 'baofeng_common', 'baofeng_uv3r', 'baofeng_wp970i', 'bjuv55', 'boblov_x3plus', 'btech', 'fake', 'fd268', 'ft1500m', 'ft1802', 'ft1d', 'ft2900', 'ft2d', 'ft4', 'ft2800', 'ft450d', 'ft50', 'ft60', 'ft70', 'ft7100', 'ft7800', 'ft8100', 'ft817', 'ft818', 'ft857', 'ft90', 'ftlx011', 'ftm3200d', 'ftm350', 'ftm7250d', 'ga510', 'generic_csv', 'generic_tpe', 'gmrsuv1', 'gmrsv2', 'h777', 'hf90', 'bf_t1', 'ic208', 'hg_uv98', 'hobbypcb', 'ic2300', 'ic2100', 'ic2200', 'ic2720', 'ic2730', 'ic9x_icf', 'ic2820', 'ic9x', 'ic9x_ll', 'ic9x_icf_ll', 'icf', 'icomciv', 'icp7', 'ict8', 'icq7', 'ict70', 'ict7h', 'icv80', 'id31', 'icv86', 'icw32', 'icx8x', 'icx90', 'id5100', 'id51', 'id51plus', 'id880', 'id800', 'idrp', 'kg935g', 'iradio_uv_5118', 'kenwood_hmk', 'kenwood_itm', 'kenwood_live', 'kguv8d', 'kguv980p', 'kguv8dplus', 'kguv8e', 'kguv920pa', 'kguv9dplus', 'leixen', 'kyd', 'kyd_IP620', 'lt725uv', 'mursv1', 'alinco', 'puxing', 'puxing_px888k', 'radioddity_r2', 'radtel_t18', 'retevis_rb15', 'retevis_rb17p', 'retevis_rb28', 'retevis_rt1', 'retevis_rt21', 'retevis_rt22', 'retevis_rt23', 'retevis_rt26', 'retevis_rt76p', 'retevis_rt87', 'retevis_rt98', 'bf_t8', 'rh5r_v2', 'tdxone_tdq8a', 'template', 'tg_uv2p', 'th350', 'th7800', 'th9000', 'th9800', 'th_uv3r', 'th_uv3r25', 'th_uv8000', 'th_uv88', 'th_uvf8d', 'thd72', 'thd74', 'thuv1f', 'tk270', 'tk3140', 'tk760', 'tk760g', 'tk8102', 'tk8160', 'tk8180', 'tmd710', 'tmv71', 'tmv71_ll', 'ts2000', 'ts480', 'ts590', 'ts850', 'uv5r', 'uv5x3', 'uv6r', 'uvb5', 'vgc', 'vx170', 'vx2', 'vx3', 'vx5', 'vx510', 'vx6', 'vx7', 'vx8', 'vxa700', 'wouxun', 'wouxun_common', 'yaesu_clone', 'iradio_uv_5118plus', 'kenwood_d7', 'mml_jc8810', 'uvk5', 'tdh8']
diff --git a/chirp/drivers/ft8100.py b/chirp/drivers/ft8100.py
index 757c3d4..ad5f4a1 100644
--- a/chirp/drivers/ft8100.py
+++ b/chirp/drivers/ft8100.py
@@ -13,33 +13,27 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import logging
import time
-import os
from chirp import chirp_common, directory, bitwise, errors
from chirp.drivers import yaesu_clone
-TONES = chirp_common.OLD_TONES
+LOG = logging.getLogger(__name__)
+TONES = chirp_common.OLD_TONES
TMODES = ["", "Tone"]
-
MODES = ['FM', 'AM']
-
STEPS = [5.0, 10.0, 12.5, 15.0, 20.0, 25.0, 50.0]
-
DUPLEX = ["", "-", "+", "split"]
-
# "M" for masked memories, which are invisible until un-masked
SKIPS = ["", "S", "M"]
-
POWER_LEVELS_VHF = [chirp_common.PowerLevel("Low", watts=5),
chirp_common.PowerLevel("Mid", watts=20),
chirp_common.PowerLevel("High", watts=50)]
-
POWER_LEVELS_UHF = [chirp_common.PowerLevel("Low", watts=5),
chirp_common.PowerLevel("Mid", watts=20),
chirp_common.PowerLevel("High", watts=35)]
-
SPECIALS = {'1L': -1,
'1U': -2,
'2L': -3,
@@ -96,7 +90,7 @@ class FT8100Radio(yaesu_clone.YaesuCloneModeRadio):
@classmethod
def match_model(cls, data, path):
if (len(data) == cls._memsize and
- data[1:10] == '\x01\x01\x07\x08\x02\x01\x01\x00\x01'):
+ data[1:10] == b'\x01\x01\x07\x08\x02\x01\x01\x00\x01'):
return True
return False
@@ -110,6 +104,7 @@ class FT8100Radio(yaesu_clone.YaesuCloneModeRadio):
rf.has_bank = False
rf.has_name = False
+ rf.valid_tones = list(TONES)
rf.valid_modes = list(MODES)
rf.valid_tmodes = list(TMODES)
rf.valid_duplexes = list(DUPLEX)
@@ -117,24 +112,33 @@ class FT8100Radio(yaesu_clone.YaesuCloneModeRadio):
rf.has_sub_devices = self.VARIANT == ''
rf.valid_tuning_steps = list(STEPS)
+ # This is not implemented properly, so don't expose it
+ rf.valid_tuning_steps.remove(12.5)
- rf.valid_bands = [(110000000, 550000000),
- (750000000, 1300000000)]
-
- rf.valid_skips = SKIPS
+ # This driver doesn't properly support the upper bound of 1300MHz
+ # so limit us to 999MHz
+ if self.VARIANT == 'VHF':
+ rf.valid_bands = [(110000000, 280000000)]
+ else:
+ rf.valid_bands = [(280000000, 550000000),
+ (750000000, 999000000)]
- rf.can_odd_split = True
+ # This is not actually implemented, so don't expose it
+ # rf.valid_skips = SKIPS
+ rf.valid_skips = []
# TODO
# rf.valid_special_chans = SPECIALS.keys()
-
# TODO
# rf.has_tuning_step = False
+
+ rf.can_odd_split = True
+
return rf
def sync_in(self):
super(FT8100Radio, self).sync_in()
- self.pipe.write(chr(yaesu_clone.CMD_ACK))
+ self.pipe.write(bytes([yaesu_clone.CMD_ACK]))
self.pipe.read(1)
def sync_out(self):
@@ -147,8 +151,7 @@ class FT8100Radio(yaesu_clone.YaesuCloneModeRadio):
mem_format = MEM_FORMAT.format(memories=self._memstart,
skips=self._skipstart,
- enables=self._enablestart
- )
+ enables=self._enablestart)
self._memobj = bitwise.parse(mem_format, self._mmap)
@@ -172,15 +175,9 @@ class FT8100Radio(yaesu_clone.YaesuCloneModeRadio):
mem.tmode = TMODES[_mem.tone_enable]
mem.mode = MODES[_mem.am]
mem.duplex = DUPLEX[_mem.duplex]
+ mem.offset = int(_mem.offset) * 1000
- if _mem.duplex == DUPLEX.index("split"):
- tx_freq = int(_mem.offset) * 1000
- print(self.VARIANT, number, tx_freq, mem.freq)
- mem.offset = tx_freq - mem.freq
- else:
- mem.offset = int(_mem.offset) * 1000
-
- if int(mem.freq / 100) == 4:
+ if mem.freq // 100 == 4:
mem.power = POWER_LEVELS_UHF[_mem.power]
else:
mem.power = POWER_LEVELS_VHF[_mem.power]
@@ -188,8 +185,8 @@ class FT8100Radio(yaesu_clone.YaesuCloneModeRadio):
# M01 can't be disabled
if not self._memobj.enables[byte] & bit and number != 1:
mem.empty = True
-
- print('R', self.VARIANT, number, _mem.baud9600)
+ elif number == 1:
+ mem.immutable = ['empty']
return mem
@@ -201,18 +198,12 @@ class FT8100Radio(yaesu_clone.YaesuCloneModeRadio):
_mem = self._memobj.memory[mem.number - 1]
- _mem.freq = int(mem.freq / 1000)
+ _mem.freq = mem.freq // 1000
_mem.tone = TONES.index(mem.rtone)
_mem.tone_enable = TMODES.index(mem.tmode)
_mem.am = MODES.index(mem.mode)
_mem.duplex = DUPLEX.index(mem.duplex)
-
- if mem.duplex == "split":
- tx_freq = mem.freq + mem.offset
- _mem.split_high = tx_freq / 10000000
- _mem.offset = (tx_freq % 10000000) / 1000
- else:
- _mem.offset = int(mem.offset / 1000)
+ _mem.offset = mem.offset // 1000
if mem.power:
_mem.power = POWER_LEVELS_VHF.index(mem.power)
@@ -226,7 +217,6 @@ class FT8100Radio(yaesu_clone.YaesuCloneModeRadio):
# TODO expose these options
_mem.baud9600 = 0
- _mem.am = 0
# These need to be cleared, otherwise strange things happen
_mem.unknown4 = 0
@@ -243,10 +233,10 @@ class FT8100Radio(yaesu_clone.YaesuCloneModeRadio):
def _bit_byte(self, number):
if self.VARIANT == 'VHF':
bit = 1 << ((number - 1) % 8)
- byte = (number - 1) / 8
+ byte = (number - 1) // 8
else:
bit = 1 << ((number - 2) % 8)
- byte = (number - 2) / 8
+ byte = (number - 2) // 8
return bit, byte
@@ -290,18 +280,17 @@ def __clone_out(radio):
pos = 0
for block in radio._block_lengths:
- if os.getenv("CHIRP_DEBUG"):
- print("\nSending %i-%i" % (pos, pos + block))
+ LOG.debug("\nSending %i-%i" % (pos, pos + block))
out = radio.get_mmap()[pos:pos + block]
# need to chew byte-by-byte here or else we lose the ACK...not sure why
for b in out:
- pipe.write(b)
+ pipe.write(bytes([b]))
pipe.read(1) # chew the echo
ack = pipe.read(1)
- if ack != chr(yaesu_clone.CMD_ACK):
+ if ack[0] != yaesu_clone.CMD_ACK:
raise Exception("block not ack'ed: %s" % repr(ack))
total_written += len(out)
@@ -309,6 +298,6 @@ def __clone_out(radio):
pos += block
- print("Clone completed in %i seconds" % (time.time() - start))
+ LOG.debug("Clone completed in %i seconds" % (time.time() - start))
return True
diff --git a/chirp/drivers/tdh8.py b/chirp/drivers/tdh8.py
index c26fede..74b89da 100644
--- a/chirp/drivers/tdh8.py
+++ b/chirp/drivers/tdh8.py
@@ -696,7 +696,7 @@ class TDH8(chirp_common.CloneModeRadio):
"->Tone",
"DTCS->DTCS"]
rf.valid_power_levels = TX_POWER
- rf.valid_duplexes = ["", "-", "+", "split"]
+ rf.valid_duplexes = ["", "-", "+", "split", "off"]
rf.valid_modes = ["FM", "NFM"]
rf.valid_tuning_steps = STEPS
@@ -851,6 +851,9 @@ class TDH8(chirp_common.CloneModeRadio):
if int(_mem.rxfreq) == int(_mem.txfreq):
mem.duplex = ""
mem.offset = 0
+ elif int(_mem.txfreq) == 66666665 and int(_mem.rxfreq) != 66666665:
+ mem.offset = 0
+ mem.duplex = 'off'
else:
mem.duplex = int(_mem.rxfreq) > int(_mem.txfreq) and "-" or "+"
mem.offset = abs(int(_mem.rxfreq) - int(_mem.txfreq)) * 10
@@ -1018,6 +1021,8 @@ class TDH8(chirp_common.CloneModeRadio):
_mem.txfreq = (mem.freq + mem.offset) / 10
elif mem.duplex == "-":
_mem.txfreq = (mem.freq - mem.offset) / 10
+ elif mem.duplex == 'off':
+ _mem.txfreq = 166666665
else:
_mem.txfreq = mem.freq / 10
diff --git a/chirp/drivers/uv5r.py b/chirp/drivers/uv5r.py
index ceea43f..4e1601f 100644
--- a/chirp/drivers/uv5r.py
+++ b/chirp/drivers/uv5r.py
@@ -193,10 +193,8 @@ struct {
txpower3:2;
} vfob;
-#seekto 0x0F48; // some new radios do not support this feature
-char bcstfmlo[14]; // broadcast FM 65-75 MHz band
-u16 fm_presets; // broadcast FM frequency
-char bcstfmhi[14]; // broadcast FM 75-108 MHz band
+#seekto 0x0F56;
+u16 fm_presets;
#seekto 0x1008;
struct {
@@ -359,6 +357,16 @@ def _upper_band_from_image(radio):
return _upper_band_from_data(radio.get_mmap())
+def _read_from_data(data, data_start, data_stop):
+ data = data[data_start:data_stop]
+ return data
+
+
+def _get_data_from_image(radio, _data_start, _data_stop):
+ image_data = _read_from_data(radio.get_mmap(), _data_start, _data_stop)
+ return image_data
+
+
def _firmware_version_from_data(data, version_start, version_stop):
version_tag = data[version_start:version_stop]
return version_tag
@@ -468,18 +476,50 @@ def _read_block(radio, start, size, first_command=False):
return chunk
+def _get_aux_data_from_radio(radio):
+ block0 = _read_block(radio, 0x1E80, 0x40, True)
+ block1 = _read_block(radio, 0x1EC0, 0x40, False)
+ block2 = _read_block(radio, 0x1F00, 0x40, False)
+ block3 = _read_block(radio, 0x1F40, 0x40, False)
+ block4 = _read_block(radio, 0x1F80, 0x40, False)
+ block5 = _read_block(radio, 0x1FC0, 0x40, False)
+ version = block1[48:62]
+ area1 = block2 + block3[0:32]
+ area2 = block3[48:64]
+ area3 = block4[16:64]
+ # check for dropped byte
+ dropped_byte = block5[15:16] == b"\xFF" # True/False
+ return version, area1, area2, area3, dropped_byte
+
+
def _get_radio_firmware_version(radio):
if radio.MODEL == "BJ-UV55":
block = _read_block(radio, 0x1FF0, 0x40, True)
version = block[0:6]
+ return version
else:
- block1 = _read_block(radio, 0x1E80, 0x40, True)
- block2 = _read_block(radio, 0x1EC0, 0x40, False)
- block3 = _read_block(radio, 0x0F40, 0x40, False)
- version = block2[48:62]
- brdcstfm = block3[0:30]
- return version, brdcstfm
- return version
+ # New radios will reply with 'alternative' (aka: bad) data if the Aux
+ # memory area is read without first reading a block from another area
+ # of memory. Reading any block that is outside of the Aux memory area
+ # (which starts at 0x1EC0) prior to reading blocks in the Aux mem area
+ # turns out to be a workaround for this problem.
+
+ # read and disregard block0
+ block0 = _read_block(radio, 0x1E80, 0x40, True)
+ block1 = _read_block(radio, 0x1EC0, 0x40, False)
+ block2 = _read_block(radio, 0x1FC0, 0x40, False)
+
+ version = block1[48:62] # firmware version
+
+ # Some new radios will drop the byte at 0x1FCF when read in 0x40 byte
+ # blocks. This results in the next 0x30 bytes being moved forward one
+ # position (putting 0xFF in position 0x1FCF and pads the now missing
+ # byte at the end, 0x1FFF, with 0x80).
+
+ # detect dropped byte
+ dropped_byte = (block2[15:16] == b"\xFF") # dropped byte?
+
+ return version, dropped_byte
IDENT_BLACKLIST = {
@@ -525,39 +565,10 @@ def _do_download(radio):
if radio.MODEL == "BJ-UV55":
radio_version = _get_radio_firmware_version(radio)
else:
- radio_version, radio_fm = _get_radio_firmware_version(radio)
+ radio_version, has_dropped_byte = \
+ _get_radio_firmware_version(radio)
LOG.info("Radio Version is %s" % repr(radio_version))
-
- if b"HN5RV" in radio_version:
- # A radio with HN5RV firmware has been detected. It could be a
- # UV-5R style radio with HIGH/LOW power levels or it could be a
- # BF-F8HP style radio with HIGH/MID/LOW power levels.
- # We are going to count on the user to make the right choice and
- # then append that model type to the end of the image so it can
- # be properly detected when loaded.
- append_model = True
- elif b"\xFF" * 7 in radio_version:
- # A radio UV-5R style radio that reports no firmware version has
- # been detected.
- # We are going to count on the user to make the right choice and
- # then append that model type to the end of the image so it can
- # be properly detected when loaded.
- append_model = True
- elif b"\x20" * 14 in radio_version:
- # A radio UV-5R style radio that reports no firmware version has
- # been detected.
- # We are going to count on the user to make the right choice and
- # then append that model type to the end of the image so it can
- # be properly detected when loaded.
- append_model = True
- elif not any(type in radio_version for type in radio._basetype):
- # This radio can't be properly detected by parsing its firmware
- # version.
- raise errors.RadioError("Incorrect 'Model' selected.")
- else:
- # This radio can be properly detected by parsing its firmware version.
- # There is no need to append its model type to the end of the image.
- append_model = False
+ LOG.info("Radio has dropped byte issue: %s" % repr(has_dropped_byte))
# Main block
LOG.debug("downloading main block...")
@@ -567,13 +578,24 @@ def _do_download(radio):
_do_status(radio, "from", radio.get_memsize())
LOG.debug("done.")
if radio._aux_block:
- LOG.debug("downloading aux block...")
- # Auxiliary block starts at 0x1ECO (?)
- for i in range(0x1EC0, 0x2000, 0x40):
- data += _read_block(radio, i, 0x40, False)
-
- if append_model:
- data += radio.MODEL.ljust(8).encode()
+ if has_dropped_byte:
+ LOG.debug("downloading aux block...")
+ # Auxiliary block starts at 0x1ECO (?)
+ for i in range(0x1EC0, 0x1FC0, 0x40):
+ data += _read_block(radio, i, 0x40, False)
+ # Shift to 0x10 block sizes as a workaround for new radios that
+ # will drop byte 0x1FCF if the last 0x40 bytes are read using a
+ # 0x40 block size
+ for i in range(0x1FC0, 0x2000, 0x10):
+ data += _read_block(radio, i, 0x10, False)
+ else:
+ # Retain 0x40 byte block download for legacy radios (the
+ # 'original' radios with firmware versions prior to BFB291 do not
+ # support reading the Aux memory are with 0x10 bytes blocks.
+ LOG.debug("downloading aux block...")
+ # Auxiliary block starts at 0x1ECO (?)
+ for i in range(0x1EC0, 0x2000, 0x40):
+ data += _read_block(radio, i, 0x40, False)
LOG.debug("done.")
return memmap.MemoryMapBytes(data)
@@ -601,69 +623,105 @@ def _do_upload(radio):
image_version = _firmware_version_from_image(radio)
if radio.MODEL == "BJ-UV55":
radio_version = _get_radio_firmware_version(radio)
+
+ # default ranges
+ _ranges_main_default = radio._ranges_main
+ _ranges_aux_default = radio._ranges_aux
else:
- radio_version, radio_fm = _get_radio_firmware_version(radio)
+ radio_version, aux_r1, aux_r2, aux_r3, \
+ has_dropped_byte = _get_aux_data_from_radio(radio)
+ LOG.info("Radio has dropped byte issue: %s" % repr(has_dropped_byte))
+
+ # determine if radio is 'original' radio
+ if b'BFB' in radio_version:
+ idx = radio_version.index(b"BFB") + 3
+ version = int(radio_version[idx:idx + 3])
+ _radio_is_orig = version < 291
+ else:
+ _radio_is_orig = False
+
+ # determine if image is from 'original' radio
+ _image_is_orig = radio._is_orig()
+
+ if _image_is_orig != _radio_is_orig:
+ raise errors.RadioError("Image not supported by radio")
+
+ aux_i1 = _get_data_from_image(radio, 0x1848, 0x18A8)
+ aux_i2 = _get_data_from_image(radio, 0x18B8, 0x18C8)
+ aux_i3 = _get_data_from_image(radio, 0x18D8, 0x1908)
+
+ # check if Aux memory of image matches Aux memory of radio
+ aux_matched = False
+ if aux_i1 != aux_r1:
+ # Area 1 does not match
+ # The safest thing to do is to skip uploading Aux mem area.
+ LOG.info("Aux memory mis-match")
+ LOG.info("Aux area 1 from image is %s" % repr(aux_i1))
+ LOG.info("Aux area 1 from radio is %s" % repr(aux_r1))
+ elif aux_i2 != aux_r2:
+ # Area 2 does not match
+ # The safest thing to do is to skip uploading Aux mem area.
+ LOG.info("Aux memory mis-match")
+ LOG.info("Aux area 2 from image is %s" % repr(aux_i2))
+ LOG.info("Aux area 2 from radio is %s" % repr(aux_r2))
+ elif aux_i3 != aux_r3:
+ # Area 3 does not match
+ # The safest thing to do is to skip uploading Aux mem area.
+ LOG.info("Aux memory mis-match")
+ LOG.info("Aux area 3 from image is %s" % repr(aux_i3))
+ LOG.info("Aux area 3 from radio is %s" % repr(aux_r3))
+ else:
+ # All areas matched
+ # Uploading full Aux mem area is permitted
+ aux_matched = True
+
+ if has_dropped_byte and not aux_matched:
+ msg = ("Image not supported by radio. You must...\n"
+ "1. Download from radio.\n"
+ "2. Make changes.\n"
+ "3. Upload back to same radio.")
+ raise errors.RadioError(msg)
+
+ # default ranges
+ _ranges_main_default = [
+ (0x0008, 0x0CF8), # skip 0x0CF8 - 0x0D08
+ (0x0D08, 0x0DF8), # skip 0x0DF8 - 0x0E08
+ (0x0E08, 0x1808),
+ ]
+
+ if _image_is_orig:
+ # default Aux mem ranges for radios before BFB291
+ _ranges_aux_default = [
+ (0x1EE0, 0x1EF0), # welcome message
+ (0x1FC0, 0x1FE0), # old band limits
+ ]
+ elif has_dropped_byte or aux_matched:
+ # default Aux mem ranges for radios with dropped byte issue
+ _ranges_aux_default = [
+ (0x1EC0, 0x2000), # the full Aux mem range
+ ]
+ else:
+ # default Aux mem ranges for radios from BFB291 to present
+ # (that don't have dropped byte issue)
+ _ranges_aux_default = [
+ (0x1EE0, 0x1EF0), # welcome message
+ (0x1F60, 0x1F70), # vhf squelch thresholds
+ (0x1F80, 0x1F90), # uhf squelch thresholds
+ (0x1FC0, 0x1FD0), # new band limits
+ ]
+
LOG.info("Image Version is %s" % repr(image_version))
LOG.info("Radio Version is %s" % repr(radio_version))
- imagev_matched_radiov = image_version == radio_version
- _skip_aux_block = False
-
- # default ranges
- _ranges_main_default = [
- (0x0008, 0x0CF8),
- (0x0D08, 0x0DF8),
- (0x0E08, 0x1808)
- ]
- _ranges_aux_default = [
- (0x1EC0, 0x1EF0) # 6 key power-on & welcome messages
- ]
-
- # skip broadcast fm range
- _ranges_main_no_fm = [
- (0x0008, 0x0CF8),
- (0x0D08, 0x0DF8),
- (0x0E08, 0x0F48),
- (0x0F68, 0x1808)
- ]
-
- # extra aux ranges
- _ranges_aux_extra = [
- (0x1F60, 0x1F70), # squelch thresholds - vhf
- (0x1F80, 0x1F90), # squelch thresholds - uhf
- (0x1FC0, 0x1FE0) # band limits
- ]
-
- # set default ranges
- ranges_main = _ranges_main_default
- ranges_aux = _ranges_aux_default
-
- # check destination radio for invalid bcst FM data
- if b"\xFF" in radio_fm:
- # 0x0F48-0x0F65 contains invalid data
- # This radio is likely to 'break' the Aux block if it is changed.
- # The safest thing to do is to skip uploading of the Aux block.
- ranges_main = _ranges_main_no_fm
- _skip_aux_block = True
- # check source image for invalid bcst FM data
- elif "\xFF" in str(radio._memobj.bcstfmlo) or \
- "\xFF" in str(radio._memobj.bcstfmhi):
- # 0x0F48-0x0F65 contains invalid data
- # This image appears to be from a radio that was likely to 'break'
- # the Aux block if it is changed (and could be broken).
- # The safest thing to do is to skip uploading of the Aux block.
- ranges_main = _ranges_main_no_fm
- _skip_aux_block = True
- # check if radio and image firmware versions match
- elif imagev_matched_radiov:
- # matched - allow all safe Aux block ranges
- ranges_aux = _ranges_aux_default + _ranges_aux_extra
-
if radio._all_range_flag:
- _skip_aux_block = False
+ # user enabled 'Range Override Parameter', upload everything
ranges_main = radio._ranges_main
ranges_aux = radio._ranges_aux
LOG.warning('Sending all ranges to radio as instructed')
+ else:
+ # set default ranges
+ ranges_main = _ranges_main_default
+ ranges_aux = _ranges_aux_default
# Main block
mmap = radio.get_mmap().get_byte_compatible()
@@ -677,10 +735,6 @@ def _do_upload(radio):
LOG.info("Old image, not writing aux block")
return # Old image, no aux block
- if _skip_aux_block:
- LOG.info("Skipped writing aux block")
- return # Aux block skipped
-
# Auxiliary block at radio address 0x1EC0, our offset 0x1808
for start_addr, end_addr in ranges_aux:
for i in range(start_addr, end_addr, 0x10):
@@ -695,13 +749,6 @@ def _do_upload(radio):
"The upload has finished successfully.\n"
"Please restart CHIRP.")
- if radio._aux_block and not imagev_matched_radiov:
- msg = ("This is NOT an error. The upload finished successfully.\n"
- "The 'Other Settings' and 'Service Settings' were skipped "
- "because the firmware version of the image (%s) does not "
- "match that of the radio (%s).")
- raise errors.RadioError(msg % (image_version, radio_version))
-
UV5R_POWER_LEVELS = [chirp_common.PowerLevel("High", watts=4.00),
chirp_common.PowerLevel("Low", watts=1.00)]
@@ -1130,14 +1177,11 @@ class BaofengUV5R(chirp_common.CloneModeRadio):
def _get_settings(self):
_mem = self._memobj
_ani = self._memobj.ani
- _fm_presets = self._memobj.fm_presets
_settings = self._memobj.settings
_squelch = self._memobj.squelch_new
_vfoa = self._memobj.vfoa
_vfob = self._memobj.vfob
_wmchannel = self._memobj.wmchannel
- _has_fmradio = (str(_mem.bcstfmlo) == " FM 65-75M" and
- str(_mem.bcstfmhi) == " FM 76-108M")
basic = RadioSettingGroup("basic", "Basic Settings")
advanced = RadioSettingGroup("advanced", "Advanced Settings")
@@ -1385,35 +1429,33 @@ class BaofengUV5R(chirp_common.CloneModeRadio):
rs = RadioSetting("firmware_msg.line2", "Firmware Message 2", val)
other.append(rs)
- aux_settings = []
-
_msg = self._memobj.sixpoweron_msg
+ val = RadioSettingValueString(0, 7, _filter(_msg.line1))
+ val.set_mutable(False)
rs = RadioSetting("sixpoweron_msg.line1",
- "6+Power-On Message 1",
- RadioSettingValueString(
- 0, 7, _filter(_msg.line1)))
- aux_settings.append(rs)
+ "6+Power-On Message 1", val)
+ other.append(rs)
+ val = RadioSettingValueString(0, 7, _filter(_msg.line2))
+ val.set_mutable(False)
rs = RadioSetting("sixpoweron_msg.line2",
- "6+Power-On Message 2",
- RadioSettingValueString(
- 0, 7, _filter(_msg.line2)))
- aux_settings.append(rs)
+ "6+Power-On Message 2", val)
+ other.append(rs)
_msg = self._memobj.poweron_msg
rs = RadioSetting("poweron_msg.line1", "Power-On Message 1",
RadioSettingValueString(
0, 7, _filter(_msg.line1)))
- aux_settings.append(rs)
+ other.append(rs)
rs = RadioSetting("poweron_msg.line2", "Power-On Message 2",
RadioSettingValueString(
0, 7, _filter(_msg.line2)))
- aux_settings.append(rs)
+ other.append(rs)
rs = RadioSetting("ponmsg", "Power-On Message",
RadioSettingValueList(
PONMSG_LIST,
PONMSG_LIST[_settings.ponmsg]))
- aux_settings.append(rs)
+ other.append(rs)
if self._is_orig():
limit = "limits_old"
@@ -1425,42 +1467,32 @@ class BaofengUV5R(chirp_common.CloneModeRadio):
"VHF Lower Limit (MHz)",
RadioSettingValueInteger(1, 1000,
vhf_limit.lower))
- aux_settings.append(rs)
+ other.append(rs)
rs = RadioSetting("%s.vhf.upper" % limit,
"VHF Upper Limit (MHz)",
RadioSettingValueInteger(1, 1000,
vhf_limit.upper))
- aux_settings.append(rs)
+ other.append(rs)
rs = RadioSetting("%s.vhf.enable" % limit, "VHF TX Enabled",
RadioSettingValueBoolean(vhf_limit.enable))
- aux_settings.append(rs)
+ other.append(rs)
uhf_limit = getattr(self._memobj, limit).uhf
rs = RadioSetting("%s.uhf.lower" % limit,
"UHF Lower Limit (MHz)",
RadioSettingValueInteger(1, 1000,
uhf_limit.lower))
- aux_settings.append(rs)
+ other.append(rs)
rs = RadioSetting("%s.uhf.upper" % limit,
"UHF Upper Limit (MHz)",
RadioSettingValueInteger(1, 1000,
uhf_limit.upper))
- aux_settings.append(rs)
+ other.append(rs)
rs = RadioSetting("%s.uhf.enable" % limit, "UHF TX Enabled",
RadioSettingValueBoolean(uhf_limit.enable))
- aux_settings.append(rs)
-
- hn5rv_warn = ('This setting will not be uploaded to your radio '
- 'because some radios with your firmware version are '
- 'known to be broken when CHIRP sends that data '
- 'to them. Please see bug #10505 on the CHIRP '
- 'issue tracker for more details.')
- for setting in aux_settings:
- if not _has_fmradio:
- setting.set_warning(hn5rv_warn)
- other.append(setting)
+ other.append(rs)
if self.MODEL != "UV-6":
workmode = RadioSettingGroup("workmode", "Work Mode Settings")
@@ -1635,34 +1667,20 @@ class BaofengUV5R(chirp_common.CloneModeRadio):
STEP_LIST, STEP_LIST[_vfob.step]))
workmode.append(rs)
- if _has_fmradio:
- fm_preset = RadioSettingGroup("fm_preset", "FM Radio Preset")
- group.append(fm_preset)
-
- # broadcast FM settings
- value = self._memobj.fm_presets
- value_shifted = ((value & 0x00FF) << 8) | ((value & 0xFF00) >> 8)
- if value_shifted >= 65.0 * 10 and value_shifted <= 108.0 * 10:
- # storage method 3 (discovered 2022)
- self._bw_shift = True
- preset = value_shifted / 10.0
- elif value >= 65.0 * 10 and value <= 108.0 * 10:
- # storage method 2
- preset = value / 10.0
- elif value <= 108.0 * 10 - 650:
- # original storage method (2012)
- preset = value / 10.0 + 65
- else:
- # unknown (undiscovered method or no FM chip?)
- preset = False
- if preset:
- rs = RadioSettingValueFloat(65, 108.0, preset, 0.1, 1)
- rset = RadioSetting("fm_presets", "FM Preset(MHz)", rs)
- fm_preset.append(rset)
-
dtmf = RadioSettingGroup("dtmf", "DTMF Settings")
group.append(dtmf)
+ # broadcast FM settings
+
+ # radios with the dropped byte issue also does not expose the broadcast
+ # FM frequency to CHIRP and ignores any frequency provided by CHIRP.
+ # Older radios that do expose the broadcast FM frequency to CHIRP have
+ # a minimum of 3 different know definitions for storing the
+ # frequencies. Since some frequencies have collisions for some of the
+ # storage methods, it is not always obvious to know which definition
+ # is being used. It is for these reasons that the FM Radio Preset tab
+ # and its associated FM Preset(MHz) setting have been removed.
+
if str(self._memobj.firmware_msg.line1) == "HN5RV01":
dtmfchars = "0123456789ABCD*#"
else:
@@ -1771,8 +1789,6 @@ class BaofengUV5R(chirp_common.CloneModeRadio):
RadioSettingValueInteger(
0, 123,
getattr(_obj, "sql%i" % (index))))
- if not _has_fmradio:
- rs.set_warning(hn5rv_warn)
service.append(rs)
return group
@@ -1789,11 +1805,8 @@ class BaofengUV5R(chirp_common.CloneModeRadio):
_settings = self._memobj.settings
for element in settings:
if not isinstance(element, RadioSetting):
- if element.get_name() == "fm_preset":
- self._set_fm_preset(element)
- else:
- self.set_settings(element)
- continue
+ self.set_settings(element)
+ continue
else:
try:
name = element.get_name()
@@ -1822,22 +1835,6 @@ class BaofengUV5R(chirp_common.CloneModeRadio):
LOG.debug(element.get_name())
raise
- def _set_fm_preset(self, settings):
- for element in settings:
- try:
- val = element.value
- if self._memobj.fm_presets <= 108.0 * 10 - 650:
- value = int(val.get_value() * 10 - 650)
- else:
- value = int(val.get_value() * 10)
- LOG.debug("Setting fm_presets = %s" % (value))
- if self._bw_shift:
- value = ((value & 0x00FF) << 8) | ((value & 0xFF00) >> 8)
- self._memobj.fm_presets = value
- except Exception:
- LOG.debug(element.get_name())
- raise
-
class UV5XAlias(chirp_common.Alias):
VENDOR = "Baofeng"
diff --git a/setup.py b/setup.py
index 8aa99b5..4e64a59 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ setup(name='chirp',
description='A cross-platform cross-radio programming tool',
packages=find_packages(include=["chirp*"]),
include_package_data=True,
- version='20231016',
+ version='20231027',
url='https://chirp.danplanet.com',
python_requires=">=3.7,<4",
install_requires=[
diff --git a/tests/Python3_Driver_Testing.md b/tests/Python3_Driver_Testing.md
index 2e82670..32a1e86 100644
--- a/tests/Python3_Driver_Testing.md
+++ b/tests/Python3_Driver_Testing.md
@@ -393,7 +393,7 @@
| <a name="Yaesu_FT-70D"></a> Yaesu_FT-70D | [@n8sqt](https://github.com/n8sqt) | 05-Dec-2022 | Yes | 0.27% |
| <a name="Yaesu_FT-7100M"></a> Yaesu_FT-7100M | | | Yes | 0.03% |
| <a name="Yaesu_FT-7800_7900"></a> Yaesu_FT-7800_7900 | [@kk7ds](https://github.com/kk7ds) | 24-Oct-2022 | Yes | 0.14% |
-| <a name="Yaesu_FT-8100"></a> Yaesu_FT-8100 | | | Yes | 0.01% |
+| <a name="Yaesu_FT-8100"></a> Yaesu_FT-8100 | [Reported working](https://chirp.danplanet.com/issues/10904) | 19-Oct-2023 | Yes | 0.01% |
| <a name="Yaesu_FT-817"></a> Yaesu_FT-817 | [@kk7ds](https://github.com/kk7ds) | 14-Feb-2019 | Yes | 0.04% |
| <a name="Yaesu_FT-817ND"></a> Yaesu_FT-817ND | [Implied by Yaesu_FT-817](#user-content-Yaesu_FT-817) | 14-Feb-2019 | Yes | 0.07% |
| <a name="Yaesu_FT-817ND_US"></a> Yaesu_FT-817ND_US | [Implied by Yaesu_FT-817](#user-content-Yaesu_FT-817) | 14-Feb-2019 | Yes | 0.02% |
@@ -425,7 +425,7 @@
**Drivers:** 420
-**Tested:** 87% (366/54) (93% of usage stats)
+**Tested:** 87% (367/53) (93% of usage stats)
**Byte clean:** 90% (380/40)
diff --git a/tests/images/Yaesu_FT-8100.img b/tests/images/Yaesu_FT-8100.img
new file mode 100644
index 0000000..a39c751
--- /dev/null
+++ b/tests/images/Yaesu_FT-8100.img
Binary files differ
diff --git a/tests/py3_driver_testers.txt b/tests/py3_driver_testers.txt
index 45424e1..ceaf190 100644
--- a/tests/py3_driver_testers.txt
+++ b/tests/py3_driver_testers.txt
@@ -353,6 +353,7 @@ Yaesu_FT-50,#10824,5-Sep-2023
Yaesu_FT-60,N0EYE,9-Jan-2023
Yaesu_FT-70D,@n8sqt,05-Dec-2022
Yaesu_FT-7800_7900,@kk7ds,24-Oct-2022
+Yaesu_FT-8100,#10904,19-Oct-2023
Yaesu_FT-8800,@kk7ds,24-Oct-2022
Yaesu_FT-8900,#10753,30-Jul-2023
Yaesu_FT-817,@kk7ds,14-Feb-2019
diff --git a/tools/check_commit.sh b/tools/check_commit.sh
index c92c2b0..6158a47 100755
--- a/tools/check_commit.sh
+++ b/tools/check_commit.sh
@@ -83,7 +83,10 @@ existing_drivers=$(git ls-tree --name-only $BASE chirp/drivers/)
limit=20
for nf in $added_files; do
for of in $existing_drivers; do
- change=$(wdiff -s $of $nf | grep $of | sed -r 's/.* ([0-9]+)% changed/\1/')
+ change=$(wdiff -s $of $nf | grep -I $of | sed -r 's/.* ([0-9]+)% changed/\1/')
+ if [ ! "$change" ]; then
+ continue
+ fi
if [ "$change" -lt "$limit" ]; then
fail "New file $nf shares at least $((100 - $change))% with $of!"
fi