def jump(distance): ''' 跳跃一定的距离 ''' if ai.get_result_len() >= 10: # 需采集10条样本以上 k, b, v = ai.computing_k_b_v(distance) press_time = distance * k[0] + b print('Y = {k} * X + {b}'.format(k=k[0], b=b)) else: press_time = distance * press_coefficient press_time = max(press_time, 200) # 设置 200ms 是最小的按压时间 press_time = int(press_time) cmd = 'shell input swipe {x1} {y1} {x2} {y2} {duration}'.format( x1=swipe_x1, y1=swipe_y1, x2=swipe_x2, y2=swipe_y2, duration=press_time) print('{}'.format(cmd)) adb.run(cmd) return press_time
def jump(distance): ''' 跳跃一定的距离 ''' if ai.get_result_len() >= 10: # 需采集10条样本以上 k, b, v = ai.computing_k_b_v(distance) press_time = distance * k[0] + b print('Y = {k} * X + {b}'.format(k=k[0], b=b)) else: press_time = distance * press_coefficient press_time = max(press_time, 200) # 设置 200ms 是最小的按压时间 press_time = int(press_time) cmd = 'shell input swipe {x1} {y1} {x2} {y2} {duration}'.format( x1=swipe_x1, y1=swipe_y1, x2=swipe_x2, y2=swipe_y2, duration=press_time ) print('{}'.format(cmd)) adb.run(cmd) return press_time