pi-top / pi-top-Python-SDK

pi-top's Python SDK (pitop package)
Apache License 2.0
27 stars 4 forks source link

PTDM subscribes to relevant events only #590

Open jcapona opened 1 year ago

jcapona commented 1 year ago

Main changes

Improve PTDMSubscribeClient structure by only subscribing to the events that were marked as relevant according to the dictionary passed to the initialise method. By doing this, overhead is reduced since it's not necessary to filter the received messages once they're received since now when that happens, we're 100% sure it's from an event we're interested in.

Couldn't remove the polling since this is required to stop the PTDMSubscribeClient's internal thread.

Screenshots (feature, test output, profiling, dev tools etc)

[insert screenshots here]

Other notes (e.g. implementation quirks, edge cases, questions / issues)

-

Manual testing tips

-

Tag anyone who definitely needs to review or help

-

codecov[bot] commented 1 year ago

Codecov Report

Base: 0.00% // Head: 60.51% // Increases project coverage by +60.51% :tada:

Coverage data is based on head (bd81adb) compared to base (1bf3128). Patch coverage: 72.00% of modified lines in pull request are covered.

:exclamation: Current head bd81adb differs from pull request most recent head 2873910. Consider uploading reports for the commit 2873910 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #590 +/- ## =========================================== + Coverage 0 60.51% +60.51% =========================================== Files 0 147 +147 Lines 0 7325 +7325 =========================================== + Hits 0 4433 +4433 - Misses 0 2892 +2892 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `60.51% <72.00%> (?)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/pi-top/pi-top-Python-SDK/pull/590?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top) | Coverage Δ | | |---|---|---| | [packages/miniscreen/pitop/miniscreen/miniscreen.py](https://codecov.io/gh/pi-top/pi-top-Python-SDK/pull/590/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top#diff-cGFja2FnZXMvbWluaXNjcmVlbi9waXRvcC9taW5pc2NyZWVuL21pbmlzY3JlZW4ucHk=) | `46.77% <0.00%> (ø)` | | | [packages/common/pitop/common/ptdm.py](https://codecov.io/gh/pi-top/pi-top-Python-SDK/pull/590/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top#diff-cGFja2FnZXMvY29tbW9uL3BpdG9wL2NvbW1vbi9wdGRtLnB5) | `91.31% <81.81%> (ø)` | | | [packages/pma/pitop/pma/imu\_controller.py](https://codecov.io/gh/pi-top/pi-top-Python-SDK/pull/590/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top#diff-cGFja2FnZXMvcG1hL3BpdG9wL3BtYS9pbXVfY29udHJvbGxlci5weQ==) | `32.72% <0.00%> (ø)` | | | [packages/common/pitop/common/bitwise\_ops.py](https://codecov.io/gh/pi-top/pi-top-Python-SDK/pull/590/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top#diff-cGFja2FnZXMvY29tbW9uL3BpdG9wL2NvbW1vbi9iaXR3aXNlX29wcy5weQ==) | `98.14% <0.00%> (ø)` | | | [...ges/robotics/pitop/robotics/pan\_tilt\_controller.py](https://codecov.io/gh/pi-top/pi-top-Python-SDK/pull/590/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top#diff-cGFja2FnZXMvcm9ib3RpY3MvcGl0b3Avcm9ib3RpY3MvcGFuX3RpbHRfY29udHJvbGxlci5weQ==) | `81.48% <0.00%> (ø)` | | | [...ges/robotics/pitop/robotics/simple\_pid/\_\_init\_\_.py](https://codecov.io/gh/pi-top/pi-top-Python-SDK/pull/590/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top#diff-cGFja2FnZXMvcm9ib3RpY3MvcGl0b3Avcm9ib3RpY3Mvc2ltcGxlX3BpZC9fX2luaXRfXy5weQ==) | `100.00% <0.00%> (ø)` | | | [packages/miniscreen/pitop/miniscreen/\_\_init\_\_.py](https://codecov.io/gh/pi-top/pi-top-Python-SDK/pull/590/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top#diff-cGFja2FnZXMvbWluaXNjcmVlbi9waXRvcC9taW5pc2NyZWVuL19faW5pdF9fLnB5) | `100.00% <0.00%> (ø)` | | | [packages/camera/pitop/camera/core/\_\_init\_\_.py](https://codecov.io/gh/pi-top/pi-top-Python-SDK/pull/590/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top#diff-cGFja2FnZXMvY2FtZXJhL3BpdG9wL2NhbWVyYS9jb3JlL19faW5pdF9fLnB5) | `100.00% <0.00%> (ø)` | | | [packages/pma/pitop/pma/servo\_motor.py](https://codecov.io/gh/pi-top/pi-top-Python-SDK/pull/590/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top#diff-cGFja2FnZXMvcG1hL3BpdG9wL3BtYS9zZXJ2b19tb3Rvci5weQ==) | `67.67% <0.00%> (ø)` | | | [packages/system/pitop/system/pitop.py](https://codecov.io/gh/pi-top/pi-top-Python-SDK/pull/590/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top#diff-cGFja2FnZXMvc3lzdGVtL3BpdG9wL3N5c3RlbS9waXRvcC5weQ==) | `100.00% <0.00%> (ø)` | | | ... and [139 more](https://codecov.io/gh/pi-top/pi-top-Python-SDK/pull/590/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top) | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pi-top)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.