Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jherkenhoff
Copy link
Collaborator

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!

@jherkenhoff jherkenhoff requested a review from lobis as a code owner August 9, 2023 10:08
@lobis
Copy link
Owner

lobis commented Aug 9, 2023

@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!

@lobis lobis merged commit b4ffeb6 into lobis:main Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants