# HG changeset patch # User Jim Unroe # Date 1358634211 18000 # Node ID 38051445b9980327938786500df56eaf8b6fc350 # Parent ae858d5f3c893962f8cbe2f08d7ed669d3e2610d [mq]: test_vfo_freq_settings diff -r ae858d5f3c89 -r 38051445b998 chirp/uv5r.py --- a/chirp/uv5r.py Sat Jan 19 16:39:58 2013 -0500 +++ b/chirp/uv5r.py Sat Jan 19 17:23:31 2013 -0500 @@ -945,6 +945,42 @@ STEP_LIST[self._memobj.vfob.step])) workmode.append(rs) + # here is my practice code + _vfoa = self._memobj.vfoa.freq + rs = RadioSetting("vfoa.freq", "VFO A Frequency", + RadioSettingValueInteger(0, 9, _vfoa[0]), + RadioSettingValueInteger(0, 9, _vfoa[1]), + RadioSettingValueInteger(0, 9, _vfoa[2]), + RadioSettingValueInteger(0, 9, _vfoa[3]), + RadioSettingValueInteger(0, 9, _vfoa[4]), + RadioSettingValueInteger(0, 9, _vfoa[5]), + RadioSettingValueInteger(0, 9, _vfoa[6]), + RadioSettingValueInteger(0, 9, _vfoa[7])) + workmode.append(rs) + + def my_validate(value): + if value < 400 and value > 174: + raise InvalidValueError("Can't be between 174-400") + return value + + real_freq = 0 + for byte in self._memobj.vfoa.freq: + real_freq = (real_freq * 10) + byte + real_freq /= 100000 + val1a = RadioSettingValueFloat(136, 512, real_freq) + val1a.set_callback(my_validate) + rs = RadioSetting("footest", "VFO A Frequency", val1a) + workmode.append(rs) + + real_freq = 0 + for byte in self._memobj.vfob.freq: + real_freq = (real_freq * 10) + byte + real_freq /= 100000 + val1b = RadioSettingValueFloat(136, 512, real_freq) + val1b.set_callback(my_validate) + rs = RadioSetting("vfob.freq", "VFO B Frequency", val1b) + workmode.append(rs) + test = RadioSettingGroup("test", "test") group.append(test) def my_validate(value):