Skip to content

Commit 53ced48

Browse files
committed
Wait for SWIR and TEC init completion before enabling TEC
1 parent fb7498a commit 53ced48

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

hypernets/open_sequence.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,21 @@ def run_sequence_file(sequence_file, instrument_port, instrument_br, # noqa C901
241241
# TEC consumes 5x more current + does it for longer.
242242
if swir_is_requested:
243243
try:
244+
# make sure SWIR+TEC have finished init
245+
for i in range(retry_count := 5):
246+
if instrument_instance.hw_info.swir_module_available and \
247+
instrument_instance.hw_info.swir_pixel_count != 0 and \
248+
instrument_instance.hw_info.swir_tec_module_available:
249+
break
250+
else:
251+
if i < retry_count:
252+
debug("SWIR+TEC hardware initialisation is not completed, retrying in 5 seconds")
253+
sleep(5)
254+
instrument_instance.get_hw_info()
255+
else:
256+
error("SWIR+TEC hardware not available")
257+
exit(27)
258+
244259
info(f"Cooling SWIR module to {instrument_swir_tec}°C...")
245260
instrument_instance.set_SWIR_module_temperature(instrument_swir_tec)
246261
info("Done!")

0 commit comments

Comments
 (0)