[ create a new paste ] login | about

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

Plain Text, pasted on Aug 20:
# 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 not zero_out_g55_offset:
        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

    if zero_out_g55_offset:
        print >>sys.stderr, "After sleep"
        if ok_for_mdi():
            print >>sys.stderr, "Ok for MDI"
            c.wait_complete()
            # clear G55 offset
            commands.clear_offset(num="2")
            zero_out_g55_offset=True
    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, "isHomed = %s " % isHomed
    return not s.estop and s.enabled and s.homed and (s.interp_state == linuxcnc.INTERP_IDLE)


Create a new paste based on this one


Comments: