frappy_psi.ls370res: add TemperatureChannel
Change-Id: I5a0fd6a1352f08583393862718f59ee5fb6eee32
This commit is contained in:
@@ -34,6 +34,8 @@ from frappy.lib import formatStatusBits
|
|||||||
from frappy.core import Done, Drivable, Parameter, Property, CommonReadHandler, CommonWriteHandler
|
from frappy.core import Done, Drivable, Parameter, Property, CommonReadHandler, CommonWriteHandler
|
||||||
from frappy.io import HasIO
|
from frappy.io import HasIO
|
||||||
from frappy_psi.channelswitcher import Channel, ChannelSwitcher
|
from frappy_psi.channelswitcher import Channel, ChannelSwitcher
|
||||||
|
from frappy_psi.picontrol import HasConvergence
|
||||||
|
|
||||||
|
|
||||||
Status = Drivable.Status
|
Status = Drivable.Status
|
||||||
|
|
||||||
@@ -209,6 +211,7 @@ class ResChannel(LakeShoreIO, Channel):
|
|||||||
_last_range_change = 0
|
_last_range_change = 0
|
||||||
rdgrng_params = 'range', 'iexc', 'vexc'
|
rdgrng_params = 'range', 'iexc', 'vexc'
|
||||||
inset_params = 'enabled', 'pause', 'dwell'
|
inset_params = 'enabled', 'pause', 'dwell'
|
||||||
|
STATUS_MASK = 0x37
|
||||||
|
|
||||||
def initModule(self):
|
def initModule(self):
|
||||||
# take io from switcher
|
# take io from switcher
|
||||||
@@ -222,7 +225,7 @@ class ResChannel(LakeShoreIO, Channel):
|
|||||||
if not self.channel == self.switcher.value == self.switcher.target:
|
if not self.channel == self.switcher.value == self.switcher.target:
|
||||||
return Done
|
return Done
|
||||||
result = self.get_param(f'RDGST?{self.channel}')
|
result = self.get_param(f'RDGST?{self.channel}')
|
||||||
result &= 0x37 # mask T_OVER and T_UNDER (change this when implementing temperatures instead of resistances)
|
result &= self.STATUS_MASK # mask T_OVER and T_UNDER
|
||||||
statustext = ' '.join(formatStatusBits(result, STATUS_BIT_LABELS))
|
statustext = ' '.join(formatStatusBits(result, STATUS_BIT_LABELS))
|
||||||
if statustext:
|
if statustext:
|
||||||
return [self.Status.ERROR, statustext]
|
return [self.Status.ERROR, statustext]
|
||||||
@@ -344,3 +347,19 @@ class ResChannel(LakeShoreIO, Channel):
|
|||||||
if not on:
|
if not on:
|
||||||
settle = 0
|
settle = 0
|
||||||
return settle
|
return settle
|
||||||
|
|
||||||
|
|
||||||
|
class TemperatureChannel(ResChannel):
|
||||||
|
raw = Parameter('raw resistance value', FloatRange(unit='Ohm'))
|
||||||
|
value = Parameter('temperature sensor', FloatRange(0, unit='K'))
|
||||||
|
STATUS_MASK = 0xff # accept T_OVER and T_UNDER
|
||||||
|
|
||||||
|
def read_raw(self):
|
||||||
|
if self.channel == self.switcher.value == self.switcher.target:
|
||||||
|
return self._read_value() or self.raw
|
||||||
|
return self.raw or 0
|
||||||
|
|
||||||
|
def read_value(self):
|
||||||
|
if self.channel == self.switcher.value == self.switcher.target:
|
||||||
|
return float(self.communicate('RDGK?%d' % self.channel))
|
||||||
|
return self.value if self.enabled else 0
|
||||||
|
|||||||
Reference in New Issue
Block a user