Fix bug preventing manual snes reconnect. Update WebUI to automatically connect if only one SNES device is detected.

This commit is contained in:
Chris
2020-06-06 19:58:10 -04:00
parent fbd00136e7
commit 7d42137782
4 changed files with 28 additions and 40 deletions

View File

@@ -1209,7 +1209,7 @@ async def websocket_server(websocket: websockets.WebSocketServerProtocol, path,
async for incoming_data in websocket:
try:
data = json.loads(incoming_data)
logging.debug(f"WebUIData:{data}")
logging.info(f"WebUIData:{data}")
if ('type' not in data) or ('content' not in data):
raise Exception('Invalid data received in websocket')
@@ -1229,11 +1229,10 @@ async def websocket_server(websocket: websockets.WebSocketServerProtocol, path,
ctx.ui_node.manual_snes = None
ctx.snes_reconnect_address = None
await snes_disconnect(ctx)
return
await snes_disconnect(ctx)
ctx.ui_node.manual_snes = data['content']['deviceId']
await snes_connect(ctx, ctx.snes_address)
else:
await snes_disconnect(ctx)
ctx.ui_node.manual_snes = data['content']['deviceId']
await snes_connect(ctx, ctx.snes_address)
elif data['type'] == 'webControl':
if 'disconnect' in data['content']: