@@ -83,6 +83,7 @@ async def set_serial_number(self, sn: str) -> bool:
83
83
self ._sn = sn
84
84
return True
85
85
86
+ @ensure_yield
86
87
async def enable_motors (self , axis : List [StackerAxis ]) -> bool :
87
88
"""Enables the axis motor if present, disables it otherwise."""
88
89
return True
@@ -92,26 +93,31 @@ async def stop_motors(self) -> bool:
92
93
"""Stop all motor movement."""
93
94
return True
94
95
96
+ @ensure_yield
95
97
async def set_run_current (self , axis : StackerAxis , current : float ) -> bool :
96
98
"""Set axis peak run current in amps."""
97
99
98
100
return True
99
101
102
+ @ensure_yield
100
103
async def set_ihold_current (self , axis : StackerAxis , current : float ) -> bool :
101
104
"""Set axis hold current in amps."""
102
105
return True
103
106
107
+ @ensure_yield
104
108
async def set_stallguard_threshold (
105
109
self , axis : StackerAxis , enable : bool , threshold : int
106
110
) -> bool :
107
111
"""Enables and sets the stallguard threshold for the given axis motor."""
108
112
self ._stallgard_threshold [axis ] = StallGuardParams (axis , enable , threshold )
109
113
return True
110
114
115
+ @ensure_yield
111
116
async def enable_tof_sensor (self , sensor : TOFSensor , enable : bool ) -> bool :
112
117
"""Enable or disable the TOF sensor."""
113
118
return True
114
119
120
+ @ensure_yield
115
121
async def manage_tof_measurement (
116
122
self ,
117
123
sensor : TOFSensor ,
@@ -129,6 +135,7 @@ async def manage_tof_measurement(
129
135
total_bytes = 3840 if start else 0 ,
130
136
)
131
137
138
+ @ensure_yield
132
139
async def get_tof_histogram (self , sensor : TOFSensor ) -> TOFMeasurementResult :
133
140
"""Get the full histogram measurement from the TOF sensor."""
134
141
return TOFMeasurementResult (
@@ -137,28 +144,33 @@ async def get_tof_histogram(self, sensor: TOFSensor) -> TOFMeasurementResult:
137
144
bins = {c : [b for b in range (NUMBER_OF_BINS )] for c in range (10 )},
138
145
)
139
146
147
+ @ensure_yield
140
148
async def set_motor_driver_register (
141
149
self , axis : StackerAxis , reg : int , value : int
142
150
) -> bool :
143
151
"""Set the register of the given motor axis driver to the given value."""
144
152
self ._motor_registers [axis ].update ({reg : value })
145
153
return True
146
154
155
+ @ensure_yield
147
156
async def get_motor_driver_register (self , axis : StackerAxis , reg : int ) -> int :
148
157
"""Gets the register value of the given motor axis driver."""
149
158
return self ._motor_registers [axis ].get (reg , 0 )
150
159
160
+ @ensure_yield
151
161
async def set_tof_driver_register (
152
162
self , sensor : TOFSensor , reg : int , value : int
153
163
) -> bool :
154
164
"""Set the register of the given tof sensor driver to the given value."""
155
165
self ._tof_registers [sensor ].update ({reg : value })
156
166
return True
157
167
168
+ @ensure_yield
158
169
async def get_tof_driver_register (self , sensor : TOFSensor , reg : int ) -> int :
159
170
"""Gets the register value of the given tof sensor driver."""
160
171
return self ._tof_registers [sensor ].get (reg , 0 )
161
172
173
+ @ensure_yield
162
174
async def get_tof_sensor_status (self , sensor : TOFSensor ) -> TOFSensorStatus :
163
175
"""Get the status of the tof sensor."""
164
176
return TOFSensorStatus (
@@ -168,10 +180,12 @@ async def get_tof_sensor_status(self, sensor: TOFSensor) -> TOFSensorStatus:
168
180
ok = True ,
169
181
)
170
182
183
+ @ensure_yield
171
184
async def get_motion_params (self , axis : StackerAxis ) -> MoveParams :
172
185
"""Get the motion parameters used by the given axis motor."""
173
186
return MoveParams (axis , 1 , 1 , 1 )
174
187
188
+ @ensure_yield
175
189
async def get_stallguard_threshold (self , axis : StackerAxis ) -> StallGuardParams :
176
190
"""Get the stallguard parameters by the given axis motor."""
177
191
return self ._stallgard_threshold [axis ]
@@ -189,13 +203,15 @@ async def get_limit_switches_status(self) -> LimitSwitchStatus:
189
203
"""Get limit switch statuses for all axes."""
190
204
return self ._limit_switch_status
191
205
206
+ @ensure_yield
192
207
async def get_platform_sensor (self , direction : Direction ) -> bool :
193
208
"""Get platform sensor status.
194
209
195
210
:return: True if platform is present, False otherwise
196
211
"""
197
212
return self ._platform_sensor_status .get (direction )
198
213
214
+ @ensure_yield
199
215
async def get_platform_status (self ) -> PlatformStatus :
200
216
"""Get platform status."""
201
217
return self ._platform_sensor_status
@@ -222,10 +238,12 @@ async def move_to_limit_switch(
222
238
"""Move until limit switch is triggered."""
223
239
return MoveResult .NO_ERROR
224
240
241
+ @ensure_yield
225
242
async def home_axis (self , axis : StackerAxis , direction : Direction ) -> MoveResult :
226
243
"""Home axis."""
227
244
return MoveResult .NO_ERROR
228
245
246
+ @ensure_yield
229
247
async def set_led (
230
248
self ,
231
249
power : float ,
@@ -238,6 +256,7 @@ async def set_led(
238
256
"""Set LED Status bar color and pattern."""
239
257
return True
240
258
259
+ @ensure_yield
241
260
async def enter_programming_mode (self ) -> None :
242
261
"""Reboot into programming mode"""
243
262
pass
0 commit comments