From: Matthias Heidbrink Date: Thu, 2 Jan 2014 18:38:52 +0000 (+0100) Subject: gmc_mh_1x_2x: Fixed sign and AC/DC for current measurements with Metrahit <= 16. X-Git-Tag: libsigrok-0.3.0~348 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1d4a28392800bde47c51334bea45060a45fd7450;p=libsigrok.git gmc_mh_1x_2x: Fixed sign and AC/DC for current measurements with Metrahit <= 16. --- diff --git a/hardware/gmc-mh-1x-2x/protocol.c b/hardware/gmc-mh-1x-2x/protocol.c index 76b804cb..66a73e9f 100644 --- a/hardware/gmc-mh-1x-2x/protocol.c +++ b/hardware/gmc-mh-1x-2x/protocol.c @@ -102,17 +102,17 @@ static void decode_ctmv_16(uint8_t ctmv, struct dev_context *devc) /** * Decode range/sign/acdc byte special chars (Metrahit 12-16). * - * @param[in] spc Special characters 1 and 2 (s1 | (s2 << 4)). + * @param[in] rs Range and sign byte. */ static void decode_rs_16(uint8_t rs, struct dev_context *devc) { sr_spew("decode_rs_16(%d) scale = %f", rs, devc->scale); - if (rs & 0x08) /* Sign */ + if (rs & 0x04) /* Sign */ devc->scale *= -1.0; if (devc->mq == SR_MQ_CURRENT) { - if (rs & 0x04) /* Current is AC */ + if (rs & 0x08) /* Current is AC */ devc->mqflags |= SR_MQFLAG_AC; else devc->mqflags |= SR_MQFLAG_DC;