diff --git a/chirp/drivers/ft8100.py b/chirp/drivers/ft8100.py
index 757c3d4b1..63db0a66c 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 .
+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,20 +104,31 @@ def get_features(self):
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)
+ # This is not actually implemented, so don't expose it
+ rf.valid_duplexes.remove('split')
rf.valid_power_levels = POWER_LEVELS_VHF
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.can_odd_split = False
- 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()
@@ -134,7 +139,7 @@ def get_features(self):
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 +152,7 @@ def process_mmap(self):
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)
@@ -175,12 +179,11 @@ def get_memory(self, number):
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 +191,8 @@ def get_memory(self, number):
# 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,7 +204,7 @@ def set_memory(self, mem):
_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)
@@ -209,10 +212,9 @@ def set_memory(self, mem):
if mem.duplex == "split":
tx_freq = mem.freq + mem.offset
- _mem.split_high = tx_freq / 10000000
- _mem.offset = (tx_freq % 10000000) / 1000
+ _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 +228,6 @@ def set_memory(self, mem):
# TODO expose these options
_mem.baud9600 = 0
- _mem.am = 0
# These need to be cleared, otherwise strange things happen
_mem.unknown4 = 0
@@ -243,10 +244,10 @@ def _checksums(self):
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 +291,17 @@ def _status():
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 +309,6 @@ def _status():
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/tests/Python3_Driver_Testing.md b/tests/Python3_Driver_Testing.md
index 2e82670e4..32a1e8657 100644
--- a/tests/Python3_Driver_Testing.md
+++ b/tests/Python3_Driver_Testing.md
@@ -393,7 +393,7 @@
| Yaesu_FT-70D | [@n8sqt](https://github.com/n8sqt) | 05-Dec-2022 | Yes | 0.27% |
| Yaesu_FT-7100M | | | Yes | 0.03% |
| Yaesu_FT-7800_7900 | [@kk7ds](https://github.com/kk7ds) | 24-Oct-2022 | Yes | 0.14% |
-| Yaesu_FT-8100 | | | Yes | 0.01% |
+| Yaesu_FT-8100 | [Reported working](https://chirp.danplanet.com/issues/10904) | 19-Oct-2023 | Yes | 0.01% |
| Yaesu_FT-817 | [@kk7ds](https://github.com/kk7ds) | 14-Feb-2019 | Yes | 0.04% |
| Yaesu_FT-817ND | [Implied by Yaesu_FT-817](#user-content-Yaesu_FT-817) | 14-Feb-2019 | Yes | 0.07% |
| 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 000000000..a39c75196
Binary files /dev/null and b/tests/images/Yaesu_FT-8100.img differ
diff --git a/tests/py3_driver_testers.txt b/tests/py3_driver_testers.txt
index 45424e147..ceaf19075 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