예제 #1
0
def update_2(*args):
    global pos_last
    global sp_last
    global run_last
    global dat
    r=run.get()
    sp=speed.get()
    pos=position.get()
    if sp!=sp_last or pos!=pos_last or r!=run_last:
        sp_last=sp
        pos_last=pos
        run_last=r
        if r==True:
            dat=[3, (pos>>8)&0xff, (pos&0xff), (sp&0xff)]
            reply=ff32.readSPI(4, dat)
            current.set(int(reply[0]<<8|reply[1]))
    elif real_current != pos and r==True:
        query()
    window.after(150, update_2)
예제 #2
0
def query(*args):
    global real_current
    reply=ff32.readSPI(4, dat)
    real_current=int(reply[0]<<8|reply[1])
    current.set(real_current)