Source code for device_client.client_paschen_motor

from device_client import DeviceClient
from device.paschen_motor import PaschenMotor


description = """
Start by running the **Homing** command. Use **Stop** anytime, including during
homing, to quickly terminate any motion. The position tracking, as seen in
values section, is reliable even after using the **Stop** command.

#### Set distance
Set distance between electrodes by moving the upper electrode.

- *distance* = absolute position in mm, current position can be seen in the
  values section.

#### Relay ON + OFF
Switch on or off device connected to the power outlet (?).

#### Valve OPEN + CLOSE
This device also controls the pumping valve. Typically, the command should be
ignored during the experiment.

#### Ping pong
Test the electrode's motion capabilities.
"""

[docs] def connect(name, password, server): client = DeviceClient(name, password, title="Paschen: Motorized electrodes", description=description) hw = PaschenMotor("/dev/ttyUSB0", 0x01, log_callback=client.emit_log) client.register_command(hw.stop, "Stop") client.register_command(hw.homing, "Homing") client.register_command(hw.set_distance, "Set", inputs=[{"unit": "mm"}]) client.register_command(hw.switch_relay_on, "Relay ON") client.register_command(hw.switch_relay_off, "Relay OFF") client.register_command(hw.open_valve, "Valve OPEN") client.register_command(hw.close_valve, "Valve CLOSE") client.register_command(hw.pingpong, "Ping pong") client.register_background_task(hw.update_frontend) client.keep_server_updated( check_readiness=hw.is_ready, check_readiness_interval=1, server_address=server, retry_on_error=True )