[chirp_devel] [h777] Enable sidekey configuration for Radioddity GA-2S

Tony Fuller
Fri Aug 16 16:04:57 PDT 2019


Dan,

Thanks for the quick reply. Here goes #3. I tested it out with my GA-2S 
by downloading as both a GA-2S and also downloading as a Baofeng 888 in
separate tabs and the settings menu looks to be correct.

Tony.

---

# HG changeset patch
# User Tony F <goldstar611 at hotmail.com>
# Date 1565994341 18000
#      Fri Aug 16 17:25:41 2019 -0500
# Branch issue_6217
# Node ID c52a31f7fee79b5c3f83b9adc52f61434d18800f
# Parent  42b4bb639fb6892826091a8a86bf9347b116fe51
[h777] Enable sidekey for Radioddity GA-2S
Issue #6217 https://chirp.danplanet.com/issues/6217
NOTE: Setting side key to "TX Power" has no affect on radio

diff --git a/chirp/drivers/h777.py b/chirp/drivers/h777.py
--- a/chirp/drivers/h777.py
+++ b/chirp/drivers/h777.py
@@ -82,7 +82,6 @@
 H777_POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1.00),
                      chirp_common.PowerLevel("High", watts=5.00)]
 VOICE_LIST = ["English", "Chinese"]
-SIDEKEYFUNCTION_LIST = ["Off", "Monitor", "Transmit Power", "Alarm"]
 TIMEOUTTIMER_LIST = ["Off", "30 seconds", "60 seconds", "90 seconds",
                      "120 seconds", "150 seconds", "180 seconds",
                      "210 seconds", "240 seconds", "270 seconds",
@@ -268,6 +267,7 @@
 
     ALIASES = [ArcshellAR5, ArcshellAR6, GV8SAlias, GV9SAlias,
A8SAlias,
                TenwayTW325Alias]
+    SIDEKEYFUNCTION_LIST = ["Off", "Monitor", "Transmit Power",
"Alarm"]
 
     # This code currently requires that ranges start at 0x0000
     # and are continious. In the original program 0x0388 and 0x03C8
@@ -521,8 +521,8 @@
         if self._has_sidekey:
             rs = RadioSetting("settings2.sidekeyfunction", "Side key
function",
                               RadioSettingValueList(
-                                  SIDEKEYFUNCTION_LIST,
-                                  SIDEKEYFUNCTION_LIST[
+                                  self.SIDEKEYFUNCTION_LIST,
+                                  self.SIDEKEYFUNCTION_LIST[
                                       self._memobj.settings2.sidekeyfu
nction]))
             basic.append(rs)
 
@@ -618,9 +618,10 @@
     VENDOR = "Radioddity"
     MODEL = "GA-2S"
     _has_fm = False
-    _has_sidekey = False
+    SIDEKEYFUNCTION_LIST = ["Off", "Monitor", "Unused", "Alarm"]
 
     @classmethod
     def match_model(cls, filedata, filename):
         # This model is only ever matched via metadata
         return False
+

On Fri, 2019-08-16 at 15:42 -0700, Dan Smith via chirp_devel wrote:
> > @@ -288,6 +287,10 @@
> >     _has_fm = True
> >     _has_sidekey = True
> > 
> > +    def __init__(self, *args, **kwargs):
> > +        super(H777Radio, self).__init__(*args, **kwargs)
> > +        self.SIDEKEYFUNCTION_LIST = ["Off", "Monitor", "Transmit
> > Power", "Alarm"]
> > +
> 
> You don't need to do this. Just put SIDEKEYFUNCTION_LIST in the class
> definition (like _has_sidekey) and use it as
> self.SIDEKEYFUNCTION_LIST as you do below. Then in the GA-2S class
> definition, just define it there as well and it will win over the
> parent's definition as appropriate. Should be two new lines, and the
> one changed one to use the instance-local version. What you have here
> is better than the global of course, but if anyone subclasses it and
> doesn't run super(), then they'd break.
> 
> I have some clones of this radio and can test when I go to apply the
> final one.
> 
> --Dan
> _______________________________________________
> chirp_devel mailing list
> chirp_devel at intrepid.danplanet.com
> http://intrepid.danplanet.com/mailman/listinfo/chirp_devel
> Developer docs: 
> http://chirp.danplanet.com/projects/chirp/wiki/Developers



More information about the chirp_devel mailing list