<div dir="ltr"><div><div><div><div>I thought that the 3 patches I submitted would be sent together as a set. Since they weren&#39;t here is how they should be applied.<br><br></div>[UV-3R] Add Basic Settings [1 of 3]<br></div>
[UV-3R] Add Band Limit Settings [2 of 3]<br></div>[UV-3R] Add Broadcast FM Presets [3 of 3]<br><br></div>Jim KC9HI<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 26, 2013 at 4:51 PM, Jim Unroe <span dir="ltr">&lt;<a href="mailto:rock.unroe@gmail.com" target="_blank">rock.unroe@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Jim Unroe &lt;<a href="mailto:rock.unroe@gmail.com">rock.unroe@gmail.com</a>&gt;<br>
# Date 1385499658 18000<br>
# Node ID 68dcf5898ba38f087d9a543256ef71828c24f650<br>
# Parent  fc6b4cd40403f4bb3f2b9bc3578366fdf20a85c6<br>
[UV-3R] Add Basic Settings<br>
expose basic settings fields in memmap<br>
add Basic Settings tab<br>
add Basic Settings and other associated support<br>
related to #1267<br>
<br>
diff -r fc6b4cd40403 -r 68dcf5898ba3 chirp/baofeng_uv3r.py<br>
--- a/chirp/baofeng_uv3r.py     Sun Nov 17 11:15:47 2013 -0800<br>
+++ b/chirp/baofeng_uv3r.py     Tue Nov 26 16:00:58 2013 -0500<br>
@@ -19,6 +19,10 @@<br>
 import os<br>
 from chirp import util, chirp_common, bitwise, errors, directory<br>
 from chirp.wouxun_common import do_download, do_upload<br>
+from chirp.settings import RadioSetting, RadioSettingGroup, \<br>
+                RadioSettingValueBoolean, RadioSettingValueList, \<br>
+                RadioSettingValueInteger, RadioSettingValueString, \<br>
+                RadioSettingValueFloat<br>
<br>
 if os.getenv(&quot;CHIRP_DEBUG&quot;):<br>
     DEBUG = True<br>
@@ -88,6 +92,29 @@<br>
   u8 unknown;<br>
   lbcd tx_freq[4];<br>
 } tx_memory[99];<br>
+<br>
+#seekto 0x07C2;<br>
+struct {<br>
+  u8 squelch;<br>
+  u8 vox;<br>
+  u8 timeout;<br>
+  u8 save:1,<br>
+     unknown_1:1,<br>
+     dw:1,<br>
+     ste:1,<br>
+     beep:1,<br>
+     unknown_2:1,<br>
+     bclo:1,<br>
+     ch_flag:1;<br>
+  u8 backlight:2,<br>
+     relaym:1,<br>
+     scanm:1,<br>
+     pri:1,<br>
+     unknown_3:3;<br>
+  u8 unknown_4[3];<br>
+  u8 pri_ch;<br>
+} settings;<br>
+<br>
 #seekto 0x0810;<br>
 struct {<br>
   lbcd rx_freq[4];<br>
@@ -113,6 +140,18 @@<br>
 } names[128];<br>
 &quot;&quot;&quot;<br>
<br>
+STEPS = [5.0, 6.25, 10.0, 12.5, 20.0, 25.0]<br>
+STEP_LIST = [str(x) for x in STEPS]<br>
+BACKLIGHT_LIST = [&quot;Off&quot;, &quot;Key&quot;, &quot;Continuous&quot;]<br>
+TIMEOUT_LIST = [&quot;Off&quot;] + [&quot;%s sec&quot; % x for x in range(30, 210, 30)]<br>
+SCANM_LIST = [&quot;TO&quot;, &quot;CO&quot;]<br>
+PRI_CH_LIST = [&quot;Off&quot;] + [&quot;%s&quot; % x for x in range(1, 100)]<br>
+CH_FLAG_LIST = [&quot;Freq Mode&quot;, &quot;Channel Mode&quot;]<br>
+POWER_LIST = [&quot;Low&quot;, &quot;High&quot;]<br>
+BANDWIDTH_LIST = [&quot;Narrow&quot;, &quot;Wide&quot;]<br>
+DUPLEX_LIST = [&quot;Off&quot;, &quot;-&quot;, &quot;+&quot;]<br>
+STE_LIST = [&quot;On&quot;, &quot;Off&quot;]<br>
+<br>
 UV3R_DUPLEX = [&quot;&quot;, &quot;-&quot;, &quot;+&quot;, &quot;&quot;]<br>
 UV3R_POWER_LEVELS = [chirp_common.PowerLevel(&quot;High&quot;, watts=2.00),<br>
                      chirp_common.PowerLevel(&quot;Low&quot;, watts=0.50)]<br>
@@ -126,6 +165,7 @@<br>
<br>
     def get_features(self):<br>
         rf = chirp_common.RadioFeatures()<br>
+        rf.has_settings = True<br>
         rf.valid_tmodes = [&quot;&quot;, &quot;Tone&quot;, &quot;TSQL&quot;, &quot;DTCS&quot;, &quot;Cross&quot;]<br>
         rf.valid_modes = [&quot;FM&quot;, &quot;NFM&quot;]<br>
         rf.valid_power_levels = UV3R_POWER_LEVELS<br>
@@ -282,6 +322,108 @@<br>
         self._set_memory(mem, _tmem)<br>
         self._set_memory(mem, _rmem)<br>
