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

Tony Fuller
Fri Aug 16 15:28:44 PDT 2019


Dan,

Thank you for your valuable insight and I'm glad we are on the same
page. Here is take 2 on that GA-2S patch.

It would be great if others could test that their 666/777/888 radios
aren't affected. 

Thanks,
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 454ca84be9ac05fbc32a224325142f9561a9c2ac
# 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",
@@ -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"]
+
     def get_features(self):
         rf = chirp_common.RadioFeatures()
         rf.has_settings = True
@@ -521,8 +524,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 +621,12 @@
     VENDOR = "Radioddity"
     MODEL = "GA-2S"
     _has_fm = False
-    _has_sidekey = False
 
     @classmethod
     def match_model(cls, filedata, filename):
         # This model is only ever matched via metadata
         return False
+
+    def __init__(self, *args, **kwargs):
+        super(ROGA2SRadio, self).__init__(*args, **kwargs)
+        self.SIDEKEYFUNCTION_LIST = ["Off", "Monitor", "Unused",
"Alarm"]



On Fri, 2019-08-16 at 08:14 -0700, Dan Smith via chirp_devel wrote:
> > I am open to suggestions on the global variable hack. If more of
> > these
> > variables were inside a class then it would be trivial to update it
> > in
> > the __init__() method using self.SIDEKEYFUNCTION_LIST
> 
> Yeah, just move that list definition into the parent class, and
> override it in the appropriate subclass. Minimizing impact to
> existing code is good, but do as much as you need to make it _right_
> :) You definitely can't modify the global, because if I'm using two
> radios together, one of which is a GA-2S, after I've used the driver
> to work with it, it's broken until restart for another variant :)
> 
> --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