File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,10 @@ def __init__(
206
206
In the range (1..16).
207
207
Ignored if not using CAN-FD.
208
208
209
+ :param bool auto_reset:
210
+ Enable automatic recovery in bus off scenario.
211
+ Resetting the driver takes ~500ms during which
212
+ it will not be responsive.
209
213
"""
210
214
self .m_objPCANBasic = PCANBasic ()
211
215
@@ -276,6 +280,14 @@ def __init__(
276
280
"Ignoring error. PCAN_ALLOW_ERROR_FRAMES is still unsupported by OSX Library PCANUSB v0.10"
277
281
)
278
282
283
+ if kwargs .get ("auto_reset" , False ):
284
+ result = self .m_objPCANBasic .SetValue (
285
+ self .m_PcanHandle , PCAN_BUSOFF_AUTORESET , PCAN_PARAMETER_ON
286
+ )
287
+
288
+ if result != PCAN_ERROR_OK :
289
+ raise PcanCanInitializationError (self ._get_formatted_error (result ))
290
+
279
291
if HAS_EVENTS :
280
292
self ._recv_event = CreateEvent (None , 0 , 0 , None )
281
293
result = self .m_objPCANBasic .SetValue (
You can’t perform that action at this time.
0 commit comments