knarfS / smuview

SmuView is a GUI for sigrok that supports power supplies, electronic loads and all sorts of measurement devices like multimeters, LCR meters and so on.
GNU General Public License v3.0
130 stars 25 forks source link

Unwanted rounding in multimeter display #53

Closed p1ngb4ck closed 1 year ago

p1ngb4ck commented 1 year ago

I use a UT61C multimeter connected via RS232. When I test a resistor of 4.7k, I get a display of 5k in the main display, while the graphs and sigrok-cli clearly show the correct values. There is some unwanted rounding active on the display routine ..

knarfS commented 1 year ago

Some more information would be helpful:

p1ngb4ck commented 1 year ago

@knarfS Ubuntu 22.04, latest git version (compiled everything regarding sigrok from git, no ubuntu packages used). Expected value (as seen in log and being shown in the graphs of smuviewk : resistor with 4700 Ohms). Smuview gets the correct value (uses it for graphs etc) but rounds it for the main display.

Shown on "main" display : 5k Ohms ("exactly" - problem is just the rounded value in display. smuview gets the correct values but displays them rounded)

Screenshot : smuview_screenshot_2022-12-12 19-04-31

Unfortunately I couldn`t screen the correct bar graph value. Yesterday it was shown correctly, today it messes up the scaling somehow, dont know why

knarfS commented 1 year ago

I think I've found the problem. SmuView is using the encoding.digits/spec.spec_digits information, provided in each individual analog data payload by the libsigrok drivers. This information is used to get a representation of the measured value as close as possible to the display of the DMM.

It looks like the fs9922 protocol decoder used for the UT61C is setting the exponent rather the number of decimal places. From the docstring in libsigrok.h:

Number of significant digits after the decimal point if positive, or number of non-significant digits before the decimal point if negative [...]

I've fixed that issue in my libsigrok branch fs9922_digits, but of course couldn't test it. Give it a try if you like. Would be great, if you could test also for other decimal places and prefixes (µ, m, k, M)- Let me know, if this works for you, then I'll open a PR in the next days.

p1ngb4ck commented 1 year ago

This works absolutely perfect so far, thank you soo much. I get exactly whats on the display of my UT-61C now. I tested any resistors I had handy (k / M works fine), as well as some defined voltages (160mV, -12V, 3.3V, 5V ,12V, 40V) Signed ( - ) numbers/decimals also work just fine. Will test some caps over the weekend to check µF & nF.

Thanks sooooo much for your work, this is just incredible =) It allows me to integrate my multimeter (and hopefully psu too soon) in my videos/streams via OBS in linux with a nice display !! Just great.

p1ngb4ck commented 1 year ago

I can confirm now, that all modes and decimal places and units work just fine.

knarfS commented 1 year ago

The wrong value inside the main display is fixed with commit https://github.com/knarfS/smuview/commit/1be2c391ecef3073e8613ecb4cc31a8dfd73941c and the latest continuous build.