#include "libsigrok.h"
#include "libsigrok-internal.h"
-/* Message logging helpers with subsystem-specific prefix string. */
-#define LOG_PREFIX "es519xx: "
-#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args)
-#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args)
-#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args)
-#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args)
-#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args)
-#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args)
+#define LOG_PREFIX "es519xx"
/* Factors for the respective measurement mode (0 means "invalid"). */
static const float factors_2400_11b[8][8] = {
else if (info->is_rpm)
/* Not a typo, it's really index 4 in factors_2400_11b[][]. */
mode = 4; /* RPM */
- else if (info->is_resistance)
+ else if (info->is_resistance || info->is_continuity)
mode = 5; /* Resistance */
else if (info->is_frequency)
mode = 6; /* Frequency */
if (info->is_continuity) {
analog->mq = SR_MQ_CONTINUITY;
analog->unit = SR_UNIT_BOOLEAN;
- *floatval = (*floatval < 0.0) ? 0.0 : 1.0;
+ *floatval = (*floatval < 0.0 || *floatval > 25.0) ? 0.0 : 1.0;
}
if (info->is_diode) {
analog->mq = SR_MQ_VOLTAGE;
return ret;
}
- handle_flags(analog, floatval, info);
+ if ((ret = parse_range(buf[0], floatval, info)) != SR_OK)
+ return ret;
- return parse_range(buf[0], floatval, info);
+ handle_flags(analog, floatval, info);
+ return SR_OK;
}
/*