Beispiel #1
0
def rt_moved(trigger):
    global zr_pressed
    if trigger.value >= trigger_threshold:
        if not zr_pressed:
            zr_pressed = True
            asyncio.ensure_future(button_press(controller_state, 'zr'),
                                  loop=loop)
    else:
        if zr_pressed:
            zr_pressed = False
            asyncio.ensure_future(button_release(controller_state, 'zr'),
                                  loop=loop)
Beispiel #2
0
def hat_moved(hat):
    if hat.x == -1:
        asyncio.ensure_future(button_press(controller_state, 'left'),
                              loop=loop)
    elif hat.x == 1:
        asyncio.ensure_future(button_press(controller_state, 'right'),
                              loop=loop)
    else:
        asyncio.ensure_future(button_release(controller_state, 'left'),
                              loop=loop)
        asyncio.ensure_future(button_release(controller_state, 'right'),
                              loop=loop)
    if hat.y == -1:
        asyncio.ensure_future(button_press(controller_state, 'down'),
                              loop=loop)
    elif hat.y == 1:
        asyncio.ensure_future(button_press(controller_state, 'up'), loop=loop)
    else:
        asyncio.ensure_future(button_release(controller_state, 'down'),
                              loop=loop)
        asyncio.ensure_future(button_release(controller_state, 'up'),
                              loop=loop)
Beispiel #3
0
def minus_pressed(button):
    asyncio.ensure_future(button_press(controller_state, 'minus'), loop=loop)
Beispiel #4
0
def home_pressed(button):
    asyncio.ensure_future(button_press(controller_state, 'home'), loop=loop)
Beispiel #5
0
def rs_pressed(button):
    asyncio.ensure_future(button_press(controller_state, 'r_stick'), loop=loop)