Skip to content

Commit 05aec12

Browse files
committed
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.
1 parent 5f45dda commit 05aec12

File tree

1 file changed

+127
-95
lines changed

1 file changed

+127
-95
lines changed

0 commit comments

Comments
 (0)