idasen_controller/main.py
async def run_command(client, config):
    """Begin the action specified by command line arguments and config"""
    # Always print current height
    initial_height, speed = struct.unpack("<Hh", await client.read_gatt_char(UUID_HEIGHT))
    print("Height: {:4.0f}mm".format(rawToMM(initial_height)))
    target = None
    if config['monitor']:
        # Print changes to height data
        await subscribe(client, UUID_HEIGHT, print_height_data)
        loop = asyncio.get_event_loop()
        wait = loop.create_future()
        await wait
    elif config['sit']:
        # Move to configured sit height
        target = config['sit_height_raw']
        await move_to(client, target)
    elif config['stand']:
        # Move to configured stand height
        target = config['stand_height_raw']
        await move_to(client, target)
    elif config['move_to']:
        # Move to custom height
        target = config['move_to_raw']
        await move_to(client, target)
    if target:
        # If we were moving to a target height, wait, then print the actual final height
        await asyncio.sleep(1)
        final_height, speed = struct.unpack("<Hh", await client.read_gatt_char(UUID_HEIGHT))
        print("Final height: {:4.0f}mm (Target: {:4.0f}mm)".format(rawToMM(final_height), rawToMM(target)))
Begin the action specified by command line arguments and config
Begin the action specified by command line arguments and config
Begin the action specified by command line arguments and config
async def run_command(client, config):
    initial_height, speed = struct.unpack("<Hh", await client.read_gatt_char(UUID_HEIGHT))
    print("Height: {:4.0f}mm".format(rawToMM(initial_height)))
    target = None
    if config['monitor']:
        await subscribe(client, UUID_HEIGHT, print_height_data)
        loop = asyncio.get_event_loop()
        wait = loop.create_future()
        await wait
    elif config['sit']:
        target = config['sit_height_raw']
        await move_to(client, target)
    elif config['stand']:
        target = config['stand_height_raw']
        await move_to(client, target)
    elif config['move_to']:
        target = config['move_to_raw']
        await move_to(client, target)
    if target:
        await asyncio.sleep(1)
        final_height, speed = struct.unpack("<Hh", await client.read_gatt_char(UUID_HEIGHT))
        print("Final height: {:4.0f}mm (Target: {:4.0f}mm)".format(rawToMM(final_height), rawToMM(target)))
async def run_command ( client , config ) : initial_height , speed = struct . unpack ( "<Hh" , await client . read_gatt_char ( UUID_HEIGHT ) ) print ( "Height: {:4.0f}mm" . format ( rawToMM ( initial_height ) ) ) target = None if config [ 'monitor' ] : await subscribe ( client , UUID_HEIGHT , print_height_data ) loop = asyncio . get_event_loop ( ) wait = loop . create_future ( ) await wait elif config [ 'sit' ] : target = config [ 'sit_height_raw' ] await move_to ( client , target ) elif config [ 'stand' ] : target = config [ 'stand_height_raw' ] await move_to ( client , target ) elif config [ 'move_to' ] : target = config [ 'move_to_raw' ] await move_to ( client , target ) if target : await asyncio . sleep ( 1 ) final_height , speed = struct . unpack ( "<Hh" , await client . read_gatt_char ( UUID_HEIGHT ) ) print ( "Final height: {:4.0f}mm (Target: {:4.0f}mm)" . format ( rawToMM ( final_height ) , rawToMM ( target ) ) )
Begin the action specified by command line arguments and config
Begin the action specified by command line arguments and config
"""Begin the action specified by command line arguments and config""" # Always print current height # Print changes to height data # Move to configured sit height # Move to configured stand height # Move to custom height # If we were moving to a target height, wait, then print the actual final height
client
config