]> sigrok.org Git - libsigrok.git/commitdiff
Voltcraft VC-830: Fix diode mode handling.
authorUwe Hermann <redacted>
Sun, 1 Sep 2013 11:10:54 +0000 (13:10 +0200)
committerUwe Hermann <redacted>
Sun, 1 Sep 2013 13:27:21 +0000 (15:27 +0200)
This DMM is not using the standard bits in the FS9922 protocol/structure
to indicate the "volt" and "diode mode" flags. Instead, it only sets the
user-defined bit "z1" to indicate both "diode mode" and "volt".

This fixes #142.

hardware/common/dmm/fs9922.c
hardware/serial-dmm/api.c
hardware/uni-t-dmm/api.c
libsigrok-internal.h

index 9decc78621723fdf08cbbfc8c3073b6d5e68b618..51d3c654dbc7aa7ed9e7efcc2949397699c4f404 100644 (file)
@@ -375,3 +375,17 @@ SR_PRIV int sr_fs9922_parse(const uint8_t *buf, float *floatval,
 
        return SR_OK;
 }
+
+SR_PRIV void sr_fs9922_z1_diode(struct sr_datafeed_analog *analog, void *info)
+{
+       struct fs9922_info *info_local;
+
+       info_local = (struct fs9922_info *)info;
+
+       /* User-defined z1 flag means "diode mode". */
+       if (info_local->is_z1) {
+               analog->mq = SR_MQ_VOLTAGE;
+               analog->unit = SR_UNIT_VOLT;
+               analog->mqflags |= SR_MQFLAG_DIODE;
+       }
+}
index b6987947f51891364e1d827e219b55f3ee8364e0..4e1e1e0135fa7315b4942491d7169260f54cbe91 100644 (file)
@@ -172,10 +172,15 @@ SR_PRIV struct dmm_info dmms[] = {
                receive_data_VOLTCRAFT_VC820_SER,
        },
        {
+               /*
+                * Note: The VC830 doesn't set the 'volt' and 'diode' bits of
+                * the FS9922 protocol. Instead, it only sets the user-defined
+                * bit "z1" to indicate "diode mode" and "voltage".
+                */
                "Voltcraft", "VC-830 (UT-D02 cable)", "2400/8n1/rts=0/dtr=1",
                2400, FS9922_PACKET_SIZE, NULL,
                sr_fs9922_packet_valid, sr_fs9922_parse,
-               NULL,
+               &sr_fs9922_z1_diode,
                &voltcraft_vc830_ser_driver_info,
                receive_data_VOLTCRAFT_VC830_SER,
        },
index e766fd8565d850e19d8b477ef1b44e9f2f34dc46..b23fc02cb3e5791fd22babafc83f67db2d5702c5 100644 (file)
@@ -99,10 +99,15 @@ SR_PRIV struct dmm_info udmms[] = {
                &voltcraft_vc820_driver_info, receive_data_VOLTCRAFT_VC820,
        },
        {
+               /*
+                * Note: The VC830 doesn't set the 'volt' and 'diode' bits of
+                * the FS9922 protocol. Instead, it only sets the user-defined
+                * bit "z1" to indicate "diode mode" and "voltage".
+                */
                "Voltcraft", "VC-830", 2400,
                FS9922_PACKET_SIZE, NULL,
                sr_fs9922_packet_valid, sr_fs9922_parse,
-               NULL,
+               &sr_fs9922_z1_diode,
                &voltcraft_vc830_driver_info, receive_data_VOLTCRAFT_VC830,
        },
        {
index 5fc0fbfabcea5303a3669a71c739fbbe7f6c6842..423463a2b5492854a1694522721132926be11f6b 100644 (file)
@@ -213,6 +213,7 @@ struct fs9922_info {
 SR_PRIV gboolean sr_fs9922_packet_valid(const uint8_t *buf);
 SR_PRIV int sr_fs9922_parse(const uint8_t *buf, float *floatval,
                            struct sr_datafeed_analog *analog, void *info);
+SR_PRIV void sr_fs9922_z1_diode(struct sr_datafeed_analog *analog, void *info);
 
 /*--- hardware/common/dmm/fs9721.c ------------------------------------------*/