Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions gcs/src/components/dashboard/floatingToolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// 3rd Party Imports
import { ActionIcon, Tooltip } from "@mantine/core"
import { useLocalStorage } from "@mantine/hooks"
import { centerOfMass, polygon } from "@turf/turf"
import {
IconAnchor,
IconAnchorOff,
Expand Down Expand Up @@ -47,10 +48,17 @@ export default function FloatingToolbar({
)
}

function centerMapOnFirstMissionItem() {
function centerMapOnMission() {
if (filteredMissionItems.length > 0) {
let lat = parseFloat(filteredMissionItems[0].x * 1e-7)
let lon = parseFloat(filteredMissionItems[0].y * 1e-7)
let points = filteredMissionItems.map((item) => [
item.x * 1e-7,
item.y * 1e-7,
])
points.push(points[0]) // Close the polygon
let geo = polygon([points])
let center = centerOfMass(geo).geometry.coordinates
let lat = parseFloat(center[0])
let lon = parseFloat(center[1])
mapRef.current.getMap().flyTo({
center: [lon, lat],
})
Expand Down Expand Up @@ -95,15 +103,15 @@ export default function FloatingToolbar({
</ActionIcon>
</Tooltip>

{/* Center Map on first mission item */}
{/* Center Map on full mission */}
<Tooltip
label={
!filteredMissionItems.length > 0 ? "No mission" : "Center on mission"
}
>
<ActionIcon
disabled={filteredMissionItems.length <= 0}
onClick={centerMapOnFirstMissionItem}
onClick={centerMapOnMission}
>
<IconMapPins />
</ActionIcon>
Expand Down
2 changes: 1 addition & 1 deletion gcs/src/components/fla/presetCategories.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const dataflashPresetCategories = [
filters: [
{
name: "Battery Voltage vs Current",
filters: { BATT: ["Volt", "Curr"] },
filters: { BAT: ["Volt", "Curr"] },
aircraftType: ["copter", "plane", "quadplane"],
},
],
Expand Down
2 changes: 2 additions & 0 deletions gcs/src/components/mainContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { SettingsProvider } from "../helpers/settingsProvider"
// Routes
import FLA from "../fla"
import Graphs from "../graphs"
import Missions from "../missions"
import Params from "../params"
import Config from "../config"
import CameraWindow from "./dashboard/webcam/webcam"
Expand All @@ -34,6 +35,7 @@ export default function AppContent() {
<SettingsModal />
<Routes>
<Route path="/" element={<Dashboard />} />
<Route path="/missions" element={<Missions />} />
<Route path="/graphs" element={<Graphs />} />
<Route path="/params" element={<Params />} />
<Route path="/config" element={<Config />} />
Expand Down
1 change: 0 additions & 1 deletion gcs/src/components/spotlight/commandHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export function AddCommand(id, command, shortcut = null, macShortcut = null) {

export function RunCommand(id) {
// Search for a command by id
console.log(`Running command, ${id}`)
try {
commands.find((entry) => entry.id == id).command()
} catch {
Expand Down
Loading