Voltcraft VC-830: Fix diode mode handling.

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.
This commit is contained in:
Uwe Hermann 2013-09-01 13:10:54 +02:00
parent a6ed50f405
commit e52bb9be83
4 changed files with 27 additions and 2 deletions

View File

@ -375,3 +375,17 @@ SR_PRIV int sr_fs9922_parse(const uint8_t *buf, float *floatval,
return SR_OK; 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;
}
}

View File

@ -172,10 +172,15 @@ SR_PRIV struct dmm_info dmms[] = {
receive_data_VOLTCRAFT_VC820_SER, 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", "Voltcraft", "VC-830 (UT-D02 cable)", "2400/8n1/rts=0/dtr=1",
2400, FS9922_PACKET_SIZE, NULL, 2400, FS9922_PACKET_SIZE, NULL,
sr_fs9922_packet_valid, sr_fs9922_parse, sr_fs9922_packet_valid, sr_fs9922_parse,
NULL, &sr_fs9922_z1_diode,
&voltcraft_vc830_ser_driver_info, &voltcraft_vc830_ser_driver_info,
receive_data_VOLTCRAFT_VC830_SER, receive_data_VOLTCRAFT_VC830_SER,
}, },

View File

@ -99,10 +99,15 @@ SR_PRIV struct dmm_info udmms[] = {
&voltcraft_vc820_driver_info, receive_data_VOLTCRAFT_VC820, &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, "Voltcraft", "VC-830", 2400,
FS9922_PACKET_SIZE, NULL, FS9922_PACKET_SIZE, NULL,
sr_fs9922_packet_valid, sr_fs9922_parse, sr_fs9922_packet_valid, sr_fs9922_parse,
NULL, &sr_fs9922_z1_diode,
&voltcraft_vc830_driver_info, receive_data_VOLTCRAFT_VC830, &voltcraft_vc830_driver_info, receive_data_VOLTCRAFT_VC830,
}, },
{ {

View File

@ -213,6 +213,7 @@ struct fs9922_info {
SR_PRIV gboolean sr_fs9922_packet_valid(const uint8_t *buf); SR_PRIV gboolean sr_fs9922_packet_valid(const uint8_t *buf);
SR_PRIV int sr_fs9922_parse(const uint8_t *buf, float *floatval, SR_PRIV int sr_fs9922_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info); 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 ------------------------------------------*/ /*--- hardware/common/dmm/fs9721.c ------------------------------------------*/