]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/brymen-bm86x/protocol.c
Makefile.am: Shorten ChangeLog target a bit.
[libsigrok.git] / src / hardware / brymen-bm86x / protocol.c
index b8e16a3f8d346c7f983f54a235ac764f57b7b69c..2840696f8127f8a84e9f1f664f468ba440d6eeba 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <string.h>
 #include <math.h>
 #include "protocol.h"
 
 #define USB_TIMEOUT 500
 
-static char char_map[128] = {
+static const char char_map[128] = {
        [0x20] = '-',
        [0x5F] = '0',
        [0x50] = '1',
@@ -161,6 +162,9 @@ static void brymen_bm86x_parse(unsigned char *buf, float *floatval,
                } else if (buf[9] & 0x04) {
                        analog[1].mq = SR_MQ_CURRENT;
                        analog[1].unit = SR_UNIT_AMPERE;
+               } else if (buf[9] & 0x08) {
+                       analog[1].mq = SR_MQ_CURRENT;
+                       analog[1].unit = SR_UNIT_PERCENTAGE;
                } else if (buf[14] & 0x04) {
                        analog[1].mq = SR_MQ_FREQUENCY;
                        analog[1].unit = SR_UNIT_HERTZ;
@@ -254,7 +258,7 @@ static int brymen_bm86x_send_command(const struct sr_dev_inst *sdi)
        }
 
        if (ret != sizeof(buf)) {
-               sr_err("Short packet: sent %d/%ld bytes.", ret, sizeof(buf));
+               sr_err("Short packet: sent %d/%zu bytes.", ret, sizeof(buf));
                return SR_ERR;
        }
 
@@ -290,7 +294,7 @@ static int brymen_bm86x_read_interrupt(const struct sr_dev_inst *sdi)
        }
 
        if (transferred != sizeof(buf)) {
-               sr_err("Short packet: received %d/%d bytes.", transferred, sizeof(buf));
+               sr_err("Short packet: received %d/%zu bytes.", transferred, sizeof(buf));
                return SR_ERR;
        }