Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions notebooks/test_multiple_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
interface.txdevice.demo_tx7332(device_index)

print("Starting Trigger...")
if interface.txdevice.start_trigger():
if interface.start_sonication():
print("Trigger Running Press enter to STOP:")
input() # Wait for the user to press Enter
if interface.txdevice.stop_trigger():
if interface.stop_sonication():
print("Trigger stopped successfully.")
else:
print("Failed to stop trigger.")
Expand Down
8 changes: 4 additions & 4 deletions notebooks/test_nucleo.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
print("Failed to get current trigger setting.")

print("Starting Trigger with current setting...")
if interface.txdevice.start_trigger():
if interface.start_sonication():
print("Trigger Running Press enter to STOP:")
input() # Wait for the user to press Enter
if interface.txdevice.stop_trigger():
if interface.stop_sonication():
print("Trigger stopped successfully.")
else:
print("Failed to stop trigger.")
Expand All @@ -84,10 +84,10 @@
print("Failed to set trigger setting.")

print("Starting Trigger with updated setting...")
if interface.txdevice.start_trigger():
if interface.start_sonication():
print("Trigger Running Press enter to STOP:")
input() # Wait for the user to press Enter
if interface.txdevice.stop_trigger():
if interface.stop_sonication():
print("Trigger stopped successfully.")
else:
print("Failed to stop trigger.")
Expand Down
6 changes: 3 additions & 3 deletions notebooks/test_thermal_stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
log_interval = 1 # seconds; you can adjust this variable as needed

frequency_kHz = 400 # Frequency in kHz
voltage = 50.0 # Voltage in Volts
voltage = 10.0 # Voltage in Volts
duration_msec = 5 # Pulse Duration in milliseconds
interval_msec = 100 # Pulse Repetition Interval in milliseconds
num_modules = 1 # Number of modules in the system
Expand Down Expand Up @@ -347,7 +347,7 @@ def input_wrapper():
user_input = threading.Thread(target=input_wrapper)

logger.info("Starting Trigger...")
if interface.txdevice.start_trigger():
if interface.start_sonication():
logger.info("Trigger Running...")
logger.info("Press enter to STOP trigger:")

Expand All @@ -370,7 +370,7 @@ def input_wrapper():
user_input.join()

time.sleep(0.5) # Give the logging thread time to finish
if interface.txdevice.stop_trigger():
if interface.stop_sonication():
logger.info("Trigger stopped successfully.")
else:
logger.error("Failed to stop trigger.")
Expand Down
4 changes: 2 additions & 2 deletions notebooks/test_ti_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
print("Press enter to START trigger:")
input() # Wait for the user to press Enter
print("Starting Trigger...")
if interface.txdevice.start_trigger():
if interface.start_sonication():
print("Trigger Running Press enter to STOP:")
input() # Wait for the user to press Enter
if interface.txdevice.stop_trigger():
if interface.stop_sonication():
print("Trigger stopped successfully.")
else:
print("Failed to stop trigger.")
Expand Down
4 changes: 2 additions & 2 deletions notebooks/test_transmitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
print("Press enter to START trigger:")
input() # Wait for the user to press Enter
print("Starting Trigger...")
if interface.txdevice.start_trigger():
if interface.start_sonication():
print("Trigger Running Press enter to STOP:")
input() # Wait for the user to press Enter
if interface.txdevice.stop_trigger():
if interface.stop_sonication():
print("Trigger stopped successfully.")
else:
print("Failed to stop trigger.")
Expand Down
4 changes: 2 additions & 2 deletions notebooks/test_transmitter2.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@
print("Failed to get trigger setting.")

print("Starting Trigger...")
if interface.txdevice.start_trigger():
if interface.start_sonication():
print("Trigger Running Press enter to STOP:")
input() # Wait for the user to press Enter
if interface.txdevice.stop_trigger():
if interface.stop_sonication():
print("Trigger stopped successfully.")
else:
print("Failed to stop trigger.")
Expand Down
12 changes: 2 additions & 10 deletions notebooks/test_updated_if.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,25 +151,17 @@
else:
print("Failed to get trigger setting.")



print("Turn HV ON")
interface.hvcontroller.turn_hv_on()

print("Starting Trigger...")
if interface.txdevice.start_trigger():
if interface.start_sonication():
print("Trigger Running Press enter to STOP:")
input() # Wait for the user to press Enter
if interface.txdevice.stop_trigger():
if interface.stop_sonication():
print("Trigger stopped successfully.")
else:
print("Failed to stop trigger.")
else:
print("Failed to get trigger setting.")

print("Turn HV OFF")
interface.hvcontroller.turn_hv_off()

print("Reset Device:")
# Ask the user for confirmation
user_input = input("Do you want to reset the device? (y/n): ").strip().lower()
Expand Down
4 changes: 2 additions & 2 deletions notebooks/test_watertank.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def input_wrapper():
user_input = threading.Thread(target=input_wrapper)

logger.info("Starting Trigger...")
if interface.txdevice.start_trigger():
if interface.start_sonication(use_external_power_supply):
logger.info("Trigger Running...")
logger.info("Press enter to STOP trigger:")

Expand All @@ -408,7 +408,7 @@ def input_wrapper():
user_input.join()

time.sleep(0.5) # Give the logging thread time to finish
if interface.txdevice.stop_trigger():
if interface.stop_sonication(use_external_power_supply):
logger.info("Trigger stopped successfully.")
else:
logger.error("Failed to stop trigger.")
Expand Down
21 changes: 16 additions & 5 deletions src/openlifu/io/LIFUInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def set_solution(self,

logger.info("%s loaded successfully.", solution_name)

def start_sonication(self) -> bool:
def start_sonication(self, use_external_power_supply:bool=False) -> bool:
"""
Start sonication.

Expand All @@ -292,8 +292,12 @@ def start_sonication(self) -> bool:
if self._test_mode:
return True

logger.info("Turn ON HV")
bHvOn = self.hvcontroller.turn_hv_on()
if not use_external_power_supply:
logger.info("Turn ON HV")
bHvOn = self.hvcontroller.turn_hv_on()
else:
logger.info("Using external power supply, HV will not be turned ON.")
bHvOn = True

if self._async_mode:
self.txdevice.async_mode(True)
Expand Down Expand Up @@ -340,7 +344,7 @@ def get_status(self) -> LIFUInterfaceStatus:

return self.status

def stop_sonication(self) -> bool:
def stop_sonication(self, use_external_power_supply:bool=False) -> bool:
"""
Stop sonication.

Expand All @@ -353,7 +357,14 @@ def stop_sonication(self) -> bool:
logger.info("Stop Sonication")
# Send the solution data to the device
bTriggerOff = self.txdevice.stop_trigger()
bHvOff = self.hvcontroller.turn_hv_off()

if not use_external_power_supply:
logger.info("Turn OFF HV")
bHvOff = self.hvcontroller.turn_hv_off()
else:
logger.info("Using external power supply, HV will not be turned OFF.")
bHvOff = True

if self._async_mode:
self.txdevice.async_mode(False)

Expand Down
Loading