sim
This commit is contained in:
parent
723e16ae03
commit
f217b185e5
|
|
@ -1,7 +1,7 @@
|
|||
from ctypes import (CFUNCTYPE, POINTER, byref, c_char, c_int32, c_uint8,
|
||||
c_void_p, cast, create_string_buffer, pointer)
|
||||
|
||||
|
||||
from src.components.Automation.BDaq import *
|
||||
buffer = {}
|
||||
|
||||
out_data =[0b00000101,0b00000101]
|
||||
|
|
@ -25,7 +25,7 @@ def InstantDoCtrl_WriteBit(useless, byte, bit, val):
|
|||
b = int(int.from_bytes(val, "big") != 0) << bit
|
||||
buffer[byte] &= 0b11111111 & ~(1 << bit)
|
||||
buffer[byte] |= b
|
||||
return 0
|
||||
return ErrorCode.Success
|
||||
|
||||
|
||||
@CFUNCTYPE(c_void_p)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class USB_586x(Component):
|
|||
def __init__(self, config=None, name=None, period=1, lazy=True, paused=False, threaded=True):
|
||||
super().__init__(config=config, name=name, period=period, lazy=lazy, paused=paused, threaded=threaded)
|
||||
self.mutex = QMutex()
|
||||
|
||||
self.simulate="--sim-io" in sys.argv
|
||||
# DEVICE INFORMATION
|
||||
self.id=config["digital_io"]["id"]
|
||||
if "5860" in self.id:
|
||||
|
|
@ -193,7 +193,7 @@ class USB_586x(Component):
|
|||
max_retry = 3
|
||||
while not ok and retry <max_retry:
|
||||
ret = self.set_bit(byte, bit, val)
|
||||
if ret != ErrorCode.Success:
|
||||
if ret != ErrorCode.Success and not self.simulate:
|
||||
self.log.error(f"SET BIT ERROR")
|
||||
self.open_device()
|
||||
retry+=1
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user