X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=output%2Fanalog.c;h=8141525ddbe11ec85f20a596d52a251f1ca4c2db;hb=036d378a628213f71afd24e9de475eacd592ca32;hp=85def20948abb808f6038246273c45cfca5d07bd;hpb=e6523173cff4b39e78566495786e43f0917c860f;p=libsigrok.git diff --git a/output/analog.c b/output/analog.c index 85def209..8141525d 100644 --- a/output/analog.c +++ b/output/analog.c @@ -24,14 +24,7 @@ #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; @@ -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) @@ -173,6 +166,18 @@ static void fancyprint(int unit, int mqflags, float value, GString *out) case SR_UNIT_CONCENTRATION: g_string_append_printf(out, "%f ppm", value * 1000000); break; + case SR_UNIT_REVOLUTIONS_PER_MINUTE: + si_printf(value, out, "RPM"); + break; + case SR_UNIT_VOLT_AMPERE: + si_printf(value, out, "VA"); + break; + case SR_UNIT_WATT: + si_printf(value, out, "W"); + break; + case SR_UNIT_WATT_HOUR: + si_printf(value, out, "Wh"); + break; default: si_printf(value, out, ""); break; @@ -196,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'); }