SFELPHOTON-1650:shapepath.py: stop-and-go struggeled with sync for first 3 measurements

This commit is contained in:
2025-04-04 17:25:47 +02:00
parent cef16196bb
commit 6e391c1f81
2 changed files with 134 additions and 7 deletions

View File

@@ -960,6 +960,9 @@ class ShapePath(MotionBase):
twait_=round((tmove+twait)/fel_per)*fel_per-tmove
if twait!=twait_:
_log.warning(f'adjust twait({twait}) to {twait_} to match multiple of fel-cycles')
# syncPlc:
# Sys.Udata[0] 0->1 'fast counter: counter up ech pluse from 0 to pt2tp_felpulse
# Sys.Udata[0] 0->1 'slow counter: increments by one after 'pt2tp_felpulse' pulses
syncPlc=f'''\
close all buffers
disable plc 2
@@ -981,6 +984,15 @@ enable plc 2
if comm: comm.gpascii.send_block(syncPlc, verb&0x08)
prg+=f'''\
//mode 5: grid pvt motion
//Sys.Udata[0] fast counter
//Sys.Udata[1] slow counter
//Sys.Udata[2] last slow counter value
while(Coord[1].DesTimeBase==0){{}}
Sys.Udata[0]=0 // resets fast counter
Sys.Udata[1]=0 // resets slow counter
Sys.Udata[2]=0
while(Sys.Udata[2]==Sys.Udata[1]){{}} //initial wait
Sys.Udata[2]=Sys.Udata[1] //save last slow counter value
pvt{tmove} abs
L1=0 //slow loop x
L0=0 //fast loop y