[ create a new paste ] login | about

Link: http://codepad.org/QoC4hIRq    [ raw code | fork ]

Plain Text, pasted on Aug 21:
# placeholder function for LivePlotter.update():
zero_out_g55_offset=True
def user_live_update():
    global zero_out_g55_offset
    # print >>sys.stderr, "zero_out_g55_offset = %s" % zero_out_g55_offset

    if zero_out_g55_offset:
        # mdi_ok = ok_for_mdi()
        # print >>sys.stderr, "mdi_ok: %s" % mdi_ok
        if ok_for_mdi():
        # if mdi_ok:
            print >>sys.stderr, "Ok for MDI"
            # c.wait_complete()
            # clear G55 offset
            # commands.clear_offset(num="2")
            commands.clear_offset("2")
            zero_out_g55_offset=False
    # if not zero_out_g55_offset:
    else:
        isHomed=True
        for i,h in enumerate(s.homed):
            # print >>sys.stderr, "home status: i = %s : h = %s" % (i,h)
            if s.axis_mask & (1<<i):
                isHomed=isHomed and h
            # print >>sys.stderr, "isHomed = %s" % isHomed
        if not isHomed:
            zero_out_g55_offset=True
            print >>sys.stderr, "zero_out_g55_offset = %s" % zero_out_g55_offset

    pass

def ok_for_mdi():
    # print >>sys.stderr, "in ok_for_mdi"
    isHomed=True
    for i,h in enumerate(s.homed):
        # print >>sys.stderr, "home status: i = %s : h = %s" % (i,h)
        if s.axis_mask & (1<<i):
            isHomed=isHomed and h
    # print >>sys.stderr, "s.estop        = %s " % s.estop
    # print >>sys.stderr, "isHomed        = %s " % isHomed
    # print >>sys.stderr, "s.enabled      = %s " % s.enabled
    # # print >>sys.stderr, "s.homed        = %d " % s.homed
    # print >>sys.stderr, "s.interp_state = %s " % (s.interp_state == linuxcnc.INTERP_IDLE)
    return not s.estop and isHomed and s.enabled and s.homed and (s.interp_state == linuxcnc.INTERP_IDLE)


Create a new paste based on this one


Comments: