X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=output%2Fanalog.c;h=d2f28b6b2853bf94d6bb2ad91eea4c750c688900;hb=bf53457d1ddea58d1cb7e4feea83ad0cc1d63031;hp=776f29549074dcbae0a23188ef53ce92b40b28c7;hpb=a944a84b17c5f5544b45e27dc07d7f60a4fd6ba8;p=libsigrok.git diff --git a/output/analog.c b/output/analog.c index 776f2954..d2f28b6b 100644 --- a/output/analog.c +++ b/output/analog.c @@ -173,6 +173,9 @@ static void fancyprint(int unit, int mqflags, float value, GString *out) * a made-up notation. */ g_string_append(out, " %oA"); break; + case SR_UNIT_CONCENTRATION: + g_string_append_printf(out, "%f ppm", value * 1000000); + break; default: si_printf(value, out, ""); } @@ -186,11 +189,11 @@ static void fancyprint(int unit, int mqflags, float value, GString *out) } static GString *receive(struct sr_output *o, const struct sr_dev_inst *sdi, - struct sr_datafeed_packet *packet) + const struct sr_datafeed_packet *packet) { - struct sr_datafeed_analog *analog; + const struct sr_datafeed_analog *analog; struct context *ctx; - float *fdata; + const float *fdata; int i, j; (void)sdi; @@ -211,7 +214,7 @@ static GString *receive(struct sr_output *o, const struct sr_dev_inst *sdi, break; case SR_DF_ANALOG: analog = packet->payload; - fdata = (float *)analog->data; + fdata = (const float *)analog->data; for (i = 0; i < analog->num_samples; i++) { for (j = 0; j < ctx->num_enabled_probes; j++) { g_string_append_printf(ctx->out, "%s: ",