Skip to content

Commit f2ec853

Browse files
committed
Change the order of sending init packet earlier
1 parent cf762fb commit f2ec853

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

neopia/neosoco.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,16 @@ def __init__(self, index=0, port_name=None):
308308
self._init(port_name)
309309

310310
def dispose(self):
311-
Neosoco._robots[self.get_index()] = None
312-
self._neobot._dispose()
313-
Runner.unregister_robot(self)
314311
# Lastly send init packe to stop all action in the controller
315312
self.write(Neosoco.OUTPUT_1, 0)
316313
self.write(Neosoco.OUTPUT_2, 0)
317314
self.write(Neosoco.OUTPUT_3, 0)
318315
self.write(Neosoco.LEFT_MOTOR, 0)
319316
self.write(Neosoco.RIGHT_MOTOR, 0)
320317
self.write(Neosoco.NOTE, 0)
318+
Neosoco._robots[self.get_index()] = None
319+
self._neobot._dispose()
320+
Runner.unregister_robot(self)
321321

322322
def reset(self):
323323
self._bpm = 60

0 commit comments

Comments
 (0)