18 |
18 |
from chirp.settings import RadioSettingGroup, RadioSetting
|
19 |
19 |
from chirp.settings import RadioSettingValueBoolean, RadioSettings
|
20 |
20 |
|
|
21 |
from textwrap import dedent
|
|
22 |
|
21 |
23 |
import time
|
22 |
24 |
import logging
|
23 |
25 |
|
... | ... | |
612 |
614 |
_memsize = 0x1a7c0
|
613 |
615 |
_range = [(500000, 1300000000)]
|
614 |
616 |
|
|
617 |
@classmethod
|
|
618 |
def get_prompts(cls):
|
|
619 |
rp = chirp_common.RadioPrompts()
|
|
620 |
rp.pre_download = _(dedent("""\
|
|
621 |
1. Ensure your firmware version is 4_10 or higher
|
|
622 |
2. Turn radio off
|
|
623 |
3. Connect your interface cable
|
|
624 |
4. Turn radio on
|
|
625 |
5. Press and release PTT 3 times while holding MONI key
|
|
626 |
6. Supported baud rates: 57600 (default) and 19200
|
|
627 |
(rotate dial while holding MONI to change)
|
|
628 |
7. Click OK
|
|
629 |
"""))
|
|
630 |
rp.pre_upload = _(dedent("""\
|
|
631 |
1. Ensure your firmware version is 4_10 or higher
|
|
632 |
2. Turn radio off
|
|
633 |
3. Connect your interface cable
|
|
634 |
4. Turn radio on
|
|
635 |
5. Press and release PTT 3 times while holding MONI key
|
|
636 |
6. Supported baud rates: 57600 (default) and 19200
|
|
637 |
(rotate dial while holding MONI to change)
|
|
638 |
7. Click OK
|
|
639 |
"""))
|
|
640 |
return rp
|
|
641 |
|
615 |
642 |
def get_features(self):
|
616 |
643 |
rf = chirp_common.RadioFeatures()
|
617 |
644 |
rf.has_dtcs_polarity = False
|
... | ... | |
655 |
682 |
|
656 |
683 |
return data
|
657 |
684 |
|
|
685 |
def _detect_baudrate_and_identify(self):
|
|
686 |
if self._identify():
|
|
687 |
return True
|
|
688 |
else:
|
|
689 |
# Apparenly Alinco support suggests to try again at a lower baud
|
|
690 |
# rate if their cable fails with the default rate. See #4355.
|
|
691 |
LOG.info("Could not talk to radio. Trying again at 19200 baud")
|
|
692 |
self.pipe.baudrate = 19200
|
|
693 |
return self._identify()
|
|
694 |
|
658 |
695 |
def _download(self, limit):
|
659 |
|
self._identify()
|
|
696 |
self._detect_baudrate_and_identify()
|
660 |
697 |
|
661 |
698 |
data = "\x00"*0x200
|
662 |
699 |
|
... | ... | |
688 |
725 |
raise Exception("Unexpected response from radio: %s" % resp)
|
689 |
726 |
|
690 |
727 |
def _upload(self, limit):
|
691 |
|
if not self._identify():
|
|
728 |
if not self._detect_baudrate_and_identify():
|
692 |
729 |
raise Exception("I can't talk to this model")
|
693 |
730 |
|
694 |
731 |
for addr in range(0x200, self._memsize, 0x40):
|