[chirp_devel] [PATCH] Fix remaining errors on Python3 startup #7923
# HG changeset patch # User Alex Page a.t.page@gmail.com # Date 1591030652 14400 # Mon Jun 01 12:57:32 2020 -0400 # Branch py3 # Node ID 7c4c5bde73f6d6364de8e21abba37fa2ad5052d4 # Parent a9922865fad99188e5f298006f374167211efad5 Fix remaining errors on Python3 startup #7923
diff --git a/chirp/drivers/tk270.py b/chirp/drivers/tk270.py --- a/chirp/drivers/tk270.py +++ b/chirp/drivers/tk270.py @@ -96,7 +96,7 @@
MEM_SIZE = 0x400 BLOCK_SIZE = 8 -MEM_BLOCKS = range(0, (MEM_SIZE / BLOCK_SIZE)) +MEM_BLOCKS = range(0, (MEM_SIZE // BLOCK_SIZE)) ACK_CMD = "\x06" TIMEOUT = 0.05 # from 0.03 up it' s safe, we set in 0.05 for a margin
@@ -242,7 +242,7 @@ # UI progress status = chirp_common.Status() status.cur = 0 - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning from radio..." radio.status_fn(status)
@@ -269,7 +269,7 @@ # UI progress status = chirp_common.Status() status.cur = 0 - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning to radio..." radio.status_fn(status) count = 0 @@ -630,7 +630,7 @@ return
# freq rx - _mem.rxfreq = mem.freq / 10 + _mem.rxfreq = mem.freq // 10
# rx enabled if valid channel, # set tx to on, we decide if off after duplex = off @@ -639,9 +639,9 @@
# freq tx if mem.duplex == "+": - _mem.txfreq = (mem.freq + mem.offset) / 10 + _mem.txfreq = (mem.freq + mem.offset) // 10 elif mem.duplex == "-": - _mem.txfreq = (mem.freq - mem.offset) / 10 + _mem.txfreq = (mem.freq - mem.offset) // 10 elif mem.duplex == "off": # set tx freq on the memap to xff for i in range(0, 4): @@ -649,7 +649,7 @@ # erase the txen flag _mem.txen = 255 else: - _mem.txfreq = mem.freq / 10 + _mem.txfreq = mem.freq // 10
# tone data ((txmode, txtone, txpol), (rxmode, rxtone, rxpol)) = \ diff --git a/chirp/drivers/tk760.py b/chirp/drivers/tk760.py --- a/chirp/drivers/tk760.py +++ b/chirp/drivers/tk760.py @@ -97,7 +97,7 @@
MEM_SIZE = 0x400 BLOCK_SIZE = 8 -MEM_BLOCKS = range(0, (MEM_SIZE / BLOCK_SIZE)) +MEM_BLOCKS = range(0, (MEM_SIZE // BLOCK_SIZE)) ACK_CMD = "\x06" # from 0.03 up it' s safe # I have to turn it up, some users reported problems with this, was 0.05 @@ -256,7 +256,7 @@ # UI progress status = chirp_common.Status() status.cur = 0 - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning from radio..." radio.status_fn(status)
@@ -283,7 +283,7 @@ # UI progress status = chirp_common.Status() status.cur = 0 - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning to radio..." radio.status_fn(status) count = 0 @@ -637,18 +637,18 @@ return
# freq rx - _mem.rxfreq = mem.freq / 10 + _mem.rxfreq = mem.freq // 10
# freq tx if mem.duplex == "+": - _mem.txfreq = (mem.freq + mem.offset) / 10 + _mem.txfreq = (mem.freq + mem.offset) // 10 elif mem.duplex == "-": - _mem.txfreq = (mem.freq - mem.offset) / 10 + _mem.txfreq = (mem.freq - mem.offset) // 10 elif mem.duplex == "off": for byte in _mem.txfreq: byte.set_raw("\xFF") else: - _mem.txfreq = mem.freq / 10 + _mem.txfreq = mem.freq // 10
# tone data ((txmode, txtone, txpol), (rxmode, rxtone, rxpol)) = \ diff --git a/chirp/drivers/tk760g.py b/chirp/drivers/tk760g.py --- a/chirp/drivers/tk760g.py +++ b/chirp/drivers/tk760g.py @@ -263,13 +263,13 @@
MEM_SIZE = 0x8000 # 32,768 bytes BLOCK_SIZE = 256 -BLOCKS = MEM_SIZE / BLOCK_SIZE +BLOCKS = MEM_SIZE // BLOCK_SIZE MEM_BLOCKS = range(0, BLOCKS)
# define and empty block of data, as it will be used a lot in this code EMPTY_BLOCK = "\xFF" * 256
-RO_BLOCKS = range(0x10, 0x1F) + range(0x59, 0x5f) +RO_BLOCKS = list(range(0x10, 0x1F)) + list(range(0x59, 0x5f)) ACK_CMD = "\x06"
POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1), @@ -529,7 +529,7 @@
# reset UI data status.cur = 0 - status.max = MEM_SIZE / 256 + status.max = MEM_SIZE // 256 status.msg = "Cloning from radio..." radio.status_fn(status)
@@ -580,7 +580,7 @@
# update UI status.cur = 0 - status.max = MEM_SIZE / 256 + status.max = MEM_SIZE // 256 status.msg = "Cloning to radio..." radio.status_fn(status)
@@ -843,7 +843,7 @@ bdata += (256 - (len(bdata)) % 256) * "\xFF"
# fill to match the whole area - bdata += (16 - len(bdata) / 256) * EMPTY_BLOCK + bdata += (16 - len(bdata) // 256) * EMPTY_BLOCK
# updating the data in the memmap [x1000] self._fill(0x1000, bdata) @@ -958,7 +958,7 @@ """Get the channel scan status from the 16 bytes array on the eeprom then from the bits on the byte, return '' or 'S' as needed""" result = "S" - byte = int(chan/8) + byte = int(chan//8) bit = chan % 8 res = self._memobj.settings.add[byte] & (pow(2, bit)) if res > 0: @@ -968,7 +968,7 @@
def _set_scan(self, chan, value): """Set the channel scan status from UI to the mem_map""" - byte = int(chan/8) + byte = int(chan//8) bit = chan % 8
# get the actual value to see if I need to change anything @@ -1086,7 +1086,7 @@ return
# frequency - _mem.rxfreq = mem.freq / 10 + _mem.rxfreq = mem.freq // 10
# this are a mistery yet, but so falr there is no impact # whit this default values for new channels @@ -1096,14 +1096,14 @@
# duplex if mem.duplex == "+": - _mem.txfreq = (mem.freq + mem.offset) / 10 + _mem.txfreq = (mem.freq + mem.offset) // 10 elif mem.duplex == "-": - _mem.txfreq = (mem.freq - mem.offset) / 10 + _mem.txfreq = (mem.freq - mem.offset) // 10 elif mem.duplex == "off": for byte in _mem.txfreq: byte.set_raw("\xFF") else: - _mem.txfreq = mem.freq / 10 + _mem.txfreq = mem.freq // 10
# tone data ((txmode, txtone, txpol), (rxmode, rxtone, rxpol)) = \
participants (1)
-
Alex Page