@@ -56,7 +56,6 @@ def __init__(self, seq: SeqBlock, name="") -> None:
56
56
self .name = name
57
57
58
58
async def prepare (self , value : ScanSpecInfo ):
59
- await self .seq .prescale_units .set (TimeUnits .us )
60
59
await self .seq .enable .set (BitMux .zero )
61
60
path = Path (value .spec .calculate ())
62
61
chunk = path .consume ()
@@ -65,26 +64,31 @@ async def prepare(self, value: ScanSpecInfo):
65
64
gaps = np .delete (gaps , 0 )
66
65
scan_size = len (chunk )
67
66
68
- fast_axis = chunk .axes ()[len (chunk .axes ()) - 2 ]
69
67
gaps = np .append (gaps , scan_size )
68
+ fast_axis = chunk .axes ()[len (chunk .axes ()) - 2 ]
69
+ # Get the resolution from the PandA Encoder?
70
+ resolution = await fast_axis .encoder_res .get_value ()
70
71
start = 0
71
72
# Wait for GPIO to go low
72
73
rows = SeqTable .row (trigger = SeqTrigger .BITA_0 )
73
74
for gap in gaps :
74
75
# Wait for GPIO to go high
75
76
rows += SeqTable .row (trigger = SeqTrigger .BITA_1 )
76
77
# Wait for position
77
- if chunk .midpoints [fast_axis ][gap - 1 ] > chunk .midpoints [fast_axis ][start ]:
78
+ if (
79
+ chunk .midpoints [fast_axis ][gap - 1 ] * resolution
80
+ > chunk .midpoints [fast_axis ][start ] * resolution
81
+ ):
78
82
trig = SeqTrigger .POSA_GT
79
- dir = False
83
+ dir = False if resolution > 0 else True
80
84
81
85
else :
82
86
trig = SeqTrigger .POSA_LT
83
- dir = True
87
+ dir = True if resolution > 0 else False
84
88
rows += SeqTable .row (
85
89
trigger = trig ,
86
90
position = int (
87
- chunk .lower [fast_axis ][start ]
91
+ chunk .midpoints [fast_axis ][start ]
88
92
/ await fast_axis .encoder_res .get_value ()
89
93
),
90
94
)
@@ -98,15 +102,16 @@ async def prepare(self, value: ScanSpecInfo):
98
102
outa1 = True ,
99
103
outb1 = dir ,
100
104
outa2 = False ,
101
- outb2 = False ,
105
+ outb2 = dir ,
102
106
)
103
107
104
108
# Wait for GPIO to go low
105
109
rows += SeqTable .row (trigger = SeqTrigger .BITA_0 )
106
110
107
111
start = gap
108
112
await asyncio .gather (
109
- self .seq .prescale .set (0 ),
113
+ self .seq .prescale .set (1.0 ),
114
+ self .seq .prescale_units .set (TimeUnits .us ),
110
115
self .seq .repeats .set (1 ),
111
116
self .seq .table .set (rows ),
112
117
)
0 commit comments