Source code for device_client.client_trap_cathode
from device_client import DeviceClient
from device.trap_cathode import TrapCathodeHeater
description = """
#### Basic usage
1. Make sure the manual switch is on (at the back of the heater box). Note that
the LED display is on regardless of the manual switch.
2. Initiate homing sequence, button **Homing**.
3. Set output power by moving the motor (0-30A) and turn on **Heating output**.
"""
[docs]
def connect(name, password, server, serial):
client = DeviceClient(name, password,
title="Trap: Cathode Heater", description=description)
hw = TrapCathodeHeater(
"./configurations/calib_trap.cfg",
bus=serial,
# limits_enabled=False, # Do not use software limits from .cfg file
log_callback=client.emit_log,
)
client.register_command(hw.stop, "Stop")
client.register_command(hw.homing, "Homing")
client.register_command(hw.set_current, "Set current",
inputs=[{"unit": "A"}])
# client.register_command(hw.moveto, "Move motor to",
# inputs=[{"unit": "mm"}])
def set_output_switch(enabled):
hw.switch_output_on() if enabled else hw.switch_output_off()
client.emit_command_state("set_output_switch", [enabled])
client.register_command(set_output_switch, "Heating output", inputs=[{"type": "toggle"}])
client.register_background_task(hw.update_frontend)
client.keep_server_updated(
check_readiness=hw.is_ready,
check_readiness_interval=0.2,
server_address=server,
retry_on_error=True
)