Skip to content
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

Merged
merged 5 commits into from
Jul 30, 2018

Conversation

YakBizzarro
Copy link
Contributor

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

@codecov
Copy link

codecov bot commented Jul 25, 2018

Codecov Report

Merging #1206 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1206   +/-   ##
=======================================
  Coverage   80.16%   80.16%           
=======================================
  Files          49       49           
  Lines        6762     6762           
=======================================
  Hits         5421     5421           
  Misses       1341     1341

Copy link
Contributor

@astafan8 astafan8 left a 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')
Copy link
Contributor

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')
Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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('.')]
Copy link
Contributor

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.

Copy link
Contributor Author

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!

@YakBizzarro
Copy link
Contributor Author

@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')
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, done

@WilliamHPNielsen
Copy link
Contributor

@YakBizzarro thank you!

@WilliamHPNielsen WilliamHPNielsen merged commit dada1fe into microsoft:master Jul 30, 2018
giulioungaretti pushed a commit that referenced this pull request Jul 30, 2018
Merge: 82cb20e c726994
Author: William H.P. Nielsen <whpn@mailbox.org>

    Merge pull request #1206 from YakBizzarro/ds4000-fix
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.

None yet

3 participants