-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set minimum version of firmware for Rigol DS4000 #1206
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1206 +/- ##
=======================================
Coverage 80.16% 80.16%
=======================================
Files 49 49
Lines 6762 6762
=======================================
Hits 5421 5421
Misses 1341 1341 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All in all - good catch! but please describe the problem, change exception to a warning, and make the code more robust against the format of the firmware version (see the comments).
idn = self.get_idn() | ||
ver = [int(x) for x in idn['firmware'].split('.')] | ||
if ver < [0,2,3]: | ||
raise RuntimeError('Firmware version must be at least 00.02.03') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a clear explanation to the exception message about why the firmware needs to be at least that.
idn = self.get_idn() | ||
ver = [int(x) for x in idn['firmware'].split('.')] | ||
if ver < [0,2,3]: | ||
raise RuntimeError('Firmware version must be at least 00.02.03') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, do you receive corrupted data all the time? as in, is the scope still usable to some extent with 00.02.02
and lower or not? if it is, then please change raise RuntimeError
to a waning warnings.warn
, because the users should not get suddenly blocked from using the driver/instrument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I just trust you that it is indeed the firmware problem, and not some minor error in the way you are using the instrument. Nevertheless, could you please double check that you are doing things in the right way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sincerely I don't know how extended is the breakage. I just noticed that the function to get the raw buffer was broken and got working after an upgrade. Also now I don't have a way anymore to check with the old version. Since it's easily upgredable, I would not waste time to try to use an old version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. but still let's keep it safe. So:
- make a warning instead of error
- add more info to the text of the warning explaining what is wrong with an older firmware
#Require version 00.02.03 | ||
|
||
idn = self.get_idn() | ||
ver = [int(x) for x in idn['firmware'].split('.')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is firmware version always a three-number string #.#.#
?
you do not have to reinvent the wheel here, just use from distutils.version import LooseVersion
(example here or here or even in QCoDeS) .
Another thing you could use is from pkg_resources import parse_version
function (examples here and here) but it is not included in the standard library of python.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good, I was looking for something similar, but I didn't found it, thanks!
@astafan8 updated as requested |
idn = self.get_idn() | ||
ver = LooseVersion(idn['firmware']) | ||
if ver < LooseVersion('00.02.03'): | ||
warnings.warn('Firmware version should be at least 00.02.03, data transfert may not work correctly') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: transfer
(without t
) :) fix it and then I'll merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line is also slightly too long. If we really want to get nitty-gritty (and we do!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done
@YakBizzarro thank you! |
Merge: 82cb20e c726994 Author: William H.P. Nielsen <[email protected]> Merge pull request #1206 from YakBizzarro/ds4000-fix
With firmware version 00.02.02, data transfer is not working correctly when accessing the raw buffer (we receive corrupted data). This commit check that the scope is running at least version 00.02.03 of the firmware.
@astafan8