示例#1
0
文件: main.py 项目: derekenos/iome
def _status(request):
    data = {
        'max_position': {
            'x': X_AXIS_MAX,
            'y': Y_AXIS_MAX
        },
        'current_position': {
            'x': x_pos,
            'y': y_pos
        },
    }
    return _200(body=data)
示例#2
0
文件: main.py 项目: derekenos/iome
def _home(request):
    """Force it to the home position by setting x_pos and y_pos to their max
    values, moving to point 0,0, and then back up 20 steps to reach the usable
    region.
    """
    global x_pos
    global y_pos
    x_pos = X_AXIS_MAX
    y_pos = Y_AXIS_MAX
    move_to_point(0, 0)
    move_to_point(20, 20)
    x_pos = 0
    y_pos = 0
    return _200()
示例#3
0
def _status(request):
    uname = os.uname()
    data = {
        'MicroPython': {
            'Release': uname.release,
            'version': uname.version,
            'mem_free': gc.mem_free(),
        },
        'Machine': {
            'Unique ID': hexlify(machine.unique_id()),
            'Frequency (Hz)': machine.freq(),
        }
    }

    return _200(body=data)
示例#4
0
文件: main.py 项目: derekenos/iome
def _demo_svg(request, filename):
    fh = open(filename, 'r')
    render_svg(fh)
    return _200()
示例#5
0
文件: main.py 项目: derekenos/iome
def _multi_step(request, axis, direction, num_steps):
    multi_step(axis, direction, num_steps)
    return _200()
示例#6
0
文件: main.py 项目: derekenos/iome
def _move_to_point(request, x, y):
    move_to_point(x, y)
    return _200()
示例#7
0
文件: main.py 项目: derekenos/iome
def _write(request, text, char_height, char_spacing, word_spacing, x_offset,
           y_offset):
    draw_text(text, char_height, char_spacing, word_spacing, x_offset,
              y_offset)
    return _200()
示例#8
0
文件: main.py 项目: derekenos/iome
def _demo(request):
    draw_text('SKETCHY FOR LIFE', char_height=64, x_offset=0, y_offset=300)
    return _200()
示例#9
0
文件: main.py 项目: derekenos/iome
def _reset(request):
    """Reset the device.
    """
    # Manually send the response prior to calling machine.reset
    send(request.connection, _200())
    machine.reset()
示例#10
0
def _config_GET(request):
    return _200(body=config._config)