]> sigrok.org Git - libsigrok.git/blobdiff - output/analog.c
Rename 'struct sr_probe' to 'struct sr_channel' everywhere.
[libsigrok.git] / output / analog.c
index 50189b41334924ed45673ac76baea3c1a7b703fd..ca3a2a0b392481e0846f725a2c02036ec7c17fa8 100644 (file)
 #include "libsigrok.h"
 #include "libsigrok-internal.h"
 
-/* Message logging helpers with subsystem-specific prefix string. */
-#define LOG_PREFIX "output/analog: "
-#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args)
-#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args)
-#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args)
-#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args)
-#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args)
-#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args)
+#define LOG_PREFIX "output/analog"
 
 struct context {
        int num_enabled_probes;
@@ -41,7 +34,7 @@ struct context {
 static int init(struct sr_output *o)
 {
        struct context *ctx;
-       struct sr_probe *probe;
+       struct sr_channel *probe;
        GSList *l;
 
        sr_spew("Initializing output module.");
@@ -129,7 +122,7 @@ static void fancyprint(int unit, int mqflags, float value, GString *out)
                si_printf(value, out, "Hz");
                break;
        case SR_UNIT_PERCENTAGE:
-               g_string_append_printf(out, "%f%%", value);
+               g_string_append_printf(out, "%f %%", value);
                break;
        case SR_UNIT_BOOLEAN:
                if (value > 0)
@@ -175,6 +168,7 @@ static void fancyprint(int unit, int mqflags, float value, GString *out)
                break;
        case SR_UNIT_REVOLUTIONS_PER_MINUTE:
                si_printf(value, out, "RPM");
+               break;
        case SR_UNIT_VOLT_AMPERE:
                si_printf(value, out, "VA");
                break;
@@ -207,6 +201,8 @@ static void fancyprint(int unit, int mqflags, float value, GString *out)
                g_string_append_printf(out, " AUTO");
        if (mqflags & SR_MQFLAG_RELATIVE)
                g_string_append_printf(out, " REL");
+       if (mqflags & SR_MQFLAG_AVG)
+               g_string_append_printf(out, " AVG");
        g_string_append_c(out, '\n');
 }
 
@@ -214,7 +210,7 @@ static int receive(struct sr_output *o, const struct sr_dev_inst *sdi,
                const struct sr_datafeed_packet *packet, GString **out)
 {
        const struct sr_datafeed_analog *analog;
-       struct sr_probe *probe;
+       struct sr_channel *probe;
        GSList *l;
        const float *fdata;
        int i, p;