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
pybricks.pupdevices.Remote: Clean up self references.
For technical and historical reasons, these classes were a bit of a mess, with various different singletons and object types that were almost but not quite working like MicroPython objects. On top of this, the object types were partially shared between the Remote and LWP3Device class.
This refactors the module to use real MicroPython objects with the normal self_in convention wherever we can. We can make a reference to the global instance so that the driver callbacks know where to put the data, and use the finalizer to unset it for safety. Then we don't need separate logic for the LWP3Device notification buffer either, which is just allocated as part of the object.
Now that each method has a self reference, we can relatively easily upgrade this code to use more than one peripheral in the future.
0 commit comments