# HG changeset patch # User Marco Filippi iz3gme.marco@gmail.com # Date 1410435831 -7200 # gio set 11 13:43:51 2014 +0200 # Node ID 5c6617d6f4bd85c47df255d41a87f2245f0dc3c2 # Parent 6dd9925f0d32b992c854ae3fb31ec0180626c90c [FT8x7] code cleanup
No functional changes at all, only some code cleanup to make code look better and pylint happier
In support of #159
diff -r 6dd9925f0d32 -r 5c6617d6f4bd chirp/ft817.py --- a/chirp/ft817.py mar set 02 09:53:39 2014 -0700 +++ b/chirp/ft817.py gio set 11 13:43:51 2014 +0200 @@ -36,7 +36,7 @@
DUPLEX = ["", "-", "+", "split"] # narrow modes has to be at end - MODES = ["LSB", "USB", "CW", "CWR", "AM", "FM", "DIG", "PKT", "NCW", + MODES = ["LSB", "USB", "CW", "CWR", "AM", "FM", "DIG", "PKT", "NCW", "NCWR", "NFM"] TMODES = ["", "Tone", "TSQL", "DTCS"] STEPSFM = [5.0, 6.25, 10.0, 12.5, 15.0, 20.0, 25.0, 50.0] @@ -46,14 +46,14 @@ # warning ranges has to be in this exact order VALID_BANDS = [(100000, 33000000), (33000000, 56000000), (76000000, 108000000), (108000000, 137000000), - (137000000, 154000000), (420000000, 470000000)] + (137000000, 154000000), (420000000, 470000000)]
CHARSET = list(chirp_common.CHARSET_ASCII) CHARSET.remove("\")
_memsize = 6509 # block 9 (130 Bytes long) is to be repeted 40 times - _block_lengths = [ 2, 40, 208, 182, 208, 182, 198, 53, 130, 118, 118] + _block_lengths = [2, 40, 208, 182, 208, 182, 198, 53, 130, 118, 118]
MEM_FORMAT = """ struct mem_struct { @@ -89,7 +89,7 @@ u32 offset; u8 name[8]; }; - + #seekto 0x4; struct { u8 fst:1, @@ -190,15 +190,15 @@ struct mem_struct qmb; struct mem_struct mtqmb; struct mem_struct mtune; - + #seekto 0x3FD; u8 visible[25]; u8 pmsvisible; - + #seekto 0x417; u8 filled[25]; u8 pmsfilled; - + #seekto 0x431; struct mem_struct memory[200]; struct mem_struct pms[2]; @@ -209,49 +209,49 @@ #seekto 0x1979; struct mem_struct sixtymeterchannels[5]; """ - _CALLSIGN_CHARSET = [chr(x) for x in range(ord("0"), ord("9")+1) + - range(ord("A"), ord("Z")+1) + + _CALLSIGN_CHARSET = [chr(x) for x in range(ord("0"), ord("9") + 1) + + range(ord("A"), ord("Z") + 1) + [ord(" ")]] _CALLSIGN_CHARSET_REV = dict(zip(_CALLSIGN_CHARSET, - range(0,len(_CALLSIGN_CHARSET)))) + range(0, len(_CALLSIGN_CHARSET))))
# WARNING Index are hard wired in memory management code !!! SPECIAL_MEMORIES = { - "VFOa-1.8M" : -35, - "VFOa-3.5M" : -34, - "VFOa-7M" : -33, - "VFOa-10M" : -32, - "VFOa-14M" : -31, - "VFOa-18M" : -30, - "VFOa-21M" : -29, - "VFOa-24M" : -28, - "VFOa-28M" : -27, - "VFOa-50M" : -26, - "VFOa-FM" : -25, - "VFOa-AIR" : -24, - "VFOa-144" : -23, - "VFOa-430" : -22, - "VFOa-HF" : -21, - "VFOb-1.8M" : -20, - "VFOb-3.5M" : -19, - "VFOb-7M" : -18, - "VFOb-10M" : -17, - "VFOb-14M" : -16, - "VFOb-18M" : -15, - "VFOb-21M" : -14, - "VFOb-24M" : -13, - "VFOb-28M" : -12, - "VFOb-50M" : -11, - "VFOb-FM" : -10, - "VFOb-AIR" : -9, - "VFOb-144M" : -8, - "VFOb-430M" : -7, - "VFOb-HF" : -6, - "HOME HF" : -5, - "HOME 50M" : -4, - "HOME 144M" : -3, - "HOME 430M" : -2, - "QMB" : -1, + "VFOa-1.8M": -35, + "VFOa-3.5M": -34, + "VFOa-7M": -33, + "VFOa-10M": -32, + "VFOa-14M": -31, + "VFOa-18M": -30, + "VFOa-21M": -29, + "VFOa-24M": -28, + "VFOa-28M": -27, + "VFOa-50M": -26, + "VFOa-FM": -25, + "VFOa-AIR": -24, + "VFOa-144": -23, + "VFOa-430": -22, + "VFOa-HF": -21, + "VFOb-1.8M": -20, + "VFOb-3.5M": -19, + "VFOb-7M": -18, + "VFOb-10M": -17, + "VFOb-14M": -16, + "VFOb-18M": -15, + "VFOb-21M": -14, + "VFOb-24M": -13, + "VFOb-28M": -12, + "VFOb-50M": -11, + "VFOb-FM": -10, + "VFOb-AIR": -9, + "VFOb-144M": -8, + "VFOb-430M": -7, + "VFOb-HF": -6, + "HOME HF": -5, + "HOME 50M": -4, + "HOME 144M": -3, + "HOME 430M": -2, + "QMB": -1, } FIRST_VFOB_INDEX = -6 LAST_VFOB_INDEX = -20 @@ -259,16 +259,16 @@ LAST_VFOA_INDEX = -35
SPECIAL_PMS = { - "PMS-L" : -37, - "PMS-U" : -36, + "PMS-L": -37, + "PMS-U": -36, } LAST_PMS_INDEX = -37
SPECIAL_MEMORIES.update(SPECIAL_PMS) - + SPECIAL_MEMORIES_REV = dict(zip(SPECIAL_MEMORIES.values(), SPECIAL_MEMORIES.keys())) - + @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() @@ -295,18 +295,19 @@ else: attempts = 5 for _i in range(0, attempts): - data = self.pipe.read(block+2) + data = self.pipe.read(block + 2) if data: break time.sleep(0.5) - if len(data) == block+2 and data[0] == chr(blocknum): + if len(data) == block + 2 and data[0] == chr(blocknum): checksum = yaesu_clone.YaesuChecksum(1, block) if checksum.get_existing(data) != \ checksum.get_calculated(data): raise Exception("Checksum Failed [%02X<>%02X] block %02X" % (checksum.get_existing(data), checksum.get_calculated(data), blocknum)) - data = data[1:block+1] # Chew away the block number and the checksum + # Chew away the block number and the checksum + data = data[1:block + 1] else: if lastblock and self._US_model: raise Exception(_("Unable to read last block. " @@ -315,18 +316,18 @@ "Please choose the correct model and try again.")) else: raise Exception("Unable to read block %02X expected %i got %i" % - (blocknum, block+2, len(data))) - + (blocknum, block + 2, len(data))) + if os.getenv("CHIRP_DEBUG"): print "Read %i" % len(data) - return data - + return data + def _clone_in(self): # Be very patient with the radio self.pipe.setTimeout(2) - + start = time.time() - + data = "" blocks = 0 status = chirp_common.Status() @@ -339,32 +340,33 @@ repeat = 40 else: repeat = 1 - for _i in range(0, repeat): - data += self._read(block, blocks, blocks == nblocks-1) + for _i in range(0, repeat): + data += self._read(block, blocks, blocks == nblocks - 1) self.pipe.write(chr(CMD_ACK)) blocks += 1 status.cur = blocks self.status_fn(status) - + if not self._US_model: status.msg = _("Clone completed, checking for spurious bytes") self.status_fn(status) moredata = self.pipe.read(2) if moredata: - raise Exception(_("Radio sent data after the last awaited block, " + raise Exception( + _("Radio sent data after the last awaited block, " "this happens when the selected model is a non-US " "but the radio is a US one. " "Please choose the correct model and try again.")) - - + + print "Clone completed in %i seconds" % (time.time() - start) - + return memmap.MemoryMap(data) - + def _clone_out(self): delay = 0.5 start = time.time() - + blocks = 0 pos = 0 status = chirp_common.Status() @@ -378,18 +380,18 @@ repeat = 1 for _i in range(0, repeat): time.sleep(0.01) - checksum = yaesu_clone.YaesuChecksum(pos, pos+block-1) + checksum = yaesu_clone.YaesuChecksum(pos, pos + block - 1) if os.getenv("CHIRP_DEBUG"): print "Block %i - will send from %i to %i byte " % \ (blocks, pos, pos + block) print util.hexprint(chr(blocks)) - print util.hexprint(self.get_mmap()[pos:pos+block]) + print util.hexprint(self.get_mmap()[pos:pos + block]) print util.hexprint(chr(checksum.get_calculated( self.get_mmap()))) self.pipe.write(chr(blocks)) - self.pipe.write(self.get_mmap()[pos:pos+block]) + self.pipe.write(self.get_mmap()[pos:pos + block]) self.pipe.write(chr(checksum.get_calculated(self.get_mmap()))) buf = self.pipe.read(1) if not buf or buf[0] != chr(CMD_ACK): @@ -403,9 +405,9 @@ blocks += 1 status.cur = blocks self.status_fn(status) - + print "Clone completed in %i seconds" % (time.time() - start) - + def sync_in(self): try: self._mmap = self._clone_in() @@ -448,7 +450,7 @@ return rf
def get_raw_memory(self, number): - return repr(self._memobj.memory[number-1]) + return repr(self._memobj.memory[number - 1])
def _get_duplex(self, mem, _mem): if _mem.is_duplex == 1: @@ -524,8 +526,8 @@ mem.empty = True return mem _mem = self._memobj.pms[-self.LAST_PMS_INDEX + mem.number] - immutable = ["number", "skip", "rtone", "ctone", "extd_number", - "dtcs", "tmode", "cross_mode", "dtcs_polarity", + immutable = ["number", "skip", "rtone", "ctone", "extd_number", + "dtcs", "tmode", "cross_mode", "dtcs_polarity", "power", "duplex", "offset", "comment"] else: raise Exception("Sorry, special memory index %i " % mem.number + @@ -545,11 +547,11 @@
# TODO add frequency range check for vfo and home memories if mem.number in range(self.FIRST_VFOA_INDEX, - self.LAST_VFOA_INDEX -1, + self.LAST_VFOA_INDEX - 1, -1): _mem = self._memobj.vfoa[-self.LAST_VFOA_INDEX + mem.number] elif mem.number in range(self.FIRST_VFOB_INDEX, - self.LAST_VFOB_INDEX -1, + self.LAST_VFOB_INDEX - 1, -1): _mem = self._memobj.vfob[-self.LAST_VFOB_INDEX + mem.number] elif mem.number in range(-2, -6, -1): @@ -587,9 +589,11 @@ self._set_memory(mem, _mem)
def _get_normal(self, number): - _mem = self._memobj.memory[number-1] - used = (self._memobj.visible[(number-1)/8] >> (number-1)%8) & 0x01 - valid = (self._memobj.filled[(number-1)/8] >> (number-1)%8) & 0x01 + _mem = self._memobj.memory[number - 1] + used = (self._memobj.visible[(number - 1) / 8] >> (number - 1) % 8) \ + & 0x01 + valid = (self._memobj.filled[(number - 1) / 8] >> (number - 1) % 8) \ + & 0x01
mem = chirp_common.Memory() mem.number = number @@ -601,7 +605,7 @@ return self._get_memory(mem, _mem)
def _set_normal(self, mem): - _mem = self._memobj.memory[mem.number-1] + _mem = self._memobj.memory[mem.number - 1] wasused = (self._memobj.visible[(mem.number - 1) / 8] >> (mem.number - 1) % 8) & 0x01 wasvalid = (self._memobj.filled[(mem.number - 1) / 8] >> @@ -611,17 +615,17 @@ if mem.number == 1: # as Dan says "yaesus are not good about that :(" # if you ulpoad an empty image you can brick your radio - raise Exception("Sorry, can't delete first memory") + raise Exception("Sorry, can't delete first memory") if wasvalid and not wasused: - self._memobj.filled[(mem.number-1) / 8] &= \ + self._memobj.filled[(mem.number - 1) / 8] &= \ ~(1 << (mem.number - 1) % 8) - _mem.set_raw("\xFF" * (_mem.size() / 8)) # clean up - self._memobj.visible[(mem.number-1) / 8] &= \ + _mem.set_raw("\xFF" * (_mem.size() / 8)) # clean up + self._memobj.visible[(mem.number - 1) / 8] &= \ ~(1 << (mem.number - 1) % 8) return if not wasvalid: - _mem.set_raw("\x00" * (_mem.size() / 8)) # clean up - + _mem.set_raw("\x00" * (_mem.size() / 8)) # clean up + self._memobj.visible[(mem.number - 1) / 8] |= 1 << (mem.number - 1) % 8 self._memobj.filled[(mem.number - 1) / 8] |= 1 << (mem.number - 1) % 8 self._set_memory(mem, _mem) @@ -669,7 +673,7 @@ RadioSettingValueBoolean(bool(_mem.ipo))) ipo.set_doc("Bypass preamp") mem.extra.append(ipo) - + att = RadioSetting("att", "ATT", RadioSettingValueBoolean(bool(_mem.att))) att.set_doc("10dB front end attenuator") @@ -685,27 +689,27 @@ _mem.tag_on_off = 0 _mem.tag_default = 0 # never use default label "CH-nnn" self._set_duplex(mem, _mem) - if mem.mode[0] == "N": # is it narrow? + if mem.mode[0] == "N": # is it narrow? _mem.mode = self.MODES.index(mem.mode[1:]) # here I suppose it's safe to set both - _mem.is_fm_narrow = _mem.is_cwdig_narrow = 1 + _mem.is_fm_narrow = _mem.is_cwdig_narrow = 1 else: _mem.mode = self.MODES.index(mem.mode) # here I suppose it's safe to set both - _mem.is_fm_narrow = _mem.is_cwdig_narrow = 0 + _mem.is_fm_narrow = _mem.is_cwdig_narrow = 0 i = 0 for lo, hi in self.VALID_BANDS: if mem.freq > lo and mem.freq < hi: - break + break i += 1 _mem.freq_range = i - # all this should be safe also when not in split but ... + # all this should be safe also when not in split but ... if mem.duplex == "split": _mem.tx_mode = _mem.mode i = 0 for lo, hi in self.VALID_BANDS: if mem.offset >= lo and mem.offset < hi: - break + break i += 1 _mem.tx_freq_range = i _mem.skip = mem.skip == "S" @@ -722,15 +726,16 @@ _mem.fm_step = self.STEPSFM.index(mem.tuning_step) except ValueError: pass - _mem.rit = 0 # not supported in chirp + _mem.rit = 0 # not supported in chirp _mem.freq = mem.freq / 10 _mem.offset = mem.offset / 10 # there are ft857D that have problems with short labels, see bug #937 # some of the radio fill with 0xff and some with blanks - # the latter is safe for all ft8x7 radio so why should i do it only for some? + # the latter is safe for all ft8x7 radio + # so why should i do it only for some? for i in range(0, 8): _mem.name[i] = ord(mem.name.ljust(8)[i]) - + for setting in mem.extra: setattr(_mem, setting.get_name(), setting.value)
@@ -759,282 +764,250 @@ antenna = RadioSettingGroup("antenna", "Antenna selection") panelcontr = RadioSettingGroup("panelcontr", "Panel controls") top = RadioSettingGroup("top", "All Settings", basic, cw, packet, - panelcontr, panel, extended, antenna) + panelcontr, panel, extended, antenna)
rs = RadioSetting("ars_144", "144 ARS", - RadioSettingValueBoolean(_settings.ars_144)) + RadioSettingValueBoolean(_settings.ars_144)) basic.append(rs) rs = RadioSetting("ars_430", "430 ARS", - RadioSettingValueBoolean(_settings.ars_430)) + RadioSettingValueBoolean(_settings.ars_430)) basic.append(rs) rs = RadioSetting("pkt9600_mic", "Paket 9600 mic level", - RadioSettingValueInteger(0, 100, _settings.pkt9600_mic)) + RadioSettingValueInteger(0, 100, _settings.pkt9600_mic)) packet.append(rs) options = ["enable", "disable"] rs = RadioSetting("disable_amfm_dial", "AM&FM Dial", - RadioSettingValueList(options, - options[_settings.disable_amfm_dial])) + RadioSettingValueList(options, + options[_settings.disable_amfm_dial])) panel.append(rs) rs = RadioSetting("am_mic", "AM mic level", - RadioSettingValueInteger(0, 100, _settings.am_mic)) + RadioSettingValueInteger(0, 100, _settings.am_mic)) basic.append(rs) options = ["OFF", "1h", "2h", "3h", "4h", "5h", "6h"] rs = RadioSetting("apo_time", "APO time", - RadioSettingValueList(options, - options[_settings.apo_time])) + RadioSettingValueList(options, options[_settings.apo_time])) basic.append(rs) options = ["OFF", "Range", "All"] rs = RadioSetting("arts_beep", "ARTS beep", - RadioSettingValueList(options, - options[_settings.arts_beep])) + RadioSettingValueList(options, options[_settings.arts_beep])) basic.append(rs) options = ["OFF", "ON", "Auto"] rs = RadioSetting("backlight", "Backlight", - RadioSettingValueList(options, - options[_settings.backlight])) + RadioSettingValueList(options, options[_settings.backlight])) panel.append(rs) options = ["6h", "8h", "10h"] rs = RadioSetting("batt_chg", "Battery charge", - RadioSettingValueList(options, - options[_settings.batt_chg])) + RadioSettingValueList(options, options[_settings.batt_chg])) basic.append(rs) options = ["440Hz", "880Hz"] rs = RadioSetting("beep_freq", "Beep frequency", - RadioSettingValueList(options, - options[_settings.beep_freq])) + RadioSettingValueList(options, options[_settings.beep_freq])) panel.append(rs) rs = RadioSetting("beep_volume", "Beep volume", - RadioSettingValueInteger(0, 100, _settings.beep_volume)) + RadioSettingValueInteger(0, 100, _settings.beep_volume)) panel.append(rs) options = ["4800", "9600", "38400"] rs = RadioSetting("cat_rate", "CAT rate", - RadioSettingValueList(options, - options[_settings.cat_rate])) + RadioSettingValueList(options, options[_settings.cat_rate])) basic.append(rs) options = ["Blue", "Amber", "Violet"] rs = RadioSetting("color", "Color", - RadioSettingValueList(options, - options[_settings.color])) + RadioSettingValueList(options, options[_settings.color])) panel.append(rs) rs = RadioSetting("contrast", "Contrast", - RadioSettingValueInteger(1, 12,_settings.contrast-1)) + RadioSettingValueInteger(1, 12, _settings.contrast - 1)) panel.append(rs) rs = RadioSetting("cw_delay", "CW delay (*10 ms)", - RadioSettingValueInteger(1, 250, _settings.cw_delay)) + RadioSettingValueInteger(1, 250, _settings.cw_delay)) cw.append(rs) rs = RadioSetting("cw_id", "CW id", - RadioSettingValueBoolean(_settings.cw_id)) + RadioSettingValueBoolean(_settings.cw_id)) cw.append(rs) options = ["Normal", "Reverse"] rs = RadioSetting("cw_paddle", "CW paddle", - RadioSettingValueList(options, - options[_settings.cw_paddle])) + RadioSettingValueList(options, options[_settings.cw_paddle])) cw.append(rs) - options = ["%i Hz" % i for i in range(300,1001,50)] + options = ["%i Hz" % i for i in range(300, 1001, 50)] rs = RadioSetting("cw_pitch", "CW pitch", - RadioSettingValueList(options, - options[_settings.cw_pitch])) + RadioSettingValueList(options, options[_settings.cw_pitch])) cw.append(rs) - options = ["%i wpm" % i for i in range(4,61)] + options = ["%i wpm" % i for i in range(4, 61)] rs = RadioSetting("cw_speed", "CW speed", - RadioSettingValueList(options, - options[_settings.cw_speed])) + RadioSettingValueList(options, options[_settings.cw_speed])) cw.append(rs) - options = ["1:%1.1f" % (i/10) for i in range(25,46,1)] + options = ["1:%1.1f" % (i / 10) for i in range(25, 46, 1)] rs = RadioSetting("cw_weight", "CW weight", - RadioSettingValueList(options, - options[_settings.cw_weight])) + RadioSettingValueList(options, options[_settings.cw_weight])) cw.append(rs) rs = RadioSetting("dig_disp", "Dig disp (*10 Hz)", - RadioSettingValueInteger(-300, 300, _settings.dig_disp)) + RadioSettingValueInteger(-300, 300, _settings.dig_disp)) packet.append(rs) rs = RadioSetting("dig_mic", "Dig mic", - RadioSettingValueInteger(0, 100, _settings.dig_mic)) + RadioSettingValueInteger(0, 100, _settings.dig_mic)) packet.append(rs) options = ["RTTY", "PSK31-L", "PSK31-U", "USER-L", "USER-U"] rs = RadioSetting("dig_mode", "Dig mode", - RadioSettingValueList(options, - options[_settings.dig_mode])) + RadioSettingValueList(options, options[_settings.dig_mode])) packet.append(rs) rs = RadioSetting("dig_shift", "Dig shift (*10 Hz)", - RadioSettingValueInteger(-300, 300, _settings.dig_shift)) + RadioSettingValueInteger(-300, 300, _settings.dig_shift)) packet.append(rs) rs = RadioSetting("fm_mic", "FM mic", - RadioSettingValueInteger(0, 100, _settings.fm_mic)) + RadioSettingValueInteger(0, 100, _settings.fm_mic)) basic.append(rs) options = ["Dial", "Freq", "Panel"] rs = RadioSetting("lock_mode", "Lock mode", - RadioSettingValueList(options, - options[_settings.lock_mode])) + RadioSettingValueList(options, options[_settings.lock_mode])) panel.append(rs) options = ["Fine", "Coarse"] rs = RadioSetting("main_step", "Main step", - RadioSettingValueList(options, - options[_settings.main_step])) + RadioSettingValueList(options, options[_settings.main_step])) panel.append(rs) rs = RadioSetting("mem_group", "Mem group", - RadioSettingValueBoolean(_settings.mem_group)) + RadioSettingValueBoolean(_settings.mem_group)) basic.append(rs) rs = RadioSetting("mic_key", "Mic key", - RadioSettingValueBoolean(_settings.mic_key)) + RadioSettingValueBoolean(_settings.mic_key)) cw.append(rs) rs = RadioSetting("mic_scan", "Mic scan", - RadioSettingValueBoolean(_settings.mic_scan)) + RadioSettingValueBoolean(_settings.mic_scan)) basic.append(rs) options = ["Off", "SSB", "CW"] rs = RadioSetting("op_filter", "Optional filter", - RadioSettingValueList(options, - options[_settings.op_filter])) + RadioSettingValueList(options, options[_settings.op_filter])) basic.append(rs) rs = RadioSetting("pkt_mic", "Packet mic", - RadioSettingValueInteger(0, 100, _settings.pkt_mic)) + RadioSettingValueInteger(0, 100, _settings.pkt_mic)) packet.append(rs) options = ["1200", "9600"] rs = RadioSetting("pkt_rate", "Packet rate", - RadioSettingValueList(options, - options[_settings.pkt_rate])) + RadioSettingValueList(options, options[_settings.pkt_rate])) packet.append(rs) options = ["Off", "3 sec", "5 sec", "10 sec"] rs = RadioSetting("resume_scan", "Resume scan", - RadioSettingValueList(options, - options[_settings.resume_scan])) + RadioSettingValueList(options, options[_settings.resume_scan])) basic.append(rs) options = ["Cont", "Chk"] rs = RadioSetting("scope", "Scope", - RadioSettingValueList(options, - options[_settings.scope])) + RadioSettingValueList(options, options[_settings.scope])) basic.append(rs) rs = RadioSetting("sidetone", "Sidetone", - RadioSettingValueInteger(0, 100, _settings.sidetone)) + RadioSettingValueInteger(0, 100, _settings.sidetone)) cw.append(rs) options = ["RF-Gain", "Squelch"] rs = RadioSetting("sql_rf_gain", "Squelch/RF-Gain", - RadioSettingValueList(options, - options[_settings.sql_rf_gain])) + RadioSettingValueList(options, options[_settings.sql_rf_gain])) panel.append(rs) rs = RadioSetting("ssb_mic", "SSB Mic", - RadioSettingValueInteger(0, 100, _settings.ssb_mic)) + RadioSettingValueInteger(0, 100, _settings.ssb_mic)) basic.append(rs) options = ["%i" % i for i in range(0, 21)] options[0] = "Off" rs = RadioSetting("tot_time", "Time-out timer", - RadioSettingValueList(options, - options[_settings.tot_time])) + RadioSettingValueList(options, options[_settings.tot_time])) basic.append(rs) rs = RadioSetting("vox_delay", "VOX delay (*100 ms)", - RadioSettingValueInteger(1, 25, _settings.vox_delay)) + RadioSettingValueInteger(1, 25, _settings.vox_delay)) basic.append(rs) rs = RadioSetting("vox_gain", "VOX Gain", - RadioSettingValueInteger(0, 100, _settings.vox_gain)) + RadioSettingValueInteger(0, 100, _settings.vox_gain)) basic.append(rs) rs = RadioSetting("extended_menu", "Extended menu", - RadioSettingValueBoolean(_settings.extended_menu)) + RadioSettingValueBoolean(_settings.extended_menu)) extended.append(rs) options = ["Tn-Rn", "Tn-Riv", "Tiv-Rn", "Tiv-Riv"] rs = RadioSetting("dcs_inv", "DCS coding", - RadioSettingValueList(options, - options[_settings.dcs_inv])) + RadioSettingValueList(options, options[_settings.dcs_inv])) extended.append(rs) rs = RadioSetting("r_lsb_car", "LSB Rx carrier point (*10 Hz)", - RadioSettingValueInteger(-30, 30, _settings.r_lsb_car)) + RadioSettingValueInteger(-30, 30, _settings.r_lsb_car)) extended.append(rs) rs = RadioSetting("r_usb_car", "USB Rx carrier point (*10 Hz)", - RadioSettingValueInteger(-30, 30, _settings.r_usb_car)) + RadioSettingValueInteger(-30, 30, _settings.r_usb_car)) extended.append(rs) rs = RadioSetting("t_lsb_car", "LSB Tx carrier point (*10 Hz)", - RadioSettingValueInteger(-30, 30, _settings.t_lsb_car)) + RadioSettingValueInteger(-30, 30, _settings.t_lsb_car)) extended.append(rs) rs = RadioSetting("t_usb_car", "USB Tx carrier point (*10 Hz)", - RadioSettingValueInteger(-30, 30, _settings.t_usb_car)) + RadioSettingValueInteger(-30, 30, _settings.t_usb_car)) extended.append(rs)
options = ["Hi", "L3", "L2", "L1"] rs = RadioSetting("tx_power", "TX power", - RadioSettingValueList(options, - options[_settings.tx_power])) + RadioSettingValueList(options, options[_settings.tx_power])) basic.append(rs)
options = ["Front", "Rear"] rs = RadioSetting("hf_antenna", "HF", - RadioSettingValueList(options, - options[_settings.hf_antenna])) + RadioSettingValueList(options, options[_settings.hf_antenna])) antenna.append(rs) rs = RadioSetting("sixm_antenna", "6M", - RadioSettingValueList(options, - options[_settings.sixm_antenna])) + RadioSettingValueList(options, + options[_settings.sixm_antenna])) antenna.append(rs) rs = RadioSetting("bc_antenna", "Broadcasting", - RadioSettingValueList(options, - options[_settings.bc_antenna])) + RadioSettingValueList(options, options[_settings.bc_antenna])) antenna.append(rs) rs = RadioSetting("air_antenna", "Air band", - RadioSettingValueList(options, - options[_settings.air_antenna])) + RadioSettingValueList(options, options[_settings.air_antenna])) antenna.append(rs) rs = RadioSetting("vhf_antenna", "VHF", - RadioSettingValueList(options, - options[_settings.vhf_antenna])) + RadioSettingValueList(options, options[_settings.vhf_antenna])) antenna.append(rs) rs = RadioSetting("uhf_antenna", "UHF", - RadioSettingValueList(options, - options[_settings.uhf_antenna])) + RadioSettingValueList(options, options[_settings.uhf_antenna])) antenna.append(rs)
- s = RadioSettingValueString(0, 7, - ''.join([self._CALLSIGN_CHARSET[x] for x in - self._memobj.callsign])) - s.set_charset(self._CALLSIGN_CHARSET) - rs = RadioSetting("callsign", "Callsign", s) + st = RadioSettingValueString(0, 7, ''.join([self._CALLSIGN_CHARSET[x] + for x in self._memobj.callsign])) + st.set_charset(self._CALLSIGN_CHARSET) + rs = RadioSetting("callsign", "Callsign", st) cw.append(rs)
rs = RadioSetting("spl", "Split", - RadioSettingValueBoolean(_settings.spl)) + RadioSettingValueBoolean(_settings.spl)) panelcontr.append(rs) options = ["None", "Up", "Down"] rs = RadioSetting("scn_mode", "Scan mode", - RadioSettingValueList(options, - options[_settings.scn_mode])) + RadioSettingValueList(options, options[_settings.scn_mode])) panelcontr.append(rs) rs = RadioSetting("pri", "Priority", - RadioSettingValueBoolean(_settings.pri)) + RadioSettingValueBoolean(_settings.pri)) panelcontr.append(rs) rs = RadioSetting("dw", "Dual watch", - RadioSettingValueBoolean(_settings.dw)) + RadioSettingValueBoolean(_settings.dw)) panelcontr.append(rs) rs = RadioSetting("art", "Auto-range transponder", - RadioSettingValueBoolean(_settings.art)) + RadioSettingValueBoolean(_settings.art)) panelcontr.append(rs) rs = RadioSetting("nb", "Noise blanker", - RadioSettingValueBoolean(_settings.nb)) + RadioSettingValueBoolean(_settings.nb)) panelcontr.append(rs) options = ["Auto", "Fast", "Slow", "Off"] rs = RadioSetting("agc", "AGC", - RadioSettingValueList(options, - options[_settings.agc])) + RadioSettingValueList(options, options[_settings.agc])) panelcontr.append(rs) options = ["PWR", "ALC", "SWR", "MOD"] rs = RadioSetting("pwr_meter_mode", "Power meter mode", - RadioSettingValueList(options, - options[_settings.pwr_meter_mode])) + RadioSettingValueList(options, + options[_settings.pwr_meter_mode])) panelcontr.append(rs) rs = RadioSetting("vox", "Vox", - RadioSettingValueBoolean(_settings.vox)) + RadioSettingValueBoolean(_settings.vox)) panelcontr.append(rs) rs = RadioSetting("bk", "Semi break-in", - RadioSettingValueBoolean(_settings.bk)) + RadioSettingValueBoolean(_settings.bk)) cw.append(rs) rs = RadioSetting("kyr", "Keyer", - RadioSettingValueBoolean(_settings.kyr)) + RadioSettingValueBoolean(_settings.kyr)) cw.append(rs) options = ["enabled", "disabled"] rs = RadioSetting("fst", "Fast", - RadioSettingValueList(options, - options[_settings.fst])) + RadioSettingValueList(options, options[_settings.fst])) panelcontr.append(rs) options = ["enabled", "disabled"] rs = RadioSetting("lock", "Lock", - RadioSettingValueList(options, - options[_settings.lock])) + RadioSettingValueList(options, options[_settings.lock])) panelcontr.append(rs)
return top @@ -1056,17 +1029,17 @@ obj = _settings setting = element.get_name() if os.getenv("CHIRP_DEBUG"): - print "Setting %s(%s) <= %s" % (setting, - getattr(obj, setting), element.value) + print "Setting %s(%s) <= %s" % (setting, + getattr(obj, setting), element.value) if setting == "contrast": - setattr(obj, setting, int(element.value)+1) + setattr(obj, setting, int(element.value) + 1) elif setting == "callsign": self._memobj.callsign = \ - [self._CALLSIGN_CHARSET_REV[x] for x in + [self._CALLSIGN_CHARSET_REV[x] for x in str(element.value)] else: setattr(obj, setting, element.value) - except Exception, e: + except: print element.get_name() raise
@@ -1078,7 +1051,7 @@ _model = "" _memsize = 6521 # block 9 (130 Bytes long) is to be repeted 40 times - _block_lengths = [ 2, 40, 208, 182, 208, 182, 198, 53, 130, 118, 130] + _block_lengths = [2, 40, 208, 182, 208, 182, 198, 53, 130, 118, 130]
@directory.register class FT817NDUSRadio(FT817Radio): @@ -1091,14 +1064,14 @@ _US_model = True _memsize = 6651 # block 9 (130 Bytes long) is to be repeted 40 times - _block_lengths = [ 2, 40, 208, 182, 208, 182, 198, 53, 130, 118, 130, 130] + _block_lengths = [2, 40, 208, 182, 208, 182, 198, 53, 130, 118, 130, 130]
SPECIAL_60M = { - "M-601" : -42, - "M-602" : -41, - "M-603" : -40, - "M-604" : -39, - "M-605" : -38, + "M-601": -42, + "M-602": -41, + "M-603": -40, + "M-604": -39, + "M-605": -38, } LAST_SPECIAL60M_INDEX = -42
@@ -1165,7 +1138,6 @@ top = FT817Radio.get_settings(self) basic = top["basic"] rs = RadioSetting("emergency", "Emergency", - RadioSettingValueBoolean(self._memobj.settings.emergency)) + RadioSettingValueBoolean(self._memobj.settings.emergency)) basic.append(rs) return top - diff -r 6dd9925f0d32 -r 5c6617d6f4bd chirp/ft857.py --- a/chirp/ft857.py mar set 02 09:53:39 2014 -0700 +++ b/chirp/ft857.py gio set 11 13:43:51 2014 +0200 @@ -30,31 +30,31 @@ _model = ""
TMODES = { - 0x04 : "Tone", - 0x05 : "TSQL", + 0x04: "Tone", + 0x05: "TSQL", # 0x08 : "DTCS Enc", not supported in UI yet - 0x0a : "DTCS", - 0xff : "Cross", - 0x00 : "", + 0x0a: "DTCS", + 0xff: "Cross", + 0x00: "", } TMODES_REV = dict(zip(TMODES.values(), TMODES.keys()))
CROSS_MODES = { - 0x01 : "->Tone", - 0x02 : "->DTCS", + 0x01: "->Tone", + 0x02: "->DTCS", # 0x04 : "Tone->", not supported in UI yet - 0x05 : "Tone->Tone", - 0x06 : "Tone->DTCS", - 0x08 : "DTCS->", - 0x09 : "DTCS->Tone", - 0x0a : "DTCS->DTCS", + 0x05: "Tone->Tone", + 0x06: "Tone->DTCS", + 0x08: "DTCS->", + 0x09: "DTCS->Tone", + 0x0a: "DTCS->DTCS", } CROSS_MODES_REV = dict(zip(CROSS_MODES.values(), CROSS_MODES.keys()))
_memsize = 7341 - # block 9 (140 Bytes long) is to be repeted 40 times + # block 9 (140 Bytes long) is to be repeted 40 times # should be 42 times but this way I can use original 817 functions - _block_lengths = [ 2, 82, 252, 196, 252, 196, 212, 55, 140, 140, 140, + _block_lengths = [2, 82, 252, 196, 252, 196, 212, 55, 140, 140, 140, 38, 176] # warning ranges has to be in this exact order VALID_BANDS = [(100000, 33000000), (33000000, 56000000), @@ -105,7 +105,7 @@ u32 offset; u8 name[8]; }; - + #seekto 0x00; struct { u16 radioconfig; @@ -279,19 +279,19 @@ struct mem_struct qmb; struct mem_struct mtqmb; struct mem_struct mtune; - + #seekto 0x4a9; u8 visible[25]; ul16 pmsvisible; - + #seekto 0x4c4; u8 filled[25]; ul16 pmsfilled; - + #seekto 0x4df; struct mem_struct memory[200]; struct mem_struct pms[10]; - + #seekto 0x1bf3; u8 arts_idw[10]; u8 beacon_text1[40]; @@ -304,56 +304,56 @@
#seekto 0x1CAD; struct mem_struct sixtymeterchannels[5]; - + """
- _CALLSIGN_CHARSET = [chr(x) for x in range(ord("0"), ord("9")+1) + - range(ord("A"), ord("Z")+1)] + [" ", "/"] + _CALLSIGN_CHARSET = [chr(x) for x in range(ord("0"), ord("9") + 1) + + range(ord("A"), ord("Z") + 1)] + [" ", "/"] _CALLSIGN_CHARSET_REV = dict(zip(_CALLSIGN_CHARSET, - range(0,len(_CALLSIGN_CHARSET)))) - _BEACON_CHARSET = _CALLSIGN_CHARSET + ["+", "."] + range(0, len(_CALLSIGN_CHARSET)))) + _BEACON_CHARSET = _CALLSIGN_CHARSET + ["+", "."] _BEACON_CHARSET_REV = dict(zip(_BEACON_CHARSET, - range(0,len(_BEACON_CHARSET)))) + range(0, len(_BEACON_CHARSET))))
# WARNING Index are hard wired in memory management code !!! SPECIAL_MEMORIES = { - "VFOa-1.8M" : -37, - "VFOa-3.5M" : -36, - "VFOa-5M" : -35, - "VFOa-7M" : -34, - "VFOa-10M" : -33, - "VFOa-14M" : -32, - "VFOa-18M" : -31, - "VFOa-21M" : -30, - "VFOa-24M" : -29, - "VFOa-28M" : -28, - "VFOa-50M" : -27, - "VFOa-FM" : -26, - "VFOa-AIR" : -25, - "VFOa-144" : -24, - "VFOa-430" : -23, - "VFOa-HF" : -22, - "VFOb-1.8M" : -21, - "VFOb-3.5M" : -20, - "VFOb-5M" : -19, - "VFOb-7M" : -18, - "VFOb-10M" : -17, - "VFOb-14M" : -16, - "VFOb-18M" : -15, - "VFOb-21M" : -14, - "VFOb-24M" : -13, - "VFOb-28M" : -12, - "VFOb-50M" : -11, - "VFOb-FM" : -10, - "VFOb-AIR" : -9, - "VFOb-144M" : -8, - "VFOb-430M" : -7, - "VFOb-HF" : -6, - "HOME HF" : -5, - "HOME 50M" : -4, - "HOME 144M" : -3, - "HOME 430M" : -2, - "QMB" : -1, + "VFOa-1.8M": -37, + "VFOa-3.5M": -36, + "VFOa-5M": -35, + "VFOa-7M": -34, + "VFOa-10M": -33, + "VFOa-14M": -32, + "VFOa-18M": -31, + "VFOa-21M": -30, + "VFOa-24M": -29, + "VFOa-28M": -28, + "VFOa-50M": -27, + "VFOa-FM": -26, + "VFOa-AIR": -25, + "VFOa-144": -24, + "VFOa-430": -23, + "VFOa-HF": -22, + "VFOb-1.8M": -21, + "VFOb-3.5M": -20, + "VFOb-5M": -19, + "VFOb-7M": -18, + "VFOb-10M": -17, + "VFOb-14M": -16, + "VFOb-18M": -15, + "VFOb-21M": -14, + "VFOb-24M": -13, + "VFOb-28M": -12, + "VFOb-50M": -11, + "VFOb-FM": -10, + "VFOb-AIR": -9, + "VFOb-144M": -8, + "VFOb-430M": -7, + "VFOb-HF": -6, + "HOME HF": -5, + "HOME 50M": -4, + "HOME 144M": -3, + "HOME 430M": -2, + "QMB": -1, } FIRST_VFOB_INDEX = -6 LAST_VFOB_INDEX = -21 @@ -361,16 +361,16 @@ LAST_VFOA_INDEX = -37
SPECIAL_PMS = { - "PMS-1L" : -47, - "PMS-1U" : -46, - "PMS-2L" : -45, - "PMS-2U" : -44, - "PMS-3L" : -43, - "PMS-3U" : -42, - "PMS-4L" : -41, - "PMS-4U" : -40, - "PMS-5L" : -39, - "PMS-5U" : -38, + "PMS-1L": -47, + "PMS-1U": -46, + "PMS-2L": -45, + "PMS-2U": -44, + "PMS-3L": -43, + "PMS-3U": -42, + "PMS-4L": -41, + "PMS-4U": -40, + "PMS-5L": -39, + "PMS-5U": -38, } LAST_PMS_INDEX = -47
@@ -379,41 +379,41 @@ SPECIAL_MEMORIES_REV = dict(zip(SPECIAL_MEMORIES.values(), SPECIAL_MEMORIES.keys()))
- FILTERS = [ "CFIL", "FIL1", "FIL2" ] + FILTERS = ["CFIL", "FIL1", "FIL2"] PROGRAMMABLEOPTIONS = [ "MFa:A/B", "MFa:A=B", "MFa:SPL", "MFb:MW", "MFb:SKIP/MCLR", "MFb:TAG", "MFc:STO", "MFc:RCL", "MFc:PROC", "MFd:RPT", "MFd:REV", "MFd:VOX", - "MFe:TON/ENC", "MFe:TON/DEC", "MFe:TDCH", + "MFe:TON/ENC", "MFe:TON/DEC", "MFe:TDCH", "MFf:ARTS", "MFf:SRCH", "MFf:PMS", - "MFg:SCN", "MFg:PRI", "MFg:DW", + "MFg:SCN", "MFg:PRI", "MFg:DW", "MFh:SCOP", "MFh:WID", "MFh:STEP", - "MFi:MTR", "MFi:SWR", "MFi:DISP", + "MFi:MTR", "MFi:SWR", "MFi:DISP", "MFj:SPOT", "MFj:BK", "MFj:KYR", - "MFk:TUNE", "MFk:DOWN", "MFk:UP", + "MFk:TUNE", "MFk:DOWN", "MFk:UP", "MFl:NB", "MFl:AGC", "MFl:AGC SEL", - "MFm:IPO", "MFm:ATT", "MFm:NAR", + "MFm:IPO", "MFm:ATT", "MFm:NAR", "MFn:CFIL", "MFn:FIL1", "MFn:FIL2", - "MFo:PLY1", "MFo:PLY2", "MFo:PLY3", + "MFo:PLY1", "MFo:PLY2", "MFo:PLY3", "MFp:DNR", "MFp:DNF", "MFp:DBF", - "01:EXT MENU", "02:144MHz ARS", "03:430MHz ARS", - "04:AM&FM DIAL", "05:AM MIC GAIN", "06:AM STEP", - "07:APO TIME", "08:ARTS BEEP", "09:ARTS ID", + "01:EXT MENU", "02:144MHz ARS", "03:430MHz ARS", + "04:AM&FM DIAL", "05:AM MIC GAIN", "06:AM STEP", + "07:APO TIME", "08:ARTS BEEP", "09:ARTS ID", "10:ARTS IDW", "11:BEACON TEXT", "12:BEACON TIME", - "13:BEEP TONE", "14:BEEP VOL", "15:CAR LSB R", + "13:BEEP TONE", "14:BEEP VOL", "15:CAR LSB R", "16:CAR LSB T", "17:CAR USB R", "18:CAR USB T", "19:CAT RATE", "20:CAT/LIN/TUN", "21:CLAR DIAL SEL", "22:CW AUTO MODE", "23:CW BFO", "24:CW DELAY", - "25:CW KEY REV", "26:CW PADDLE", "27:CW PITCH", + "25:CW KEY REV", "26:CW PADDLE", "27:CW PITCH", "28:CW QSK", "29:CW SIDE TONE", "30:CW SPEED", "31:CW TRAINING", "32:CW WEIGHT", "33:DCS CODE", "34:DCS INV", "35:DIAL STEP", "36:DIG DISP", - "37:DIG GAIN", "38:DIG MODE", "39:DIG SHIFT", + "37:DIG GAIN", "38:DIG MODE", "39:DIG SHIFT", "40:DIG VOX", "41:DISP COLOR", "42:DISP CONTRAST", "43:DISP INTENSITY", "44:DISP MODE", "45:DSP BPF WIDTH", "46:DSP HPF CUTOFF", "47:DSP LPF CUTOFF","48:DSP MIC EQ", - "49:DSP NR LEVEL", "50:EMERGENCY", "51:FM MIC GAIN", + "49:DSP NR LEVEL", "50:EMERGENCY", "51:FM MIC GAIN", "52:FM STEP", "53:HOME->VFO", "54:LOCK MODE", "55:MEM GROUP", "56:MEM TAG", "57:MEM/VFO DIAL MODE", "58:MIC SCAN", "59:MIC SEL", "60:MTR ARX", @@ -426,8 +426,8 @@ "85:TUNER/ATAS", "86:TX IF FILTER", "87:VOX DELAY", "88:VOX GAIN", "89:XVTR A FREQ", "90:XVTR B FREQ", "91:XVTR SEL", - "MONI", "Q.SPL", "TCALL", "ATC", "USER"] - + "MONI", "Q.SPL", "TCALL", "ATC", "USER"] + @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() @@ -437,7 +437,8 @@ 3. Press and hold in the [MODE <] and [MODE >] keys while turning the radio on ("CLONE MODE" will appear on the display). - 4. <b>After clicking OK</b>, press the [C](SEND) key to send image.""")) + 4. <b>After clicking OK</b>, + press the [C](SEND) key to send image.""")) rp.pre_upload = _(dedent("""\ 1. Turn radio off. 2. Connect cable to ACC jack. @@ -470,14 +471,14 @@ mem.cross_mode = self.CROSS_MODES[int(_mem.tmode)]
if mem.tmode == "Tone": - mem.rtone = mem.ctone = chirp_common.TONES[_mem.tone] + mem.rtone = mem.ctone = chirp_common.TONES[_mem.tone] elif mem.tmode == "TSQL": - mem.rtone = mem.ctone = chirp_common.TONES[_mem.tone] - elif mem.tmode == "DTCS Enc": # UI does not support it yet but - # this code has alreay been tested - mem.dtcs = mem.rx_dtcs = chirp_common.DTCS_CODES[_mem.dcs] + mem.rtone = mem.ctone = chirp_common.TONES[_mem.tone] + elif mem.tmode == "DTCS Enc": # UI does not support it yet but + # this code has alreay been tested + mem.dtcs = mem.rx_dtcs = chirp_common.DTCS_CODES[_mem.dcs] elif mem.tmode == "DTCS": - mem.dtcs = mem.rx_dtcs = chirp_common.DTCS_CODES[_mem.dcs] + mem.dtcs = mem.rx_dtcs = chirp_common.DTCS_CODES[_mem.dcs] elif mem.tmode == "Cross": mem.ctone = chirp_common.TONES[_mem.rxtone] # don't want to fail for this @@ -500,8 +501,8 @@ _mem.tone = _mem.rxtone = chirp_common.TONES.index(mem.rtone) elif mem.tmode == "TSQL": _mem.tone = _mem.rxtone = chirp_common.TONES.index(mem.ctone) - elif mem.tmode == "DTCS Enc": # UI does not support it yet but - # this code has alreay been tested + elif mem.tmode == "DTCS Enc": # UI does not support it yet but + # this code has alreay been tested _mem.dcs = _mem.rxdcs = chirp_common.DTCS_CODES.index(mem.dtcs) elif mem.tmode == "DTCS": _mem.dcs = _mem.rxdcs = chirp_common.DTCS_CODES.index(mem.rx_dtcs) @@ -528,446 +529,411 @@ panelcontr, panel, extended)
rs = RadioSetting("extended_menu", "Extended menu", - RadioSettingValueBoolean(_settings.extended_menu)) + RadioSettingValueBoolean(_settings.extended_menu)) extended.append(rs) rs = RadioSetting("ars_144", "144MHz ARS", - RadioSettingValueBoolean(_settings.ars_144)) + RadioSettingValueBoolean(_settings.ars_144)) basic.append(rs) rs = RadioSetting("ars_430", "430MHz ARS", - RadioSettingValueBoolean(_settings.ars_430)) + RadioSettingValueBoolean(_settings.ars_430)) basic.append(rs) options = ["enable", "disable"] rs = RadioSetting("disable_amfm_dial", "AM&FM Dial", - RadioSettingValueList(options, - options[_settings.disable_amfm_dial])) + RadioSettingValueList(options, + options[_settings.disable_amfm_dial])) panel.append(rs) rs = RadioSetting("am_mic", "AM mic gain", - RadioSettingValueInteger(0, 100, _settings.am_mic)) + RadioSettingValueInteger(0, 100, _settings.am_mic)) basic.append(rs) options = ["OFF", "1h", "2h", "3h", "4h", "5h", "6h"] rs = RadioSetting("apo_time", "APO time", - RadioSettingValueList(options, - options[_settings.apo_time])) + RadioSettingValueList(options, options[_settings.apo_time])) basic.append(rs) options = ["OFF", "Range", "All"] rs = RadioSetting("arts_beep", "ARTS beep", - RadioSettingValueList(options, - options[_settings.arts_beep])) + RadioSettingValueList(options, options[_settings.arts_beep])) basic.append(rs) rs = RadioSetting("arts_id", "ARTS ID", - RadioSettingValueBoolean(_settings.arts_id)) + RadioSettingValueBoolean(_settings.arts_id)) extended.append(rs) - s = RadioSettingValueString(0, 10, - ''.join([self._CALLSIGN_CHARSET[x] for x in - self._memobj.arts_idw])) - s.set_charset(self._CALLSIGN_CHARSET) - rs = RadioSetting("arts_idw", "ARTS IDW", s) + st = RadioSettingValueString(0, 10, ''.join([self._CALLSIGN_CHARSET[x] + for x in self._memobj.arts_idw])) + st.set_charset(self._CALLSIGN_CHARSET) + rs = RadioSetting("arts_idw", "ARTS IDW", st) extended.append(rs) - s = RadioSettingValueString(0, 40, - ''.join([self._BEACON_CHARSET[x] for x in - self._memobj.beacon_text1])) - s.set_charset(self._BEACON_CHARSET) - rs = RadioSetting("beacon_text1", "Beacon text1", s) + st = RadioSettingValueString(0, 40, ''.join([self._BEACON_CHARSET[x] + for x in self._memobj.beacon_text1])) + st.set_charset(self._BEACON_CHARSET) + rs = RadioSetting("beacon_text1", "Beacon text1", st) extended.append(rs) - s = RadioSettingValueString(0, 40, - ''.join([self._BEACON_CHARSET[x] for x in - self._memobj.beacon_text2])) - s.set_charset(self._BEACON_CHARSET) - rs = RadioSetting("beacon_text2", "Beacon text2", s) + st = RadioSettingValueString(0, 40, ''.join([self._BEACON_CHARSET[x] + for x in self._memobj.beacon_text2])) + st.set_charset(self._BEACON_CHARSET) + rs = RadioSetting("beacon_text2", "Beacon text2", st) extended.append(rs) - s = RadioSettingValueString(0, 40, - ''.join([self._BEACON_CHARSET[x] for x in - self._memobj.beacon_text3])) - s.set_charset(self._BEACON_CHARSET) - rs = RadioSetting("beacon_text3", "Beacon text3", s) + st = RadioSettingValueString(0, 40, ''.join([self._BEACON_CHARSET[x] + for x in self._memobj.beacon_text3])) + st.set_charset(self._BEACON_CHARSET) + rs = RadioSetting("beacon_text3", "Beacon text3", st) extended.append(rs) - options = ["OFF"]+["%i sec" % i for i in range(1,256)] + options = ["OFF"] + ["%i sec" % i for i in range(1, 256)] rs = RadioSetting("beacon_time", "Beacon time", - RadioSettingValueList(options, - options[_settings.beacon_time])) + RadioSettingValueList(options, options[_settings.beacon_time])) extended.append(rs) options = ["440Hz", "880Hz", "1760Hz"] rs = RadioSetting("beep_tone", "Beep tone", - RadioSettingValueList(options, - options[_settings.beep_tone])) + RadioSettingValueList(options, options[_settings.beep_tone])) panel.append(rs) rs = RadioSetting("beep_vol", "Beep volume", - RadioSettingValueInteger(0, 100, _settings.beep_vol)) + RadioSettingValueInteger(0, 100, _settings.beep_vol)) panel.append(rs) rs = RadioSetting("r_lsb_car", "LSB Rx carrier point (*10 Hz)", - RadioSettingValueInteger(-30, 30, _settings.r_lsb_car)) + RadioSettingValueInteger(-30, 30, _settings.r_lsb_car)) extended.append(rs) rs = RadioSetting("r_usb_car", "USB Rx carrier point (*10 Hz)", - RadioSettingValueInteger(-30, 30, _settings.r_usb_car)) + RadioSettingValueInteger(-30, 30, _settings.r_usb_car)) extended.append(rs) rs = RadioSetting("t_lsb_car", "LSB Tx carrier point (*10 Hz)", - RadioSettingValueInteger(-30, 30, _settings.t_lsb_car)) + RadioSettingValueInteger(-30, 30, _settings.t_lsb_car)) extended.append(rs) rs = RadioSetting("t_usb_car", "USB Tx carrier point (*10 Hz)", - RadioSettingValueInteger(-30, 30, _settings.t_usb_car)) + RadioSettingValueInteger(-30, 30, _settings.t_usb_car)) extended.append(rs) options = ["4800", "9600", "38400"] rs = RadioSetting("cat_rate", "CAT rate", - RadioSettingValueList(options, - options[_settings.cat_rate])) + RadioSettingValueList(options, options[_settings.cat_rate])) basic.append(rs) options = ["CAT", "Linear", "Tuner"] rs = RadioSetting("cat_lin_tun", "CAT/LIN/TUN selection", - RadioSettingValueList(options, - options[_settings.cat_lin_tun])) + RadioSettingValueList(options, options[_settings.cat_lin_tun])) extended.append(rs) - options = ["MAIN", "VFO/MEM", "CLAR"] # TODO test the 3 options on non D radio - # which have only SEL and MAIN + options = ["MAIN", "VFO/MEM", "CLAR"] + # TODO test the 3 options on non D radio + # which have only SEL and MAIN rs = RadioSetting("clar_dial_sel", "Clarifier dial selection", - RadioSettingValueList(options, - options[_settings.clar_dial_sel])) + RadioSettingValueList(options, + options[_settings.clar_dial_sel])) panel.append(rs) rs = RadioSetting("cw_auto_mode", "CW Automatic mode", - RadioSettingValueBoolean(_settings.cw_auto_mode)) + RadioSettingValueBoolean(_settings.cw_auto_mode)) cw.append(rs) options = ["USB", "LSB", "AUTO"] rs = RadioSetting("cw_bfo", "CW BFO", - RadioSettingValueList(options, - options[_settings.cw_bfo])) + RadioSettingValueList(options, options[_settings.cw_bfo])) cw.append(rs) - options = ["FULL"]+["%i ms" % (i*10) for i in range(3,301)] + options = ["FULL"] + ["%i ms" % (i * 10) for i in range(3, 301)] val = (_settings.cw_delay + _settings.cw_delay_hi * 256) - 2 rs = RadioSetting("cw_delay", "CW delay", - RadioSettingValueList(options, - options[val])) + RadioSettingValueList(options, options[val])) cw.append(rs) options = ["Normal", "Reverse"] rs = RadioSetting("cw_key_rev", "CW key reverse", - RadioSettingValueList(options, - options[_settings.cw_key_rev])) + RadioSettingValueList(options, options[_settings.cw_key_rev])) cw.append(rs) rs = RadioSetting("cw_paddle", "CW paddle", - RadioSettingValueBoolean(_settings.cw_paddle)) + RadioSettingValueBoolean(_settings.cw_paddle)) cw.append(rs) - options = ["%i Hz" % i for i in range(400,801,100)] + options = ["%i Hz" % i for i in range(400, 801, 100)] rs = RadioSetting("cw_pitch", "CW pitch", - RadioSettingValueList(options, - options[_settings.cw_pitch])) + RadioSettingValueList(options, options[_settings.cw_pitch])) cw.append(rs) - options = ["%i ms" % i for i in range(5,31,5)] + options = ["%i ms" % i for i in range(5, 31, 5)] rs = RadioSetting("cw_qsk", "CW QSK", - RadioSettingValueList(options, - options[_settings.cw_qsk])) + RadioSettingValueList(options, options[_settings.cw_qsk])) cw.append(rs) rs = RadioSetting("cw_sidetone", "CW sidetone volume", - RadioSettingValueInteger(0, 100, _settings.cw_sidetone)) + RadioSettingValueInteger(0, 100, _settings.cw_sidetone)) cw.append(rs) - options = ["%i wpm" % i for i in range(4,61)] + options = ["%i wpm" % i for i in range(4, 61)] rs = RadioSetting("cw_speed", "CW speed", - RadioSettingValueList(options, - options[_settings.cw_speed])) + RadioSettingValueList(options, options[_settings.cw_speed])) cw.append(rs) options = ["Numeric", "Alphabet", "AlphaNumeric"] rs = RadioSetting("cw_training", "CW trainig", - RadioSettingValueList(options, - options[_settings.cw_training])) + RadioSettingValueList(options, options[_settings.cw_training])) cw.append(rs) - options = ["1:%1.1f" % (i/10) for i in range(25,46,1)] + options = ["1:%1.1f" % (i / 10) for i in range(25, 46, 1)] rs = RadioSetting("cw_weight", "CW weight", - RadioSettingValueList(options, - options[_settings.cw_weight])) + RadioSettingValueList(options, options[_settings.cw_weight])) cw.append(rs) options = ["Tn-Rn", "Tn-Riv", "Tiv-Rn", "Tiv-Riv"] rs = RadioSetting("dcs_inv", "DCS inv", - RadioSettingValueList(options, - options[_settings.dcs_inv])) + RadioSettingValueList(options, options[_settings.dcs_inv])) extended.append(rs) options = ["Fine", "Coarse"] rs = RadioSetting("dial_step", "Dial step", - RadioSettingValueList(options, - options[_settings.dial_step])) + RadioSettingValueList(options, options[_settings.dial_step])) panel.append(rs) rs = RadioSetting("dig_disp", "Dig disp (*10 Hz)", - RadioSettingValueInteger(-300, 300, _settings.dig_disp)) + RadioSettingValueInteger(-300, 300, _settings.dig_disp)) packet.append(rs) rs = RadioSetting("dig_mic", "Dig gain", - RadioSettingValueInteger(0, 100, _settings.dig_mic)) + RadioSettingValueInteger(0, 100, _settings.dig_mic)) packet.append(rs) options = ["RTTYL", "RTTYU", "PSK31-L", "PSK31-U", "USER-L", "USER-U"] rs = RadioSetting("dig_mode", "Dig mode", - RadioSettingValueList(options, - options[_settings.dig_mode])) + RadioSettingValueList(options, options[_settings.dig_mode])) packet.append(rs) rs = RadioSetting("dig_shift", "Dig shift (*10 Hz)", - RadioSettingValueInteger(-300, 300, _settings.dig_shift)) + RadioSettingValueInteger(-300, 300, _settings.dig_shift)) packet.append(rs) rs = RadioSetting("dig_vox", "Dig vox", - RadioSettingValueInteger(0, 100, _settings.dig_vox)) + RadioSettingValueInteger(0, 100, _settings.dig_vox)) packet.append(rs) options = ["ARTS", "BAND", "FIX", "MEMGRP", "MODE", "MTR", "VFO"] rs = RadioSetting("disp_color", "Display color mode", - RadioSettingValueList(options, - options[_settings.disp_color])) + RadioSettingValueList(options, options[_settings.disp_color])) panel.append(rs) rs = RadioSetting("disp_color_arts", "Display color ARTS set", - RadioSettingValueInteger(0, 1,_settings.disp_color_arts)) + RadioSettingValueInteger(0, 1, _settings.disp_color_arts)) panel.append(rs) rs = RadioSetting("disp_color_band", "Display color band set", - RadioSettingValueInteger(0, 1,_settings.disp_color_band)) + RadioSettingValueInteger(0, 1, _settings.disp_color_band)) panel.append(rs) rs = RadioSetting("disp_color_memgrp", "Display color memory group set", - RadioSettingValueInteger(0, 1,_settings.disp_color_memgrp)) + RadioSettingValueInteger(0, 1, _settings.disp_color_memgrp)) panel.append(rs) rs = RadioSetting("disp_color_mode", "Display color mode set", - RadioSettingValueInteger(0, 1,_settings.disp_color_mode)) + RadioSettingValueInteger(0, 1, _settings.disp_color_mode)) panel.append(rs) rs = RadioSetting("disp_color_mtr", "Display color meter set", - RadioSettingValueInteger(0, 1,_settings.disp_color_mtr)) + RadioSettingValueInteger(0, 1, _settings.disp_color_mtr)) panel.append(rs) rs = RadioSetting("disp_color_vfo", "Display color VFO set", - RadioSettingValueInteger(0, 1,_settings.disp_color_vfo)) + RadioSettingValueInteger(0, 1, _settings.disp_color_vfo)) panel.append(rs) rs = RadioSetting("disp_color_fix", "Display color fix set", - RadioSettingValueInteger(1, 32,_settings.disp_color_fix+1)) + RadioSettingValueInteger(1, 32, _settings.disp_color_fix + 1)) panel.append(rs) rs = RadioSetting("disp_contrast", "Contrast", - RadioSettingValueInteger(3, 15,_settings.disp_contrast+2)) + RadioSettingValueInteger(3, 15, _settings.disp_contrast + 2)) panel.append(rs) rs = RadioSetting("disp_intensity", "Intensity", - RadioSettingValueInteger(1, 3,_settings.disp_intensity)) + RadioSettingValueInteger(1, 3, _settings.disp_intensity)) panel.append(rs) options = ["OFF", "Auto1", "Auto2", "ON"] rs = RadioSetting("disp_mode", "Display backlight mode", - RadioSettingValueList(options, - options[_settings.disp_mode])) + RadioSettingValueList(options, options[_settings.disp_mode])) panel.append(rs) options = ["60Hz", "120Hz", "240Hz"] rs = RadioSetting("dsp_bpf", "Dsp band pass filter", - RadioSettingValueList(options, - options[_settings.dsp_bpf])) + RadioSettingValueList(options, options[_settings.dsp_bpf])) cw.append(rs) - options = ["100Hz", "160Hz", "220Hz", "280Hz", "340Hz", "400Hz", "460Hz", "520Hz", - "580Hz", "640Hz", "720Hz", "760Hz", "820Hz", "880Hz", "940Hz", "1000Hz"] + options = ["100Hz", "160Hz", "220Hz", "280Hz", "340Hz", "400Hz", + "460Hz", "520Hz", "580Hz", "640Hz", "720Hz", "760Hz", "820Hz", + "880Hz", "940Hz", "1000Hz"] rs = RadioSetting("dsp_hpf", "Dsp hi pass filter cut off", - RadioSettingValueList(options, - options[_settings.dsp_hpf])) + RadioSettingValueList(options, options[_settings.dsp_hpf])) basic.append(rs) - options = ["1000Hz", "1160Hz", "1320Hz", "1480Hz", "1650Hz", "1800Hz", "1970Hz", "2130Hz", - "2290Hz", "2450Hz", "2610Hz", "2770Hz", "2940Hz", "3100Hz", "3260Hz", "3420Hz", - "3580Hz", "3740Hz", "3900Hz", "4060Hz", "4230Hz", "4390Hz", "4550Hz", "4710Hz", - "4870Hz", "5030Hz", "5190Hz", "5390Hz", "5520Hz", "5680Hz", "5840Hz", "6000Hz"] + options = ["1000Hz", "1160Hz", "1320Hz", "1480Hz", "1650Hz", "1800Hz", + "1970Hz", "2130Hz", "2290Hz", "2450Hz", "2610Hz", "2770Hz", + "2940Hz", "3100Hz", "3260Hz", "3420Hz", "3580Hz", "3740Hz", + "3900Hz", "4060Hz", "4230Hz", "4390Hz", "4550Hz", "4710Hz", + "4870Hz", "5030Hz", "5190Hz", "5390Hz", "5520Hz", "5680Hz", + "5840Hz", "6000Hz"] rs = RadioSetting("dsp_lpf", "Dsp low pass filter cut off", - RadioSettingValueList(options, - options[_settings.dsp_lpf])) + RadioSettingValueList(options, options[_settings.dsp_lpf])) basic.append(rs) options = ["OFF", "LPF", "HPF", "BOTH"] rs = RadioSetting("dsp_mic_eq", "Dsp mic equalization", - RadioSettingValueList(options, - options[_settings.dsp_mic_eq])) + RadioSettingValueList(options, options[_settings.dsp_mic_eq])) basic.append(rs) rs = RadioSetting("dsp_nr", "DSP noise reduction level", - RadioSettingValueInteger(1, 16, _settings.dsp_nr+1)) + RadioSettingValueInteger(1, 16, _settings.dsp_nr + 1)) basic.append(rs) # emergency only for US model rs = RadioSetting("fm_mic", "FM mic gain", - RadioSettingValueInteger(0, 100, _settings.fm_mic)) + RadioSettingValueInteger(0, 100, _settings.fm_mic)) basic.append(rs) rs = RadioSetting("home_vfo", "Enable HOME to VFO moving", - RadioSettingValueBoolean(_settings.home_vfo)) + RadioSettingValueBoolean(_settings.home_vfo)) panel.append(rs) options = ["Dial", "Freq", "Panel", "All"] rs = RadioSetting("lock_mode", "Lock mode", - RadioSettingValueList(options, - options[_settings.lock_mode])) + RadioSettingValueList(options, options[_settings.lock_mode])) panel.append(rs) rs = RadioSetting("mem_group", "Mem group", - RadioSettingValueBoolean(_settings.mem_group)) + RadioSettingValueBoolean(_settings.mem_group)) basic.append(rs) options = ["CW SIDETONE", "CW SPEED", "MHz/MEM GRP", "MIC GAIN", "NB LEVEL", "RF POWER", "STEP"] rs = RadioSetting("mem_vfo_dial_mode", "Mem/VFO dial mode", - RadioSettingValueList(options, - options[_settings.mem_vfo_dial_mode])) + RadioSettingValueList(options, + options[_settings.mem_vfo_dial_mode])) panel.append(rs) rs = RadioSetting("mic_scan", "Mic scan", - RadioSettingValueBoolean(_settings.mic_scan)) + RadioSettingValueBoolean(_settings.mic_scan)) basic.append(rs) options = ["NOR", "RMT", "CAT"] rs = RadioSetting("mic_sel", "Mic selection", - RadioSettingValueList(options, - options[_settings.mic_sel])) + RadioSettingValueList(options, options[_settings.mic_sel])) extended.append(rs) - options = ["SIG", "CTR", "VLT", "N/A", "FS", "OFF"] + options = ["SIG", "CTR", "VLT", "N/A", "FS", "OFF"] rs = RadioSetting("mtr_arx_sel", "Meter receive selection", - RadioSettingValueList(options, - options[_settings.mtr_arx_sel])) + RadioSettingValueList(options, options[_settings.mtr_arx_sel])) extended.append(rs) options = ["PWR", "ALC", "MOD", "SWR", "VLT", "N/A", "OFF"] rs = RadioSetting("mtr_atx_sel", "Meter transmit selection", - RadioSettingValueList(options, - options[_settings.mtr_atx_sel])) + RadioSettingValueList(options, options[_settings.mtr_atx_sel])) extended.append(rs) rs = RadioSetting("mtr_peak_hold", "Meter peak hold", - RadioSettingValueBoolean(_settings.mtr_peak_hold)) + RadioSettingValueBoolean(_settings.mtr_peak_hold)) extended.append(rs) rs = RadioSetting("nb_level", "Noise blanking level", - RadioSettingValueInteger(0, 100, _settings.nb_level)) + RadioSettingValueInteger(0, 100, _settings.nb_level)) basic.append(rs) - s = RadioSettingValueString(0, 4, - ''.join([self._CALLSIGN_CHARSET[x] for x in - self._memobj.op_filter1_name])) - s.set_charset(self._CALLSIGN_CHARSET) - rs = RadioSetting("op_filter1_name", "Optional filter1 name", s) + st = RadioSettingValueString(0, 4, ''.join([self._CALLSIGN_CHARSET[x] + for x in self._memobj.op_filter1_name])) + st.set_charset(self._CALLSIGN_CHARSET) + rs = RadioSetting("op_filter1_name", "Optional filter1 name", st) extended.append(rs) - s = RadioSettingValueString(0, 4, - ''.join([self._CALLSIGN_CHARSET[x] for x in - self._memobj.op_filter2_name])) - s.set_charset(self._CALLSIGN_CHARSET) - rs = RadioSetting("op_filter2_name", "Optional filter2 name", s) + st = RadioSettingValueString(0, 4, ''.join([self._CALLSIGN_CHARSET[x] + for x in self._memobj.op_filter2_name])) + st.set_charset(self._CALLSIGN_CHARSET) + rs = RadioSetting("op_filter2_name", "Optional filter2 name", st) extended.append(rs) rs = RadioSetting("pg_a", "Programmable key MFq:A", - RadioSettingValueList(self.PROGRAMMABLEOPTIONS, - self.PROGRAMMABLEOPTIONS[_settings.pg_a])) + RadioSettingValueList(self.PROGRAMMABLEOPTIONS, + self.PROGRAMMABLEOPTIONS[_settings.pg_a])) extended.append(rs) rs = RadioSetting("pg_b", "Programmable key MFq:B", - RadioSettingValueList(self.PROGRAMMABLEOPTIONS, - self.PROGRAMMABLEOPTIONS[_settings.pg_b])) + RadioSettingValueList(self.PROGRAMMABLEOPTIONS, + self.PROGRAMMABLEOPTIONS[_settings.pg_b])) extended.append(rs) rs = RadioSetting("pg_c", "Programmable key MFq:C", - RadioSettingValueList(self.PROGRAMMABLEOPTIONS, - self.PROGRAMMABLEOPTIONS[_settings.pg_c])) + RadioSettingValueList(self.PROGRAMMABLEOPTIONS, + self.PROGRAMMABLEOPTIONS[_settings.pg_c])) extended.append(rs) rs = RadioSetting("pg_acc", "Programmable mic key ACC", - RadioSettingValueList(self.PROGRAMMABLEOPTIONS, - self.PROGRAMMABLEOPTIONS[_settings.pg_acc])) + RadioSettingValueList(self.PROGRAMMABLEOPTIONS, + self.PROGRAMMABLEOPTIONS[_settings.pg_acc])) extended.append(rs) rs = RadioSetting("pg_p1", "Programmable mic key P1", - RadioSettingValueList(self.PROGRAMMABLEOPTIONS, - self.PROGRAMMABLEOPTIONS[_settings.pg_p1])) + RadioSettingValueList(self.PROGRAMMABLEOPTIONS, + self.PROGRAMMABLEOPTIONS[_settings.pg_p1])) extended.append(rs) rs = RadioSetting("pg_p2", "Programmable mic key P2", - RadioSettingValueList(self.PROGRAMMABLEOPTIONS, - self.PROGRAMMABLEOPTIONS[_settings.pg_p2])) + RadioSettingValueList(self.PROGRAMMABLEOPTIONS, + self.PROGRAMMABLEOPTIONS[_settings.pg_p2])) extended.append(rs) rs = RadioSetting("pkt1200", "Packet 1200 gain level", - RadioSettingValueInteger(0, 100, _settings.pkt1200)) + RadioSettingValueInteger(0, 100, _settings.pkt1200)) packet.append(rs) rs = RadioSetting("pkt9600", "Packet 9600 gain level", - RadioSettingValueInteger(0, 100, _settings.pkt9600)) + RadioSettingValueInteger(0, 100, _settings.pkt9600)) packet.append(rs) options = ["1200", "9600"] rs = RadioSetting("pkt_rate", "Packet rate", - RadioSettingValueList(options, - options[_settings.pkt_rate])) + RadioSettingValueList(options, options[_settings.pkt_rate])) packet.append(rs) rs = RadioSetting("proc_level", "Proc level", - RadioSettingValueInteger(0, 100, _settings.proc_level)) + RadioSettingValueInteger(0, 100, _settings.proc_level)) basic.append(rs) rs = RadioSetting("rf_power_hf", "Rf power set HF", - RadioSettingValueInteger(5, 100, _settings.rf_power_hf)) + RadioSettingValueInteger(5, 100, _settings.rf_power_hf)) basic.append(rs) rs = RadioSetting("rf_power_6m", "Rf power set 6m", - RadioSettingValueInteger(5, 100, _settings.rf_power_6m)) + RadioSettingValueInteger(5, 100, _settings.rf_power_6m)) basic.append(rs) rs = RadioSetting("rf_power_vhf", "Rf power set VHF", - RadioSettingValueInteger(5, 50, _settings.rf_power_vhf)) + RadioSettingValueInteger(5, 50, _settings.rf_power_vhf)) basic.append(rs) rs = RadioSetting("rf_power_uhf", "Rf power set UHF", - RadioSettingValueInteger(2, 20, _settings.rf_power_uhf)) + RadioSettingValueInteger(2, 20, _settings.rf_power_uhf)) basic.append(rs) options = ["TIME", "BUSY", "STOP"] rs = RadioSetting("scan_mode", "Scan mode", - RadioSettingValueList(options, - options[_settings.scan_mode])) + RadioSettingValueList(options, options[_settings.scan_mode])) basic.append(rs) rs = RadioSetting("scan_resume", "Scan resume", - RadioSettingValueInteger(1, 10, _settings.scan_resume)) + RadioSettingValueInteger(1, 10, _settings.scan_resume)) basic.append(rs) rs = RadioSetting("split_tone", "Split tone enable", - RadioSettingValueBoolean(_settings.split_tone)) + RadioSettingValueBoolean(_settings.split_tone)) extended.append(rs) options = ["RF-Gain", "Squelch"] rs = RadioSetting("sql_rf_gain", "Squelch/RF-Gain", - RadioSettingValueList(options, - options[_settings.sql_rf_gain])) + RadioSettingValueList(options, options[_settings.sql_rf_gain])) panel.append(rs) rs = RadioSetting("ssb_mic", "SSB Mic gain", - RadioSettingValueInteger(0, 100, _settings.ssb_mic)) + RadioSettingValueInteger(0, 100, _settings.ssb_mic)) basic.append(rs) - options = ["Off"]+["%i" % i for i in range(1, 21)] + options = ["Off"] + ["%i" % i for i in range(1, 21)] rs = RadioSetting("tot_time", "Time-out timer", - RadioSettingValueList(options, - options[_settings.tot_time])) + RadioSettingValueList(options, options[_settings.tot_time])) basic.append(rs) options = ["OFF", "ATAS(HF)", "ATAS(HF&50)", "ATAS(ALL)", "TUNER"] rs = RadioSetting("tuner_atas", "Tuner/ATAS device", - RadioSettingValueList(options, - options[_settings.tuner_atas])) + RadioSettingValueList(options, options[_settings.tuner_atas])) extended.append(rs) rs = RadioSetting("tx_if_filter", "Transmit IF filter", - RadioSettingValueList(self.FILTERS, - self.FILTERS[_settings.tx_if_filter])) + RadioSettingValueList(self.FILTERS, + self.FILTERS[_settings.tx_if_filter])) basic.append(rs) rs = RadioSetting("vox_delay", "VOX delay (*100 ms)", - RadioSettingValueInteger(1, 30, _settings.vox_delay)) + RadioSettingValueInteger(1, 30, _settings.vox_delay)) basic.append(rs) rs = RadioSetting("vox_gain", "VOX Gain", - RadioSettingValueInteger(1, 100, _settings.vox_gain)) + RadioSettingValueInteger(1, 100, _settings.vox_gain)) basic.append(rs) rs = RadioSetting("xvtr_a", "Xvtr A displacement", - RadioSettingValueInteger(-4294967295, 4294967295, self._memobj.xvtr_a_offset * (-1 if _settings.xvtr_a_negative else 1))) + RadioSettingValueInteger(-4294967295, 4294967295, + self._memobj.xvtr_a_offset * + (-1 if _settings.xvtr_a_negative else 1))) extended.append(rs) rs = RadioSetting("xvtr_b", "Xvtr B displacement", - RadioSettingValueInteger(-4294967295, 4294967295, self._memobj.xvtr_b_offset * (-1 if _settings.xvtr_b_negative else 1))) + RadioSettingValueInteger(-4294967295, 4294967295, + self._memobj.xvtr_b_offset * + (-1 if _settings.xvtr_b_negative else 1))) extended.append(rs) options = ["OFF", "XVTR A", "XVTR B"] rs = RadioSetting("xvtr_sel", "Transverter function selection", - RadioSettingValueList(options, - options[_settings.xvtr_sel])) + RadioSettingValueList(options, options[_settings.xvtr_sel])) extended.append(rs) - + rs = RadioSetting("disp", "Display large", - RadioSettingValueBoolean(_settings.disp)) + RadioSettingValueBoolean(_settings.disp)) panel.append(rs) rs = RadioSetting("nb", "Noise blanker", - RadioSettingValueBoolean(_settings.nb)) + RadioSettingValueBoolean(_settings.nb)) panelcontr.append(rs) options = ["Auto", "Fast", "Slow", "Off"] rs = RadioSetting("agc", "AGC", - RadioSettingValueList(options, - options[_settings.agc])) + RadioSettingValueList(options, options[_settings.agc])) panelcontr.append(rs) options = ["PWR", "ALC", "SWR", "MOD"] rs = RadioSetting("pwr_meter_mode", "Power meter mode", - RadioSettingValueList(options, - options[_settings.pwr_meter_mode])) + RadioSettingValueList(options, + options[_settings.pwr_meter_mode])) panelcontr.append(rs) rs = RadioSetting("vox", "Vox", - RadioSettingValueBoolean(_settings.vox)) + RadioSettingValueBoolean(_settings.vox)) panelcontr.append(rs) rs = RadioSetting("bk", "Semi break-in", - RadioSettingValueBoolean(_settings.bk)) + RadioSettingValueBoolean(_settings.bk)) cw.append(rs) rs = RadioSetting("kyr", "Keyer", - RadioSettingValueBoolean(_settings.kyr)) + RadioSettingValueBoolean(_settings.kyr)) cw.append(rs) options = ["enabled", "disabled"] rs = RadioSetting("fst", "Fast", - RadioSettingValueList(options, - options[_settings.fst])) + RadioSettingValueList(options, options[_settings.fst])) panelcontr.append(rs) options = ["enabled", "disabled"] rs = RadioSetting("lock", "Lock", - RadioSettingValueList(options, - options[_settings.lock])) + RadioSettingValueList(options, options[_settings.lock])) panelcontr.append(rs) rs = RadioSetting("scope_peakhold", "Scope max hold", - RadioSettingValueBoolean(_settings.scope_peakhold)) + RadioSettingValueBoolean(_settings.scope_peakhold)) panelcontr.append(rs) options = ["21", "31", "127"] rs = RadioSetting("scope_width", "Scope width (channels)", - RadioSettingValueList(options, - options[_settings.scope_width])) + RadioSettingValueList(options, options[_settings.scope_width])) panelcontr.append(rs) rs = RadioSetting("proc", "Speech processor", - RadioSettingValueBoolean(_settings.proc)) + RadioSettingValueBoolean(_settings.proc)) panelcontr.append(rs) - + return top
def set_settings(self, settings): @@ -987,36 +953,36 @@ obj = _settings setting = element.get_name() if os.getenv("CHIRP_DEBUG"): - print "Setting %s(%s) <= %s" % (setting, + print "Setting %s(%s) <= %s" % (setting, getattr(obj, setting), element.value) if setting == "arts_idw": self._memobj.arts_idw = \ - [self._CALLSIGN_CHARSET_REV[x] for x in + [self._CALLSIGN_CHARSET_REV[x] for x in str(element.value)] elif setting in ["beacon_text1", "beacon_text2", "beacon_text3", "op_filter1_name", "op_filter2_name"]: setattr(self._memobj, setting, - [self._BEACON_CHARSET_REV[x] for x in + [self._BEACON_CHARSET_REV[x] for x in str(element.value)]) elif setting == "cw_delay": - val = int(element.value)+2 - setattr(obj, "cw_delay_hi", val/256) - setattr(obj, setting, val&0xff) + val = int(element.value) + 2 + setattr(obj, "cw_delay_hi", val / 256) + setattr(obj, setting, val & 0xff) elif setting == "dig_vox": val = int(element.value) - setattr(obj, "dig_vox_enable", int(val>0)) + setattr(obj, "dig_vox_enable", int(val > 0)) setattr(obj, setting, val) elif setting in ["disp_color_fix", "dsp_nr"]: - setattr(obj, setting, int(element.value)-1) + setattr(obj, setting, int(element.value) - 1) elif setting == "disp_contrast": - setattr(obj, setting, int(element.value)-2) + setattr(obj, setting, int(element.value) - 2) elif setting in ["xvtr_a", "xvtr_b"]: val = int(element.value) - setattr(obj, setting + "_negative", int(val<0)) + setattr(obj, setting + "_negative", int(val < 0)) setattr(self._memobj, setting + "_offset", abs(val)) else: setattr(obj, setting, element.value) - except Exception, e: + except: print element.get_name() raise
@@ -1030,20 +996,20 @@ _model = "" _US_model = True _memsize = 7481 - # block 9 (140 Bytes long) is to be repeted 40 times + # block 9 (140 Bytes long) is to be repeted 40 times # should be 42 times but this way I can use original 817 functions - _block_lengths = [ 2, 82, 252, 196, 252, 196, 212, 55, 140, 140, 140, 38, + _block_lengths = [2, 82, 252, 196, 252, 196, 212, 55, 140, 140, 140, 38, 176, 140]
SPECIAL_60M = { - "M-601" : -52, - "M-602" : -51, - "M-603" : -50, - "M-604" : -49, - "M-605" : -48, + "M-601": -52, + "M-602": -51, + "M-603": -50, + "M-604": -49, + "M-605": -48, } LAST_SPECIAL60M_INDEX = -52 - + SPECIAL_MEMORIES = dict(FT857Radio.SPECIAL_MEMORIES) SPECIAL_MEMORIES.update(SPECIAL_60M)
@@ -1109,7 +1075,7 @@ top = FT857Radio.get_settings(self) basic = top["basic"] rs = RadioSetting("emergency", "Emergency", - RadioSettingValueBoolean(self._memobj.settings.emergency)) + RadioSettingValueBoolean(self._memobj.settings.emergency)) basic.append(rs) return top