Maximum lateral range and minimum autofocus range

This commit is contained in:
jaknapper 2024-01-11 20:38:47 +00:00
parent e611840aca
commit c4e02d9087

View file

@ -385,6 +385,11 @@ class SmartScanThing(Thing):
# It's annoying to have to wait to find out! # It's annoying to have to wait to find out!
max_dist = self.max_range max_dist = self.max_range
if self.autofocus_dz == 0:
logger.info(f'Running scan without autofocus')
elif self.autofocus_dz <= 200:
logger.warning(f'Your dz range is {self.autofocus_dz} steps, which is too short to attempt to focus. Running without autofocus')
if self.skip_background: if self.skip_background:
d = background_detect.background_distributions d = background_detect.background_distributions
if not d: if not d:
@ -489,6 +494,7 @@ class SmartScanThing(Thing):
path.append(pos) path.append(pos)
attempts = 0 attempts = 0
if self.autofocus_dz > 200:
while True: while True:
recentre.looping_autofocus(dz=self.autofocus_dz) recentre.looping_autofocus(dz=self.autofocus_dz)
current_height = stage.position["z"] current_height = stage.position["z"]
@ -524,6 +530,7 @@ class SmartScanThing(Thing):
stage.move_absolute(z=int(focused_path[z_index][2])) stage.move_absolute(z=int(focused_path[z_index][2]))
attempts += 1 attempts += 1
name = f"image_{loc[0]}_{loc[1]}.jpg" name = f"image_{loc[0]}_{loc[1]}.jpg"
# img = Image.open(cam.capture_jpeg(resolution="full").open()) # img = Image.open(cam.capture_jpeg(resolution="full").open())
jpegblob = cam.capture_jpeg(resolution="full") jpegblob = cam.capture_jpeg(resolution="full")
@ -607,7 +614,7 @@ class SmartScanThing(Thing):
@thing_property @thing_property
def max_range(self) -> int: def max_range(self) -> int:
"""The maximum distance from the centre of the scan before we break""" """The maximum distance from the centre of the scan before we break"""
return self.thing_settings.get("max_range", 400000) return self.thing_settings.get("max_range", 70000)
@max_range.setter @max_range.setter
def max_range(self, value: int) -> None: def max_range(self, value: int) -> None: