auf die harte tour gelernt...

This commit is contained in:
chrissy 2026-05-18 18:31:05 +02:00
parent 368b2fb2e4
commit 1fd112b036
1 changed files with 39 additions and 35 deletions

View File

@ -170,46 +170,50 @@ def main():
datadict = {}
ser.write(str.encode(f"G1 Z{z_search} F{feedrate}\r\n"))
try:
for y in np.linspace(args.ystart, args.yend, args.ypts,endpoint=True):
if y >= max_y:
break
else:
ser.write(str.encode(f"G1 X{args.xstart+prboffs_x} Y{y+prboffs_y} F{feedrate}\r\n"))
time.sleep(2)
for x in np.linspace(args.xstart, args.xend, args.xpts, endpoint=True):
if x >= max_x:
for y in np.linspace(args.ystart, args.yend, args.ypts,endpoint=True):
if y >= max_y:
break
else:
ser.write(str.encode(f"G1 X{x+prboffs_x} Z{z_search} F{feedrate}\r\n"))
time.sleep(1)
ser.write(str.encode(f"G1 Z{min_z} F{feedrate}\r\n"))
ser.write(str.encode("M18 \r\n")) # disable steppers
ser.write(str.encode(f"G1 X{args.xstart+prboffs_x} Y{y+prboffs_y} F{feedrate}\r\n"))
time.sleep(2)
tsa.resume() # scan
data_bytes = tsa.scan(args.fstart, args.fstop, args.pts, 2)
tsa.wait
time.sleep(2)
ser.write(str.encode("M17 X Y Z\r\n")) # enable steppers
ser.write(str.encode(f"G1 Z{z_search} F{feedrate}\r\n"))
freq_arr, data_arr = convert_data_to_arrays(
args.fstart, args.fstop, args.pts, data_bytes
)
datadict[(x, y)] = data_arr
time.sleep(1)
progress+=1
b.update(progress + 1)
b.finish()
writeCSV(
freq_arr,
datadict,
f'{now.strftime("%Y-%m-%d_%H%M")}_{args.out}.csv',
args,
)
tsa.resume() # resume so screen isn't still frozen
tsa.disconnect()
for x in np.linspace(args.xstart, args.xend, args.xpts, endpoint=True):
if x >= max_x:
break
else:
ser.write(str.encode(f"G1 X{x+prboffs_x} Z{z_search} F{feedrate}\r\n"))
time.sleep(1)
ser.write(str.encode(f"G1 Z{min_z} F{feedrate}\r\n"))
ser.write(str.encode("M18 \r\n")) # disable steppers
time.sleep(2)
tsa.resume() # scan
data_bytes = tsa.scan(args.fstart, args.fstop, args.pts, 2)
tsa.wait
time.sleep(2)
ser.write(str.encode("M17 X Y Z\r\n")) # enable steppers
ser.write(str.encode(f"G1 Z{z_search} F{feedrate}\r\n"))
freq_arr, data_arr = convert_data_to_arrays(
args.fstart, args.fstop, args.pts, data_bytes
)
datadict[(x, y)] = data_arr
time.sleep(1)
progress+=1
b.update(progress)
except:
pass
finally:
b.finish()
writeCSV(
freq_arr,
datadict,
f'{now.strftime("%Y-%m-%d_%H%M")}_{args.out}.csv',
args,
)
tsa.resume() # resume so screen isn't still frozen
tsa.disconnect()
if __name__ == "__main__":