This changes the behavior of the analog output module to ignore channels
that aren't enabled. This matches the behavior of the bits output module,
so that the two default output modules behave the same way.

diff --git a/src/output/analog.c b/src/output/analog.c
index 019279f..1b41b70 100644
--- a/src/output/analog.c
+++ b/src/output/analog.c
@@ -117,15 +117,19 @@ static int receive(const struct sr_output *o, const
struct sr_datafeed_packet *p
                for (i = 0; i < analog->num_samples; i++) {
                        for (l = analog->meaning->channels, c = 0; l; l =
l->next, c++) {
                                ch = l->data;
-                               g_string_append_printf(*out, "%s: ",
ch->name);
-                               number = g_strdup_printf("%.*f",
MAX(digits, 0),
-                                               fdata[i * num_channels +
c]);
-                               g_string_append(*out, number);
-                               g_free(number);
-                               g_string_append(*out, " ");
-                               g_string_append(*out, suffix);
-                               g_string_append(*out, "\n");
-                       }
+                                if (ch->enabled) {
+                                        g_string_append_printf(
+                                                *out, "%s: ", ch->name);
+                                        number = g_strdup_printf(
+                                                "%.*f", MAX(digits, 0),
+                                                fdata[i * num_channels +
c]);
+                                        g_string_append(*out, number);
+                                        g_free(number);
+                                        g_string_append(*out, " ");
+                                        g_string_append(*out, suffix);
+                                        g_string_append(*out, "\n");
+                                }
+                        }
                }
                g_free(suffix);
                break;
------------------------------------------------------------------------------
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to