Bug #4355 » alinco_djg7_baud_rate_1.patch
chirp/drivers/alinco.py Sat Jan 07 12:05:37 2017 -0500 → chirp/drivers/alinco.py Mon Jan 09 15:19:33 2017 +0100 | ||
---|---|---|
from chirp.settings import RadioSettingGroup, RadioSetting
|
||
from chirp.settings import RadioSettingValueBoolean, RadioSettings
|
||
from textwrap import dedent
|
||
import time
|
||
import logging
|
||
... | ... | |
_memsize = 0x1a7c0
|
||
_range = [(500000, 1300000000)]
|
||
@classmethod
|
||
def get_prompts(cls):
|
||
rp = chirp_common.RadioPrompts()
|
||
rp.pre_download = _(dedent("""\
|
||
1. Ensure your firmware version is 4_10 or higher
|
||
2. Turn radio off
|
||
3. Connect your interface cable
|
||
4. Turn radio on
|
||
5. Press and release PTT 3 times while holding MONI key
|
||
6. Supported baud rates: 57600 (default) and 19200
|
||
(rotate dial while holding MONI to change)
|
||
7. Click OK
|
||
"""))
|
||
rp.pre_upload = _(dedent("""\
|
||
1. Ensure your firmware version is 4_10 or higher
|
||
2. Turn radio off
|
||
3. Connect your interface cable
|
||
4. Turn radio on
|
||
5. Press and release PTT 3 times while holding MONI key
|
||
6. Supported baud rates: 57600 (default) and 19200
|
||
(rotate dial while holding MONI to change)
|
||
7. Click OK
|
||
"""))
|
||
return rp
|
||
def get_features(self):
|
||
rf = chirp_common.RadioFeatures()
|
||
rf.has_dtcs_polarity = False
|
||
... | ... | |
return data
|
||
def _detect_baudrate_and_identify(self):
|
||
if self._identify():
|
||
return True
|
||
else:
|
||
# Apparenly Alinco support suggests to try again at a lower baud
|
||
# rate if their cable fails with the default rate. See #4355.
|
||
LOG.info("Could not talk to radio. Trying again at 19200 baud")
|
||
self.pipe.baudrate = 19200
|
||
return self._identify()
|
||
def _download(self, limit):
|
||
self._identify()
|
||
self._detect_baudrate_and_identify()
|
||
data = "\x00"*0x200
|
||
... | ... | |
raise Exception("Unexpected response from radio: %s" % resp)
|
||
def _upload(self, limit):
|
||
if not self._identify():
|
||
if not self._detect_baudrate_and_identify():
|
||
raise Exception("I can't talk to this model")
|
||
for addr in range(0x200, self._memsize, 0x40):
|