-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for Digitech QM1576 serial protocol parser The protocol #187
base: master
Are you sure you want to change the base?
Conversation
is described at https://www.airspayce.com/mikem/QM1578/protocol.txt You can use this decoder with libsigrok and Digitech QM1578 via ESP32 Bluetooth-Serial converter available from the author at: https://www.airspayce.com/mikem/QM1578/QM1578BluetoothClient.ino which connects to the QM1578 over Bluetooth LE, fetches the data stream and sends it on the serial port to the host, where this driver can read it with this command for example: sigrok-cli --driver digitech-qm1578:conn=/dev/ttyUSB1 --continuous
src/dmm/qm1578.c
Outdated
case 0x05: return -3; /* For amps */ | ||
case 0x06: return -3; /* For volts */ | ||
default: | ||
sr_dbg("Unknown multiplier: 0x%02x.", buf[11]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please indent your code, more info: https://www2.cs.arizona.edu/~mccann/indent_c.html
src/dmm/qm1578.c
Outdated
|
||
/* On overload, digits 4 to 1 are: 0x0b 0x0a 0x00 0x0b */ | ||
if (buf[8] == 0x0b) | ||
return INFINITY; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed indention
src/dmm/qm1578.c
Outdated
digit = buf[8 - i]; | ||
if (digit < 0 || digit > 9) | ||
continue; | ||
val = 10.0 * val + digit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add indent to indicate this board in inside the for loop
src/dmm/qm1578.c
Outdated
* and just use the presence of the trailing record separator | ||
*/ | ||
if (buf[14] != 0x0d) | ||
return FALSE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/dmm/qm1578.c
Outdated
if (buf[13] & 0x10) | ||
analog->meaning->mqflags |= SR_MQFLAG_AUTORANGE; | ||
if (buf[13] & 0x40) | ||
analog->meaning->mqflags |= SR_MQFLAG_DC; | ||
if (buf[13] & 0x80) | ||
analog->meaning->mqflags |= SR_MQFLAG_AC; | ||
if (buf[13] & 0x20) | ||
analog->meaning->mqflags |= SR_MQFLAG_RELATIVE; | ||
if (buf[12] & 0x40) | ||
analog->meaning->mqflags |= SR_MQFLAG_HOLD; | ||
if ((buf[13] & 0x0c) == 0x0c) | ||
analog->meaning->mqflags |= SR_MQFLAG_MAX; | ||
if ((buf[13] & 0x0c) == 0x08) | ||
analog->meaning->mqflags |= SR_MQFLAG_MIN; | ||
if ((buf[13] & 0x0c) == 0x0c) | ||
analog->meaning->mqflags |= SR_MQFLAG_AVG; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/dmm/qm1578.c
Outdated
analog->meaning->mq = SR_MQ_CURRENT; | ||
analog->meaning->unit = SR_UNIT_AMPERE; | ||
analog->meaning->mqflags |= SR_MQFLAG_AC | SR_MQFLAG_RMS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/dmm/qm1578.c
Outdated
analog->meaning->mq = SR_MQ_VOLTAGE; | ||
analog->meaning->unit = SR_UNIT_VOLT; | ||
analog->meaning->mqflags |= SR_MQFLAG_DIODE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/dmm/qm1578.c
Outdated
if (buf[10] == 0x04) | ||
{ | ||
analog->meaning->mq = SR_MQ_FREQUENCY; | ||
analog->meaning->unit = SR_UNIT_HERTZ; | ||
} | ||
else | ||
{ | ||
analog->meaning->mq = SR_MQ_DUTY_CYCLE; | ||
analog->meaning->unit = SR_UNIT_PERCENTAGE; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto, you did it for internal if/else but forgot for external one
src/dmm/qm1578.c
Outdated
analog->meaning->mq = SR_MQ_CONTINUITY; | ||
analog->meaning->unit = SR_UNIT_OHM; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/dmm/qm1578.c
Outdated
val *= powf(10, exponent); | ||
|
||
if (buf[12] & 0x80) | ||
val = -val; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Thanks for your review. |
Perfect! If you want please squash these commits, but I will already give an approval |
Thanks for your help and efforts. |
Merged as https://sigrok.org/gitaction?p=libsigrok.git;a=commit;h=46caa76de9b44c4f72287bb6e7443836e7fe414c, thank you! Can you please add a wiki page for this device ( https://sigrok.org/wiki/Supported_hardware#Multimeters ) and add your information there so that it won't ever get lost? Especially the contents of https://www.airspayce.com/mikem/QM1578/protocol.txt, the arduino sketch and instructions on how to build/flash/use the arduino sketch. |
is described at https://www.airspayce.com/mikem/QM1578/protocol.txt
You can use this decoder with libsigrok and Digitech QM1578 via ESP32
Bluetooth-Serial converter available from the author at:
https://www.airspayce.com/mikem/QM1578/QM1578BluetoothClient.ino which
connects to the QM1578 over Bluetooth LE, fetches the data stream and
sends it on the serial port to the host, where this driver can read it
with this command for example:
sigrok-cli --driver digitech-qm1578:conn=/dev/ttyUSB1 --continuous