Closedown

This commit is contained in:
sfop
2016-07-05 16:36:41 +02:00
parent 90d95473c5
commit aff0bfbb84

View File

@@ -1,3 +1,6 @@
import ch.psi.pshell.device.DeviceBase as DeviceBase
from startup import *
class CamTool(DeviceBase):
def __init__(self, name, prefix = "cam:", latch = False):
DeviceBase.__init__(self, name)
@@ -43,10 +46,10 @@ class CamTool(DeviceBase):
while(timestamp == self.timestamp.read()):
time.sleep(0.001)
def enable_bg(self, value):
def enableBackground(self, value):
self.cam_bg_en.write(1 if value else 0)
def capture_bg(self, images):
def captureBackground(self, images):
self.start()
self.cam_bg_capture.write(images)
sleep(0.1)
@@ -57,16 +60,33 @@ class CamTool(DeviceBase):
#while( self.cam_bg_capture_remain.read() > 0):
# self.capture()
self.doInitialize()
def doClose(self):
self.cam_run.close()
self.cam_latch.close()
self.timestamp.close()
self.cam_x.close()
self.cam_y.close()
self.profile_x.close()
self.profile_y.close()
self.cam_image.close()
self.cam_image_shape.close()
self.cam_bg_image.close()
self.cam_bg_en.close()
self.cam_bg_capture.close()
self.cam_bg_capture_remain.close()
#if __name__ == "__builtin__":
camera_tool = CamTool("camtool")
camera_tool.capture()
print camera_tool.cam_x.read(), camera_tool.cam_y.read()
if __name__ == "__builtin__":
camera_tool = CamTool("camtool")
camera_tool.enable_bg(True)
camera_tool.enable_bg(False)
camera_tool.enableBackground(False)
camera_tool.enableBackground(True)
camera_tool.captureBackground(5)
camera_tool.capture_bg(5)
add_device(camera_tool, True)
camera_tool.capture()
print camera_tool.cam_x.read(), camera_tool.cam_y.read()
add_device(camera_tool, True)