# Constants
##################################################
DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'scope_rate', 30)
+PERSIST_ALPHA_MIN_EXP, PERSIST_ALPHA_MAX_EXP = -2, 0
+SLIDER_STEPS = 100
+ DEFAULT_TRIG_MODE = gr.prefs().get_long('wxgui', 'trig_mode', gr.gr_TRIG_MODE_AUTO)
DEFAULT_WIN_SIZE = (600, 300)
COUPLING_MODES = (
('DC', False),
trigger_channel_key,
decimation_key,
msg_key,
+ use_persistence,
+ persist_alpha,
+ trig_mode,
):
pubsub.pubsub.__init__(self)
#check num inputs
self[FRAME_RATE_KEY] = frame_rate
self[TRIGGER_LEVEL_KEY] = 0
self[TRIGGER_CHANNEL_KEY] = 0
- self[TRIGGER_MODE_KEY] = gr.gr_TRIG_MODE_AUTO
+ self[TRIGGER_MODE_KEY] = trig_mode
+
self[TRIGGER_SLOPE_KEY] = gr.gr_TRIG_SLOPE_POS
self[T_FRAC_OFF_KEY] = 0.5
+ self[USE_PERSISTENCE_KEY] = use_persistence
+ self[PERSIST_ALPHA_KEY] = persist_alpha
+
+ if self[TRIGGER_MODE_KEY] == gr.gr_TRIG_MODE_STRIPCHART:
+ self[T_FRAC_OFF_KEY] = 0.0
+
for i in range(num_inputs):
self.proxy(common.index_key(AC_COUPLE_KEY, i), controller, common.index_key(ac_couple_key, i))
#init panel and plot
xy_mode=False,
ac_couple=False,
num_inputs=1,
+ trig_mode=scope_window.DEFAULT_TRIG_MODE,
frame_rate=scope_window.DEFAULT_FRAME_RATE,
+ use_persistence=False,
+ persist_alpha=None,
**kwargs #do not end with a comma
):
+ #ensure analog alpha
+ if persist_alpha is None:
+ actual_frame_rate=float(frame_rate)
+ analog_cutoff_freq=0.5 # Hertz
+ #calculate alpha from wanted cutoff freq
+ persist_alpha = 1.0 - math.exp(-2.0*math.pi*analog_cutoff_freq/actual_frame_rate)
+
if not t_scale: t_scale = 10.0/sample_rate
#init
gr.hier_block2.__init__(