Skip to content

Commit 7a826e2

Browse files
Pulling in the changes from the Laser PR
1 parent a5d94fa commit 7a826e2

File tree

1 file changed

+6
-10
lines changed
  • src/navigate/model/devices/laser

1 file changed

+6
-10
lines changed

src/navigate/model/devices/laser/asi.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class ASILaser(LaserBase, SerialDevice):
5656
This class is used to control a laser connected to a ASI Device.
5757
"""
5858

59-
def __init__(self, microscope_name, device_connection, configuration, device_id: 0):
59+
def __init__(self, microscope_name, device_connection, configuration, device_id: int = 0):
6060
"""Initialize the ASILaser class.
6161
6262
Parameters
@@ -162,20 +162,18 @@ def set_power(self, laser_intensity: float):
162162
self.output_voltage = (int(laser_intensity) / 100) * self.laser_max_ao * 1000
163163
if self.output_voltage > (self.laser_max_ao * 1000):
164164
self.output_voltage = self.laser_max_ao * 1000
165-
165+
self.laser.move_axis(self.analog_axis, self.output_voltage)
166166
self._current_intensity = laser_intensity
167167

168168
def turn_on(self):
169169
"""Turns on the laser."""
170170
if self.modulation_type == "mixed":
171171
self.set_power(self._current_intensity)
172-
self.laser.move_axis(self.analog_axis, self.output_voltage)
173172
self.laser.logic_card_on(self.digital_axis)
174173
logger.info(f"{str(self)} initialized with mixed modulation.")
175174

176175
elif self.modulation_type == "analog":
177176
self.set_power(self._current_intensity)
178-
self.laser.move_axis(self.analog_axis, self.output_voltage)
179177
logger.info(f"{str(self)} initialized with analog modulation.")
180178

181179
elif self.modulation_type == "digital":
@@ -186,18 +184,16 @@ def turn_on(self):
186184
def turn_off(self):
187185
"""Turns off the laser."""
188186
if self.modulation_type == "mixed":
189-
# tmp = self._current_intensity
187+
tmp = self._current_intensity
190188
self.set_power(0)
191-
self.laser.move_axis(self.analog_axis, 0)
192-
# self._current_intensity = tmp
189+
self._current_intensity = tmp
193190
self.laser.logic_card_off(self.digital_axis)
194191
logger.info(f"{str(self)} initialized with mixed modulation.")
195192

196193
elif self.modulation_type == "analog":
197-
# tmp = self._current_intensity
194+
tmp = self._current_intensity
198195
self.set_power(0)
199-
self.laser.move_axis(self.analog_axis, 0)
200-
# self._current_intensity = tmp
196+
self._current_intensity = tmp
201197
logger.info(f"{str(self)} initialized with analog modulation.")
202198

203199
elif self.modulation_type == "digital":

0 commit comments

Comments
 (0)