lobis / hvps

A Python package for controlling high voltage power supplies (HVPS) over serial port. Supports CAEN and iseg power supplies.
https://github.com/lobis/hvps
BSD 3-Clause "New" or "Revised" License
8 stars 2 forks source link

Add support for single-board CAEN devices #36

Closed jherkenhoff closed 1 year ago

jherkenhoff commented 1 year ago

My single module CAEN Supply (R8034N) deliveres its response without the "BD:00" part, which is why the _parse_response function threw an error. I edited the regular expression in the _parse_response function to accomodate the missing board number. If the board number is missing, it implicitly assumes its board number 0, and returns that. This might be considered a bit of a hack, but I cant think of any cases where this could become a problem.

Thanks for this great library!

lobis commented 1 year ago

@jherkenhoff thanks a lot for your contribution!

I was under the impression that all CAEN units would return the BD in the response, but we could only test with two distinct models so it was expected that many things would not work out of the box.

Your contribution appears to solve this issue perfectly while improving the code with named capture groups, I was not aware of this feature but I will surely use it on the future, thanks!

I wish we could have a better way to do automated tests, we should probably write some kind of serial emulator with hardcoded responses in order to make sure we didn't break anything everytime we do a push like this (we test them at the lab before merging). It's in our TODO list.

If you find any other improvements or have any suggestions please feel free to make them known to us!