py_test_interface icon indicating copy to clipboard operation
py_test_interface copied to clipboard

Return the device class and model

Open tomtastic opened this issue 4 years ago • 2 comments

Using commands 0x03 and 0x04, return the class and model of the device. This is useful for adding support for these devices to the Sigrok driver (https://github.com/sigrokproject/libsigrok/pull/100)

eg.

$ ./hm305.py
Class (0x04): 0x4B50
Model (0x03): 305
1.8 Volts
0.0 Amps
0.0 Watts

Also applied some minor code formatting using Black.

tomtastic avatar Feb 01 '21 11:02 tomtastic

Hi, I was looking through some of the files from the software DVD of my recently purchased HM310T, and I noticed some references to ClassID, which is always a two character ASCII alphanumeric identifier.

Mine is also 0x4B50 which is actually KP in ascii.

This corresponds with the data in /Sofeware/setting/Rules.XML which gives a little more info about the meaning of the "class" of device. Here is each ClassID with its corresponding ClassName from what I saw:

D3    3-digit display linear DC power supply
K3    3-digit display switch DC power supply
DF    4-digit display linear DC power supply
KF    4-digit display switch DC power supply
DP    4-digit display programmable linear DC power supply
KP    4-digit display programmable switch DC power supply
PL    4-digit display programmable switch DC power supply
PT    4-digit display programmable switch DC power supply
SP    5-digit display  programmable  DC power supply
KM    4-digit display High-power switching power supply
KC    4-digit High Power Digital Control Power Supply

Of course there are some other attributes for these DeviceClass XML elements I just didn't want to copy the whole file verbatim since I'm not sure if that could be considered a copyright problem.

The same file also has some ModelID info indicating max volts/amps/power, but those are pretty self-explanatory anyways.

thehans avatar Apr 27 '21 18:04 thehans

@tomtastic I don't know if you've seen my recent posts elsewhere (EEVblog thread and sigrok etommens PR), but I made some extensive changes to hm305.py, starting from your branch, and I figured I'd share in case you are interested. https://github.com/thehans/py_test_interface/blob/master/hm305.py

First, I ended up displaying the device class as an ascii string, as suggested by my last comment. The reads now support multiple registers per request, and have optimized away the need to wait for timeout when receiving responses. I also made some Enums representing register addresses and added my own documentation in comments. Most of the info is not a lot different than what's already on sigrok wiki, but I scanned and found quite a few other registers with non-zero values and tried to document those as well.

Cheers

thehans avatar May 03 '21 16:05 thehans