[chirp_devel] [PATCH] [uv5r]Add Shift and Offset support to Work Mode VFO Presets
# HG changeset patch # User Jim Unroe rock.unroe@gmail.com # Date 1361319296 18000 # Node ID 36293926e162128da56feec659698981119fff3a # Parent 4bf797d4483c5b521f81639dd4405d82c05ff4a7 [uv5r]Add Shift and Offset support to Work Mode VFO Presets update vfoa and vfob structure to support sftd (shift direction) add the following Work Mode tab presets Shift (Off, +, -) Offset (0.00 - 69.95 MHz) #599
diff -r 4bf797d4483c -r 36293926e162 chirp/uv5r.py --- a/chirp/uv5r.py Mon Feb 18 21:33:26 2013 -0500 +++ b/chirp/uv5r.py Tue Feb 19 19:14:56 2013 -0500 @@ -131,7 +131,8 @@ u8 unused1:7, band:1; u8 unknown3; - u8 unused2:4, + u8 unused2:2, + sftd:2, scode:4; u8 unknown4; u8 unused3:1 @@ -153,7 +154,8 @@ u8 unused1:7, band:1; u8 unknown3; - u8 unused2:4, + u8 unused2:2, + sftd:2, scode:4; u8 unknown4; u8 unused3:1 @@ -948,6 +950,45 @@ rs.set_apply_callback(apply_freq, self._memobj.vfob) workmode.append(rs)
+ options = ["Off", "+", "-"] + rs = RadioSetting("vfoa.sftd", "VFO A Shift", + RadioSettingValueList(options, + options[self._memobj.vfoa.sftd])) + workmode.append(rs) + + rs = RadioSetting("vfob.sftd", "VFO B Shift", + RadioSettingValueList(options, + options[self._memobj.vfob.sftd])) + workmode.append(rs) + + def convert_bytes_to_offset(bytes): + real_offset = 0 + for byte in bytes: + real_offset = (real_offset * 10) + byte + return chirp_common.format_freq(real_offset * 10000) + + def apply_offset(setting, obj): + print setting.value + value = chirp_common.parse_freq(str(setting.value)) / 10000 + print value + print obj + for i in range(3, -1, -1): + obj.offset[i] = value % 10 + value /= 10 + print "Applied %s:\n%s" % (setting.value, obj) + + val1a = RadioSettingValueString(0, 10, + convert_bytes_to_offset(self._memobj.vfoa.offset)) + rs = RadioSetting("vfoa.offset", "VFO A Offset (0.00-69.95)", val1a) + rs.set_apply_callback(apply_offset, self._memobj.vfoa) + workmode.append(rs) + + val1b = RadioSettingValueString(0, 10, + convert_bytes_to_offset(self._memobj.vfob.offset)) + rs = RadioSetting("vfob.offset", "VFO B Offset (0.00-69.95)", val1b) + rs.set_apply_callback(apply_offset, self._memobj.vfob) + workmode.append(rs) + options = ["High", "Low"] rs = RadioSetting("vfoa.txpower", "VFO A Power", RadioSettingValueList(options,
Hi Jim,
# HG changeset patch # User Jim Unroe rock.unroe@gmail.com # Date 1361319296 18000 # Node ID 36293926e162128da56feec659698981119fff3a # Parent 4bf797d4483c5b521f81639dd4405d82c05ff4a7 [uv5r]Add Shift and Offset support to Work Mode VFO Presets update vfoa and vfob structure to support sftd (shift direction) add the following Work Mode tab presets Shift (Off, +, -) Offset (0.00 - 69.95 MHz) #599
Thanks for this. I wish all the drivers could get this much attention to detail :)
def convert_bytes_to_offset(bytes):
real_offset = 0
for byte in bytes:
real_offset = (real_offset * 10) + byte
return chirp_common.format_freq(real_offset * 10000)
def apply_offset(setting, obj):
print setting.value
value = chirp_common.parse_freq(str(setting.value)) /
10000
print value
print obj
for i in range(3, -1, -1):
obj.offset[i] = value % 10
value /= 10
print "Applied %s:\n%s" % (setting.value, obj)
I've already applied this, but could you follow up with a patch to remove all the debug print statements that we've added while working on this? The UV5R driver is really chatty and I think we can clean up most of that stuff now that we know it's working. Just if/when you have time, I'd appreciate it.
I'm also a little concerned at the size of the get_settings() function now that you've gone and added every dang feature the radio supports :)
I think we should make a point of going back and splitting these out into separate functions, just for cleanliness. It won't really affect how it works, just how it looks to the developer. I think maybe one helper function per page would be fine.
Are you interested in helping with this? I don't want to derail your progress towards getting anything else closed out, but definitely don't want it to get away from us :)
Thanks!
I've already applied this, but could you follow up with a patch to remove all the debug print statements that we've added while working on this? The UV5R driver is really chatty and I think we can clean up most of that stuff now that we know it's working. Just if/when you have time, I'd appreciate it.
Dang it. I meant to do that. Sorry. It shall be done.
I'm also a little concerned at the size of the get_settings() function now that you've gone and added every dang feature the radio supports :)
I think we should make a point of going back and splitting these out into separate functions, just for cleanliness. It won't really affect how it works, just how it looks to the developer. I think maybe one helper function per page would be fine.
Are you interested in helping with this? I don't want to derail your progress towards getting anything else closed out, but definitely don't want it to get away from us :)
Sure. But I'm not sure exactly what you are looking for. But I'm pretty sure that once you get me started, I can help with this.
Thanks!
You're welcome
Jim
participants (2)
-
Dan Smith
-
Jim Unroe