def get_memory(self, num): _mem = self._memobj.memories[num] mem = chirp_common.Memory() mem.number = num if int(_mem.rxfreq) == 166666665: mem.empty = True return mem mem.name = ''.join([str(c) for c in self._memobj.names[num].name if ord(str(c)) < 127]).rstrip() mem.freq = int(_mem.rxfreq) * 10 offset = (int(_mem.txfreq) - int(_mem.rxfreq)) * 10 if offset == 0: mem.duplex = '' elif abs(offset) < 100000000: mem.duplex = offset < 0 and '-' or '+' mem.offset = abs(offset) else: mem.duplex = 'split' mem.offset = int(_mem.txfreq) * 10 mem.power = POWER_LEVELS[_mem.power] mem.mode = 'NFM' if _mem.narrow else 'FM' mem.skip = '' if _mem.scan else 'S' LOG.debug('got txtone: %s' % repr(self._decode_tone(_mem.txtone))) LOG.debug('got rxtone: %s' % repr(self._decode_tone(_mem.rxtone))) chirp_common.split_tone_decode(mem, self._decode_tone(_mem.txtone), self._decode_tone(_mem.rxtone)) try: mem.extra = self._get_extra(_mem) except: LOG.exception('Failed to get extra for %i' % num) return mem
def get_memory(self, number): mem = chirp_common.Memory() mem.number = number _mem = self._get_raw_memory(number) if _mem is None: mem.empty = True return mem mem.name = str(_mem.name).rstrip('\x00') mem.freq = int(_mem.rx_freq) * 10 chirp_common.split_tone_decode(mem, self._decode_tone(_mem.tx_tone), self._decode_tone(_mem.rx_tone)) if _mem.wide: mem.mode = 'FM' else: mem.mode = 'NFM' mem.power = POWER_LEVELS[_mem.highpower] offset = (int(_mem.tx_freq) - int(_mem.rx_freq)) * 10 if offset == 0: mem.duplex = '' elif abs(offset) < 10000000: mem.duplex = offset < 0 and '-' or '+' mem.offset = abs(offset) else: mem.duplex = 'split' mem.offset = int(_mem.tx_freq) * 10 skipbyte = self._memobj.skipflags[(mem.number - 1) // 8] skipbit = skipbyte & (1 << (mem.number - 1) % 8) mem.skip = skipbit and 'S' or '' return mem
def get_memory(self, number): _mem = self._memobj.memory[number - 1] mem = chirp_common.Memory() mem.number = number if _mem.get_raw().startswith("\xFF\xFF\xFF\xFF"): mem.empty = True return mem mem.freq = int(_mem.rx_freq) * 10 txfreq = int(_mem.tx_freq) * 10 if self._is_txinh(_mem): mem.duplex = "off" mem.offset = 0 elif txfreq == mem.freq: mem.duplex = "" elif abs(txfreq - mem.freq) > 70000000: mem.duplex = "split" mem.offset = txfreq elif txfreq < mem.freq: mem.duplex = "-" mem.offset = mem.freq - txfreq elif txfreq > mem.freq: mem.duplex = "+" mem.offset = txfreq - mem.freq txmode, txval, txpol = self._decode_tone(_mem.tx_tone) rxmode, rxval, rxpol = self._decode_tone(_mem.rx_tone) chirp_common.split_tone_decode(mem, (txmode, txval, txpol), (rxmode, rxval, rxpol)) mem.name = str(self._memobj.names[number - 1].name) mem.name = mem.name.replace("\xFF", " ").rstrip() mem.skip = not _mem.scan and "S" or "" mem.mode = _mem.isnarrow and "NFM" or "FM" mem.power = POWER_LEVELS[1 - _mem.ishighpower] mem.extra = RadioSettingGroup("extra", "Extra Settings") rs = RadioSetting( "pttid", "PTT ID", RadioSettingValueList(PTTID_LIST, PTTID_LIST[_mem.pttid])) mem.extra.append(rs) rs = RadioSetting("vox", "VOX", RadioSettingValueBoolean(_mem.vox)) mem.extra.append(rs) rs = RadioSetting("bcl", "Busy Channel Lockout", RadioSettingValueList(BCL_LIST, BCL_LIST[_mem.bcl])) mem.extra.append(rs) rs = RadioSetting( "scramble_code", "Scramble Code", RadioSettingValueList(CODES_LIST, CODES_LIST[_mem.scramble_code])) mem.extra.append(rs) return mem
def get_memory(self, number): _mem, _nam = self._get_memobjs(number) mem = chirp_common.Memory() if isinstance(number, str): mem.number = SPECIALS[number] mem.extd_number = number else: mem.number = number if _mem.freq.get_raw()[0] == "\xFF": mem.empty = True return mem mem.freq = int(_mem.freq) * 10 mem.offset = int(_mem.offset) * 10 chirp_common.split_tone_decode( mem, self._decode_tone(_mem.txtone, _mem.txpol), self._decode_tone(_mem.rxtone, _mem.rxpol)) if _mem.step > 0x05: _mem.step = 0x00 mem.duplex = DUPLEX[_mem.duplex] mem.mode = _mem.isnarrow and "NFM" or "FM" mem.skip = "" if _mem.scanadd else "S" mem.power = POWER_LEVELS[_mem.highpower] if mem.freq == mem.offset and mem.duplex == "-": mem.duplex = "off" mem.offset = 0 if _nam: for char in _nam: try: mem.name += CHARSET[char] except IndexError: break mem.name = mem.name.rstrip() mem.extra = RadioSettingGroup("Extra", "extra") rs = RadioSetting("bcl", "BCL", RadioSettingValueBoolean(_mem.bcl)) mem.extra.append(rs) rs = RadioSetting("revfreq", "Reverse Duplex", RadioSettingValueBoolean(_mem.revfreq)) mem.extra.append(rs) rs = RadioSetting("pttid", "PTT ID", RadioSettingValueBoolean(_mem.pttid)) mem.extra.append(rs) rs = RadioSetting("compander", "Compander", RadioSettingValueBoolean(_mem.compander)) mem.extra.append(rs) return mem
def get_memory(self, number): # Get a low-level memory object mapped to the image _mem = self._memobj.memory[number] # get flag info cbyte = number / 8 ; cbit = 7 - (number % 8) ; setflag = self._memobj.csetflag[cbyte].c[cbit]; skipflag = self._memobj.cskipflag[cbyte].c[cbit]; mem = chirp_common.Memory() mem.number = number # Set the memory number if setflag == 1: mem.empty = True return mem mem.freq = int(_mem.freq) * 100 mem.offset = int(_mem.offset) * 100 mem.name = str(_mem.name).rstrip() # Set the alpha tag mem.duplex = DUPLEXES[_mem.duplex] mem.mode = MODES[_mem.channel_width] mem.power = POWER_LEVELS[_mem.power] rxtone = txtone = None rxmode = TMODES[_mem.rxtmode] txmode = TMODES[_mem.txtmode] # doesn't work if rxmode == "Tone": rxtone = TONES[_mem.rxtone] elif rxmode == "DTCS": rxtone = chirp_common.ALL_DTCS_CODES[self._get_dcs_index(_mem,'rx')] if txmode == "Tone": txtone = TONES[_mem.txtone] elif txmode == "DTCS": txtone = chirp_common.ALL_DTCS_CODES[self._get_dcs_index(_mem,'tx')] rxpol = _mem.rxinv and "R" or "N" txpol = _mem.txinv and "R" or "N" chirp_common.split_tone_decode(mem, (txmode, txtone, txpol), (rxmode, rxtone, rxpol)) mem.skip = "S" if skipflag == 1 else "" # We'll consider any blank (i.e. 0MHz frequency) to be empty if mem.freq == 0: mem.empty = True return mem
def get_memory(self, number): """Get the mem representation from the radio image""" _mem = self._get_special(number) # Create a high-level memory object to return to the UI mem = chirp_common.Memory() # Check if special or normal if isinstance(number, str): mem.number = SPECIALS[number] mem.extd_number = number else: mem.number = number if _mem.get_raw()[0] == "\xFF": mem.empty = True return mem # Freq and offset mem.freq = int(_mem.rxfreq) * 10 # TX freq (Stored as a difference) mem.offset = int(_mem.txoffset) * 10 mem.duplex = "" # must work out the polarity if mem.offset != 0: if _mem.offminus == 1: mem.duplex = "-" # tx below RX if _mem.offplus == 1: # tx above RX mem.duplex = "+" # split RX/TX in different bands if mem.offset > 71000000: mem.duplex = "split" # show the actual value in the offset, depending on the shift if _mem.offminus == 1: mem.offset = mem.freq - mem.offset if _mem.offplus == 1: mem.offset = mem.freq + mem.offset # wide/narrow mem.mode = MODES[int(_mem.wide)] # skip mem.skip = SKIP_VALUES[_mem.noskip] # tone data rxtone = txtone = None txtone = self._decode_tone(_mem.txtone, _mem.ttondinv) rxtone = self._decode_tone(_mem.rxtone, _mem.rtondinv) chirp_common.split_tone_decode(mem, txtone, rxtone) return mem
def get_memory(self, number): _mem = self._memobj.memory[number - 1] mem = chirp_common.Memory() mem.number = number mem.freq = int(_mem.rxfreq) * 10 # We'll consider any blank (i.e. 0MHz frequency) to be empty if mem.freq == 0: mem.empty = True return mem if _mem.rxfreq.get_raw() == "\xFF\xFF\xFF\xFF": mem.freq = 0 mem.empty = True return mem if int(_mem.rxfreq) == int(_mem.txfreq): mem.duplex = "" mem.offset = 0 else: mem.duplex = int(_mem.rxfreq) > int(_mem.txfreq) and "-" or "+" mem.offset = abs(int(_mem.rxfreq) - int(_mem.txfreq)) * 10 mem.mode = _mem.wide and "FM" or "NFM" rxtone = txtone = None txtone = self.decode_tone(_mem.txtone) rxtone = self.decode_tone(_mem.rxtone) chirp_common.split_tone_decode(mem, txtone, rxtone) mem.power = RT1_POWER_LEVELS[_mem.highpower] if _mem.skip: mem.skip = "S" mem.extra = RadioSettingGroup("Extra", "extra") rs = RadioSetting("bcl", "BCL", RadioSettingValueBoolean(not _mem.bcl)) mem.extra.append(rs) rs = RadioSetting("epilogue", "Epilogue(STE)", RadioSettingValueBoolean(not _mem.epilogue)) mem.extra.append(rs) rs = RadioSetting("compander", "Compander", RadioSettingValueBoolean(not _mem.compander)) mem.extra.append(rs) rs = RadioSetting("scramble", "Scramble", RadioSettingValueBoolean(not _mem.scramble)) mem.extra.append(rs) return mem
def get_memory(self, number): """Return a Memory object for the memory at location @number""" try: rmem = self._memobj.memory[number - 1] except KeyError: raise errors.InvalidMemoryLocation('Unknown channel %s' % number) if number < 1 or number > self.CHANNELS: raise errors.InvalidMemoryLocation( 'Channel number must be 1 and %s' % self.CHANNELS) mem = chirp_common.Memory() mem.number = number mem.freq = int(rmem.rxfreq) * 10 # A blank (0MHz) or 0xFFFFFFFF frequency is considered empty if mem.freq == 0 or rmem.rxfreq.get_raw() == '\xFF\xFF\xFF\xFF': LOG.debug('empty channel %d', number) mem.freq = 0 mem.empty = True return mem if rmem.txfreq.get_raw() == '\xFF\xFF\xFF\xFF': mem.duplex = 'off' mem.offset = 0 elif int(rmem.rxfreq) == int(rmem.txfreq): mem.duplex = '' mem.offset = 0 else: mem.duplex = '-' if int(rmem.rxfreq) > int(rmem.txfreq) else '+' mem.offset = abs(int(rmem.rxfreq) - int(rmem.txfreq)) * 10 mem.mode = 'NFM' if rmem.narrow else 'FM' mem.skip = 'S' if rmem.skip else '' mem.power = self.X3P_POWER_LEVELS[rmem.highpower] txtone = self._decode_tone(rmem.txtone) rxtone = self._decode_tone(rmem.rxtone) chirp_common.split_tone_decode(mem, txtone, rxtone) mem.extra = RadioSettingGroup('Extra', 'extra') mem.extra.append( RadioSetting('bcl', 'Busy Channel Lockout', RadioSettingValueBoolean(current=(not rmem.bcl)))) mem.extra.append( RadioSetting( 'scramble', 'Scramble', RadioSettingValueBoolean(current=(not rmem.scramble)))) mem.extra.append( RadioSetting( 'compander', 'Compander', RadioSettingValueBoolean(current=(not rmem.compander)))) return mem
def get_memory(self, number): """Extract a high-level memory object from the low-level memory map, This is called to populate a memory in the UI""" # Get a low-level memory object mapped to the image _mem = self._memobj.memory[number - 1] # Create a high-level memory object to return to the UI mem = chirp_common.Memory() # number mem.number = number # empty if _mem.get_raw()[0] == "\xFF": mem.empty = True return mem # rx freq mem.freq = int(_mem.rx_freq) * 10 # checking if tx freq is empty, this is "possible" on the # original soft after a warning, and radio is happy with it if _mem.tx_freq.get_raw() == "\xFF\xFF\xFF\xFF": mem.duplex = "off" mem.offset = 0 else: rx = int(_mem.rx_freq) * 10 tx = int(_mem.tx_freq) * 10 if tx == rx: mem.offset = 0 mem.duplex = "" else: mem.duplex = rx > tx and "-" or "+" mem.offset = abs(tx - rx) # tone data txtone = self._decode_tone(_mem.tx_tone) rxtone = self._decode_tone(_mem.rx_tone) chirp_common.split_tone_decode(mem, txtone, rxtone) # Extra setting group, FD-268 don't uset it at all # FD-288's & others do it? mem.extra = RadioSettingGroup("extra", "Extra") busy = RadioSetting("Busy", "Busy Channel Lockout", RadioSettingValueBoolean( bool(_mem.busy_lock))) mem.extra.append(busy) scramble = RadioSetting("Scrambler", "Scrambler Option", RadioSettingValueBoolean( bool(_mem.scrambler))) mem.extra.append(scramble) # return mem return mem
def get_memory(self, number): """Return a Memory object for the memory at location @number""" try: rmem = self._memobj.memory[number - 1] except KeyError: raise errors.InvalidMemoryLocation('Unknown channel %s' % number) if number < 1 or number > self.CHANNELS: raise errors.InvalidMemoryLocation( 'Channel number must be 1 and %s' % self.CHANNELS) mem = chirp_common.Memory() mem.number = number mem.freq = int(rmem.rxfreq) * 10 # A blank (0MHz) or 0xFFFFFFFF frequency is considered empty if mem.freq == 0 and rmem.rxfreq.get_raw() == '\xFF\xFF\xFF\xFF': LOG.debug('empty channel %d', number) mem.freq = 0 mem.empty = True return mem if rmem.txfreq.get_raw() == '\xFF\xFF\xFF\xFF': mem.duplex = 'off' mem.offset = 0 elif int(rmem.rxfreq) == int(rmem.txfreq): mem.duplex = '' mem.offset = 0 else: mem.duplex = '-' if int(rmem.rxfreq) > int(rmem.txfreq) else '+' mem.offset = abs(int(rmem.rxfreq) - int(rmem.txfreq)) * 10 mem.mode = 'NFM' if rmem.narrow else 'FM' mem.skip = 'S' if rmem.skip else '' mem.power = self.X3P_POWER_LEVELS[rmem.highpower] txtone = self._decode_tone(rmem.txtone) rxtone = self._decode_tone(rmem.rxtone) chirp_common.split_tone_decode(mem, txtone, rxtone) mem.extra = RadioSettingGroup('Extra', 'extra') mem.extra.append(RadioSetting('bcl', 'Busy Channel Lockout', RadioSettingValueBoolean( current=(not rmem.bcl)))) mem.extra.append(RadioSetting('scramble', 'Scramble', RadioSettingValueBoolean( current=(not rmem.scramble)))) mem.extra.append(RadioSetting('compander', 'Compander', RadioSettingValueBoolean( current=(not rmem.compander)))) return mem
def get_memory(self, number): _mem = self._memobj.memory[number - 1] mem = chirp_common.Memory() mem.number = number mem.freq = int(_mem.rxfreq) * 10 # We'll consider any blank (i.e. 0MHz frequency) to be empty if mem.freq == 0: mem.empty = True return mem if _mem.rxfreq.get_raw() == "\xFF\xFF\xFF\xFF": mem.freq = 0 mem.empty = True return mem if _mem.txfreq.get_raw() == "\xFF\xFF\xFF\xFF": mem.duplex = "off" mem.offset = 0 elif int(_mem.rxfreq) == int(_mem.txfreq): mem.duplex = "" mem.offset = 0 else: mem.duplex = int(_mem.rxfreq) > int(_mem.txfreq) and "-" or "+" mem.offset = abs(int(_mem.rxfreq) - int(_mem.txfreq)) * 10 mem.mode = not _mem.narrow and "FM" or "NFM" mem.skip = _mem.skip and "S" or "" txtone = self._decode_tone(_mem.txtone) rxtone = self._decode_tone(_mem.rxtone) chirp_common.split_tone_decode(mem, txtone, rxtone) mem.extra = RadioSettingGroup("Extra", "extra") rs = RadioSetting("bcl", "Busy Channel Lockout", RadioSettingValueBoolean(not _mem.bcl)) mem.extra.append(rs) rs = RadioSetting("scramble", "Scramble", RadioSettingValueBoolean(not _mem.scramble)) mem.extra.append(rs) rs = RadioSetting("compander", "Compander", RadioSettingValueBoolean(not _mem.compander)) mem.extra.append(rs) return mem
def get_memory(self, number): _mem, _flg = self._get_memobjs(number) mem = chirp_common.Memory() mem.number = number if _flg.get() == 0x0F: mem.empty = True return mem mem.freq = int(_mem.freq) * 100 # compensate for 6.25 and 12.5 kHz tuning steps, add 500 Hz if needed lastdigit = int(_mem.freq) % 10 if (lastdigit == 2 or lastdigit == 7): mem.freq += 50 mem.offset = int(_mem.offset) * 100 mem.name = str(_mem.name).rstrip() mem.duplex = DUPLEXES[_mem.duplex] mem.mode = _mem.is_am and "AM" or MODES[_mem.channel_width] rxtone = txtone = None rxmode = TMODES[_mem.rxtmode] txmode = TMODES[_mem.txtmode] if txmode == "Tone": txtone = TONES[_mem.txtone] elif txmode == "DTCS": txtone = chirp_common.ALL_DTCS_CODES[self._get_dcs_index(_mem, 'tx')] if rxmode == "Tone": rxtone = TONES[_mem.rxtone] elif rxmode == "DTCS": rxtone = chirp_common.ALL_DTCS_CODES[self._get_dcs_index(_mem, 'rx')] rxpol = _mem.rxinv and "R" or "N" txpol = _mem.txinv and "R" or "N" chirp_common.split_tone_decode(mem, (txmode, txtone, txpol), (rxmode, rxtone, rxpol)) mem.skip = _flg.get_skip() and "S" or _flg.get_pskip() and "P" or "" mem.power = POWER_LEVELS[_mem.power] return mem
def _get_tone(self, mem, _mem): rx_tone = tx_tone = None tx_tmode = TMODES[_mem.tx_tmode] rx_tmode = TMODES[_mem.rx_tmode] if tx_tmode == "Tone": tx_tone = TONES[_mem.tx_tone - 1] elif tx_tmode == "DTCS": tx_tone = DTCS_CODES[_mem.tx_tone - 1] if rx_tmode == "Tone": rx_tone = TONES[_mem.rx_tone - 1] elif rx_tmode == "DTCS": rx_tone = DTCS_CODES[_mem.rx_tone - 1] tx_pol = _mem.tx_tmode == 0x03 and "R" or "N" rx_pol = _mem.rx_tmode == 0x03 and "R" or "N" chirp_common.split_tone_decode(mem, (tx_tmode, tx_tone, tx_pol), (rx_tmode, rx_tone, rx_pol))
def get_memory(self, number): _mem, _flg = self._get_memobjs(number) mem = chirp_common.Memory() mem.number = number if _flg.get() == 0x0F: mem.empty = True return mem mem.freq = int(_mem.freq) * 100 mem.offset = int(_mem.offset) * 100 mem.name = str(_mem.name).rstrip() mem.duplex = DUPLEXES[_mem.duplex] mem.mode = _mem.is_am and "AM" or MODES[_mem.channel_width] rxtone = txtone = None rxmode = TMODES[_mem.rxtmode] txmode = TMODES[_mem.txtmode] if txmode == "Tone": txtone = TONES[_mem.txtone] elif txmode == "DTCS": txtone = chirp_common.ALL_DTCS_CODES[self._get_dcs_index(_mem, 'tx')] if rxmode == "Tone": rxtone = TONES[_mem.rxtone] elif rxmode == "DTCS": rxtone = chirp_common.ALL_DTCS_CODES[self._get_dcs_index(_mem, 'rx')] rxpol = _mem.rxinv and "R" or "N" txpol = _mem.txinv and "R" or "N" chirp_common.split_tone_decode(mem, (txmode, txtone, txpol), (rxmode, rxtone, rxpol)) mem.skip = _flg.get_skip() and "S" or _flg.get_pskip() and "P" or "" mem.power = POWER_LEVELS[_mem.power] return mem
def get_memory(self, number): _mem, _name = self._get_memobjs(number) mem = chirp_common.Memory() if isinstance(number, str): mem.number = SPECIALS[number] mem.extd_number = number else: mem.number = number if _mem.get_raw().startswith("\xFF\xFF\xFF\xFF"): mem.empty = True return mem mem.freq = int(_mem.rx_freq) * 10 offset = (int(_mem.tx_freq) - int(_mem.rx_freq)) * 10 if not offset: mem.offset = 0 mem.duplex = '' elif offset < 0: mem.offset = abs(offset) mem.duplex = '-' else: mem.offset = offset mem.duplex = '+' txmode, txval, txpol = self._decode_tone(_mem.tx_tone) rxmode, rxval, rxpol = self._decode_tone(_mem.rx_tone) chirp_common.split_tone_decode(mem, (txmode, txval, txpol), (rxmode, rxval, rxpol)) mem.mode = 'NFM' if _mem.narrow else 'FM' mem.skip = '' if _mem.scanadd else 'S' mem.power = POWER_LEVELS[int(_mem.highpower)] mem.name = str(_name.name).rstrip('\xFF ') return mem
def _test_split_tone_decode(self, tx, rx, **vals): mem = chirp_common.Memory() chirp_common.split_tone_decode(mem, tx, rx) for key, value in vals.items(): self.assertEqual(getattr(mem, key), value)
def get_memory(self, number): """Get the mem representation from the radio image""" _mem = self._memobj.memory[number - 1] # Create a high-level memory object to return to the UI mem = chirp_common.Memory() # Memory number mem.number = number if _mem.get_raw()[0] == "\xFF": mem.empty = True # but is not enough, you have to clear the memory in the mmap # to get it ready for the sync_out process, just in case _mem.set_raw("\xFF" * 16) # set the channel to inactive state self.set_active(number - 1, False) return mem # Freq and offset mem.freq = int(_mem.rxfreq) * 10 # tx freq can be blank if _mem.get_raw()[4] == "\xFF" or int(_mem.txen) == 255: # TX freq not set mem.offset = 0 mem.duplex = "off" else: # TX feq set offset = (int(_mem.txfreq) * 10) - mem.freq if offset < 0: mem.offset = abs(offset) mem.duplex = "-" elif offset > 0: mem.offset = offset mem.duplex = "+" else: mem.offset = 0 # power mem.power = POWER_LEVELS[int(_mem.power)] # skip mem.skip = self.get_scan(number - 1) # tone data rxtone = txtone = None txtone = self.decode_tone(_mem.tx_tone) rxtone = self.decode_tone(_mem.rx_tone) chirp_common.split_tone_decode(mem, txtone, rxtone) # Extra # bank and number in the channel mem.extra = RadioSettingGroup("extra", "Extra") bl = RadioSetting("busy", "Busy Channel lock", RadioSettingValueBoolean( not bool(_mem.busy))) mem.extra.append(bl) sf = RadioSetting("shift", "Beat Shift", RadioSettingValueBoolean( not bool(_mem.shift))) mem.extra.append(sf) return mem
def get_memory(self, number): bitpos = (1 << ((number - 1) % 8)) bytepos = ((number - 1) / 8) LOG.debug("bitpos %s" % bitpos) LOG.debug("bytepos %s" % bytepos) _mem = self._memobj.memory[number - 1] mem = chirp_common.Memory() mem.number = number mem.freq = int(_mem.rx_freq) * 10 txfreq = int(_mem.tx_freq) * 10 if txfreq == mem.freq: mem.duplex = "" elif txfreq == 0: mem.duplex = "off" mem.offset = 0 # 166666665*10 is the equivalent for FF FF FF FF # stored in the TX field elif txfreq == 1666666650: mem.duplex = "off" mem.offset = 0 elif txfreq < mem.freq: mem.duplex = "-" mem.offset = mem.freq - txfreq elif txfreq > mem.freq: mem.duplex = "+" mem.offset = txfreq - mem.freq # get bandwith FM or NFM mem.mode = MODE_LIST[_mem.mode] # tone data txtone = self.decode_tone(_mem.tx_tone) rxtone = self.decode_tone(_mem.rx_tone) chirp_common.split_tone_decode(mem, txtone, rxtone) mem.power = POWER_LEVELS[_mem.power] # add extra channel settings to the OTHER tab of the properties # extra settings are unfortunately inverted mem.extra = RadioSettingGroup("extra", "Extra") scanadd = RadioSetting( "scanadd", "Scan Add", RadioSettingValueBoolean(not bool(_mem.scanadd))) scanadd.set_doc("Add channel for scanning") mem.extra.append(scanadd) bclo = RadioSetting("bclo", "Busy Lockout", RadioSettingValueBoolean(not bool(_mem.bclo))) bclo.set_doc("Busy Lockout") mem.extra.append(bclo) scramb = RadioSetting("scramb", "Scramble", RadioSettingValueBoolean(not bool(_mem.scramb))) scramb.set_doc("Scramble Audio Signal") mem.extra.append(scramb) compand = RadioSetting( "compand", "Compander", RadioSettingValueBoolean(not bool(_mem.compand))) compand.set_doc("Compress Audio for TX") mem.extra.append(compand) return mem
def get_memory(self, number): """Get the mem representation from the radio image""" _mem = self._memobj.memory[number - 1] # Create a high-level memory object to return to the UI mem = chirp_common.Memory() # Memory number mem.number = number if _mem.get_raw()[0] == "\xFF": mem.empty = True # but is not enough, you have to clear the memory in the mmap # to get it ready for the sync_out process, just in case _mem.set_raw("\xFF" * 16) # set the channel to inactive state self.set_active(number - 1, False) return mem # Freq and offset mem.freq = int(_mem.rxfreq) * 10 # tx freq can be blank if _mem.get_raw()[4] == "\xFF" or int(_mem.txen) == 255: # TX freq not set mem.offset = 0 mem.duplex = "off" else: # TX feq set offset = (int(_mem.txfreq) * 10) - mem.freq if offset < 0: mem.offset = abs(offset) mem.duplex = "-" elif offset > 0: mem.offset = offset mem.duplex = "+" else: mem.offset = 0 # power mem.power = POWER_LEVELS[int(_mem.power)] # skip mem.skip = self.get_scan(number - 1) # tone data rxtone = txtone = None txtone = self.decode_tone(_mem.tx_tone) rxtone = self.decode_tone(_mem.rx_tone) chirp_common.split_tone_decode(mem, txtone, rxtone) # Extra # bank and number in the channel mem.extra = RadioSettingGroup("extra", "Extra") bl = RadioSetting("busy", "Busy Channel lock", RadioSettingValueBoolean(not bool(_mem.busy))) mem.extra.append(bl) sf = RadioSetting("shift", "Beat Shift", RadioSettingValueBoolean(not bool(_mem.shift))) mem.extra.append(sf) return mem
def get_memory(self, number): bitpos = (1 << (number % 8)) bytepos = (number / 8) _mem = self._memobj.memory[number] _skp = self._memobj.skip_flags[bytepos] _usd = self._memobj.used_flags[bytepos] mem = chirp_common.Memory() mem.number = number if _usd & bitpos: mem.empty = True return mem mem.freq = int(_mem.freq) * 100 mem.offset = int(_mem.offset) * 100 mem.name = self.filter_name(str(_mem.name).rstrip()) mem.duplex = DUPLEXES[_mem.duplex] mem.mode = MODES[_mem.channel_width] if _mem.tx_off == True: mem.duplex = "off" mem.offset = 0 rxtone = txtone = None rxmode = TMODES[_mem.rxtmode] txmode = TMODES[_mem.txtmode] if txmode == "Tone": txtone = TONES[_mem.txtone] elif txmode == "DTCS": txtone = chirp_common.ALL_DTCS_CODES[self._get_dcs_index(_mem, 'tx')] if rxmode == "Tone": rxtone = TONES[_mem.rxtone] elif rxmode == "DTCS": rxtone = chirp_common.ALL_DTCS_CODES[self._get_dcs_index(_mem, 'rx')] rxpol = _mem.rxinv and "R" or "N" txpol = _mem.txinv and "R" or "N" chirp_common.split_tone_decode(mem, (txmode, txtone, txpol), (rxmode, rxtone, rxpol)) if _skp & bitpos: mem.skip = "S" mem.power = POWER_LEVELS[_mem.power] mem.extra = RadioSettingGroup("Extra", "extra") rs = RadioSetting("bcl", "Busy Channel Lockout", RadioSettingValueList(BCLO, BCLO[_mem.bcl])) mem.extra.append(rs) rs = RadioSetting("squelch", "Squelch", RadioSettingValueList(SQUELCH, SQUELCH[_mem.squelch])) mem.extra.append(rs) return mem
def get_memory(self, number): _mem, _name = self._get_memobjs(number) mem = chirp_common.Memory() if isinstance(number, str): mem.number = SPECIALS[number] mem.extd_number = number else: mem.number = number if _mem.get_raw().startswith("\xFF\xFF\xFF\xFF"): mem.empty = True return mem if isinstance(number, int): e = self._memobj.enable[(number - 1) / 8] enabled = e.flags[7 - ((number - 1) % 8)] s = self._memobj.skip[(number - 1) / 8] dont_skip = s.flags[7 - ((number - 1) % 8)] else: enabled = True dont_skip = True if not enabled: mem.empty = True return mem mem.freq = int(_mem.rx_freq) * 10 mem.duplex = THUVF8D_DUPLEX[_mem.duplex] mem.offset = int(_mem.offset) * 10 txmode, txval, txpol = self._decode_tone(_mem.tx_tone) rxmode, rxval, rxpol = self._decode_tone(_mem.rx_tone) chirp_common.split_tone_decode(mem, (txmode, txval, txpol), (rxmode, rxval, rxpol)) mem.name = str(_mem.name).rstrip('\xFF ') if dont_skip: mem.skip = '' else: mem.skip = 'S' mem.mode = _mem.wideband and "FM" or "NFM" mem.power = POWER_LEVELS[1 - _mem.ishighpower] mem.extra = RadioSettingGroup("extra", "Extra Settings") rs = RadioSetting( "pttid", "PTT ID", RadioSettingValueList(PTTID_LIST, PTTID_LIST[_mem.pttid])) mem.extra.append(rs) rs = RadioSetting("vox", "VOX", RadioSettingValueBoolean(_mem.vox)) mem.extra.append(rs) rs = RadioSetting( "bclo", "Busy Channel Lockout", RadioSettingValueList(BCLO_LIST, BCLO_LIST[_mem.bclo])) mem.extra.append(rs) rs = RadioSetting( "apro", "APRO", RadioSettingValueList(APRO_LIST, APRO_LIST[_mem.apro])) mem.extra.append(rs) rs = RadioSetting( "rpt_md", "Repeater Mode", RadioSettingValueList(RPTMD_LIST, RPTMD_LIST[_mem.rpt_md])) mem.extra.append(rs) return mem
def get_memory(self, number): bitpos = (1 << (number % 8)) bytepos = (number / 8) _mem = self._memobj.memory[number] _skp = self._memobj.skip_flags[bytepos] _usd = self._memobj.used_flags[bytepos] mem = chirp_common.Memory() mem.number = number if _usd & bitpos: mem.empty = True return mem mem.freq = int(_mem.freq) * 100 # compensate for 6.25 and 12.5 kHz tuning steps, add 500 Hz if needed lastdigit = int(_mem.freq) % 10 if (lastdigit == 2 or lastdigit == 7): mem.freq += 50 mem.offset = int(_mem.offset) * 100 mem.name = self.filter_name(str(_mem.name).rstrip()) mem.duplex = DUPLEXES[_mem.duplex] mem.mode = MODES[_mem.channel_width] if _mem.tx_off == True: mem.duplex = "off" mem.offset = 0 rxtone = txtone = None rxmode = TMODES[_mem.rxtmode] txmode = TMODES[_mem.txtmode] if txmode == "Tone": txtone = TONES[_mem.txtone] elif txmode == "DTCS": txtone = chirp_common.ALL_DTCS_CODES[self._get_dcs_index( _mem, 'tx')] if rxmode == "Tone": rxtone = TONES[_mem.rxtone] elif rxmode == "DTCS": rxtone = chirp_common.ALL_DTCS_CODES[self._get_dcs_index( _mem, 'rx')] rxpol = _mem.rxinv and "R" or "N" txpol = _mem.txinv and "R" or "N" chirp_common.split_tone_decode(mem, (txmode, txtone, txpol), (rxmode, rxtone, rxpol)) if _skp & bitpos: mem.skip = "S" mem.power = POWER_LEVELS[_mem.power] mem.extra = RadioSettingGroup("Extra", "extra") rs = RadioSetting("bcl", "Busy Channel Lockout", RadioSettingValueList(BCLO, BCLO[_mem.bcl])) mem.extra.append(rs) rs = RadioSetting( "squelch", "Squelch", RadioSettingValueList(SQUELCH, SQUELCH[_mem.squelch])) mem.extra.append(rs) return mem
def get_memory(self, number): """Get the mem representation from the radio image""" _mem = self._memobj.memory[number - 1] _tone = self._memobj.tone[number - 1] _ch = self._memobj.ch_settings[number - 1] # Create a high-level memory object to return to the UI mem = chirp_common.Memory() # Memory number mem.number = number if _mem.get_raw()[0] == "\xFF" or not self.get_active(number - 1): mem.empty = True # but is not enough, you have to crear the memory in the mmap # to get it ready for the sync_out process _mem.set_raw("\xFF" * 8) return mem # Freq and offset mem.freq = int(_mem.rxfreq) * 10 # tx freq can be blank if _mem.get_raw()[4] == "\xFF": # TX freq not set mem.offset = 0 mem.duplex = "off" else: # TX feq set offset = (int(_mem.txfreq) * 10) - mem.freq if offset < 0: mem.offset = abs(offset) mem.duplex = "-" elif offset > 0: mem.offset = offset mem.duplex = "+" else: mem.offset = 0 # power mem.power = POWER_LEVELS[_ch.power] # wide/marrow mem.mode = MODES[_ch.wide] # skip mem.skip = self.get_scan(number - 1) # tone data rxtone = txtone = None txtone = self.decode_tone(_tone.tx_tone) rxtone = self.decode_tone(_tone.rx_tone) chirp_common.split_tone_decode(mem, txtone, rxtone) # Extra # bank and number in the channel mem.extra = RadioSettingGroup("extra", "Extra") bl = RadioSetting("busy_lock", "Busy Channel lock", RadioSettingValueBoolean( not bool(_ch.busy_lock))) mem.extra.append(bl) return mem
def get_memory(self, number): _mem, _name = self._get_memobjs(number) mem = chirp_common.Memory() if isinstance(number, str): mem.number = SPECIALS[number] mem.extd_number = number else: mem.number = number if _mem.get_raw().startswith("\xFF\xFF\xFF\xFF"): mem.empty = True return mem if isinstance(number, int): enabled = self._memobj.enable[(number - 1) / 8].flags[7 - ((number - 1) % 8)] dont_skip = self._memobj.skip[(number - 1) / 8].flags[7 - ((number - 1) % 8)] else: enabled = True dont_skip = True if not enabled: mem.empty = True return mem mem.freq = int(_mem.rx_freq) * 10 mem.duplex = THUVF8D_DUPLEX[_mem.duplex] mem.offset = int(_mem.offset) * 10 txmode, txval, txpol = self._decode_tone(_mem.tx_tone) rxmode, rxval, rxpol = self._decode_tone(_mem.rx_tone) chirp_common.split_tone_decode(mem, (txmode, txval, txpol), (rxmode, rxval, rxpol)) mem.name = str(_mem.name).rstrip('\xFF ') mem.skip = dont_skip and "" or "S" mem.mode = _mem.wideband and "FM" or "NFM" mem.power = POWER_LEVELS[1 - _mem.ishighpower] mem.extra = RadioSettingGroup("extra", "Extra Settings") rs = RadioSetting("pttid", "PTT ID", RadioSettingValueList(PTTID_LIST, PTTID_LIST[_mem.pttid])) mem.extra.append(rs) rs = RadioSetting("vox", "VOX", RadioSettingValueBoolean(_mem.vox)) mem.extra.append(rs) rs = RadioSetting("bclo", "Busy Channel Lockout", RadioSettingValueList(BCLO_LIST, BCLO_LIST[_mem.bclo])) mem.extra.append(rs) rs = RadioSetting("apro", "APRO", RadioSettingValueList(APRO_LIST, APRO_LIST[_mem.apro])) mem.extra.append(rs) rs = RadioSetting("rpt_md", "Repeater Mode", RadioSettingValueList(RPTMD_LIST, RPTMD_LIST[_mem.rpt_md])) mem.extra.append(rs) return mem
def get_memory(self, number): """Get the mem representation from the radio image""" bitpos = (1 << (number % 8)) bytepos = (number / 8) _mem = self._memory_obj()[number] _names = self._name_obj()[number] _scn = self._scan_obj()[bytepos] _usd = self._used_obj()[bytepos] isused = bitpos & int(_usd) isscan = bitpos & int(_scn) # Create a high-level memory object to return to the UI mem = chirp_common.Memory() # Memory number mem.number = number if not isused: mem.empty = True return mem # Freq and offset mem.freq = int(_mem.rxfreq) * 10 # tx freq can be blank if _mem.get_raw()[4] == "\xFF": # TX freq not set mem.offset = 0 mem.duplex = "off" else: # TX feq set offset = (int(_mem.txfreq) * 10) - mem.freq if offset < 0: mem.offset = abs(offset) mem.duplex = "-" elif offset > 0: mem.offset = offset mem.duplex = "+" else: mem.offset = 0 # skip if not isscan: mem.skip = "S" # name TAG of the channel mem.name = str(_names.name).strip("\xFF") # power mem.power = POWER_LEVELS[int(_mem.txp)] # wide/narrow mem.mode = MODES[int(_mem.wn)] # tone data rxtone = txtone = None txtone = self.decode_tone(_mem.txtone) rxtone = self.decode_tone(_mem.rxtone) chirp_common.split_tone_decode(mem, txtone, rxtone) # Extra mem.extra = RadioSettingGroup("extra", "Extra") bcl = RadioSetting("bcl", "Busy channel lockout", RadioSettingValueBoolean(bool(_mem.bcl))) mem.extra.append(bcl) revert = RadioSetting("revert", "Revert", RadioSettingValueBoolean(bool(_mem.revert))) mem.extra.append(revert) dname = RadioSetting("dname", "Display name", RadioSettingValueBoolean(bool(_mem.dname))) mem.extra.append(dname) return mem
def get_memory(self, number): _mem = self._memobj.memory[number - 1] mem = chirp_common.Memory() mem.number = number if _mem.get_raw().startswith("\xFF\xFF\xFF\xFF"): mem.empty = True return mem mem.freq = int(_mem.rx_freq) * 10 txfreq = int(_mem.tx_freq) * 10 if self._is_txinh(_mem): mem.duplex = "off" mem.offset = 0 elif txfreq == mem.freq: mem.duplex = "" elif abs(txfreq - mem.freq) > 70000000: mem.duplex = "split" mem.offset = txfreq elif txfreq < mem.freq: mem.duplex = "-" mem.offset = mem.freq - txfreq elif txfreq > mem.freq: mem.duplex = "+" mem.offset = txfreq - mem.freq txmode, txval, txpol = self._decode_tone(_mem.tx_tone) rxmode, rxval, rxpol = self._decode_tone(_mem.rx_tone) chirp_common.split_tone_decode(mem, (txmode, txval, txpol), (rxmode, rxval, rxpol)) mem.name = str(self._memobj.names[number - 1].name) mem.name = mem.name.replace("\xFF", " ").rstrip() mem.skip = not _mem.scan and "S" or "" mem.mode = _mem.isnarrow and "NFM" or "FM" mem.power = POWER_LEVELS[1 - _mem.ishighpower] mem.extra = RadioSettingGroup("extra", "Extra Settings") rs = RadioSetting("pttid", "PTT ID", RadioSettingValueList(PTTID_LIST, PTTID_LIST[_mem.pttid])) mem.extra.append(rs) rs = RadioSetting("vox", "VOX", RadioSettingValueBoolean(_mem.vox)) mem.extra.append(rs) rs = RadioSetting("bcl", "Busy Channel Lockout", RadioSettingValueList(BCL_LIST, BCL_LIST[_mem.bcl])) mem.extra.append(rs) rs = RadioSetting("scramble_code", "Scramble Code", RadioSettingValueList(CODES_LIST, CODES_LIST[_mem.scramble_code])) mem.extra.append(rs) return mem
def get_memory(self, number): bitpos = (1 << ((number - 1) % 8)) bytepos = ((number - 1) / 8) LOG.debug("bitpos %s" % bitpos) LOG.debug("bytepos %s" % bytepos) _mem = self._memobj.memory[number - 1] mem = chirp_common.Memory() mem.number = number mem.freq = int(_mem.rx_freq) * 10 txfreq = int(_mem.tx_freq) * 10 if txfreq == mem.freq: mem.duplex = "" elif txfreq == 0: mem.duplex = "off" mem.offset = 0 # 166666665*10 is the equivalent for FF FF FF FF # stored in the TX field elif txfreq == 1666666650: mem.duplex = "off" mem.offset = 0 elif txfreq < mem.freq: mem.duplex = "-" mem.offset = mem.freq - txfreq elif txfreq > mem.freq: mem.duplex = "+" mem.offset = txfreq - mem.freq # get bandwith FM or NFM mem.mode = MODE_LIST[_mem.mode] # tone data txtone = self.decode_tone(_mem.tx_tone) rxtone = self.decode_tone(_mem.rx_tone) chirp_common.split_tone_decode(mem, txtone, rxtone) mem.power = POWER_LEVELS[_mem.power] # add extra channel settings to the OTHER tab of the properties # extra settings are unfortunately inverted mem.extra = RadioSettingGroup("extra", "Extra") scanadd = RadioSetting("scanadd", "Scan Add", RadioSettingValueBoolean( not bool(_mem.scanadd))) scanadd.set_doc("Add channel for scanning") mem.extra.append(scanadd) bclo = RadioSetting("bclo", "Busy Lockout", RadioSettingValueBoolean(not bool(_mem.bclo))) bclo.set_doc("Busy Lockout") mem.extra.append(bclo) scramb = RadioSetting("scramb", "Scramble", RadioSettingValueBoolean(not bool(_mem.scramb))) scramb.set_doc("Scramble Audio Signal") mem.extra.append(scramb) compand = RadioSetting("compand", "Compander", RadioSettingValueBoolean( not bool(_mem.compand))) compand.set_doc("Compress Audio for TX") mem.extra.append(compand) return mem
def get_memory(self, number): _mem, _flg = self._get_memobjs(number) mem = chirp_common.Memory() mem.number = number if _flg.get() == 0x0F: mem.empty = True return mem mem.freq = int(_mem.freq) * 100 # compensate for 6.25 and 12.5 kHz tuning steps, add 500 Hz if needed lastdigit = int(_mem.freq) % 10 if (lastdigit == 2 or lastdigit == 7): mem.freq += 50 mem.offset = int(_mem.offset) * 100 mem.name = str(_mem.name).rstrip() mem.duplex = DUPLEXES[_mem.duplex] mem.mode = _mem.is_am and "AM" or MODES[_mem.channel_width] mem.tuning_step = TUNING_STEPS[_mem.tune_step] if _mem.txoff: mem.duplex = DUPLEXES[3] rxtone = txtone = None rxmode = TMODES[_mem.rxtmode] if (_mem.sqlMode == SQL_MODES.index("Carrier") or _mem.sqlMode == SQL_MODES.index("Opt Sig Only")): rxmode = TMODES.index('') txmode = TMODES[_mem.txtmode] if txmode == "Tone": # If custom tone is being used, show as 88.5 (and set # checkbox in extras) Future: Improve chirp_common, so I # can add "CUSTOM" into TONES if _mem.txtone == len(TONES): txtone = 88.5 else: txtone = TONES[_mem.txtone] elif txmode == "DTCS": txtone = chirp_common.ALL_DTCS_CODES[self._get_dcs_index( _mem, 'tx')] if rxmode == "Tone": # If custom tone is being used, show as 88.5 (and set # checkbox in extras) Future: Improve chirp_common, so I # can add "CUSTOM" into TONES if _mem.rxtone == len(TONES): rxtone = 88.5 else: rxtone = TONES[_mem.rxtone] elif rxmode == "DTCS": rxtone = chirp_common.ALL_DTCS_CODES[self._get_dcs_index( _mem, 'rx')] rxpol = _mem.rxinv and "R" or "N" txpol = _mem.txinv and "R" or "N" chirp_common.split_tone_decode(mem, (txmode, txtone, txpol), (rxmode, rxtone, rxpol)) mem.skip = _flg.get_skip() and "S" or _flg.get_pskip() and "P" or "" mem.power = POWER_LEVELS[_mem.power] mem.extra = RadioSettingGroup("Extra", "extra") rs = RadioSetting("rev", "Reverse", RadioSettingValueBoolean(_mem.rev)) mem.extra.append(rs) rs = RadioSetting("compander", "Compander", RadioSettingValueBoolean(_mem.compander)) mem.extra.append(rs) rs = RadioSetting("talkaround", "Talkaround", RadioSettingValueBoolean(_mem.talkaround)) mem.extra.append(rs) rs = RadioSetting("pttid", "PTT ID", RadioSettingValueList(PTT_IDS, PTT_IDS[_mem.pttid])) mem.extra.append(rs) rs = RadioSetting("bclo", "Busy Channel Lockout", RadioSettingValueList(BCLO, BCLO[_mem.bclo])) mem.extra.append(rs) rs = RadioSetting( "optsig", "Optional Signaling", RadioSettingValueList(OPT_SIGS, OPT_SIGS[_mem.optsig])) mem.extra.append(rs) rs = RadioSetting( "OPTSIGSQL", "Squelch w/Opt Signaling", RadioSettingValueList( OPT_SIG_SQL, SQL_MODES[_mem.sqlMode] if SQL_MODES[_mem.sqlMode] in OPT_SIG_SQL else "Off")) mem.extra.append(rs) rs = RadioSetting( "dtmfSlotNum", "DTMF", RadioSettingValueList(DTMF_SLOTS, DTMF_SLOTS[_mem.dtmfSlotNum])) mem.extra.append(rs) rs = RadioSetting( "twotone", "2-Tone", RadioSettingValueList(TONE2_SLOTS, TONE2_SLOTS[_mem.twotone])) mem.extra.append(rs) rs = RadioSetting( "fivetone", "5-Tone", RadioSettingValueList(TONE5_SLOTS, TONE5_SLOTS[_mem.fivetone])) mem.extra.append(rs) # Chose not to expose scramble rs = RadioSetting("scramble", # "Scrambler Switch", RadioSettingValueList(SCRAMBLE_CODES, # SCRAMBLE_CODES[_mem.scramble])) mem.extra.append(rs) # Memory properties dialog is only capable of Boolean and List # RadioSettingValue classes, so cannot configure it rs = # RadioSetting("custtone", "Custom CTCSS", # RadioSettingValueFloat(min(TONES), max(TONES), _mem.custtone # and _mem.custtone / 10 or 151.1, 0.1, 1)) # mem.extra.append(rs) custToneStr = chirp_common.format_freq(_mem.custtone) rs = RadioSetting("CUSTTONETX", "Use Custom CTCSS (%s) for Tx" % custToneStr, RadioSettingValueBoolean(_mem.txtone == len(TONES))) mem.extra.append(rs) rs = RadioSetting("CUSTTONERX", "Use Custom CTCSS (%s) for Rx" % custToneStr, RadioSettingValueBoolean(_mem.rxtone == len(TONES))) mem.extra.append(rs) return mem
def get_memory(self, number): mem = chirp_common.Memory() _mem = self._memobj.channels[number - 1] _nam = self._memobj.names[number - 1] mem.number = number bitpos = (1 << ((number - 1) % 8)) bytepos = ((number - 1) / 8) _scn = self._memobj.scanflags[bytepos] _usd = self._memobj.usedflags[bytepos] isused = bitpos & int(_usd) isscan = bitpos & int(_scn) if not isused: mem.empty = True return mem mem.freq = int(_mem.rxfreq) * 10 # We'll consider any blank (i.e. 0MHz frequency) to be empty if mem.freq == 0: mem.empty = True return mem if _mem.rxfreq.get_raw() == "\xFF\xFF\xFF\xFF": mem.empty = True return mem if _mem.get_raw() == ("\xFF" * 16): LOG.debug("Initializing empty memory") _mem.set_raw("\x00" * 16) # Freq and offset mem.freq = int(_mem.rxfreq) * 10 # tx freq can be blank if _mem.get_raw()[4] == "\xFF": # TX freq not set mem.offset = 0 mem.duplex = "off" else: # TX freq set offset = (int(_mem.txfreq) * 10) - mem.freq if offset != 0: if _split(self.get_features(), mem.freq, int(_mem.txfreq) * 10): mem.duplex = "split" mem.offset = int(_mem.txfreq) * 10 elif offset < 0: mem.offset = abs(offset) mem.duplex = "-" elif offset > 0: mem.offset = offset mem.duplex = "+" else: mem.offset = 0 for char in _nam.name: if str(char) == "\xFF": char = " " mem.name += str(char) mem.name = mem.name.rstrip() mem.mode = _mem.isnarrow and "NFM" or "FM" rxtone = txtone = None txtone = self.decode_tone(_mem.txtone) rxtone = self.decode_tone(_mem.rxtone) chirp_common.split_tone_decode(mem, txtone, rxtone) mem.power = RT23_POWER_LEVELS[_mem.highpower] if not isscan: mem.skip = "S" mem.extra = RadioSettingGroup("Extra", "extra") rs = RadioSetting("bcl", "BCL", RadioSettingValueBoolean(_mem.bcl)) mem.extra.append(rs) rs = RadioSetting( "pttid", "PTT ID", RadioSettingValueList(LIST_PTTID, LIST_PTTID[_mem.pttid])) mem.extra.append(rs) rs = RadioSetting( "signaling", "Optional Signaling", RadioSettingValueList(LIST_SIGNALING, LIST_SIGNALING[_mem.signaling])) mem.extra.append(rs) return mem