Fix bug on LaserDistance generating huge logs

This commit is contained in:
gac-S_Changer
2020-02-04 09:34:53 +01:00
parent 97c1f97e98
commit a4f41d6a0a
4 changed files with 18 additions and 8 deletions
+2 -2
View File
@@ -1,10 +1,10 @@
#Wed Jan 22 08:53:02 CET 2020
#Tue Feb 04 09:33:51 CET 2020
dry_mount_counter=0
room_temperature_enabled=false
pin_offset=0.0
puck_types=true
imaging_enabled=false
dry_timestamp=1.579679582092E9
dry_timestamp=1.580771768364E9
roi_h=1000
led_level=0.0
beamline_status_enabled=false
+2 -2
View File
@@ -1,2 +1,2 @@
#Tue Jan 21 14:03:38 CET 2020
FileSequentialNumber=138
#Mon Feb 03 09:28:54 CET 2020
FileSequentialNumber=149
+1 -1
View File
@@ -1,3 +1,3 @@
#Thu Jun 06 15:40:21 CEST 2019
#Fri Jan 31 16:58:30 CET 2020
detection=Mechanical
disabled=false
+13 -3
View File
@@ -1,17 +1,27 @@
class LaserDistance(ReadonlyRegisterBase):
def __init__(self):
ReadonlyRegisterBase.__init__(self, "laser_distance")
def doRead(self):
ret = ue.readable.read()
ret = 0.0 if math.isnan(ret) else ret
ret = None if ret is None else (0.0 if math.isnan(ret) else ret)
return ret
class ListenerAI (DeviceListener):
def onValueChanged(self, device, value, former):
laser_distance.setCache( 0.0 if math.isnan(value) else value, None)
def onValueChanged(self, device, value, former):
if laser_distance is not None:
value = None if value is None else (0.0 if math.isnan(value) else value)
laser_distance.setCache(value, None)
for l in ue.listeners:
if Nameable.getShortClassName(l.getClass()) == "ListenerAI":
ue.removeListener(l)
listenerAI = ListenerAI()
ue.addListener(listenerAI)
laser_distance=LaserDistance()
add_device(laser_distance, True)
laser_distance.update()