[chirp_devel] [PATCH 1 of 2] Add "has_nostep_tuning" flag to RadioFeatures. This flag means that the

Dan Smith
Tue Jan 17 16:27:57 PST 2012


# HG changeset patch
# User Dan Smith <dsmith at danplanet.com>
# Date 1326846306 28800
# Node ID b51a59425d8352815637e5187cb9ea194441534f
# Parent  4b90cf6547c80734eb838217da99c271c2aa2f12
Add "has_nostep_tuning" flag to RadioFeatures. This flag means that the
destination radio does not require a tuning step matching the frequency
of a given set_memory() operation. The radio may also use this flag to push
step validation down into the driver layer instead of letting the UI make
the determination.

diff -r 4b90cf6547c8 -r b51a59425d83 chirp/chirp_common.py
--- a/chirp/chirp_common.py	Mon Jan 16 12:01:26 2012 -0800
+++ b/chirp/chirp_common.py	Tue Jan 17 16:25:06 2012 -0800
@@ -534,6 +534,7 @@
         "has_ctone"           : BOOLEAN,
         "has_cross"           : BOOLEAN,
         "has_infinite_number" : BOOLEAN,
+        "has_nostep_tuning"   : BOOLEAN,
 
         # Attributes
         "valid_modes"         : [],
@@ -621,6 +622,9 @@
         self.init("has_infinite_number", False,
                   "Indicates that the radio is not constrained in the " +
                   "number of memories that it can store")
+        self.init("has_nostep_tuning", False,
+                  "Indicates that the radio does not require a valid " +
+                  "tuning step to store a frequency")
 
         self.init("valid_modes", list(MODES),
                   "Supported emission (or receive) modes")
@@ -784,7 +788,7 @@
             msg = ValidationWarning("Power level %s not supported" % mem.power)
             msgs.append(msg)
 
-        if rf.valid_tuning_steps:
+        if rf.valid_tuning_steps and not rf.has_nostep_tuning:
             try:
                 step = required_step(mem.freq)
                 if step not in rf.valid_tuning_steps:
diff -r 4b90cf6547c8 -r b51a59425d83 chirpui/memedit.py
--- a/chirpui/memedit.py	Mon Jan 16 12:01:26 2012 -0800
+++ b/chirpui/memedit.py	Tue Jan 17 16:25:06 2012 -0800
@@ -190,7 +190,13 @@
             print e
             new = None
 
-        set_ts(chirp_common.required_step(new))
+        features = self.rthread.radio.get_features()
+
+        try:
+            set_ts(chirp_common.required_step(new))
+        except errors.InvalidDataError, e:
+            if not features.has_nostep_tuning:
+                raise e
 
         if new and self._config.get_bool("autorpt") and new != prev:
             band = int(new / 100000000)



More information about the chirp_devel mailing list