Advertisements

Archive for January 9th, 2019

Siglent SDM3045X Screen Shot File

As with the Siglent SDS2304X oscilloscope, the SDM3045M multimeter delivers broken screen shot files over the network: the actual file size doesn’t match the BMP file size field, causing kvetching in subsequent use:

[ed@shiitake tmp]$ lxi screenshot -a 192.168.1.41 -p siglent-sdm3000 test.bmp
Saved screenshot image to test.bmp
[ed@shiitake tmp]$ convert test.bmp test.png
convert-im6.q16: length and filesize do not match `test.bmp' @ warning/bmp.c/ReadBMPImage/831.

Files stored on a USB stick jammed into the meter’s front panel have the correct size, so it’s not clear where the fault lies.

Because the files contain extra data following the (intact) image, it will display correctly:

Astable - 2N7000 - IDSS cal
Astable – 2N7000 – IDSS cal

The BMP header contains the correct size at offset +0x02:

lxi screenshot -a 192.168.1.41 -p siglent-sdm3000 test.bmp
hexdump -C test.bmp | head
00000000  42 4d 36 fa 05 00 00 00  00 00 36 00 00 00 28 00  |BM6.......6...(.|
00000010  00 00 e0 01 00 00 10 01  00 00 01 00 18 00 00 00  |................|
00000020  00 00 00 fa 05 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

The horizontal image size at +0x12 and vertical size at +0x6 are correct: the screen is 480×272 pixels. Each pixel has three bytes = 24 bits, as specified at +0x1C.

So the file should contain 0x0005fa36 = 391734 bytes, but, as delivered, it’s much, much larger:

ll --block-size=1 test.bmp
-rw-rw-r-- 1 ed ed 1152054 Dec 26 08:45 test.bmp

Oddly, 1552054 bytes is exactly the size the oscilloscope files should be. I have no explanation, although it looks like a copypasta error.

As before, the simplest solution is to truncate the file and be done with it:

#!/bin/bash
lxi screenshot -a 192.168.1.41 -p siglent-sdm3000 /tmp/"$1".bmp
truncate --size=391734 /tmp/"$1".bmp
convert /tmp/"$1".bmp "$1".png
echo Screenshot: "$1".png

And then It Just Works:

~/bin/getsdm3045x.sh testfix
Saved screenshot image to /tmp/testfix.bmp
Screenshot: testfix.png

Sheesh & similar remarks.

Advertisements

1 Comment