You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My bleak based application is finally stable and ready and I would like to thank Bleak and especially @dlech for this great cross platform library. The application includes a small PCB that monitors and analyzes stepper motor signals and transmits them in real time to a python app that displays them. https://github.com/zapta/ble_stepper_motor_analyzer
Things I have leaned:
Initially I considered the asyncio as a hassle, and wrapped it with blocking run-until-complete, but later realized that I can actually take advantage of it, performing BLE transactions in the background tasks promises without introducing jitter in the running chart. (asyncio is new to me).
The UI and graphic is provided by pyqtgraph which is a framework with callbacks to my code such that I didn't have control over the main(). To keep the event loop running I used it's timer function to call my handler which is then invokes the event loop to avoid starvation.
For easy distribution I use pyinstaller with onefile mode, which creates fully functional single file executables, including with Bleak.
I am still need to figure out how type declaration work in Python. I hope that if I declare a variable or argument as lets say 'int', I will get an error if trying to assign to it a string, but could make that to work.
In retrospect, I happy with my choice of implementing this cross platform app in Python and I think it's more portable and open to modifications by users this way.
Overall the app is very stable, over long runs, and is reasonable on the CPU usage.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
My bleak based application is finally stable and ready and I would like to thank Bleak and especially @dlech for this great cross platform library. The application includes a small PCB that monitors and analyzes stepper motor signals and transmits them in real time to a python app that displays them. https://github.com/zapta/ble_stepper_motor_analyzer
Things I have leaned:
Initially I considered the asyncio as a hassle, and wrapped it with blocking run-until-complete, but later realized that I can actually take advantage of it, performing BLE transactions in the background tasks promises without introducing jitter in the running chart. (asyncio is new to me).
The UI and graphic is provided by pyqtgraph which is a framework with callbacks to my code such that I didn't have control over the main(). To keep the event loop running I used it's timer function to call my handler which is then invokes the event loop to avoid starvation.
I tested my app also with a cheap BeeLink computer which has an older BLE adapter that didn't support the Data Length Extension feature, so I replaced with with an external adapter that solved the problem. MTU exchange takes affect under windows but not under linux #1227 (comment)
I abstracted Bleak and my device with an abstract class which makes it easy to reuse it with different applications. https://github.com/zapta/ble_stepper_motor_analyzer/blob/main/python/common/probe.py
For easy distribution I use pyinstaller with onefile mode, which creates fully functional single file executables, including with Bleak.
I am still need to figure out how type declaration work in Python. I hope that if I declare a variable or argument as lets say 'int', I will get an error if trying to assign to it a string, but could make that to work.
In retrospect, I happy with my choice of implementing this cross platform app in Python and I think it's more portable and open to modifications by users this way.
Overall the app is very stable, over long runs, and is reasonable on the CPU usage.
Thanks again for a great support.
Beta Was this translation helpful? Give feedback.
All reactions