|
6 | 6 | __author__ = "Dennis van Gils" |
7 | 7 | __authoremail__ = "vangils.dennis@gmail.com" |
8 | 8 | __url__ = "https://github.com/Dennis-van-Gils/DvG_Arduino_PyQt_multithread_demo" |
9 | | -__date__ = "24-06-2020" |
| 9 | +__date__ = "01-07-2020" |
10 | 10 | __version__ = "2.1" |
11 | 11 |
|
12 | 12 | import os |
|
26 | 26 | from DvG_pyqt_controls import create_Toggle_button, SS_GROUP |
27 | 27 | from DvG_debug_functions import dprint, print_fancy_traceback as pft |
28 | 28 |
|
29 | | -import DvG_dev_Arduino__fun_serial as Arduino_functions |
30 | | -import DvG_QDeviceIO |
| 29 | +#import DvG_dev_Arduino__fun_serial as Arduino_functions |
| 30 | +from DvG_dev_Arduino__protocol_serial import Arduino # I.e. the `device |
| 31 | +from DvG_dev_Arduino__qdev import Arduino_qdev |
| 32 | +from DvG_QDeviceIO import QDeviceIO |
| 33 | + |
31 | 34 |
|
32 | 35 | # Constants |
33 | 36 | # fmt: off |
@@ -427,7 +430,7 @@ def DAQ_function(): |
427 | 430 | # Connect to Arduino |
428 | 431 | # -------------------------------------------------------------------------- |
429 | 432 |
|
430 | | - ard = Arduino_functions.Arduino(name="Ard", baudrate=115200) |
| 433 | + ard = Arduino(name="Ard", baudrate=115200) |
431 | 434 | ard.auto_connect( |
432 | 435 | Path("last_used_port.txt"), match_identity="Wave generator" |
433 | 436 | ) |
@@ -459,16 +462,30 @@ def DAQ_function(): |
459 | 462 | # Set up multithreaded communication with the Arduino |
460 | 463 | # -------------------------------------------------------------------------- |
461 | 464 |
|
| 465 | + """ |
| 466 | + # fmt: off |
| 467 | + qdev_ard = Arduino_qdev( |
| 468 | + dev = ard, |
| 469 | + DAQ_function = DAQ_function, |
| 470 | + DAQ_interval_ms = DAQ_INTERVAL_ARDUINO, |
| 471 | + critical_not_alive_count = 3, |
| 472 | + calc_DAQ_rate_every_N_iter=100, |
| 473 | + debug = DEBUG, |
| 474 | + ) |
| 475 | + """ |
| 476 | + # fmt: on |
| 477 | + |
462 | 478 | # Create QDeviceIO |
463 | | - qdev_ard = DvG_QDeviceIO.QDeviceIO(ard) |
| 479 | + qdev_ard = QDeviceIO(ard) |
464 | 480 |
|
465 | 481 | # Create workers |
466 | 482 | # fmt: off |
467 | 483 | qdev_ard.create_worker_DAQ( |
468 | 484 | DAQ_function = DAQ_function, |
469 | 485 | DAQ_interval_ms = DAQ_INTERVAL_ARDUINO, |
470 | 486 | critical_not_alive_count = 3, |
471 | | - debug = DEBUG,) |
| 487 | + debug = DEBUG, |
| 488 | + ) |
472 | 489 | # fmt: on |
473 | 490 |
|
474 | 491 | qdev_ard.create_worker_jobs(debug=DEBUG) |
|
0 commit comments