Skip to content

Commit 603f6f7

Browse files
committed
configured_plots: simplify logic
1 parent 62f868d commit 603f6f7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

app/plot_app/configured_plots.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,7 @@ def generate_plots(ulog, px4_ulog, db_data, vehicle_data, link_to_3d_page,
464464
changed_params=changed_params, x_range=x_range)
465465
num_rc_channels = 8
466466
if data_plot.dataset:
467-
max_channels = np.amax(data_plot.dataset.data['channel_count'])
468-
if max_channels < num_rc_channels: num_rc_channels = max_channels
467+
num_rc_channels = min(np.amax(data_plot.dataset.data['channel_count']), num_rc_channels)
469468
legends = []
470469
for i in range(num_rc_channels):
471470
channel_names = px4_ulog.get_configured_rc_input_names(i)
@@ -618,8 +617,8 @@ def generate_plots(ulog, px4_ulog, db_data, vehicle_data, link_to_3d_page,
618617
# only plot if at least one of the outputs is not constant
619618
all_constant = True
620619
if data_plot.dataset:
621-
max_outputs = np.amax(data_plot.dataset.data['noutputs'])
622-
if max_outputs < num_actuator_outputs: num_actuator_outputs = max_outputs
620+
num_actuator_outputs = min(np.amax(data_plot.dataset.data['noutputs']),
621+
num_actuator_outputs)
623622

624623
for i in range(num_actuator_outputs):
625624
output_data = data_plot.dataset.data['output['+str(i)+']']

0 commit comments

Comments
 (0)