[chirp_devel] [PATCH] [vx8] Various additional settings - #1807
Please ignore my first attempt. I've created an issue (and added a few more settings while I was at it). This should be tested against a VX-8DR, since I'm using a VX-8GR.
Ray
Hi Ray!
Thanks for the patch. It's awesome to get a huge chunk of work like this out of the blue :)
- def apply_ff_padded_yaesu(cls, setting, obj):
# FF pad yaesus custom string format.
rawval = setting.value.get_value()
max_len = getattr(obj, "padded_yaesu").size() / 8
rawval = str(rawval).rstrip()
val = [CHARSET.index(x) for x in rawval]
for x in range(len(val), max_len):
val.append(0xFF)
setattr(obj, "padded_yaesu", val)
It looks like this is only used in one place, right? If so, instead of the getattr/setattr, I think you should just do this:
obj.padded_yaesu = val
- def apply_lcd_contrast(cls, setting, obj):
rawval = setting.value.get_value()
val = 0x10 | cls._LCD_CONTRAST.index(rawval) + 1
setattr(obj, "lcd_contrast", val)
Ditto for this and most of the others below. The only reason you should need to use getattr/setattr is if you need to calculate the name of the attribute, which is done in set_settings() for a couple of situations.
I'm going to go ahead and apply this, but could you follow up with a patch to convert those to direct attribute syntax like above?
Again, thanks a bunch for this substantial first contribution :)
--Dan
Copy and paste got the better of me. I've attached a patch to the patch. I hope using the same original issue number is ok.
Ray
On Sun, Aug 3, 2014 at 10:12 PM, Dan Smith dsmith@danplanet.com wrote:
Hi Ray!
Thanks for the patch. It's awesome to get a huge chunk of work like this out of the blue :)
- def apply_ff_padded_yaesu(cls, setting, obj):
# FF pad yaesus custom string format.
rawval = setting.value.get_value()
max_len = getattr(obj, "padded_yaesu").size() / 8
rawval = str(rawval).rstrip()
val = [CHARSET.index(x) for x in rawval]
for x in range(len(val), max_len):
val.append(0xFF)
setattr(obj, "padded_yaesu", val)
It looks like this is only used in one place, right? If so, instead of the getattr/setattr, I think you should just do this:
obj.padded_yaesu = val
- def apply_lcd_contrast(cls, setting, obj):
rawval = setting.value.get_value()
val = 0x10 | cls._LCD_CONTRAST.index(rawval) + 1
setattr(obj, "lcd_contrast", val)
Ditto for this and most of the others below. The only reason you should need to use getattr/setattr is if you need to calculate the name of the attribute, which is done in set_settings() for a couple of situations.
I'm going to go ahead and apply this, but could you follow up with a patch to convert those to direct attribute syntax like above?
Again, thanks a bunch for this substantial first contribution :)
--Dan
chirp_devel mailing list chirp_devel@intrepid.danplanet.com http://intrepid.danplanet.com/mailman/listinfo/chirp_devel Developer docs: http://chirp.danplanet.com/projects/chirp/wiki/Developers
participants (2)
-
Dan Smith
-
ray c