<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'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"><<a href="mailto:rock.unroe@gmail.com" target="_blank">rock.unroe@gmail.com</a>></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 <<a href="mailto:rock.unroe@gmail.com">rock.unroe@gmail.com</a>><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("CHIRP_DEBUG"):<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>
"""<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 = ["Off", "Key", "Continuous"]<br>
+TIMEOUT_LIST = ["Off"] + ["%s sec" % x for x in range(30, 210, 30)]<br>
+SCANM_LIST = ["TO", "CO"]<br>
+PRI_CH_LIST = ["Off"] + ["%s" % x for x in range(1, 100)]<br>
+CH_FLAG_LIST = ["Freq Mode", "Channel Mode"]<br>
+POWER_LIST = ["Low", "High"]<br>
+BANDWIDTH_LIST = ["Narrow", "Wide"]<br>
+DUPLEX_LIST = ["Off", "-", "+"]<br>
+STE_LIST = ["On", "Off"]<br>
+<br>
UV3R_DUPLEX = ["", "-", "+", ""]<br>
UV3R_POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00),<br>
chirp_common.PowerLevel("Low", 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 = ["", "Tone", "TSQL", "DTCS", "Cross"]<br>
rf.valid_modes = ["FM", "NFM"]<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("basic", "Basic Settings")<br>
+ group = RadioSettingGroup("top", "All Settings", basic)<br>
+<br>
+ rs = RadioSetting("squelch", "Squelch Level",<br>
+ RadioSettingValueInteger(0, 9, self._memobj.settings.squelch))<br>
+ basic.append(rs)<br>
+<br>
+ rs = RadioSetting("backlight", "LCD Back Light",<br>
+ RadioSettingValueList(BACKLIGHT_LIST,<br>
+ BACKLIGHT_LIST[self._memobj.settings.backlight]))<br>
+ basic.append(rs)<br>
+<br>
+ rs = RadioSetting("beep", "Keypad Beep",<br>
+ RadioSettingValueBoolean(self._memobj.settings.beep))<br>
+ basic.append(rs)<br>
+<br>
+ rs = RadioSetting("vox", "VOX Level (0=OFF)",<br>
+ RadioSettingValueInteger(0, 9, self._memobj.settings.vox))<br>
+ basic.append(rs)<br>
+<br>
+ rs = RadioSetting("dw", "Dual Watch",<br>
+ RadioSettingValueBoolean(self._memobj.settings.dw))<br>
+ basic.append(rs)<br>
+<br>
+ rs = RadioSetting("ste", "Squelch Tail Eliminate",<br>
+ RadioSettingValueList(STE_LIST,<br>
+ STE_LIST[self._memobj.settings.ste]))<br>
+ basic.append(rs)<br>
+<br>
+ rs = RadioSetting("save", "Battery Saver",<br>
+ RadioSettingValueBoolean(self._memobj.settings.save))<br>
+ basic.append(rs)<br>
+<br>
+ rs = RadioSetting("timeout", "Time Out Timer",<br>
+ RadioSettingValueList(TIMEOUT_LIST,<br>
+ TIMEOUT_LIST[self._memobj.settings.timeout]))<br>
+ basic.append(rs)<br>
+<br>
+ rs = RadioSetting("scanm", "Scan Mode",<br>
+ RadioSettingValueList(SCANM_LIST,<br>
+ SCANM_LIST[self._memobj.settings.scanm]))<br>
+ basic.append(rs)<br>
+<br>
+ rs = RadioSetting("relaym", "Repeater Sound Response",<br>
+ RadioSettingValueBoolean(self._memobj.settings.relaym))<br>
+ basic.append(rs)<br>
+<br>
+ rs = RadioSetting("bclo", "Busy Channel Lock Out",<br>
+ RadioSettingValueBoolean(self._memobj.settings.bclo))<br>
+ basic.append(rs)<br>
+<br>
+ rs = RadioSetting("pri", "Priority Channel Scanning",<br>
+ RadioSettingValueBoolean(self._memobj.settings.pri))<br>
+ basic.append(rs)<br>
+<br>
+ rs = RadioSetting("pri_ch", "Priority Channel",<br>
+ RadioSettingValueList(PRI_CH_LIST,<br>
+ PRI_CH_LIST[self._memobj.settings.pri_ch]))<br>
+ basic.append(rs)<br>
+<br>
+ rs = RadioSetting("ch_flag", "Display Mode",<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 "." in name:<br>
+ bits = name.split(".")<br>
+ obj = self._memobj<br>
+ for bit in bits[:-1]:<br>
+ if "/" in bit:<br>
+ bit, index = bit.split("/", 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 "Using apply callback"<br>
+ element.run_apply_callback()<br>
+ else:<br>
+ print "Setting %s = %s" % (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>