Skip to content

Commit

Permalink
Add check of curve length
Browse files Browse the repository at this point in the history
  • Loading branch information
xresende committed May 14, 2018
1 parent 915f766 commit 0d9fc9a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions siriuspy/siriuspy/pwrsupply/prucontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from siriuspy.bsmp import BSMP as _BSMP
from siriuspy.bsmp import Response as _Response
from siriuspy.bsmp.exceptions import SerialError as _SerialError
from siriuspy.csdevice.pwrsupply import MAX_WFMSIZE as _MAX_WFMSIZE
from siriuspy.csdevice.pwrsupply import DEFAULT_WFMDATA as _DEFAULT_WFMDATA
from siriuspy.pwrsupply.pru import Const as _PRUConst
# from siriuspy.pwrsupply.pru import PRUInterface as _PRUInterface
Expand Down Expand Up @@ -768,6 +769,8 @@ def pru_curve_write(self, device_id, curve):
n, n0 = len(curve), len(self._curves[idx])
if n == 0:
raise ValueError('Invalid empty curve!')
elif n > _MAX_WFMSIZE:
raise ValueError('Curve length exceeds maximum value!')
elif n > n0:
for i in self.device_ids:
# padd wfmdata with current last value
Expand Down

0 comments on commit 0d9fc9a

Please sign in to comment.