bug in set lat/lon/coords

This commit is contained in:
Florent 2025-04-20 22:18:38 +02:00
parent b8e2280ed8
commit 12f2146f17

View file

@ -578,9 +578,12 @@ async def next_cmd(mc, cmds, json_output=False):
else: else:
print("ok") print("ok")
case "lat": case "lat":
res = await mc.commands.set_coords(\ if "adv_lon" in mc.self_info :
float(cmds[2]),\ lon = mc.self_info['adv_lon']
mc.self_infos['adv_lon']) else:
lon = 0
lat = float(cmds[2])
res = await mc.commands.set_coords(lat, lon)
logger.debug(res) logger.debug(res)
if res.type == EventType.ERROR: if res.type == EventType.ERROR:
print(f"Error: {res}") print(f"Error: {res}")
@ -589,9 +592,12 @@ async def next_cmd(mc, cmds, json_output=False):
else: else:
print("ok") print("ok")
case "lon": case "lon":
res = await mc.commands.set_coords(\ if "adv_lat" in mc.self_info :
mc.self_infos['adv_lat'],\ lat = mc.self_info['adv_lat']
float(cmds[2])) else:
lat = 0
lon = float(cmds[2])
res = await mc.commands.set_coords(lat, lon)
logger.debug(res) logger.debug(res)
if res.type == EventType.ERROR: if res.type == EventType.ERROR:
print(f"Error: {res}") print(f"Error: {res}")
@ -600,7 +606,7 @@ async def next_cmd(mc, cmds, json_output=False):
else: else:
print("ok") print("ok")
case "coords": case "coords":
params=cmds[2].commands.split(",") params=cmds[2].split(",")
res = await mc.commands.set_coords(\ res = await mc.commands.set_coords(\
float(params[0]),\ float(params[0]),\
float(params[1])) float(params[1]))