diff --git a/meshview/templates/node.html b/meshview/templates/node.html index d44040d..1166118 100644 --- a/meshview/templates/node.html +++ b/meshview/templates/node.html @@ -78,8 +78,10 @@ L.polyline(trace).addTo(map); L.marker(trace[0]).addTo(map); {% for n in neighbors %} - L.circleMarker({{n | tojson}}).addTo(map); - L.polyline([trace[0], {{n | tojson}}], {color: 'red'}).addTo(map); + var m = L.circleMarker({{n.location | tojson}}); + m.bindPopup('SNR: {{n.snr}}
{{n.node_id | node_id_to_hex}}'); + m.addTo(map); + L.polyline([trace[0], {{n.location | tojson}}], {color: 'red'}).addTo(map); {% endfor %} {% endif %} diff --git a/meshview/web.py b/meshview/web.py index 04b513b..72ee8c7 100644 --- a/meshview/web.py +++ b/meshview/web.py @@ -41,15 +41,24 @@ async def build_neighbors(node_id): return [] _, payload = decode_payload.decode(packet) neighbors = [] + results = {} async with asyncio.TaskGroup() as tg: for n in payload.neighbors: + results[n.node_id] = { + 'node_id': n.node_id, + 'snr': n.snr, + } neighbors.append(tg.create_task(store.get_node(n.node_id))) - result = [] + print(results) + for node in [n.result() for n in neighbors]: if node.last_lat and node.last_long: - result.append((node.last_lat * 1e-7, node.last_long * 1e-7)) - return result + results[node.node_id]['location'] = (node.last_lat * 1e-7, node.last_long * 1e-7) + else: + del results[node.node_id] + + return list(results.values()) def node_id_to_hex(node_id):