Skip to content
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

Update vc96.c #234

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/dmm/vc96.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static int parse_value(const uint8_t *buf,
sr_atof_ascii((const char *)&valstr, result);

dot_pos = strcspn(valstr, ".");
if (dot_pos < cnt) //
if (dot_pos < cnt)
*exponent = -(cnt - dot_pos - 1);
else
*exponent = 0;
Expand Down Expand Up @@ -110,7 +110,6 @@ static void parse_flags(const char *buf, struct vc96_info *info)
/* Bytes 9-10: Unit */
u = (const char *)&unit;

/* the lineup of mA, uA, A is important, 1st detecting A ends the detection and m or u are lost */
if (!g_ascii_strcasecmp(u, "mA"))
info->is_milli = info->is_ampere = TRUE;
else if (!g_ascii_strcasecmp(u, "uA"))
Expand Down Expand Up @@ -264,6 +263,11 @@ SR_PRIV int sr_vc96_parse(const uint8_t *buf, float *floatval,

memset(info_local, 0x00, sizeof(struct vc96_info));

if ((ret = parse_value(buf, floatval, &exponent)) != SR_OK) {
sr_dbg("Error parsing value: %d.", ret);
Copy link
Contributor

@harper23 harper23 Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This program path can't be reached since the function parse_value always returns SR_OK,

return ret;
}

parse_flags((const char *)buf, info_local);
handle_flags(analog, floatval, &exponent, info_local);

Expand Down