Refinements - ensure gca/gcf are gone.

This commit is contained in:
Danny Staple
2022-11-16 22:44:25 +00:00
parent 66a49b4ec3
commit 97018fc119
7 changed files with 15 additions and 11 deletions
@@ -12,6 +12,7 @@ class RobotDisplay:
self.line = ""
self.arena = {}
self.display_closed = False
self.fig, self.ax = plt.subplots()
self.pose_coords = []
self.pose_uv = []
@@ -55,12 +56,11 @@ class RobotDisplay:
async def main(self):
plt.ion()
await self.ble_connection.connect()
self.fig, self.ax = plt.subplots()
try:
request = json.dumps({"command": "arena"}).encode()
print(f"Sending request for arena: {request}")
await self.ble_connection.send_uart_data(request)
plt.gcf().canvas.mpl_connect("close_event", self.handle_close)
self.fig.canvas.mpl_connect("close_event", self.handle_close)
while not self.display_closed:
self.draw()