X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=src%2Fhardware%2Fhp-3478a%2Fprotocol.c;h=2e9130b022a9ab01832701ebdae41eb0c1533c47;hp=7842f2f4e25992ca81a9d72e2f6d63a783274256;hb=569165c0e44323ce8a4baf1da4d540e8976e9d33;hpb=8ef4fb3347830023b80a5e121c7ffd66e10f4944 diff --git a/src/hardware/hp-3478a/protocol.c b/src/hardware/hp-3478a/protocol.c index 7842f2f4..2e9130b0 100644 --- a/src/hardware/hp-3478a/protocol.c +++ b/src/hardware/hp-3478a/protocol.c @@ -1,7 +1,7 @@ /* * This file is part of the libsigrok project. * - * Copyright (C) 2017-2018 Frank Stettner + * Copyright (C) 2017-2021 Frank Stettner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -69,9 +69,8 @@ SR_PRIV int hp_3478a_set_mq(const struct sr_dev_inst *sdi, enum sr_mq mq, struct sr_scpi_dev_inst *scpi = sdi->conn; struct dev_context *devc = sdi->priv; - /* No need to send command if we're not changing measurement type. */ - if (devc->measurement_mq == mq && - ((devc->measurement_mq_flags & mq_flags) == mq_flags)) + /* No need to send a command if we're not changing the measurement type. */ + if (devc->measurement_mq == mq && devc->measurement_mq_flag == mq_flags) return SR_OK; for (i = 0; i < ARRAY_SIZE(sr_mq_to_cmd_map); i++) { @@ -227,17 +226,17 @@ static int parse_function_byte(struct dev_context *devc, uint8_t function_byte) return SR_ERR_DATA; /* Function + Range */ - devc->measurement_mq_flags = 0; + devc->measurement_mq_flag = 0; devc->acquisition_mq_flags = 0; if ((function_byte & SB1_FUNCTION_BLOCK) == FUNCTION_VDC) { devc->measurement_mq = SR_MQ_VOLTAGE; - devc->measurement_mq_flags |= SR_MQFLAG_DC; + devc->measurement_mq_flag = SR_MQFLAG_DC; devc->acquisition_mq_flags |= SR_MQFLAG_DC; devc->measurement_unit = SR_UNIT_VOLT; parse_range_vdc(devc, function_byte); } else if ((function_byte & SB1_FUNCTION_BLOCK) == FUNCTION_VAC) { devc->measurement_mq = SR_MQ_VOLTAGE; - devc->measurement_mq_flags |= SR_MQFLAG_AC; + devc->measurement_mq_flag = SR_MQFLAG_AC; devc->acquisition_mq_flags |= SR_MQFLAG_AC | SR_MQFLAG_RMS; devc->measurement_unit = SR_UNIT_VOLT; parse_range_vac(devc, function_byte); @@ -247,19 +246,19 @@ static int parse_function_byte(struct dev_context *devc, uint8_t function_byte) parse_range_ohm(devc, function_byte); } else if ((function_byte & SB1_FUNCTION_BLOCK) == FUNCTION_4WR) { devc->measurement_mq = SR_MQ_RESISTANCE; - devc->measurement_mq_flags |= SR_MQFLAG_FOUR_WIRE; + devc->measurement_mq_flag = SR_MQFLAG_FOUR_WIRE; devc->acquisition_mq_flags |= SR_MQFLAG_FOUR_WIRE; devc->measurement_unit = SR_UNIT_OHM; parse_range_ohm(devc, function_byte); } else if ((function_byte & SB1_FUNCTION_BLOCK) == FUNCTION_ADC) { devc->measurement_mq = SR_MQ_CURRENT; - devc->measurement_mq_flags |= SR_MQFLAG_DC; + devc->measurement_mq_flag = SR_MQFLAG_DC; devc->acquisition_mq_flags |= SR_MQFLAG_DC; devc->measurement_unit = SR_UNIT_AMPERE; parse_range_a(devc, function_byte); } else if ((function_byte & SB1_FUNCTION_BLOCK) == FUNCTION_AAC) { devc->measurement_mq = SR_MQ_CURRENT; - devc->measurement_mq_flags |= SR_MQFLAG_AC; + devc->measurement_mq_flag = SR_MQFLAG_AC; devc->acquisition_mq_flags |= SR_MQFLAG_AC | SR_MQFLAG_RMS; devc->measurement_unit = SR_UNIT_AMPERE; parse_range_a(devc, function_byte);