<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Kosta,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Comments inline.</div></div><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>This change is precipitated by the requirement to support configurable civ's (#4547) such that we are no longer able to hard code these values into the code base. While I agree that it would be ideal to not include it as part of the refactoring effort, so as to reduce its scope, the refactoring itself would introduce a circular dependency on the hard coded classes and thus makes it a requirement of this change.</div></div></div></blockquote><div><br></div><div class="gmail_default" style="font-size:small">You are assuming that the change to probe_model() would be applied *after* splitting up the file if it's not embedded within the same patch. But there is no reason that a patch to change probe_model() could not be applied *before* any other possible refactoring. It would, as you imply, make the Icom detect mechanism more consistent with the Kenwood one insofar as they would use the same driver enumeration mechanism, and at the same time remove the reliance on the module-global dict of radio models.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>The intent of this change is to reduce potential conflicts amongst developers working on similar radio models. Currently there are multiple implementations of icom live mode radios being introduced into the code base - this change should minimize the scope of those changes making it i) easier to develop and ii) reducing merge conflicts and iii) easier to test.</div></div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">I don't really buy this. The rate of change in that file is very low. The addition of a radio involves (a) adding new classes that are not used in any way by other existing specific driver classes, and (b) *maybe* changing some common code if the new radio involves new features that none of the existing radios use. The former isn't going to introduce merge conflicts, and the latter will introduce them just as much if the common code is in a separate file as if it's in the same file. What changes is whether one or two files are involved, that's all.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">As for easier testing, testing is a real issue with the Icom Live mode radios regardless of the changes you're proposing. I'm pretty sure that none of the developers has all of these radios. Any change to the common code - including yours - has the potential to break some or all of the others.</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>Another outcome of this change is to allow for a clear isolation of radio specific implementation details from the base class, thus reducing the potential for knock on effects from a developer introducing a new radio model while unknowingly breaking another.</div></div></div></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Not really, no. Either the new radio involves changes to the common code or it doesn't. The potential for breakage doesn't change just because the common code is in a separate file.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>The root of the impending changes to support #4547 stems from the current implementation of how CIV values are handled, in that they are currently implemented as static variables and will need to become class variables. As this is a significant deviation to the implementation of the base IcomCIVRadio class, this change will allow for the development of specific radio models mentioned above to continue unimpeded by that work.<br></div></div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">I get the requirement to move to a configurable ID value, and I get that changing probe_model() is a first step, eliminating the need for the current static dict. I'm not arguing against making that change. What you seem to be arguing is that splitting the file means that a slew of changes to the base class won't affect development of subclasses. In theory, it does keep the changes in separate files. However, if I'm working on a new radio, and the base class is undergoing changes right underneath my feet, so to speak, I'm going to be a bit concerned anyway about whether or not my new radio is going to work. And what if a change in the base class creates a need to update all of the existing subclasses? Then there are going to be merge conflicts anyway.</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div></div><div>This particular situation arises anytime new source files are introduced into the code base; there is however precedence for this type of change on this code base, for example:<br></div></div></div></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Precedent doesn't mean it's a good thing. :-)</div><div class="gmail_default" style="font-size:small"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div></div><div>In our particular situation the history is not lost as in the previous revision. In fact, the icomciv.py file is retained in the repo along with its history.<br></div></div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">It's there, but who will know it's there in a couple of years? You and I (and Dan) might know where to look to find the previous commit messages, but someone coming along and looking to implement a new radio would not know where to look.</div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>Every one of us is welcome to an opinion, in my own personal view I simply find that the separation of implementation classes from their inherited base class to be cleaner and good programming practice which in the long run creates for a healthier code base and development experience overall. In this case however the intent was not imposed merely for aesthetic reasons but rather to avoid conflict and allow for concurrent development to take place moving forward. Given the scope of the changed code itself is relatively small I see a small risk impact.<br></div></div></div></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Unless you tell me you have all of the Icom Live radios, I'm going to disagree on the level of risk. :-) How will you test?</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Anyway, as you said, we're all entitled to our opinions. We've expressed ours, but of course the decisions belong to Dan. :-)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Martin.</div><div class="gmail_default" style="font-size:small">KD6YAM</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-size:small"></div><div style="font-size:small">Personally, I would prefer to not see this patch applied at least until we understand why it might be helpful to the upcoming changes for #4547, since I just don't see the justification right now.</div><div style="font-size:small"><br></div><div style="font-size:small">Martin.</div><div style="font-size:small">KD6YAM</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 30, 2021 at 9:42 AM Kosta A. via chirp_devel <<a href="mailto:chirp_devel@intrepid.danplanet.com" target="_blank">chirp_devel@intrepid.danplanet.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"># HG changeset patch<br>
# User Kosta A. <<a href="mailto:ve7kcy@gmail.com" target="_blank">ve7kcy@gmail.com</a>><br>
# Date 1619800737 25200<br>
# Fri Apr 30 09:38:57 2021 -0700<br>
# Node ID 941a95de942d7c263a6197bf115cc75bc3624de9<br>
# Parent cd3e2444040876b4a19b41c6cfecedb79ff4a8fe<br>
[icomciv] Restructuring of IcomCIVRadio radio classes; breakout each radio into its own module in preparetion for simplifying support for upcomming CIV feature #4547.<br>
<br>
diff --git a/chirp/drivers/ic7000.py b/chirp/drivers/ic7000.py<br>
new file mode 100644<br>
--- /dev/null<br>
+++ b/chirp/drivers/ic7000.py<br>
@@ -0,0 +1,84 @@<br>
+# Copyright 2008 Dan Smith <<a href="mailto:dsmith@danplanet.com" target="_blank">dsmith@danplanet.com</a>><br>
+#<br>
+# This program is free software: you can redistribute it and/or modify<br>
+# it under the terms of the GNU General Public License as published by<br>
+# the Free Software Foundation, either version 3 of the License, or<br>
+# (at your option) any later version.<br>
+#<br>
+# This program is distributed in the hope that it will be useful,<br>
+# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+# GNU General Public License for more details.<br>
+#<br>
+# You should have received a copy of the GNU General Public License<br>
+# along with this program. If not, see <<a href="http://www.gnu.org/licenses/" rel="noreferrer" target="_blank">http://www.gnu.org/licenses/</a>>.<br>
+<br>
+import struct<br>
+import logging<br>
+<br>
+from chirp import chirp_common, errors, directory<br>
+from chirp.drivers import icf, icomciv<br>
+<br>
+LOG = logging.getLogger(__name__)<br>
+<br>
+# <a href="http://www.vk4adc.com/" rel="noreferrer" target="_blank">http://www.vk4adc.com/</a><br>
+# web/index.php/reference-information/49-general-ref-info/182-civ7400<br>
+MEM_IC7000_FORMAT = """<br>
+u8 bank;<br>
+bbcd number[2];<br>
+u8 spl:4,<br>
+ skip:4;<br>
+lbcd freq[5];<br>
+u8 mode;<br>
+u8 filter;<br>
+u8 duplex:4,<br>
+ tmode:4;<br>
+bbcd rtone[3];<br>
+bbcd ctone[3];<br>
+u8 dtcs_polarity;<br>
+bbcd dtcs[2];<br>
+lbcd freq_tx[5];<br>
+u8 mode_tx;<br>
+u8 filter_tx;<br>
+u8 duplex_tx:4,<br>
+ tmode_tx:4;<br>
+bbcd rtone_tx[3];<br>
+bbcd ctone_tx[3];<br>
+u8 dtcs_polarity_tx;<br>
+bbcd dtcs_tx[2];<br>
+char name[9];<br>
+"""<br>
+<br>
+class IC7000MemFrame(icomciv.BankMemFrame):<br>
+ FORMAT = MEM_IC7000_FORMAT<br>
+<br>
+@directory.register<br>
+class Icom7000Radio(icomciv.IcomCIVRadio):<br>
+ """Icom IC-7000"""<br>
+ MODEL = "IC-7000"<br>
+ _model = "\x70"<br>
+ _template = 102<br>
+<br>
+ _num_banks = 5 # Banks A-E<br>
+ _bank_index_bounds = (1, 99)<br>
+ _bank_class = icf.IcomBank<br>
+<br>
+ def _initialize(self):<br>
+ self._classes["mem"] = IC7000MemFrame<br>
+ self._rf.has_bank = True<br>
+ self._rf.has_dtcs_polarity = True<br>
+ self._rf.has_dtcs = True<br>
+ self._rf.has_ctone = True<br>
+ self._rf.has_offset = True<br>
+ self._rf.has_name = True<br>
+ self._rf.has_tuning_step = False<br>
+ self._rf.valid_modes = ["LSB", "USB", "AM", "CW", "RTTY", "FM", "WFM"]<br>
+ self._rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS"]<br>
+ self._rf.valid_duplexes = ["", "-", "+", "split"]<br>
+ self._rf.valid_bands = [(30000, 199999999), (400000000, 470000000)]<br>
+ self._rf.valid_tuning_steps = []<br>
+ self._rf.valid_skips = ["S", ""]<br>
+ self._rf.valid_name_length = 9<br>
+ self._rf.valid_characters = chirp_common.CHARSET_ASCII<br>
+ self._rf.memory_bounds = (0, 99 * self._num_banks - 1)<br>
+ self._rf.can_odd_split = True<br>
diff --git a/chirp/drivers/ic7100.py b/chirp/drivers/ic7100.py<br>
new file mode 100644<br>
--- /dev/null<br>
+++ b/chirp/drivers/ic7100.py<br>
@@ -0,0 +1,88 @@<br>
+# Copyright 2008 Dan Smith <<a href="mailto:dsmith@danplanet.com" target="_blank">dsmith@danplanet.com</a>><br>
+#<br>
+# This program is free software: you can redistribute it and/or modify<br>
+# it under the terms of the GNU General Public License as published by<br>
+# the Free Software Foundation, either version 3 of the License, or<br>
+# (at your option) any later version.<br>
+#<br>
+# This program is distributed in the hope that it will be useful,<br>
+# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+# GNU General Public License for more details.<br>
+#<br>
+# You should have received a copy of the GNU General Public License<br>
+# along with this program. If not, see <<a href="http://www.gnu.org/licenses/" rel="noreferrer" target="_blank">http://www.gnu.org/licenses/</a>>.<br>
+<br>
+import struct<br>
+import logging<br>
+<br>
+from chirp import chirp_common, errors, directory<br>
+from chirp.drivers import icf, icomciv<br>
+<br>
+LOG = logging.getLogger(__name__)<br>
+<br>
+<br>
+MEM_IC7100_FORMAT = """<br>
+u8 bank; // 1 bank number<br>
+bbcd number[2]; // 2,3<br>
+u8 splitSelect; // 4 split and select memory settings<br>
+lbcd freq[5]; // 5-9 operating freq<br>
+u8 mode; // 10 operating mode<br>
+u8 filter; // 11 filter<br>
+u8 dataMode; // 12 data mode setting (on or off)<br>
+u8 duplex:4, // 13 duplex on/-/+<br>
+ tmode:4; // 13 tone<br>
+u8 dsql:4, // 14 digital squelch<br>
+ unknown1:4; // 14 zero<br>
+bbcd rtone[3]; // 15-17 repeater tone freq<br>
+bbcd ctone[3]; // 18-20 tone squelch setting<br>
+u8 dtcsPolarity; // 21 DTCS polarity<br>
+u8 unknown2:4, // 22 zero<br>
+ firstDtcs:4; // 22 first digit of DTCS code<br>
+u8 secondDtcs:4, // 23 second digit DTCS<br>
+ thirdDtcs:4; // 23 third digit DTCS<br>
+u8 digitalSquelch; // 24 Digital code squelch setting<br>
+lbcd duplexOffset[3]; // 25-27 duplex offset freq<br>
+char destCall[8]; // 28-35 destination call sign<br>
+char accessRepeaterCall[8];// 36-43 access repeater call sign<br>
+char linkRepeaterCall[8]; // 44-51 gateway/link repeater call sign<br>
+bbcd duplexSettings[47]; // repeat of 5-51 for duplex<br>
+char name[16]; // 52-60 Name of station<br>
+"""<br>
+<br>
+class IC7100MemFrame(icomciv.BankMemFrame):<br>
+ FORMAT = MEM_IC7100_FORMAT<br>
+<br>
+@directory.register<br>
+class Icom7100Radio(icomciv.IcomCIVRadio):<br>
+ """Icom IC-7100"""<br>
+ MODEL = "IC-7100"<br>
+ _model = "\x88"<br>
+ _template = 102<br>
+<br>
+ _num_banks = 5<br>
+ _bank_index_bounds = (1, 99)<br>
+ _bank_class = icf.IcomBank<br>
+<br>
+ def _initialize(self):<br>
+ self._classes["mem"] = IC7100MemFrame<br>
+ self._rf.has_bank = True<br>
+ self._rf.has_bank_index = False<br>
+ self._rf.has_bank_names = False<br>
+ self._rf.has_dtcs_polarity = False<br>
+ self._rf.has_dtcs = False<br>
+ self._rf.has_ctone = True<br>
+ self._rf.has_offset = False<br>
+ self._rf.has_name = True<br>
+ self._rf.has_tuning_step = False<br>
+ self._rf.valid_modes = [<br>
+ "LSB", "USB", "AM", "CW", "RTTY", "FM", "WFM", "CWR", "RTTYR", "DV"<br>
+ ]<br>
+ self._rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS"]<br>
+ self._rf.valid_duplexes = ["", "-", "+"]<br>
+ self._rf.valid_bands = [(30000, 199999999), (400000000, 470000000)]<br>
+ self._rf.valid_tuning_steps = []<br>
+ self._rf.valid_skips = []<br>
+ self._rf.valid_name_length = 16<br>
+ self._rf.valid_characters = chirp_common.CHARSET_ASCII<br>
+ self._rf.memory_bounds = (0, 99 * self._num_banks - 1)<br>
diff --git a/chirp/drivers/ic7200.py b/chirp/drivers/ic7200.py<br>
new file mode 100644<br>
--- /dev/null<br>
+++ b/chirp/drivers/ic7200.py<br>
@@ -0,0 +1,48 @@<br>
+# Copyright 2008 Dan Smith <<a href="mailto:dsmith@danplanet.com" target="_blank">dsmith@danplanet.com</a>><br>
+#<br>
+# This program is free software: you can redistribute it and/or modify<br>
+# it under the terms of the GNU General Public License as published by<br>
+# the Free Software Foundation, either version 3 of the License, or<br>
+# (at your option) any later version.<br>
+#<br>
+# This program is distributed in the hope that it will be useful,<br>
+# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+# GNU General Public License for more details.<br>
+#<br>
+# You should have received a copy of the GNU General Public License<br>
+# along with this program. If not, see <<a href="http://www.gnu.org/licenses/" rel="noreferrer" target="_blank">http://www.gnu.org/licenses/</a>>.<br>
+<br>
+import struct<br>
+import logging<br>
+<br>
+from chirp import chirp_common, errors, directory<br>
+from chirp.drivers import icf, icomciv<br>
+<br>
+LOG = logging.getLogger(__name__)<br>
+<br>
+<br>
+@directory.register<br>
+class Icom7200Radio(icomciv.IcomCIVRadio):<br>
+ """Icom IC-7200"""<br>
+ MODEL = "7200"<br>
+ _model = "\x76"<br>
+ _template = 201<br>
+<br>
+ _num_banks = 1 # Banks not supported<br>
+<br>
+ def _initialize(self):<br>
+ self._rf.has_bank = False<br>
+ self._rf.has_dtcs_polarity = False<br>
+ self._rf.has_dtcs = False<br>
+ self._rf.has_ctone = False<br>
+ self._rf.has_offset = False<br>
+ self._rf.has_name = False<br>
+ self._rf.has_tuning_step = False<br>
+ self._rf.valid_modes = ["LSB", "USB", "AM", "CW", "RTTY",<br>
+ "CWR", "RTTYR"]<br>
+ self._rf.valid_tmodes = []<br>
+ self._rf.valid_duplexes = []<br>
+ self._rf.valid_bands = [(30000, 60000000)]<br>
+ self._rf.valid_skips = []<br>
+ self._rf.memory_bounds = (1, 201)<br>
diff --git a/chirp/drivers/ic7300.py b/chirp/drivers/ic7300.py<br>
new file mode 100644<br>
--- /dev/null<br>
+++ b/chirp/drivers/ic7300.py<br>
@@ -0,0 +1,103 @@<br>
+# Copyright 2008 Dan Smith <<a href="mailto:dsmith@danplanet.com" target="_blank">dsmith@danplanet.com</a>><br>
+#<br>
+# This program is free software: you can redistribute it and/or modify<br>
+# it under the terms of the GNU General Public License as published by<br>
+# the Free Software Foundation, either version 3 of the License, or<br>
+# (at your option) any later version.<br>
+#<br>
+# This program is distributed in the hope that it will be useful,<br>
+# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+# GNU General Public License for more details.<br>
+#<br>
+# You should have received a copy of the GNU General Public License<br>
+# along with this program. If not, see <<a href="http://www.gnu.org/licenses/" rel="noreferrer" target="_blank">http://www.gnu.org/licenses/</a>>.<br>
+<br>
+import struct<br>
+import logging<br>
+<br>
+from chirp import chirp_common, errors, directory<br>
+from chirp.drivers import icf, icomciv<br>
+<br>
+LOG = logging.getLogger(__name__)<br>
+<br>
+<br>
+MEM_IC7300_FORMAT = """<br>
+bbcd number[2]; // 1,2<br>
+u8 spl:4, // 3 split and select memory settings<br>
+ select:4;<br>
+lbcd freq[5]; // 4-8 receive freq<br>
+u8 mode; // 9 operating mode<br>
+u8 filter; // 10 filter 1-3 (undocumented)<br>
+u8 dataMode:4, // 11 data mode setting (on or off)<br>
+ tmode:4; // 11 tone type<br>
+char pad1;<br>
+bbcd rtone[2]; // 12-14 tx tone freq<br>
+char pad2;<br>
+bbcd ctone[2]; // 15-17 tone rx squelch setting<br>
+lbcd freq_tx[5]; // 4-8 transmit freq<br>
+u8 mode_tx; // 9 tx operating mode<br>
+u8 filter_tx; // 10<br>
+u8 dataMode_tx:4, // 11 tx data mode setting (on or off)<br>
+ tmode_tx:4; // 11 tx tone type<br>
+char pad3;<br>
+bbcd rtone_tx[2]; // 12-14 repeater tone freq<br>
+char pad4;<br>
+bbcd ctone_tx[2]; // 15-17 tone squelch setting<br>
+char name[10]; // 18-27 Callsign<br>
+"""<br>
+<br>
+class IC7300MemFrame(icomciv.MemFrame):<br>
+ FORMAT = MEM_IC7300_FORMAT<br>
+<br>
+@directory.register<br>
+class Icom7300Radio(icomciv.IcomCIVRadio):<br>
+ """Icom IC-7300"""<br>
+ MODEL = "IC-7300"<br>
+ _model = "\x94"<br>
+ _template = 100 # Use P1 as blank template<br>
+<br>
+ _SPECIAL_CHANNELS = {<br>
+ "P1": 100,<br>
+ "P2": 101,<br>
+ }<br>
+ _SPECIAL_CHANNELS_REV = dict(zip(_SPECIAL_CHANNELS.values(),<br>
+ _SPECIAL_CHANNELS.keys()))<br>
+<br>
+ def _is_special(self, number):<br>
+ return number > 99 or isinstance(number, str)<br>
+<br>
+ def _get_special_info(self, number):<br>
+ info = SpecialChannel()<br>
+ if isinstance(number, str):<br>
+ <a href="http://info.name" rel="noreferrer" target="_blank">info.name</a> = number<br>
+ info.channel = self._SPECIAL_CHANNELS[number]<br>
+ info.location = info.channel<br>
+ else:<br>
+ info.location = number<br>
+ <a href="http://info.name" rel="noreferrer" target="_blank">info.name</a> = self._SPECIAL_CHANNELS_REV[number]<br>
+ info.channel = info.location<br>
+ return info<br>
+<br>
+ def _initialize(self):<br>
+ self._classes["mem"] = IC7300MemFrame<br>
+ self._rf.has_name = True<br>
+ self._rf.has_dtcs = False<br>
+ self._rf.has_dtcs_polarity = False<br>
+ self._rf.has_bank = False<br>
+ self._rf.has_tuning_step = False<br>
+ self._rf.has_nostep_tuning = True<br>
+ self._rf.can_odd_split = True<br>
+ self._rf.memory_bounds = (1, 99)<br>
+ self._rf.valid_modes = [<br>
+ "LSB", "USB", "AM", "CW", "RTTY", "FM", "CWR", "RTTYR",<br>
+ "Data+LSB", "Data+USB", "Data+AM", "N/A", "N/A", "Data+FM"<br>
+ ]<br>
+ self._rf.valid_tmodes = ["", "Tone", "TSQL"]<br>
+ # self._rf.valid_duplexes = ["", "-", "+", "split"]<br>
+ self._rf.valid_duplexes = [] # To prevent using memobj.duplex<br>
+ self._rf.valid_bands = [(1800000, 70500000)]<br>
+ self._rf.valid_skips = []<br>
+ self._rf.valid_name_length = 10<br>
+ self._rf.valid_characters = chirp_common.CHARSET_ASCII<br>
+ self._rf.valid_special_chans = sorted(self._SPECIAL_CHANNELS.keys())<br>
diff --git a/chirp/drivers/ic746.py b/chirp/drivers/ic746.py<br>
new file mode 100644<br>
--- /dev/null<br>
+++ b/chirp/drivers/ic746.py<br>
@@ -0,0 +1,76 @@<br>
+# Copyright 2008 Dan Smith <<a href="mailto:dsmith@danplanet.com" target="_blank">dsmith@danplanet.com</a>><br>
+#<br>
+# This program is free software: you can redistribute it and/or modify<br>
+# it under the terms of the GNU General Public License as published by<br>
+# the Free Software Foundation, either version 3 of the License, or<br>
+# (at your option) any later version.<br>
+#<br>
+# This program is distributed in the hope that it will be useful,<br>
+# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+# GNU General Public License for more details.<br>
+#<br>
+# You should have received a copy of the GNU General Public License<br>
+# along with this program. If not, see <<a href="http://www.gnu.org/licenses/" rel="noreferrer" target="_blank">http://www.gnu.org/licenses/</a>>.<br>
+<br>
+import struct<br>
+import logging<br>
+<br>
+from chirp import chirp_common, errors, directory<br>
+from chirp.drivers import icf, icomciv<br>
+<br>
+LOG = logging.getLogger(__name__)<br>
+<br>
+<br>
+MEM_IC746_FORMAT = """<br>
+bbcd number[2];<br>
+u8 unknown1;<br>
+lbcd freq[5];<br>
+u8 unknown2:5,<br>
+ mode:3;<br>
+u8 unknown1;<br>
+u8 unknown2:2,<br>
+ duplex:2,<br>
+ unknown3:1,<br>
+ tmode:3;<br>
+u8 unknown4;<br>
+bbcd rtone[2];<br>
+u8 unknown5;<br>
+bbcd ctone[2];<br>
+u8 dtcs_polarity;<br>
+bbcd dtcs[2];<br>
+u8 unknown[11];<br>
+char name[9];<br>
+"""<br>
+<br>
+class IC746MemFrame(icomciv.MemFrame):<br>
+ FORMAT = MEM_IC746_FORMAT<br>
+<br>
+@directory.register<br>
+class Icom746Radio(icomciv.IcomCIVRadio):<br>
+ """Icom IC-746"""<br>
+ MODEL = "746"<br>
+ BAUD_RATE = 9600<br>
+ _model = "\x56"<br>
+ _template = 102<br>
+<br>
+ _num_banks = 1 # Banks not supported<br>
+<br>
+ def _initialize(self):<br>
+ self._classes["mem"] = IC746MemFrame<br>
+ self._rf.has_bank = False<br>
+ self._rf.has_dtcs_polarity = False<br>
+ self._rf.has_dtcs = False<br>
+ self._rf.has_ctone = True<br>
+ self._rf.has_offset = False<br>
+ self._rf.has_name = True<br>
+ self._rf.has_tuning_step = False<br>
+ self._rf.valid_modes = ["LSB", "USB", "AM", "CW", "RTTY", "FM"]<br>
+ self._rf.valid_tmodes = ["", "Tone", "TSQL"]<br>
+ self._rf.valid_duplexes = ["", "-", "+"]<br>
+ self._rf.valid_bands = [(30000, 199999999)]<br>
+ self._rf.valid_tuning_steps = []<br>
+ self._rf.valid_skips = []<br>
+ self._rf.valid_name_length = 9<br>
+ self._rf.valid_characters = chirp_common.CHARSET_ASCII<br>
+ self._rf.memory_bounds = (1, 99)<br>
diff --git a/chirp/drivers/ic910.py b/chirp/drivers/ic910.py<br>
new file mode 100644<br>
--- /dev/null<br>
+++ b/chirp/drivers/ic910.py<br>
@@ -0,0 +1,142 @@<br>
+# Copyright 2008 Dan Smith <<a href="mailto:dsmith@danplanet.com" target="_blank">dsmith@danplanet.com</a>><br>
+#<br>
+# This program is free software: you can redistribute it and/or modify<br>
+# it under the terms of the GNU General Public License as published by<br>
+# the Free Software Foundation, either version 3 of the License, or<br>
+# (at your option) any later version.<br>
+#<br>
+# This program is distributed in the hope that it will be useful,<br>
+# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+# GNU General Public License for more details.<br>
+#<br>
+# You should have received a copy of the GNU General Public License<br>
+# along with this program. If not, see <<a href="http://www.gnu.org/licenses/" rel="noreferrer" target="_blank">http://www.gnu.org/licenses/</a>>.<br>
+<br>
+import struct<br>
+import logging<br>
+<br>
+from chirp import chirp_common, errors, directory<br>
+from chirp.drivers import icf, icomciv<br>
+<br>
+LOG = logging.getLogger(__name__)<br>
+<br>
+<br>
+MEM_IC910_FORMAT = """<br>
+u8 bank; // 1 bank number<br>
+bbcd number[2]; // 2,3<br>
+lbcd freq[5]; // 4-8 operating freq<br>
+u8 mode; // 9 operating mode<br>
+u8 filter; // 10 filter<br>
+u8 tmode:4, // 11 tone<br>
+ duplex:4; // 11 duplex off/-/+<br>
+bbcd rtone[3]; // 12-14 repeater tone freq<br>
+bbcd ctone[3]; // 15-17 tone squelch setting<br>
+lbcd duplexOffset[3]; // 18-20 duplex offset freq<br>
+"""<br>
+<br>
+class IC910MemFrame(icomciv.BankMemFrame):<br>
+ FORMAT = MEM_IC910_FORMAT<br>
+<br>
+@directory.register<br>
+class Icom910Radio(icomciv.IcomCIVRadio):<br>
+ """Icom IC-910"""<br>
+ MODEL = "IC-910"<br>
+ BAUD_RATE = 19200<br>
+ _model = "\x60"<br>
+ _template = 100<br>
+<br>
+ _num_banks = 3 # Banks for 2m, 70cm, 23cm<br>
+ _bank_index_bounds = (1, 99)<br>
+ _bank_class = icf.IcomBank<br>
+<br>
+ _SPECIAL_CHANNELS = {<br>
+ "1A": 100,<br>
+ "1b": 101,<br>
+ "2A": 102,<br>
+ "2b": 103,<br>
+ "3A": 104,<br>
+ "3b": 105,<br>
+ "C": 106,<br>
+ }<br>
+ _SPECIAL_CHANNELS_REV = {v: k for k, v in _SPECIAL_CHANNELS.items()}<br>
+<br>
+ _SPECIAL_BANKS = {<br>
+ "2m": 1,<br>
+ "70cm": 2,<br>
+ "23cm": 3,<br>
+ }<br>
+ _SPECIAL_BANKS_REV = {v: k for k, v in _SPECIAL_BANKS.items()}<br>
+<br>
+ def _get_special_names(self, band):<br>
+ return sorted([band + "-" + key<br>
+ for key in self._SPECIAL_CHANNELS.keys()])<br>
+<br>
+ def _is_special(self, number):<br>
+ return number >= 1000 or isinstance(number, str)<br>
+<br>
+ def _get_special_info(self, number):<br>
+ info = BankSpecialChannel()<br>
+ if isinstance(number, str):<br>
+ <a href="http://info.name" rel="noreferrer" target="_blank">info.name</a> = number<br>
+ (band_name, chan_name) = number.split("-")<br>
+ info.bank = self._SPECIAL_BANKS[band_name]<br>
+ info.channel = self._SPECIAL_CHANNELS[chan_name]<br>
+ info.location = info.bank * 1000 + info.channel<br>
+ else:<br>
+ info.location = number<br>
+ (info.bank, info.channel) = divmod(number, 1000)<br>
+ band_name = self._SPECIAL_BANKS_REV[info.bank]<br>
+ chan_name = self._SPECIAL_CHANNELS_REV[info.channel]<br>
+ <a href="http://info.name" rel="noreferrer" target="_blank">info.name</a> = band_name + "-" + chan_name<br>
+ return info<br>
+<br>
+ # The IC-910 has a bank of memories for each band. The 23cm band is only<br>
+ # available when the optional UX-910 unit is installed, but there is no<br>
+ # direct means of detecting its presence. Instead, attempt to access the<br>
+ # first memory in the 23cm bank. If that's successful, the unit is there,<br>
+ # and we can present all 3 banks to the user. Otherwise, the unit is not<br>
+ # installed, so we present 2 banks to the user, for 2m and 70cm.<br>
+ def _detect_23cm_unit(self):<br>
+ if not self.pipe:<br>
+ return True<br>
+ f = IC910MemFrame()<br>
+ f.set_location(1, 3) # First memory in 23cm bank<br>
+ self._send_frame(f)<br>
+ f.read(self.pipe)<br>
+ if f._cmd == 0xFA: # Error code lands in command field<br>
+ self._num_banks = 2<br>
+ LOG.debug("UX-910 unit is %sinstalled" %<br>
+ ("not " if self._num_banks == 2 else ""))<br>
+ return self._num_banks == 3<br>
+<br>
+ def _initialize(self):<br>
+ self._classes["mem"] = IC910MemFrame<br>
+ self._has_23cm_unit = self._detect_23cm_unit()<br>
+ self._rf.has_bank = True<br>
+ self._rf.has_dtcs_polarity = False<br>
+ self._rf.has_dtcs = False<br>
+ self._rf.has_ctone = True<br>
+ self._rf.has_offset = True<br>
+ self._rf.has_name = False<br>
+ self._rf.has_tuning_step = False<br>
+ self._rf.valid_modes = ["LSB", "USB", "CW", "NCW", "FM", "NFM"]<br>
+ self._rf.valid_tmodes = ["", "Tone", "TSQL"]<br>
+ self._rf.valid_duplexes = ["", "-", "+"]<br>
+ self._rf.valid_bands = [(136000000, 174000000),<br>
+ (420000000, 480000000)]<br>
+ self._rf.valid_tuning_steps = []<br>
+ self._rf.valid_skips = []<br>
+ self._rf.valid_special_chans = (self._get_special_names("2m") +<br>
+ self._get_special_names("70cm"))<br>
+ self._rf.memory_bounds = (1, 99 * self._num_banks)<br>
+<br>
+ if self._has_23cm_unit:<br>
+ self._rf.valid_bands.append((1240000000, 1320000000))<br>
+ self._rf.valid_special_chans += self._get_special_names("23cm")<br>
+<br>
+ # Combine mode and filter into unified mode<br>
+ self._unified_modes = True<br>
+<br>
+ # Use Chirp locations starting with 1<br>
+ self._adjust_bank_loc_start = True<br>
diff --git a/chirp/drivers/icomciv.py b/chirp/drivers/icomciv.py<br>
--- a/chirp/drivers/icomciv.py<br>
+++ b/chirp/drivers/icomciv.py<br>
@@ -1,6 +1,21 @@<br>
-# Latest update: March, 2021 RJ DeWitt added IC-7300<br>
+# Copyright 2008 Dan Smith <<a href="mailto:dsmith@danplanet.com" target="_blank">dsmith@danplanet.com</a>><br>
+#<br>
+# This program is free software: you can redistribute it and/or modify<br>
+# it under the terms of the GNU General Public License as published by<br>
+# the Free Software Foundation, either version 3 of the License, or<br>
+# (at your option) any later version.<br>
+#<br>
+# This program is distributed in the hope that it will be useful,<br>
+# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+# GNU General Public License for more details.<br>
+#<br>
+# You should have received a copy of the GNU General Public License<br>
+# along with this program. If not, see <<a href="http://www.gnu.org/licenses/" rel="noreferrer" target="_blank">http://www.gnu.org/licenses/</a>>.<br>
+<br>
import struct<br>
import logging<br>
+<br>
from chirp.drivers import icf<br>
from chirp import chirp_common, util, errors, bitwise, directory<br>
from chirp.memmap import MemoryMap<br>
@@ -23,122 +38,6 @@<br>
unknown_2:4;<br>
"""<br>
<br>
-<br>
-# <a href="http://www.vk4adc.com/" rel="noreferrer" target="_blank">http://www.vk4adc.com/</a><br>
-# web/index.php/reference-information/49-general-ref-info/182-civ7400<br>
-MEM_IC7000_FORMAT = """<br>
-u8 bank;<br>
-bbcd number[2];<br>
-u8 spl:4,<br>
- skip:4;<br>
-lbcd freq[5];<br>
-u8 mode;<br>
-u8 filter;<br>
-u8 duplex:4,<br>
- tmode:4;<br>
-bbcd rtone[3];<br>
-bbcd ctone[3];<br>
-u8 dtcs_polarity;<br>
-bbcd dtcs[2];<br>
-lbcd freq_tx[5];<br>
-u8 mode_tx;<br>
-u8 filter_tx;<br>
-u8 duplex_tx:4,<br>
- tmode_tx:4;<br>
-bbcd rtone_tx[3];<br>
-bbcd ctone_tx[3];<br>
-u8 dtcs_polarity_tx;<br>
-bbcd dtcs_tx[2];<br>
-char name[9];<br>
-"""<br>
-<br>
-MEM_IC7100_FORMAT = """<br>
-u8 bank; // 1 bank number<br>
-bbcd number[2]; // 2,3<br>
-u8 splitSelect; // 4 split and select memory settings<br>
-lbcd freq[5]; // 5-9 operating freq<br>
-u8 mode; // 10 operating mode<br>
-u8 filter; // 11 filter<br>
-u8 dataMode; // 12 data mode setting (on or off)<br>
-u8 duplex:4, // 13 duplex on/-/+<br>
- tmode:4; // 13 tone<br>
-u8 dsql:4, // 14 digital squelch<br>
- unknown1:4; // 14 zero<br>
-bbcd rtone[3]; // 15-17 repeater tone freq<br>
-bbcd ctone[3]; // 18-20 tone squelch setting<br>
-u8 dtcsPolarity; // 21 DTCS polarity<br>
-u8 unknown2:4, // 22 zero<br>
- firstDtcs:4; // 22 first digit of DTCS code<br>
-u8 secondDtcs:4, // 23 second digit DTCS<br>
- thirdDtcs:4; // 23 third digit DTCS<br>
-u8 digitalSquelch; // 24 Digital code squelch setting<br>
-lbcd duplexOffset[3]; // 25-27 duplex offset freq<br>
-char destCall[8]; // 28-35 destination call sign<br>
-char accessRepeaterCall[8];// 36-43 access repeater call sign<br>
-char linkRepeaterCall[8]; // 44-51 gateway/link repeater call sign<br>
-bbcd duplexSettings[47]; // repeat of 5-51 for duplex<br>
-char name[16]; // 52-60 Name of station<br>
-"""<br>
-<br>
-MEM_IC910_FORMAT = """<br>
-u8 bank; // 1 bank number<br>
-bbcd number[2]; // 2,3<br>
-lbcd freq[5]; // 4-8 operating freq<br>
-u8 mode; // 9 operating mode<br>
-u8 filter; // 10 filter<br>
-u8 tmode:4, // 11 tone<br>
- duplex:4; // 11 duplex off/-/+<br>
-bbcd rtone[3]; // 12-14 repeater tone freq<br>
-bbcd ctone[3]; // 15-17 tone squelch setting<br>
-lbcd duplexOffset[3]; // 18-20 duplex offset freq<br>
-"""<br>
-<br>
-mem_duptone_format = """<br>
-bbcd number[2];<br>
-u8 unknown1;<br>
-lbcd freq[5];<br>
-u8 unknown2:5,<br>
- mode:3;<br>
-u8 unknown1;<br>
-u8 unknown2:2,<br>
- duplex:2,<br>
- unknown3:1,<br>
- tmode:3;<br>
-u8 unknown4;<br>
-bbcd rtone[2];<br>
-u8 unknown5;<br>
-bbcd ctone[2];<br>
-u8 dtcs_polarity;<br>
-bbcd dtcs[2];<br>
-u8 unknown[11];<br>
-char name[9];<br>
-"""<br>
-<br>
-MEM_IC7300_FORMAT = """<br>
-bbcd number[2]; // 1,2<br>
-u8 spl:4, // 3 split and select memory settings<br>
- select:4;<br>
-lbcd freq[5]; // 4-8 receive freq<br>
-u8 mode; // 9 operating mode<br>
-u8 filter; // 10 filter 1-3 (undocumented)<br>
-u8 dataMode:4, // 11 data mode setting (on or off)<br>
- tmode:4; // 11 tone type<br>
-char pad1;<br>
-bbcd rtone[2]; // 12-14 tx tone freq<br>
-char pad2;<br>
-bbcd ctone[2]; // 15-17 tone rx squelch setting<br>
-lbcd freq_tx[5]; // 4-8 transmit freq<br>
-u8 mode_tx; // 9 tx operating mode<br>
-u8 filter_tx; // 10<br>
-u8 dataMode_tx:4, // 11 tx data mode setting (on or off)<br>
- tmode_tx:4; // 11 tx tone type<br>
-char pad3;<br>
-bbcd rtone_tx[2]; // 12-14 repeater tone freq<br>
-char pad4;<br>
-bbcd ctone_tx[2]; // 15-17 tone squelch setting<br>
-char name[10]; // 18-27 Callsign<br>
-"""<br>
-<br>
SPLIT = ["", "spl"]<br>
<br>
<br>
@@ -207,6 +106,7 @@<br>
<br>
class MemFrame(Frame):<br>
"""A memory frame"""<br>
+ FORMAT = MEM_FORMAT<br>
_cmd = 0x1A<br>
_sub = 0x00<br>
_loc = 0<br>
@@ -227,7 +127,7 @@<br>
def get_obj(self):<br>
"""Return a bitwise parsed object"""<br>
self._data = MemoryMap(str(self._data)) # Make sure we're assignable<br>
- return bitwise.parse(MEM_FORMAT, self._data)<br>
+ return bitwise.parse(self.FORMAT, self._data)<br>
<br>
def initialize(self):<br>
"""Initialize to sane values"""<br>
@@ -236,7 +136,7 @@<br>
<br>
class BankMemFrame(MemFrame):<br>
"""A memory frame for radios with multiple banks"""<br>
- FORMAT = MEM_IC7000_FORMAT<br>
+ FORMAT = None<br>
_bnk = 0<br>
<br>
def set_location(self, loc, bank=1):<br>
@@ -256,28 +156,6 @@<br>
return bitwise.parse(self.FORMAT, self._data)<br>
<br>
<br>
-class IC7100MemFrame(BankMemFrame):<br>
- FORMAT = MEM_IC7100_FORMAT<br>
-<br>
-<br>
-class IC910MemFrame(BankMemFrame):<br>
- FORMAT = MEM_IC910_FORMAT<br>
-<br>
-<br>
-class DupToneMemFrame(MemFrame):<br>
- def get_obj(self):<br>
- self._data = MemoryMap(str(self._data))<br>
- return bitwise.parse(mem_duptone_format, self._data)<br>
-<br>
-<br>
-class IC7300MemFrame(MemFrame):<br>
- FORMAT = MEM_IC7300_FORMAT<br>
-<br>
- def get_obj(self):<br>
- self._data = MemoryMap(str(self._data))<br>
- return bitwise.parse(self.FORMAT, self._data)<br>
-<br>
-<br>
class SpecialChannel(object):<br>
"""Info for special (named) channels"""<br>
<br>
@@ -442,10 +320,10 @@<br>
else:<br>
return repr(f.get_obj())<br>
<br>
-# We have a simple mapping between the memory location in the frequency<br>
-# editor and (bank, channel) of the radio. The mapping doesn't<br>
-# change so we use a little math to calculate what bank a location<br>
-# is in. We can't change the bank a location is in so we just pass.<br>
+ # We have a simple mapping between the memory location in the frequency<br>
+ # editor and (bank, channel) of the radio. The mapping doesn't<br>
+ # change so we use a little math to calculate what bank a location<br>
+ # is in. We can't change the bank a location is in so we just pass.<br>
def _get_bank(self, loc):<br>
if self._adjust_bank_loc_start:<br>
loc -= 1<br>
@@ -562,6 +440,8 @@<br>
<br>
if self._rf.can_odd_split and memobj.spl:<br>
mem.duplex = "split"<br>
+ if hasattr(memobj, "duplex"):<br>
+ mem.duplex = "split"<br>
mem.offset = int(memobj.freq_tx)<br>
mem.immutable = []<br>
elif hasattr(memobj, "duplexOffset"):<br>
@@ -620,10 +500,10 @@<br>
f.make_empty()<br>
self._send_frame(f)<br>
<br>
-# The next two lines accept the radio's status after setting the memory<br>
-# and reports the results to the debug log. This is needed for the<br>
-# IC-7000. No testing was done to see if it breaks memory delete on the<br>
-# IC-746 or IC-7200.<br>
+ # The next two lines accept the radio's status after setting the memory<br>
+ # and reports the results to the debug log. This is needed for the<br>
+ # IC-7000. No testing was done to see if it breaks memory delete on the<br>
+ # IC-746 or IC-7200.<br>
f = self._recv_frame()<br>
LOG.debug("Result:\n%s" % util.hexprint(f.get_data()))<br>
return<br>
@@ -708,311 +588,28 @@<br>
LOG.debug("Result:\n%s" % util.hexprint(f.get_data()))<br>
<br>
<br>
-@directory.register<br>
-class Icom7200Radio(IcomCIVRadio):<br>
- """Icom IC-7200"""<br>
- MODEL = "7200"<br>
- _model = "\x76"<br>
- _template = 201<br>
-<br>
- _num_banks = 1 # Banks not supported<br>
-<br>
- def _initialize(self):<br>
- self._rf.has_bank = False<br>
- self._rf.has_dtcs_polarity = False<br>
- self._rf.has_dtcs = False<br>
- self._rf.has_ctone = False<br>
- self._rf.has_offset = False<br>
- self._rf.has_name = False<br>
- self._rf.has_tuning_step = False<br>
- self._rf.valid_modes = ["LSB", "USB", "AM", "CW", "RTTY",<br>
- "CWR", "RTTYR"]<br>
- self._rf.valid_tmodes = []<br>
- self._rf.valid_duplexes = []<br>
- self._rf.valid_bands = [(30000, 60000000)]<br>
- self._rf.valid_skips = []<br>
- self._rf.memory_bounds = (1, 201)<br>
-<br>
-<br>
-@directory.register<br>
-class Icom7000Radio(IcomCIVRadio):<br>
- """Icom IC-7000"""<br>
- MODEL = "IC-7000"<br>
- _model = "\x70"<br>
- _template = 102<br>
-<br>
- _num_banks = 5 # Banks A-E<br>
- _bank_index_bounds = (1, 99)<br>
- _bank_class = icf.IcomBank<br>
-<br>
- def _initialize(self):<br>
- self._classes["mem"] = BankMemFrame<br>
- self._rf.has_bank = True<br>
- self._rf.has_dtcs_polarity = True<br>
- self._rf.has_dtcs = True<br>
- self._rf.has_ctone = True<br>
- self._rf.has_offset = True<br>
- self._rf.has_name = True<br>
- self._rf.has_tuning_step = False<br>
- self._rf.valid_modes = ["LSB", "USB", "AM", "CW", "RTTY", "FM", "WFM"]<br>
- self._rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS"]<br>
- self._rf.valid_duplexes = ["", "-", "+", "split"]<br>
- self._rf.valid_bands = [(30000, 199999999), (400000000, 470000000)]<br>
- self._rf.valid_tuning_steps = []<br>
- self._rf.valid_skips = ["S", ""]<br>
- self._rf.valid_name_length = 9<br>
- self._rf.valid_characters = chirp_common.CHARSET_ASCII<br>
- self._rf.memory_bounds = (0, 99 * self._num_banks - 1)<br>
- self._rf.can_odd_split = True<br>
-<br>
-<br>
-@directory.register<br>
-class Icom7100Radio(IcomCIVRadio):<br>
- """Icom IC-7100"""<br>
- MODEL = "IC-7100"<br>
- _model = "\x88"<br>
- _template = 102<br>
-<br>
- _num_banks = 5<br>
- _bank_index_bounds = (1, 99)<br>
- _bank_class = icf.IcomBank<br>
-<br>
- def _initialize(self):<br>
- self._classes["mem"] = IC7100MemFrame<br>
- self._rf.has_bank = True<br>
- self._rf.has_bank_index = False<br>
- self._rf.has_bank_names = False<br>
- self._rf.has_dtcs_polarity = False<br>
- self._rf.has_dtcs = False<br>
- self._rf.has_ctone = True<br>
- self._rf.has_offset = False<br>
- self._rf.has_name = True<br>
- self._rf.has_tuning_step = False<br>
- self._rf.valid_modes = [<br>
- "LSB", "USB", "AM", "CW", "RTTY", "FM", "WFM", "CWR", "RTTYR", "DV"<br>
- ]<br>
- self._rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS"]<br>
- self._rf.valid_duplexes = ["", "-", "+"]<br>
- self._rf.valid_bands = [(30000, 199999999), (400000000, 470000000)]<br>
- self._rf.valid_tuning_steps = []<br>
- self._rf.valid_skips = []<br>
- self._rf.valid_name_length = 16<br>
- self._rf.valid_characters = chirp_common.CHARSET_ASCII<br>
- self._rf.memory_bounds = (0, 99 * self._num_banks - 1)<br>
-<br>
-<br>
-@directory.register<br>
-class Icom746Radio(IcomCIVRadio):<br>
- """Icom IC-746"""<br>
- MODEL = "746"<br>
- BAUD_RATE = 9600<br>
- _model = "\x56"<br>
- _template = 102<br>
-<br>
- _num_banks = 1 # Banks not supported<br>
-<br>
- def _initialize(self):<br>
- self._classes["mem"] = DupToneMemFrame<br>
- self._rf.has_bank = False<br>
- self._rf.has_dtcs_polarity = False<br>
- self._rf.has_dtcs = False<br>
- self._rf.has_ctone = True<br>
- self._rf.has_offset = False<br>
- self._rf.has_name = True<br>
- self._rf.has_tuning_step = False<br>
- self._rf.valid_modes = ["LSB", "USB", "AM", "CW", "RTTY", "FM"]<br>
- self._rf.valid_tmodes = ["", "Tone", "TSQL"]<br>
- self._rf.valid_duplexes = ["", "-", "+"]<br>
- self._rf.valid_bands = [(30000, 199999999)]<br>
- self._rf.valid_tuning_steps = []<br>
- self._rf.valid_skips = []<br>
- self._rf.valid_name_length = 9<br>
- self._rf.valid_characters = chirp_common.CHARSET_ASCII<br>
- self._rf.memory_bounds = (1, 99)<br>
-<br>
-<br>
-@directory.register<br>
-class Icom910Radio(IcomCIVRadio):<br>
- """Icom IC-910"""<br>
- MODEL = "IC-910"<br>
- BAUD_RATE = 19200<br>
- _model = "\x60"<br>
- _template = 100<br>
-<br>
- _num_banks = 3 # Banks for 2m, 70cm, 23cm<br>
- _bank_index_bounds = (1, 99)<br>
- _bank_class = icf.IcomBank<br>
-<br>
- _SPECIAL_CHANNELS = {<br>
- "1A": 100,<br>
- "1b": 101,<br>
- "2A": 102,<br>
- "2b": 103,<br>
- "3A": 104,<br>
- "3b": 105,<br>
- "C": 106,<br>
- }<br>
- _SPECIAL_CHANNELS_REV = {v: k for k, v in _SPECIAL_CHANNELS.items()}<br>
-<br>
- _SPECIAL_BANKS = {<br>
- "2m": 1,<br>
- "70cm": 2,<br>
- "23cm": 3,<br>
- }<br>
- _SPECIAL_BANKS_REV = {v: k for k, v in _SPECIAL_BANKS.items()}<br>
-<br>
- def _get_special_names(self, band):<br>
- return sorted([band + "-" + key<br>
- for key in self._SPECIAL_CHANNELS.keys()])<br>
-<br>
- def _is_special(self, number):<br>
- return number >= 1000 or isinstance(number, str)<br>
-<br>
- def _get_special_info(self, number):<br>
- info = BankSpecialChannel()<br>
- if isinstance(number, str):<br>
- <a href="http://info.name" rel="noreferrer" target="_blank">info.name</a> = number<br>
- (band_name, chan_name) = number.split("-")<br>
- info.bank = self._SPECIAL_BANKS[band_name]<br>
- info.channel = self._SPECIAL_CHANNELS[chan_name]<br>
- info.location = info.bank * 1000 + info.channel<br>
- else:<br>
- info.location = number<br>
- (info.bank, info.channel) = divmod(number, 1000)<br>
- band_name = self._SPECIAL_BANKS_REV[info.bank]<br>
- chan_name = self._SPECIAL_CHANNELS_REV[info.channel]<br>
- <a href="http://info.name" rel="noreferrer" target="_blank">info.name</a> = band_name + "-" + chan_name<br>
- return info<br>
-<br>
- # The IC-910 has a bank of memories for each band. The 23cm band is only<br>
- # available when the optional UX-910 unit is installed, but there is no<br>
- # direct means of detecting its presence. Instead, attempt to access the<br>
- # first memory in the 23cm bank. If that's successful, the unit is there,<br>
- # and we can present all 3 banks to the user. Otherwise, the unit is not<br>
- # installed, so we present 2 banks to the user, for 2m and 70cm.<br>
- def _detect_23cm_unit(self):<br>
- if not self.pipe:<br>
- return True<br>
- f = IC910MemFrame()<br>
- f.set_location(1, 3) # First memory in 23cm bank<br>
- self._send_frame(f)<br>
- f.read(self.pipe)<br>
- if f._cmd == 0xFA: # Error code lands in command field<br>
- self._num_banks = 2<br>
- LOG.debug("UX-910 unit is %sinstalled" %<br>
- ("not " if self._num_banks == 2 else ""))<br>
- return self._num_banks == 3<br>
-<br>
- def _initialize(self):<br>
- self._classes["mem"] = IC910MemFrame<br>
- self._has_23cm_unit = self._detect_23cm_unit()<br>
- self._rf.has_bank = True<br>
- self._rf.has_dtcs_polarity = False<br>
- self._rf.has_dtcs = False<br>
- self._rf.has_ctone = True<br>
- self._rf.has_offset = True<br>
- self._rf.has_name = False<br>
- self._rf.has_tuning_step = False<br>
- self._rf.valid_modes = ["LSB", "USB", "CW", "NCW", "FM", "NFM"]<br>
- self._rf.valid_tmodes = ["", "Tone", "TSQL"]<br>
- self._rf.valid_duplexes = ["", "-", "+"]<br>
- self._rf.valid_bands = [(136000000, 174000000),<br>
- (420000000, 480000000)]<br>
- self._rf.valid_tuning_steps = []<br>
- self._rf.valid_skips = []<br>
- self._rf.valid_special_chans = (self._get_special_names("2m") +<br>
- self._get_special_names("70cm"))<br>
- self._rf.memory_bounds = (1, 99 * self._num_banks)<br>
-<br>
- if self._has_23cm_unit:<br>
- self._rf.valid_bands.append((1240000000, 1320000000))<br>
- self._rf.valid_special_chans += self._get_special_names("23cm")<br>
-<br>
- # Combine mode and filter into unified mode<br>
- self._unified_modes = True<br>
-<br>
- # Use Chirp locations starting with 1<br>
- self._adjust_bank_loc_start = True<br>
-<br>
-<br>
-@directory.register<br>
-class Icom7300Radio(IcomCIVRadio): # Added March, 2021 by Rick DeWitt<br>
- """Icom IC-7300"""<br>
- MODEL = "IC-7300"<br>
- _model = "\x94"<br>
- _template = 100 # Use P1 as blank template<br>
-<br>
- _SPECIAL_CHANNELS = {<br>
- "P1": 100,<br>
- "P2": 101,<br>
- }<br>
- _SPECIAL_CHANNELS_REV = dict(zip(_SPECIAL_CHANNELS.values(),<br>
- _SPECIAL_CHANNELS.keys()))<br>
-<br>
- def _is_special(self, number):<br>
- return number > 99 or isinstance(number, str)<br>
-<br>
- def _get_special_info(self, number):<br>
- info = SpecialChannel()<br>
- if isinstance(number, str):<br>
- <a href="http://info.name" rel="noreferrer" target="_blank">info.name</a> = number<br>
- info.channel = self._SPECIAL_CHANNELS[number]<br>
- info.location = info.channel<br>
- else:<br>
- info.location = number<br>
- <a href="http://info.name" rel="noreferrer" target="_blank">info.name</a> = self._SPECIAL_CHANNELS_REV[number]<br>
- info.channel = info.location<br>
- return info<br>
-<br>
- def _initialize(self):<br>
- self._classes["mem"] = IC7300MemFrame<br>
- self._rf.has_name = True<br>
- self._rf.has_dtcs = False<br>
- self._rf.has_dtcs_polarity = False<br>
- self._rf.has_bank = False<br>
- self._rf.has_tuning_step = False<br>
- self._rf.has_nostep_tuning = True<br>
- self._rf.can_odd_split = True<br>
- self._rf.memory_bounds = (1, 99)<br>
- self._rf.valid_modes = [<br>
- "LSB", "USB", "AM", "CW", "RTTY", "FM", "CWR", "RTTYR",<br>
- "Data+LSB", "Data+USB", "Data+AM", "N/A", "N/A", "Data+FM"<br>
- ]<br>
- self._rf.valid_tmodes = ["", "Tone", "TSQL"]<br>
- # self._rf.valid_duplexes = ["", "-", "+", "split"]<br>
- self._rf.valid_duplexes = [] # To prevent using memobj.duplex<br>
- self._rf.valid_bands = [(1800000, 70500000)]<br>
- self._rf.valid_skips = []<br>
- self._rf.valid_name_length = 10<br>
- self._rf.valid_characters = chirp_common.CHARSET_ASCII<br>
- self._rf.valid_special_chans = sorted(self._SPECIAL_CHANNELS.keys())<br>
-<br>
-<br>
-CIV_MODELS = {<br>
- (0x76, 0xE0): Icom7200Radio,<br>
- (0x88, 0xE0): Icom7100Radio,<br>
- (0x70, 0xE0): Icom7000Radio,<br>
- (0x46, 0xE0): Icom746Radio,<br>
- (0x60, 0xE0): Icom910Radio,<br>
- (0x94, 0xE0): Icom7300Radio,<br>
-}<br>
-<br>
-<br>
def probe_model(ser):<br>
"""Probe the radio attatched to @ser for its model"""<br>
f = Frame()<br>
f.set_command(0x19, 0x00)<br>
<br>
- for model, controller in CIV_MODELS.keys():<br>
- f.send(model, controller, ser)<br>
+ models = {}<br>
+ for rclass in directory.DRV_TO_RADIO.values():<br>
+ if issubclass(rclass, IcomCIVRadio):<br>
+ models[rclass.MODEL] = rclass<br>
+<br>
+ for rclass in models.values():<br>
+ model = ord(rclass._model)<br>
+ f.send(model, 0xE0, ser)<br>
try:<br>
f.read(ser)<br>
except errors.RadioError:<br>
continue<br>
<br>
if len(f.get_data()) == 1:<br>
- model = ord(f.get_data()[0])<br>
- return CIV_MODELS[(model, controller)]<br>
+ md = ord(f.get_data()[0])<br>
+ if (md == model):<br>
+ return rclass<br>
<br>
if f.get_data():<br>
LOG.debug("Got data, but not 1 byte:")<br>
_______________________________________________<br>
chirp_devel mailing list<br>
<a href="mailto:chirp_devel@intrepid.danplanet.com" target="_blank">chirp_devel@intrepid.danplanet.com</a><br>
<a href="http://intrepid.danplanet.com/mailman/listinfo/chirp_devel" rel="noreferrer" target="_blank">http://intrepid.danplanet.com/mailman/listinfo/chirp_devel</a><br>
Developer docs: <a href="http://chirp.danplanet.com/projects/chirp/wiki/Developers" rel="noreferrer" target="_blank">http://chirp.danplanet.com/projects/chirp/wiki/Developers</a><br>
</blockquote></div>
</blockquote></div></div>
</blockquote></div></div>