d_decimator_count = d_decimator_count_init;
- for (int i = 0; i < d_nchannels; i++)
- d_buffer[i][d_obi] = channel_data[i]; // copy data into buffer
-
- switch (d_state){
- case HOLD_OFF:
- d_hold_off_count--;
- if (d_hold_off_count <= 0)
- enter_look_for_trigger ();
- break;
-
- case LOOK_FOR_TRIGGER:
- if (found_trigger ())
- enter_post_trigger ();
- break;
-
- case POST_TRIGGER:
- d_post_trigger_count--;
- if (d_post_trigger_count <= 0){
- write_output_records ();
- enter_hold_off ();
- }
- break;
-
- default:
- assert (0);
+ if (d_trigger_mode != gr_TRIG_MODE_STRIPCHART)
+ {
+ for (int i = 0; i < d_nchannels; i++)
+ d_buffer[i][d_obi] = channel_data[i]; // copy data into buffer
+
+ switch (d_state){
+ case HOLD_OFF:
+ d_hold_off_count--;
+ if (d_hold_off_count <= 0)
+ enter_look_for_trigger ();
+ break;
+
+ case LOOK_FOR_TRIGGER:
+ if (found_trigger ())
+ enter_post_trigger ();
+ break;
+
+ case POST_TRIGGER:
+ d_post_trigger_count--;
+ if (d_post_trigger_count <= 0){
+ write_output_records ();
+ enter_hold_off ();
+ }
+ break;
+
+ default:
+ assert (0);
+ }
+
+ d_obi = incr_bi (d_obi);
+ }
+ else
+ {
+ for (int i = 0; i < d_nchannels; i++)
+ {
+ for (int j = OUTPUT_RECORD_SIZE-1; j >= 0; j--)
+ {
+ d_buffer[i][j] = d_buffer[i][j-1];
+ }
+ d_buffer[i][0] = channel_data[i];
+ }
+ write_output_records();
}
-
- d_obi = incr_bi (d_obi);
}
/*
gr_TRIG_MODE_FREE,
gr_TRIG_MODE_AUTO,
gr_TRIG_MODE_NORM,
+ gr_TRIG_MODE_STRIPCHART,
};
enum gr_trigger_slope {
import wx
from gnuradio import gr
+RUN_ALWAYS = gr.prefs().get_bool ('wxgui', 'run_always', False)
+
class wxgui_hb(object):
"""
The wxgui hier block helper/wrapper class:
assert points[0] == self or points[0][0] == self
copy = gr.copy(self._hb.input_signature().sizeof_stream_item(0))
handler = self._handler_factory(copy.set_enabled)
- handler(False) #initially disable the copy block
+ if RUN_ALWAYS == False:
+ handler(False) #initially disable the copy block
+ else:
+ handler(True) #initially enable the copy block
self._bind_to_visible_event(win=self.win, handler=handler)
points = list(points)
points.insert(1, copy) #insert the copy block into the chain
if cache[0] == visible: return
cache[0] = visible
#print visible, handler
- handler(visible)
+ if RUN_ALWAYS == False:
+ handler(visible)
+ else:
+ handler(True)
return callback
@staticmethod
# Constants
##################################################
DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'scope_rate', 30)
+DEFAULT_TRIG_MODE = gr.prefs().get_long('wxgui', 'trig_mode', gr.gr_TRIG_MODE_AUTO)
DEFAULT_WIN_SIZE = (600, 300)
COUPLING_MODES = (
('DC', False),
('Freerun', gr.gr_TRIG_MODE_FREE),
('Auto', gr.gr_TRIG_MODE_AUTO),
('Normal', gr.gr_TRIG_MODE_NORM),
+ ('Stripchart', gr.gr_TRIG_MODE_STRIPCHART),
)
TRIGGER_SLOPES = (
('Pos +', gr.gr_TRIG_SLOPE_POS),
trigger_channel_key,
decimation_key,
msg_key,
+ 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
+
+ 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,
**kwargs #do not end with a comma
):
v_scale=v_scale,
v_offset=v_offset,
xy_mode=xy_mode,
+ trig_mode=trig_mode,
ac_couple_key=AC_COUPLE_KEY,
trigger_level_key=TRIGGER_LEVEL_KEY,
trigger_mode_key=TRIGGER_MODE_KEY,
SLIDER_STEPS = 100
AVG_ALPHA_MIN_EXP, AVG_ALPHA_MAX_EXP = -3, 0
DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'waterfall_rate', 30)
+DEFAULT_COLOR_MODE = gr.prefs().get_string('wxgui', 'waterfall_color', 'rgb1')
DEFAULT_WIN_SIZE = (600, 300)
DIV_LEVELS = (1, 2, 5, 10, 20)
MIN_DYNAMIC_RANGE, MAX_DYNAMIC_RANGE = 10, 200
def _on_incr_time_scale(self, event):
old_rate = self.parent[FRAME_RATE_KEY]
self.parent[FRAME_RATE_KEY] *= 0.75
+ if self.parent[FRAME_RATE_KEY] < 1.0:
+ self.parent[FRAME_RATE_KEY] = 1.0
+
if self.parent[FRAME_RATE_KEY] == old_rate:
self.parent[DECIMATION_KEY] += 1
def _on_decr_time_scale(self, event):
self[REF_LEVEL_KEY] = ref_level
self[BASEBAND_FREQ_KEY] = baseband_freq
self[COLOR_MODE_KEY] = COLOR_MODES[0][1]
+ self[COLOR_MODE_KEY] = DEFAULT_COLOR_MODE
self[RUNNING_KEY] = True
#setup the box with plot and controls
self.control_panel = control_panel(self)
#grid parameters
sample_rate = self[SAMPLE_RATE_KEY]
frame_rate = self[FRAME_RATE_KEY]
+ if frame_rate < 1.0 :
+ frame_rate = 1.0
baseband_freq = self[BASEBAND_FREQ_KEY]
num_lines = self[NUM_LINES_KEY]
y_divs = self[Y_DIVS_KEY]
ac_couple=$ac_couple,
xy_mode=$xy_mode,
num_inputs=$num_inputs,
+ trig_mode=$trig_mode,
#if $win_size()
size=$win_size,
#end if
<value></value>
<type>notebook</type>
</param>
+ <param>
+ <name>Trigger Mode</name>
+ <key>trig_mode</key>
+ <type>enum</type>
+ <option>
+ <name>Auto</name>
+ <key>gr.gr_TRIG_MODE_AUTO</key>
+ </option>
+ <option>
+ <name>Normal</name>
+ <key>gr.gr_TRIG_MODE_NORM</key>
+ </option>
+ <option>
+ <name>Freerun</name>
+ <key>gr.gr_TRIG_MODE_FREE</key>
+ </option>
+ <option>
+ <name>Stripchart</name>
+ <key>gr.gr_TRIG_MODE_STRIPCHART</key>
+ </option>
+ </param>
<check>not $win_size or len($win_size) == 2</check>
<check>not $xy_mode or '$type' == 'complex' or $num_inputs != 1</check>
<sink>