[chirp_devel] [PATCH] [uv5r] UV-82 use ASCII charset Partially fixes #5227

Imuli
Wed Oct 11 16:30:18 PDT 2017


On Sun, Oct 08, 2017 at 07:36:30PM -0700, Dan Smith via chirp_devel wrote:
> > diff -r b4000bed33bd -r c207cd1d97ea chirp/drivers/uv5r.py
> > --- a/chirp/drivers/uv5r.py	Sat Sep 30 13:10:50 2017 +0200
> > +++ b/chirp/drivers/uv5r.py	Sat Oct 07 11:58:01 2017 -0400
> > @@ -764,7 +764,7 @@
> >         rf.has_tuning_step = False
> >         rf.can_odd_split = True
> >         rf.valid_name_length = 7
> > -        rf.valid_characters = UV5R_CHARSET
> > +        rf.valid_characters = getattr(self, '_valid_chars', UV5R_CHARSET)

> Also, can’t you just do self._valid_chars here?
> Should be the same as your getattr(), even for subclasses.

That would be a better way to do it.
I didn't specify _valid_chars on the main class.

This look better?

# HG changeset patch
# User Imuli <i at imu.li>
# Date 1507764361 14400
#      Wed Oct 11 19:26:01 2017 -0400
# Node ID b9f8cc63d0bc2a97520116687713cf673b9849ae
# Parent  b4000bed33bd10e80c07ffad79e3271ceae41be4
[uv5r] UV-82 use ASCII charset Partially fixes #5227

The UV-82 supports all of ASCII (with two replacements).

I imagine other Baofeng radios do also, so this provides an easy means to
specify supported characters for different models.

diff -r b4000bed33bd -r b9f8cc63d0bc chirp/drivers/uv5r.py
--- a/chirp/drivers/uv5r.py	Sat Sep 30 13:10:50 2017 +0200
+++ b/chirp/drivers/uv5r.py	Wed Oct 11 19:26:01 2017 -0400
@@ -728,6 +728,7 @@
     _ranges_aux = [
                    (0x1EC0, 0x2000),
                   ]
+    _valid_chars = UV5R_CHARSET
 
     @classmethod
     def get_prompts(cls):
@@ -764,7 +765,7 @@
         rf.has_tuning_step = False
         rf.can_odd_split = True
         rf.valid_name_length = 7
-        rf.valid_characters = UV5R_CHARSET
+        rf.valid_characters = self._valid_chars
         rf.valid_skips = ["", "S"]
         rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"]
         rf.valid_cross_modes = ["Tone->Tone", "Tone->DTCS", "DTCS->Tone",
@@ -1777,6 +1778,7 @@
     _idents = [UV5R_MODEL_UV82]
     _vhf_range = (130000000, 176000000)
     _uhf_range = (400000000, 521000000)
+    _valid_chars = chirp_common.CHARSET_ASCII
 
     def _is_orig(self):
         # Override this for UV82 to always return False

-- 
All original matter is hereby placed immediately under the public domain.



More information about the chirp_devel mailing list