Merge branch 'uniax' into wip

Conflicts:
	cfg/uniax.cfg
	secop/core.py
	secop_psi/trinamic.py
This commit is contained in:
2021-09-21 16:52:15 +02:00
11 changed files with 480 additions and 35 deletions

View File

@ -77,7 +77,15 @@ class HwParam(PersistentParam):
class Motor(PersistentMixin, HasIodev, Drivable):
address = Property('module address', IntRange(0, 255), default=1)
<<<<<<< HEAD
value = Parameter('motor position', FloatRange(unit='deg', fmtstr='%.3f'))
=======
# limit_pin_mask = Property('input pin mask for lower/upper limit switch',
# TupleOf(IntRange(0, 15), IntRange(0, 15)),
# default=(8, 0))
value = Parameter('motor position', FloatRange(unit='deg', fmtstr='%.3f'), poll=False, default=0) # polling by read_status
>>>>>>> uniax
zero = PersistentParam('zero point', FloatRange(unit='$'), readonly=False, default=0)
encoder = HwParam('encoder reading', FloatRange(unit='$', fmtstr='%.1f'),
209, ANGLE_SCALE, readonly=True, initwrite=False, persistent=True)
@ -93,7 +101,7 @@ class Motor(PersistentMixin, HasIodev, Drivable):
FloatRange(0, 360., unit='$'),
212, ANGLE_SCALE, readonly=False, group='more')
speed = HwParam('max. speed', FloatRange(0, MAX_SPEED, unit='$/sec'),
4, SPEED_SCALE, readonly=False, group='more')
4, SPEED_SCALE, readonly=False, group='motorparam')
minspeed = HwParam('min. speed', FloatRange(0, MAX_SPEED, unit='$/sec'),
130, SPEED_SCALE, readonly=False, default=SPEED_SCALE, group='motorparam')
currentspeed = HwParam('current speed', FloatRange(-MAX_SPEED, MAX_SPEED, unit='$/sec'),
@ -120,7 +128,8 @@ class Motor(PersistentMixin, HasIodev, Drivable):
iodevClass = BytesIO
fast_pollfactor = 0.001 # poll as fast as possible when busy
# fast_pollfactor = 0.001 # poll as fast as possible when busy
fast_pollfactor = 0.05
_started = 0
_calcTimeout = True
_need_reset = None
@ -218,7 +227,6 @@ class Motor(PersistentMixin, HasIodev, Drivable):
initialized = self.comm(GET_GLOB_PAR, 255, bank=2)
if initialized: # no power loss
self.saveParameters()
print('SAVED', self.persistentData)
else: # just powered up
# get persistent values
writeDict = self.loadParameters()
@ -386,20 +394,21 @@ class Motor(PersistentMixin, HasIodev, Drivable):
def stop(self):
self.comm(MOTOR_STOP, 0)
self.status = self.Status.IDLE, 'stopped'
self.target = self.value # indicate to customers that this was stopped
self._started = 0
@Command()
def step(self):
self.comm(MOVE, 1, FULL_STEP / ANGLE_SCALE)
#@Command()
#def step(self):
# self.comm(MOVE, 1, FULL_STEP / ANGLE_SCALE)
@Command()
def back(self):
self.comm(MOVE, 1, - FULL_STEP / ANGLE_SCALE)
#@Command()
#def back(self):
# self.comm(MOVE, 1, - FULL_STEP / ANGLE_SCALE)
@Command(IntRange(), result=IntRange())
def get_axis_par(self, adr):
return self.comm(GET_AXIS_PAR, adr)
#@Command(IntRange(), result=IntRange())
#def get_axis_par(self, adr):
# return self.comm(GET_AXIS_PAR, adr)
@Command((IntRange(), FloatRange()), result=IntRange())
def set_axis_par(self, adr, value):
return self.comm(SET_AXIS_PAR, adr, value)
#@Command((IntRange(), FloatRange()), result=IntRange())
#def set_axis_par(self, adr, value):
# return self.comm(SET_AXIS_PAR, adr, value)