<br>
+    def get_settings(self):<br>
+        basic = RadioSettingGroup(&quot;basic&quot;, &quot;Basic Settings&quot;)<br>
+        group = RadioSettingGroup(&quot;top&quot;, &quot;All Settings&quot;, basic)<br>
+<br>
+        rs = RadioSetting(&quot;squelch&quot;, &quot;Squelch Level&quot;,<br>
+                          RadioSettingValueInteger(0, 9, self._memobj.settings.squelch))<br>
+        basic.append(rs)<br>
+<br>
+        rs = RadioSetting(&quot;backlight&quot;, &quot;LCD Back Light&quot;,<br>
+                          RadioSettingValueList(BACKLIGHT_LIST,<br>
+                                        BACKLIGHT_LIST[self._memobj.settings.backlight]))<br>
+        basic.append(rs)<br>
+<br>
+        rs = RadioSetting(&quot;beep&quot;, &quot;Keypad Beep&quot;,<br>
+                          RadioSettingValueBoolean(self._memobj.settings.beep))<br>
+        basic.append(rs)<br>
+<br>
+        rs = RadioSetting(&quot;vox&quot;, &quot;VOX Level (0=OFF)&quot;,<br>
+                          RadioSettingValueInteger(0, 9, self._memobj.settings.vox))<br>
+        basic.append(rs)<br>
+<br>
+        rs = RadioSetting(&quot;dw&quot;, &quot;Dual Watch&quot;,<br>
+                          RadioSettingValueBoolean(self._memobj.settings.dw))<br>
+        basic.append(rs)<br>
+<br>
+        rs = RadioSetting(&quot;ste&quot;, &quot;Squelch Tail Eliminate&quot;,<br>
+                          RadioSettingValueList(STE_LIST,<br>
+                                        STE_LIST[self._memobj.settings.ste]))<br>
+        basic.append(rs)<br>
+<br>
+        rs = RadioSetting(&quot;save&quot;, &quot;Battery Saver&quot;,<br>
+                          RadioSettingValueBoolean(self._memobj.settings.save))<br>
+        basic.append(rs)<br>
+<br>
+        rs = RadioSetting(&quot;timeout&quot;, &quot;Time Out Timer&quot;,<br>
+                          RadioSettingValueList(TIMEOUT_LIST,<br>
+                                        TIMEOUT_LIST[self._memobj.settings.timeout]))<br>
+        basic.append(rs)<br>
+<br>
+        rs = RadioSetting(&quot;scanm&quot;, &quot;Scan Mode&quot;,<br>
+                          RadioSettingValueList(SCANM_LIST,<br>
+                                        SCANM_LIST[self._memobj.settings.scanm]))<br>
+        basic.append(rs)<br>
+<br>
+        rs = RadioSetting(&quot;relaym&quot;, &quot;Repeater Sound Response&quot;,<br>
+                          RadioSettingValueBoolean(self._memobj.settings.relaym))<br>
+        basic.append(rs)<br>
+<br>
+        rs = RadioSetting(&quot;bclo&quot;, &quot;Busy Channel Lock Out&quot;,<br>
+                          RadioSettingValueBoolean(self._memobj.settings.bclo))<br>
+        basic.append(rs)<br>
+<br>
+        rs = RadioSetting(&quot;pri&quot;, &quot;Priority Channel Scanning&quot;,<br>
+                          RadioSettingValueBoolean(self._memobj.settings.pri))<br>
+        basic.append(rs)<br>
+<br>
+        rs = RadioSetting(&quot;pri_ch&quot;, &quot;Priority Channel&quot;,<br>
+                          RadioSettingValueList(PRI_CH_LIST,<br>
+                                        PRI_CH_LIST[self._memobj.settings.pri_ch]))<br>
+        basic.append(rs)<br>
+<br>
+        rs = RadioSetting(&quot;ch_flag&quot;, &quot;Display Mode&quot;,<br>
+                          RadioSettingValueList(CH_FLAG_LIST,<br>
+                                        CH_FLAG_LIST[self._memobj.settings.ch_flag]))<br>
+        basic.append(rs)<br>
+<br>
+        return group<br>
+<br>
+    def set_settings(self, settings):<br>
+        _settings = self._memobj.settings<br>
+        for element in settings:<br>
+            if not isinstance(element, RadioSetting):<br>
+                self.set_settings(element)<br>
+                continue<br>
+            else:<br>
+                try:<br>
+                    name = element.get_name()<br>
+                    if &quot;.&quot; in name:<br>
+                        bits = name.split(&quot;.&quot;)<br>
+                        obj = self._memobj<br>
+                        for bit in bits[:-1]:<br>
+                            if &quot;/&quot; in bit:<br>
+                                bit, index = bit.split(&quot;/&quot;, 1)<br>
+                                index = int(index)<br>
+                                obj = getattr(obj, bit)[index]<br>
+                            else:<br>
+                                obj = getattr(obj, bit)<br>
+                        setting = bits[-1]<br>
+                    else:<br>
+                        obj = _settings<br>
+                        setting = element.get_name()<br>
+<br>
+                    if element.has_apply_callback():<br>
+                        print &quot;Using apply callback&quot;<br>
+                        element.run_apply_callback()<br>
+                    else:<br>
+                        print &quot;Setting %s = %s&quot; % (setting, element.value)<br>
+                        setattr(obj, setting, element.value)<br>
+                except Exception, e:<br>
+                    print element.get_name()<br>
+                    raise<br>
+<br>
     @classmethod<br>
     def match_model(cls, filedata, filename):<br>
         return len(filedata) == 3648<br>
</blockquote></div><br></div>