From 270718148af4e09fd24f82dadf2ccf74e410c147 Mon Sep 17 00:00:00 2001 From: Sacha Weatherstone Date: Mon, 13 Feb 2023 00:12:01 +1000 Subject: [PATCH] Test waypoint sending --- src/pages/Map.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pages/Map.tsx b/src/pages/Map.tsx index e7424906..96163747 100644 --- a/src/pages/Map.tsx +++ b/src/pages/Map.tsx @@ -15,9 +15,10 @@ import { bbox, lineString } from "@turf/turf"; import { SidebarSection } from "@app/components/UI/Sidebar/SidebarSection.js"; import { Button } from "@app/components/UI/Button.js"; import { SidebarButton } from "@app/components/UI/Sidebar/sidebarButton.js"; +import { Protobuf } from "@meshtastic/meshtasticjs"; export const MapPage = (): JSX.Element => { - const { nodes, waypoints } = useDevice(); + const { nodes, waypoints, addWaypoint, connection } = useDevice(); const { rasterSources } = useAppStore(); const { default: map } = useMap(); @@ -83,6 +84,16 @@ export const MapPage = (): JSX.Element => { > { + const waypoint = new Protobuf.Waypoint({ + name: "test", + description: "test description", + latitudeI: Math.trunc(e.lngLat.lat * 1e7), + longitudeI: Math.trunc(e.lngLat.lng * 1e7) + }); + addWaypoint(waypoint); + connection?.sendWaypoint(waypoint, "broadcast"); + }} mapLib={maplibregl} attributionControl={false} renderWorldCopies={false}