allow skipping of pause command
This commit is contained in:
parent
2cbd4b66e2
commit
9400432771
|
|
@ -42,14 +42,15 @@ with open(args.output, "w") as f:
|
|||
sys.exit("pitch goes from c3 to b5")
|
||||
duration = int(duration)
|
||||
pause = int(pause)
|
||||
if duration < 1 or pause < 0:
|
||||
if duration < 1 or pause < -1:
|
||||
sys.exit("duration/pause are integer multiples of 1/16th beat")
|
||||
feedrate = int(frequency * 60 / args.steps_per_mm)
|
||||
length = duration * base_duration / 60 * feedrate
|
||||
position += -length if position > 100 else length
|
||||
if position < 0 or position > 200:
|
||||
sys.exit("does not fit in 200x200")
|
||||
pause_ms = int(pause * base_duration)
|
||||
f.write(f"G0 X{position:.6f} Y{position:.6f} F{feedrate}\n")
|
||||
f.write(f"G4 P{pause_ms}\n")
|
||||
if pause != 1:
|
||||
pause_ms = int(pause * base_duration)
|
||||
f.write(f"G4 P{pause_ms}\n")
|
||||
f.write("G4 S2 ; wait 2 seconds\n")
|
||||
|
|
|
|||
Loading…
Reference in a new issue