Open GoogleCodeExporter opened 9 years ago
Hello,
attached you will find a patch that fixes the problem. The drawback is that the
task parameter now contains the task_handle (an integer) not the task object
itself so you need to fix that in your AI_callback.py.
Maybe it would be a good idea to register a local callback that calls the
callback given by the user, using the task object as parameter and maybe also a
data array.
I also suggest to update the documentation as it was very confusing for me when
I first tried to use this event. I can come up with a patch for that but I
would like to know other opinions about the local callback part.
I guess that the done_event and signal_event have the same problem which can be
fixed the same way, but I haven't tested this.
Best wishes,
Tobias
Original comment by m...@tobiasgehring.de
on 29 Aug 2010 at 1:33
Attachments:
I 'fixed' this - although it is probably not fully thread-safe. The callback
function now gets:
* a Task object from the Task cache, so no new Tasks are created in the callback
* the data retrieved from the DAQ card (instead of the number of samples).
It's a breaking API change, though, I guess. A more simple patch would not add
the data as a parameter, which won't break the API.
Original comment by valhall...@gmail.com
on 24 Feb 2011 at 1:43
Attachments:
I tried to fix this problem for DigitalInputTask.register_signal_event... (I'm running python 3.5 and using the port_to_py3_testStage branch, and I see no evidence that the problem is related to that.) First, I changed the register_every_n_samples_event function by hand, according to nidaq.diff from valhall...@gmail.com on 24 Feb 2011. I did this to understand the pattern, and then I applied it (as best I could) to the register_signal_event function.
When I run the code, registration works, but when the callback fires, the following error results: Traceback (most recent call last): File "_ctypes/callbacks.c", line 234, in 'calling callback function' TypeError: fwrapper() missing 1 required positional argument: 'cb_data' ...and the error keeps repeating every time the signal event occurs.
This is tantalizing and looks hopeful, but I have no prior experience with ctypes, and I'm running out of time on my job to get this working. The diff file is attached (I had to append .txt, since this web site wouldn't accept.
If I can't fix it, then I'll have to use the corresponding (lower-level) functions provided by https://github.com/clade/PyDAQmx, which I'd prefer to avoid.
If anyone can help, I'd appreciate any suggestions or comments.
Thanks. -Peter nidaqmx.diff.txt
Original issue reported on code.google.com by
liujiny...@gmail.com
on 28 Apr 2010 at 8:37Attachments: