From a3334124802c7f2add1f49aed1a369d6153212b0 Mon Sep 17 00:00:00 2001
From: Bharat Kathi
Date: Wed, 19 Feb 2025 17:40:50 -0800
Subject: [PATCH 1/6] gr25: swap big to little endian
---
gr25/model/ecu.go | 14 +++++++-------
gr25/model/message.go | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/gr25/model/ecu.go b/gr25/model/ecu.go
index a86ffe58..cfc70ba2 100644
--- a/gr25/model/ecu.go
+++ b/gr25/model/ecu.go
@@ -2,9 +2,9 @@ package model
import mp "github.com/gaucho-racing/mapache-go"
-var ecuStatusOne = mp.Message{
- mp.NewField("ecu_state", 1, mp.Unsigned, mp.BigEndian, nil),
- mp.NewField("ecu_status_flags", 3, mp.Unsigned, mp.BigEndian, func(f mp.Field) []mp.Signal {
+var ECUStatusOne = mp.Message{
+ mp.NewField("ecu_state", 1, mp.Unsigned, mp.LittleEndian, nil),
+ mp.NewField("ecu_status_flags", 3, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
signals := []mp.Signal{}
bitMap := []string{
"ecu_status_acu",
@@ -32,7 +32,7 @@ var ecuStatusOne = mp.Message{
}
return signals
}),
- mp.NewField("ecu_maps", 1, mp.Unsigned, mp.BigEndian, func(f mp.Field) []mp.Signal {
+ mp.NewField("ecu_maps", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
signals := []mp.Signal{}
signals = append(signals, mp.Signal{
Name: "ecu_power_level",
@@ -46,7 +46,7 @@ var ecuStatusOne = mp.Message{
})
return signals
}),
- mp.NewField("ecu_max_cell_temp", 1, mp.Unsigned, mp.BigEndian, func(f mp.Field) []mp.Signal {
+ mp.NewField("ecu_max_cell_temp", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
signals := []mp.Signal{}
signals = append(signals, mp.Signal{
Name: "ecu_max_cell_temp",
@@ -55,7 +55,7 @@ var ecuStatusOne = mp.Message{
})
return signals
}),
- mp.NewField("ecu_acu_state_of_charge", 1, mp.Unsigned, mp.BigEndian, func(f mp.Field) []mp.Signal {
+ mp.NewField("ecu_acu_state_of_charge", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
signals := []mp.Signal{}
signals = append(signals, mp.Signal{
Name: "ecu_acu_state_of_charge",
@@ -64,7 +64,7 @@ var ecuStatusOne = mp.Message{
})
return signals
}),
- mp.NewField("ecu_glv_state_of_charge", 1, mp.Unsigned, mp.BigEndian, func(f mp.Field) []mp.Signal {
+ mp.NewField("ecu_glv_state_of_charge", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
signals := []mp.Signal{}
signals = append(signals, mp.Signal{
Name: "ecu_glv_state_of_charge",
diff --git a/gr25/model/message.go b/gr25/model/message.go
index 3be674f4..8d35e100 100644
--- a/gr25/model/message.go
+++ b/gr25/model/message.go
@@ -3,7 +3,7 @@ package model
import mp "github.com/gaucho-racing/mapache-go"
var messageMap = map[int]mp.Message{
- 0x003: ecuStatusOne,
+ 0x003: ECUStatusOne,
}
func GetMessage(id int) mp.Message {
From d713e3cd969be6f56fdb71fdcda7c220ad24833f Mon Sep 17 00:00:00 2001
From: Bharat Kathi
Date: Wed, 19 Feb 2025 17:45:51 -0800
Subject: [PATCH 2/6] gr25: add ecu 0x004
---
gr25/model/ecu.go | 39 +++++++++++++++++++++++++++++++++++++++
gr25/model/message.go | 1 +
2 files changed, 40 insertions(+)
diff --git a/gr25/model/ecu.go b/gr25/model/ecu.go
index cfc70ba2..455f76ee 100644
--- a/gr25/model/ecu.go
+++ b/gr25/model/ecu.go
@@ -74,3 +74,42 @@ var ECUStatusOne = mp.Message{
return signals
}),
}
+
+var ECUStatusTwo = mp.Message{
+ mp.NewField("ecu_tractive_system_voltage", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
+ signals := []mp.Signal{}
+ signals = append(signals, mp.Signal{
+ Name: "ecu_tractive_system_voltage",
+ Value: float64(f.Value) * 0.01,
+ RawValue: f.Value,
+ })
+ return signals
+ }),
+ mp.NewField("ecu_vehicle_speed", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
+ signals := []mp.Signal{}
+ signals = append(signals, mp.Signal{
+ Name: "ecu_vehicle_speed",
+ Value: float64(f.Value) * 0.01,
+ RawValue: f.Value,
+ })
+ return signals
+ }),
+ mp.NewField("ecu_fr_wheel_rpm", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
+ signals := []mp.Signal{}
+ signals = append(signals, mp.Signal{
+ Name: "ecu_fr_wheel_rpm",
+ Value: float64(f.Value)*0.1 - 3276.8,
+ RawValue: f.Value,
+ })
+ return signals
+ }),
+ mp.NewField("ecu_fl_wheel_rpm", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
+ signals := []mp.Signal{}
+ signals = append(signals, mp.Signal{
+ Name: "ecu_fl_wheel_rpm",
+ Value: float64(f.Value)*0.1 - 3276.8,
+ RawValue: f.Value,
+ })
+ return signals
+ }),
+}
diff --git a/gr25/model/message.go b/gr25/model/message.go
index 8d35e100..1a96c9f9 100644
--- a/gr25/model/message.go
+++ b/gr25/model/message.go
@@ -4,6 +4,7 @@ import mp "github.com/gaucho-racing/mapache-go"
var messageMap = map[int]mp.Message{
0x003: ECUStatusOne,
+ 0x004: ECUStatusTwo,
}
func GetMessage(id int) mp.Message {
From 9701658fea1f108592713c24b8b18db744ff11c9 Mon Sep 17 00:00:00 2001
From: Bharat Kathi
Date: Wed, 19 Feb 2025 17:53:55 -0800
Subject: [PATCH 3/6] gr25: add ecu 0x005
---
gr25/model/ecu.go | 21 +++++++++++++++++++++
gr25/model/message.go | 1 +
2 files changed, 22 insertions(+)
diff --git a/gr25/model/ecu.go b/gr25/model/ecu.go
index 455f76ee..286b1f9e 100644
--- a/gr25/model/ecu.go
+++ b/gr25/model/ecu.go
@@ -113,3 +113,24 @@ var ECUStatusTwo = mp.Message{
return signals
}),
}
+
+var ECUStatusThree = mp.Message{
+ mp.NewField("ecu_rr_wheel_rpm", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
+ signals := []mp.Signal{}
+ signals = append(signals, mp.Signal{
+ Name: "ecu_rr_wheel_rpm",
+ Value: float64(f.Value)*0.1 - 3276.8,
+ RawValue: f.Value,
+ })
+ return signals
+ }),
+ mp.NewField("ecu_rl_wheel_rpm", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
+ signals := []mp.Signal{}
+ signals = append(signals, mp.Signal{
+ Name: "ecu_rl_wheel_rpm",
+ Value: float64(f.Value)*0.1 - 3276.8,
+ RawValue: f.Value,
+ })
+ return signals
+ }),
+}
diff --git a/gr25/model/message.go b/gr25/model/message.go
index 1a96c9f9..2b65852d 100644
--- a/gr25/model/message.go
+++ b/gr25/model/message.go
@@ -5,6 +5,7 @@ import mp "github.com/gaucho-racing/mapache-go"
var messageMap = map[int]mp.Message{
0x003: ECUStatusOne,
0x004: ECUStatusTwo,
+ 0x005: ECUStatusThree,
}
func GetMessage(id int) mp.Message {
From 21938c32c2ad95db035a967249162139c9d1ab4a Mon Sep 17 00:00:00 2001
From: Bharat Kathi
Date: Wed, 19 Feb 2025 17:59:43 -0800
Subject: [PATCH 4/6] gr25: fix ecu status ingest
---
gr25/model/ecu.go | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/gr25/model/ecu.go b/gr25/model/ecu.go
index 286b1f9e..8e06518e 100644
--- a/gr25/model/ecu.go
+++ b/gr25/model/ecu.go
@@ -76,7 +76,7 @@ var ECUStatusOne = mp.Message{
}
var ECUStatusTwo = mp.Message{
- mp.NewField("ecu_tractive_system_voltage", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
+ mp.NewField("ecu_tractive_system_voltage", 2, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
signals := []mp.Signal{}
signals = append(signals, mp.Signal{
Name: "ecu_tractive_system_voltage",
@@ -85,7 +85,7 @@ var ECUStatusTwo = mp.Message{
})
return signals
}),
- mp.NewField("ecu_vehicle_speed", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
+ mp.NewField("ecu_vehicle_speed", 2, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
signals := []mp.Signal{}
signals = append(signals, mp.Signal{
Name: "ecu_vehicle_speed",
@@ -94,7 +94,7 @@ var ECUStatusTwo = mp.Message{
})
return signals
}),
- mp.NewField("ecu_fr_wheel_rpm", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
+ mp.NewField("ecu_fr_wheel_rpm", 2, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
signals := []mp.Signal{}
signals = append(signals, mp.Signal{
Name: "ecu_fr_wheel_rpm",
@@ -103,7 +103,7 @@ var ECUStatusTwo = mp.Message{
})
return signals
}),
- mp.NewField("ecu_fl_wheel_rpm", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
+ mp.NewField("ecu_fl_wheel_rpm", 2, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
signals := []mp.Signal{}
signals = append(signals, mp.Signal{
Name: "ecu_fl_wheel_rpm",
@@ -115,7 +115,7 @@ var ECUStatusTwo = mp.Message{
}
var ECUStatusThree = mp.Message{
- mp.NewField("ecu_rr_wheel_rpm", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
+ mp.NewField("ecu_rr_wheel_rpm", 2, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
signals := []mp.Signal{}
signals = append(signals, mp.Signal{
Name: "ecu_rr_wheel_rpm",
@@ -124,7 +124,7 @@ var ECUStatusThree = mp.Message{
})
return signals
}),
- mp.NewField("ecu_rl_wheel_rpm", 1, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
+ mp.NewField("ecu_rl_wheel_rpm", 2, mp.Unsigned, mp.LittleEndian, func(f mp.Field) []mp.Signal {
signals := []mp.Signal{}
signals = append(signals, mp.Signal{
Name: "ecu_rl_wheel_rpm",
From a0d37f7b60062847154842bfa32afb19d87fe732 Mon Sep 17 00:00:00 2001
From: Bharat Kathi
Date: Wed, 19 Feb 2025 18:17:31 -0800
Subject: [PATCH 5/6] dashboard: get rid all gr24 widgets
---
dashboard/src/components/Header.tsx | 7 +-
dashboard/src/consts/config.tsx | 169 +-----
dashboard/src/main.tsx | 46 --
dashboard/src/models/gr24/acu.tsx | 503 ------------------
dashboard/src/models/gr24/mobile.tsx | 43 --
dashboard/src/pages/gr24/acu/ACUPage.tsx | 125 -----
.../pages/gr24/acu/widgets/CellLiveWidget.tsx | 187 -------
.../gr24/acu/widgets/DebugRawLiveWidget.tsx | 78 ---
.../gr24/acu/widgets/SegmentLiveWidget.tsx | 175 ------
dashboard/src/pages/gr24/bcm/BCMPage.tsx | 110 ----
.../gr24/bcm/widgets/DebugRawLiveWidget.tsx | 78 ---
.../pages/gr24/dash_panel/DashPanelPage.tsx | 111 ----
.../dash_panel/widgets/DebugRawLiveWidget.tsx | 78 ---
.../pages/gr24/dashboard/DashboardPage.tsx | 69 ---
.../src/pages/gr24/inverter/InverterPage.tsx | 110 ----
.../inverter/widgets/DebugRawLiveWidget.tsx | 78 ---
.../src/pages/gr24/mobile/MobilePage.tsx | 127 -----
.../widgets/AccelerometerLiveWidget.tsx | 131 -----
.../widgets/AltitudeGraphLiveWidget.tsx | 206 -------
.../gr24/mobile/widgets/DebugLiveWidget.tsx | 134 -----
.../mobile/widgets/DebugRawLiveWidget.tsx | 86 ---
.../gr24/mobile/widgets/MapLiveWidget.tsx | 122 -----
.../mobile/widgets/MapSpeedLiveWidget.tsx | 172 ------
.../gr24/mobile/widgets/SpeedLiveWidget.tsx | 105 ----
dashboard/src/pages/gr24/nodes/NodesPage.tsx | 374 -------------
.../src/pages/gr24/pedal/PedalDetailsPage.tsx | 131 -----
dashboard/src/pages/gr24/pedal/PedalPage.tsx | 113 ----
.../gr24/pedal/widgets/DebugRawLiveWidget.tsx | 78 ---
.../gr24/pedal/widgets/PedalLiveWidget.tsx | 94 ----
dashboard/src/pages/gr24/vdm/VDMPage.tsx | 106 ----
.../gr24/vdm/widgets/DebugRawLiveWidget.tsx | 78 ---
dashboard/src/pages/gr24/wheel/WheelPage.tsx | 106 ----
.../gr24/wheel/widgets/DebugRawLiveWidget.tsx | 78 ---
33 files changed, 3 insertions(+), 4205 deletions(-)
delete mode 100644 dashboard/src/models/gr24/acu.tsx
delete mode 100644 dashboard/src/models/gr24/mobile.tsx
delete mode 100644 dashboard/src/pages/gr24/acu/ACUPage.tsx
delete mode 100644 dashboard/src/pages/gr24/acu/widgets/CellLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/acu/widgets/DebugRawLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/acu/widgets/SegmentLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/bcm/BCMPage.tsx
delete mode 100644 dashboard/src/pages/gr24/bcm/widgets/DebugRawLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/dash_panel/DashPanelPage.tsx
delete mode 100644 dashboard/src/pages/gr24/dash_panel/widgets/DebugRawLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/dashboard/DashboardPage.tsx
delete mode 100644 dashboard/src/pages/gr24/inverter/InverterPage.tsx
delete mode 100644 dashboard/src/pages/gr24/inverter/widgets/DebugRawLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/mobile/MobilePage.tsx
delete mode 100644 dashboard/src/pages/gr24/mobile/widgets/AccelerometerLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/mobile/widgets/AltitudeGraphLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/mobile/widgets/DebugLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/mobile/widgets/DebugRawLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/mobile/widgets/MapLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/mobile/widgets/MapSpeedLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/mobile/widgets/SpeedLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/nodes/NodesPage.tsx
delete mode 100644 dashboard/src/pages/gr24/pedal/PedalDetailsPage.tsx
delete mode 100644 dashboard/src/pages/gr24/pedal/PedalPage.tsx
delete mode 100644 dashboard/src/pages/gr24/pedal/widgets/DebugRawLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/pedal/widgets/PedalLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/vdm/VDMPage.tsx
delete mode 100644 dashboard/src/pages/gr24/vdm/widgets/DebugRawLiveWidget.tsx
delete mode 100644 dashboard/src/pages/gr24/wheel/WheelPage.tsx
delete mode 100644 dashboard/src/pages/gr24/wheel/widgets/DebugRawLiveWidget.tsx
diff --git a/dashboard/src/components/Header.tsx b/dashboard/src/components/Header.tsx
index 9b0f0e39..2d4ed284 100644
--- a/dashboard/src/components/Header.tsx
+++ b/dashboard/src/components/Header.tsx
@@ -1,16 +1,13 @@
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Separator } from "@/components/ui/separator";
-import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
- DropdownMenuRadioGroup,
- DropdownMenuRadioItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import { currentVehicle, currentUser } from "@/consts/config";
+import { currentUser } from "@/consts/config";
import { SHA256 } from "crypto-js";
import { useNavigate } from "react-router-dom";
import { logout } from "@/lib/auth";
@@ -24,8 +21,6 @@ interface HeaderProps {
const Header = (props: HeaderProps) => {
const navigate = useNavigate();
- function selectVehicle(vehicleId: string) {}
-
return (
- );
- };
-
- const SpeedDisplay = () => {
- return (
-
-
-
{(messageJson.speed * 2.23694).toFixed(0)}
-
MPH
-
-
-
-
{(messageJson.speed * 3.6).toFixed(0)}
-
KMPH
-
-
- );
- };
-
- const LoadingComponent = () => {
- if (readyState === ReadyState.CONNECTING) {
- return (
-
- );
- } else if (readyState === ReadyState.CLOSED) {
- return (
-
- );
- } else {
- return (
-
-
-
- );
- }
- };
-
- return (
- <>
-
- {lastMessage ? (
-
- ) : (
-
- )}
-
- >
- );
-}
-
-export default MapSpeedLiveWidget;
diff --git a/dashboard/src/pages/gr24/mobile/widgets/SpeedLiveWidget.tsx b/dashboard/src/pages/gr24/mobile/widgets/SpeedLiveWidget.tsx
deleted file mode 100644
index cc94486a..00000000
--- a/dashboard/src/pages/gr24/mobile/widgets/SpeedLiveWidget.tsx
+++ /dev/null
@@ -1,105 +0,0 @@
-import { Loader2 } from "lucide-react";
-import useWebSocket, { ReadyState } from "react-use-websocket";
-import React, { useEffect, useState } from "react";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faCircleXmark } from "@fortawesome/free-regular-svg-icons";
-import { Mobile, initMobile } from "@/models/gr24/mobile";
-import { MAPACHE_WS_URL } from "@/consts/config";
-
-function SpeedLiveWidget() {
- const [socketUrl] = React.useState(`${MAPACHE_WS_URL}/ws/gr24/mobile`);
- const { lastMessage, readyState } = useWebSocket(socketUrl);
- const [messageJson, setMessageJson] = useState(initMobile);
-
- useEffect(() => {
- if (lastMessage !== null) {
- const data = JSON.parse(lastMessage.data);
- setMessageJson(data);
- }
- }, [lastMessage]);
-
- const getCompassString = () => {
- const compass = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"];
- const index = Math.round(messageJson.heading / 45) % 8;
- return compass[index];
- };
-
- const CompassDisplay = () => {
- return (
-
-
- {messageJson.heading.toFixed(1)}° {getCompassString()}
-
-
- );
- };
-
- const SpeedDisplay = () => {
- return (
-
-
-
- {(messageJson.speed * 2.23694).toFixed(0)}
-
-
MPH
-
-
-
-
{(messageJson.speed * 3.6).toFixed(0)}
-
KMPH
-
-
- );
- };
-
- const LoadingComponent = () => {
- if (readyState === ReadyState.CONNECTING) {
- return (
-
- );
- } else if (readyState === ReadyState.CLOSED) {
- return (
-
- );
- } else {
- return (
-
-
-
- );
- }
- };
-
- return (
- <>
-
- {lastMessage ? (
-
- ) : (
-
- )}
-
- >
- );
-}
-
-export default SpeedLiveWidget;
diff --git a/dashboard/src/pages/gr24/nodes/NodesPage.tsx b/dashboard/src/pages/gr24/nodes/NodesPage.tsx
deleted file mode 100644
index c5754327..00000000
--- a/dashboard/src/pages/gr24/nodes/NodesPage.tsx
+++ /dev/null
@@ -1,374 +0,0 @@
-import Layout from "@/components/Layout";
-import { Card } from "@/components/ui/card";
-import React, { useMemo } from "react";
-import ReactFlow, { Handle, Position } from "reactflow";
-
-import "reactflow/dist/style.css";
-
-function NodesPage() {
- React.useEffect(() => {}, []);
-
- const nodeTypes = useMemo(() => {
- return {
- wheel: ({ data }: { data: any }) => {
- return (
-
- {data.label}
-
-
-
- );
- },
- acu: ({ data }: { data: any }) => {
- return (
-
- {data.label}
-
-
-
- );
- },
- inverter: ({ data }: { data: any }) => {
- return (
-
- {data.label}
-
-
-
- );
- },
- ecu: ({ data }: { data: any }) => {
- return (
-
- {data.label}
-
-
-
- );
- },
- dpanel: ({ data }: { data: any }) => {
- return (
-
- {data.label}
-
-
-
- );
- },
- steering: ({ data }: { data: any }) => {
- return (
-
- {data.label}
-
-
-
- );
- },
- node_small: ({ data }: { data: any }) => {
- return (
-
- {data.label}
-
-
-
- );
- },
- };
- }, []);
-
- const initialNodes = [
- {
- id: "wheel/fl",
- position: { x: 20, y: 100 },
- data: { label: "FL" },
- type: "wheel",
- },
- {
- id: "wheel/fr",
- position: { x: 400, y: 100 },
- data: { label: "FR" },
- type: "wheel",
- },
- {
- id: "wheel/rl",
- position: { x: 20, y: 600 },
- data: { label: "RL" },
- type: "wheel",
- },
- {
- id: "wheel/rr",
- position: { x: 400, y: 600 },
- data: { label: "RR" },
- type: "wheel",
- },
- {
- id: "acu",
- position: { x: 135, y: 700 },
- data: { label: "ACU" },
- type: "acu",
- },
- {
- id: "inverter",
- position: { x: 160, y: 600 },
- data: { label: "Inverter" },
- type: "inverter",
- },
- {
- id: "vdm",
- position: { x: 160, y: 400 },
- data: { label: "VDM" },
- type: "ecu",
- },
- {
- id: "tcm",
- position: { x: 240, y: 50 },
- data: { label: "TCM" },
- type: "node_small",
- },
- {
- id: "bcm",
- position: { x: 125, y: 50 },
- data: { label: "BCM" },
- type: "node_small",
- },
- {
- id: "pedal",
- position: { x: 185, y: 120 },
- data: { label: "Pedals" },
- type: "node_small",
- },
- {
- id: "steering",
- position: { x: 185, y: 260 },
- data: { label: "Steering" },
- type: "steering",
- },
- {
- id: "dpanel",
- position: { x: 110, y: 190 },
- data: { label: "Dash Panel" },
- type: "dpanel",
- },
- ];
- const animated = false;
- const initialEdges = [
- { id: "1", target: "bcm", source: "tcm", animated: animated },
- {
- id: "2",
- source: "tcm",
- target: "pedal",
- animated: animated,
- },
- {
- id: "2",
- source: "pedal",
- target: "dpanel",
- animated: animated,
- },
- {
- id: "3",
- source: "pedal",
- target: "dpanel",
- animated: animated,
- },
- {
- id: "4",
- source: "dpanel",
- target: "steering",
- animated: animated,
- },
- {
- id: "5",
- source: "steering",
- target: "vdm",
- animated: animated,
- },
- {
- id: "6",
- source: "vdm",
- target: "inverter",
- animated: animated,
- },
- {
- id: "7",
- source: "inverter",
- target: "acu",
- animated: animated,
- },
- {
- id: "8",
- source: "wheel/fl",
- target: "wheel/rl",
- animated: animated,
- },
- {
- id: "8",
- source: "wheel/fr",
- target: "wheel/rr",
- animated: animated,
- },
- {
- id: "10",
- target: "wheel/rl",
- source: "bcm",
- animated: animated,
- },
- {
- id: "11",
- target: "wheel/rr",
- source: "bcm",
- animated: animated,
- },
- // {
- // id: "8",
- // target: "wheel/fl",
- // source: "bcm",
- // animated: animated,
- // },
- // {
- // id: "9",
- // target: "wheel/fr",
- // source: "bcm",
- // animated: animated,
- // },
- // {
- // id: "10",
- // target: "wheel/rl",
- // source: "bcm",
- // animated: animated,
- // },
- // {
- // id: "11",
- // target: "wheel/rr",
- // source: "bcm",
- // animated: animated,
- // },
- ];
-
- return (
- <>
-
- Nodes
-
-
- Haha it's a{" "}
-
- Nodes.h
-
{" "}
- reference
-
-
-
-
-
-
-
-
- >
- );
-}
-
-export default NodesPage;
diff --git a/dashboard/src/pages/gr24/pedal/PedalDetailsPage.tsx b/dashboard/src/pages/gr24/pedal/PedalDetailsPage.tsx
deleted file mode 100644
index 5badd668..00000000
--- a/dashboard/src/pages/gr24/pedal/PedalDetailsPage.tsx
+++ /dev/null
@@ -1,131 +0,0 @@
-import { Loader2 } from "lucide-react";
-import React, { useCallback } from "react";
-import { checkCredentials } from "@/lib/auth";
-import { useNavigate } from "react-router-dom";
-import useWebSocket, { ReadyState } from "react-use-websocket";
-import { Button } from "@/components/ui/button";
-import { Progress } from "@/components/ui/progress";
-
-function PedalDetailsPage() {
- const navigate = useNavigate();
- const [loading, setLoading] = React.useState(true);
-
- const [socketUrl] = React.useState("ws://localhost:7001/ws/gr24/pedal");
- const { sendMessage, lastMessage, readyState } = useWebSocket(socketUrl);
-
- const [jsonData, setJsonData] = React.useState([{}]);
-
- React.useEffect(() => {
- init();
- if (lastMessage !== null) {
- setJsonData((prev) => [
- ...prev.concat(JSON.parse(lastMessage.data)).slice(-100),
- ]);
- }
- }, [lastMessage]);
-
- const handleClickSendMessage = useCallback(() => sendMessage("Hello"), []);
-
- const connectionStatus = {
- [ReadyState.CONNECTING]: "Connecting",
- [ReadyState.OPEN]: "Open",
- [ReadyState.CLOSING]: "Closing",
- [ReadyState.CLOSED]: "Closed",
- [ReadyState.UNINSTANTIATED]: "Uninstantiated",
- }[readyState];
-
- const init = async () => {
- const currentRoute = window.location.pathname + window.location.search;
- const status = await checkCredentials();
- if (status != 0) {
- navigate(`/auth/register?route=${currentRoute}`);
- } else {
- setLoading(false);
- }
- };
-
- const LoadingComponent = () => {
- return (
-
-
-
- );
- };
-
- return loading ? (
-
- ) : (
- <>
-
-
-
The WebSocket is currently {connectionStatus}
-
-
-
- {lastMessage ? (
-
-
Last Message ID: {JSON.parse(lastMessage.data).id}
-
-
- APPS One: {JSON.parse(lastMessage.data).apps_one}
-
-
-
- APPS Two: {JSON.parse(lastMessage.data).apps_two}
-
-
-
- Brake Pressure Front:{" "}
- {JSON.parse(lastMessage.data).brake_pressure_front}
-
-
-
- Brake Pressure Rear:{" "}
- {JSON.parse(lastMessage.data).brake_pressure_rear}
-
-
- ) : (
-
No data
- )}
-
-
-
- Message Count: {jsonData.length}
-
- {jsonData.reverse().map((message, idx) => (
-
{JSON.stringify(message)}
- ))}
-
-
-
-
- >
- );
-}
-
-export default PedalDetailsPage;
diff --git a/dashboard/src/pages/gr24/pedal/PedalPage.tsx b/dashboard/src/pages/gr24/pedal/PedalPage.tsx
deleted file mode 100644
index 1ada4e50..00000000
--- a/dashboard/src/pages/gr24/pedal/PedalPage.tsx
+++ /dev/null
@@ -1,113 +0,0 @@
-import Layout from "@/components/Layout";
-import { useEffect, useState } from "react";
-import { Card } from "@/components/ui/card";
-import { Button } from "@/components/ui/button";
-import { pedalLiveWidgets, vdmLiveWidgets } from "@/consts/config";
-import DebugRawLiveWidget from "./widgets/DebugRawLiveWidget";
-import PedalLiveWidget from "./widgets/PedalLiveWidget";
-
-function PedalPage() {
- const [selectingWidgets, setSelectingWidgets] = useState(false);
- const [widgets, setWidgets] = useState([
- {
- name: "Pedal Live",
- width: 300,
- height: 300,
- component: ,
- },
- {
- name: "Raw Debug Live",
- width: 600,
- height: 300,
- component: ,
- },
- ]);
-
- useEffect(() => {});
-
- function addToWidgets(widget) {
- if (!widgets.some((item) => item.name === widget.name)) {
- setWidgets((prevWidgets) => [...prevWidgets, widget]);
- }
- }
-
- function removeFromWidgets(widget) {
- setWidgets((prevWidgets) =>
- prevWidgets.filter((item) => item.name !== widget.name),
- );
- }
-
- const SelectWidgetsComponent = () => {
- return (
-
-
- Select Widgets
- {pedalLiveWidgets.map((widget) => (
-
-
{widget.name}
- {widgets.some((item) => item.name === widget.name) ? (
-
- ) : (
-
- )}
-
- ))}
-
-
- );
- };
-
- return (
- <>
-
-
-
-
-
- {selectingWidgets ? (
-
- ) : (
-
- {widgets.map((widget) => (
-
- {widget.component}
-
- ))}
-
- )}
-
- >
- );
-}
-
-export default PedalPage;
diff --git a/dashboard/src/pages/gr24/pedal/widgets/DebugRawLiveWidget.tsx b/dashboard/src/pages/gr24/pedal/widgets/DebugRawLiveWidget.tsx
deleted file mode 100644
index 2fcf3964..00000000
--- a/dashboard/src/pages/gr24/pedal/widgets/DebugRawLiveWidget.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import { Loader2 } from "lucide-react";
-import useWebSocket, { ReadyState } from "react-use-websocket";
-import React, { useEffect, useState } from "react";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faCircleXmark } from "@fortawesome/free-regular-svg-icons";
-import { Mobile, initMobile } from "@/models/gr24/mobile";
-import { MAPACHE_WS_URL } from "@/consts/config";
-
-function DebugRawLiveWidget() {
- const [socketUrl] = React.useState(`${MAPACHE_WS_URL}/ws/gr24/pedal`);
- const { lastMessage, readyState } = useWebSocket(socketUrl);
- const [messageJson, setMessageJson] = useState(initMobile);
-
- useEffect(() => {
- if (lastMessage !== null) {
- const data = JSON.parse(lastMessage.data);
- setMessageJson(data);
- }
- }, [lastMessage]);
-
- const LoadingComponent = () => {
- if (readyState === ReadyState.CONNECTING) {
- return (
-
- );
- } else if (readyState === ReadyState.CLOSED) {
- return (
-
- );
- } else {
- return (
-
-
-
- );
- }
- };
-
- return (
- <>
-
- {lastMessage ? (
-
-
- {Object.entries(messageJson).map(([key, value]) => (
-
-
{key}:
-
- {value.toString()}
-
-
- ))}
-
-
-
Last Update:
-
- {new Date(messageJson.created_at).toISOString()}
-
-
-
- ) : (
-
- )}
-
- >
- );
-}
-
-export default DebugRawLiveWidget;
diff --git a/dashboard/src/pages/gr24/pedal/widgets/PedalLiveWidget.tsx b/dashboard/src/pages/gr24/pedal/widgets/PedalLiveWidget.tsx
deleted file mode 100644
index 5c2803c7..00000000
--- a/dashboard/src/pages/gr24/pedal/widgets/PedalLiveWidget.tsx
+++ /dev/null
@@ -1,94 +0,0 @@
-import { Loader2 } from "lucide-react";
-import React from "react";
-import useWebSocket, { ReadyState } from "react-use-websocket";
-import { Progress } from "@/components/ui/progress";
-import { Separator } from "@/components/ui/separator";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faCircleXmark } from "@fortawesome/free-regular-svg-icons";
-import { MAPACHE_WS_URL } from "@/consts/config";
-
-function GR24PedalLiveWidget() {
- const [socketUrl] = React.useState(`${MAPACHE_WS_URL}/ws/gr24/pedal`);
- const { lastMessage, readyState } = useWebSocket(socketUrl);
-
- const LoadingComponent = () => {
- if (readyState === ReadyState.CONNECTING) {
- return (
-
- );
- } else if (readyState === ReadyState.CLOSED) {
- return (
-
- );
- } else {
- return (
-
-
-
- );
- }
- };
-
- return (
- <>
-
- {lastMessage ? (
-
-
-
-
APPS 1:
-
- {parseFloat(JSON.parse(lastMessage.data).apps_one).toFixed(2)}
-
-
-
-
-
-
-
APPS 2:
-
- {parseFloat(JSON.parse(lastMessage.data).apps_two).toFixed(2)}
-
-
-
-
-
-
-
-
{JSON.parse(lastMessage.data).apps_one_raw}
-
-
-
-
{JSON.parse(lastMessage.data).apps_two_raw}
-
-
- ) : (
-
- )}
-
- >
- );
-}
-
-export default GR24PedalLiveWidget;
diff --git a/dashboard/src/pages/gr24/vdm/VDMPage.tsx b/dashboard/src/pages/gr24/vdm/VDMPage.tsx
deleted file mode 100644
index 767c288b..00000000
--- a/dashboard/src/pages/gr24/vdm/VDMPage.tsx
+++ /dev/null
@@ -1,106 +0,0 @@
-import Layout from "@/components/Layout";
-import { useEffect, useState } from "react";
-import { Card } from "@/components/ui/card";
-import { Button } from "@/components/ui/button";
-import { vdmLiveWidgets } from "@/consts/config";
-import DebugRawLiveWidget from "./widgets/DebugRawLiveWidget";
-
-function VDMPage() {
- const [selectingWidgets, setSelectingWidgets] = useState(false);
- const [widgets, setWidgets] = useState([
- {
- name: "Raw Debug Live",
- width: 600,
- height: 900,
- component: ,
- },
- ]);
-
- useEffect(() => {});
-
- function addToWidgets(widget) {
- if (!widgets.some((item) => item.name === widget.name)) {
- setWidgets((prevWidgets) => [...prevWidgets, widget]);
- }
- }
-
- function removeFromWidgets(widget) {
- setWidgets((prevWidgets) =>
- prevWidgets.filter((item) => item.name !== widget.name),
- );
- }
-
- const SelectWidgetsComponent = () => {
- return (
-
-
- Select Widgets
- {vdmLiveWidgets.map((widget) => (
-
-
{widget.name}
- {widgets.some((item) => item.name === widget.name) ? (
-
- ) : (
-
- )}
-
- ))}
-
-
- );
- };
-
- return (
- <>
-
-
-
-
-
- {selectingWidgets ? (
-
- ) : (
-
- {widgets.map((widget) => (
-
- {widget.component}
-
- ))}
-
- )}
-
- >
- );
-}
-
-export default VDMPage;
diff --git a/dashboard/src/pages/gr24/vdm/widgets/DebugRawLiveWidget.tsx b/dashboard/src/pages/gr24/vdm/widgets/DebugRawLiveWidget.tsx
deleted file mode 100644
index b7e2bd6e..00000000
--- a/dashboard/src/pages/gr24/vdm/widgets/DebugRawLiveWidget.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import { Loader2 } from "lucide-react";
-import useWebSocket, { ReadyState } from "react-use-websocket";
-import React, { useEffect, useState } from "react";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faCircleXmark } from "@fortawesome/free-regular-svg-icons";
-import { Mobile, initMobile } from "@/models/gr24/mobile";
-import { MAPACHE_WS_URL } from "@/consts/config";
-
-function DebugRawLiveWidget() {
- const [socketUrl] = React.useState(`${MAPACHE_WS_URL}/ws/gr24/vdm`);
- const { lastMessage, readyState } = useWebSocket(socketUrl);
- const [messageJson, setMessageJson] = useState(initMobile);
-
- useEffect(() => {
- if (lastMessage !== null) {
- const data = JSON.parse(lastMessage.data);
- setMessageJson(data);
- }
- }, [lastMessage]);
-
- const LoadingComponent = () => {
- if (readyState === ReadyState.CONNECTING) {
- return (
-
- );
- } else if (readyState === ReadyState.CLOSED) {
- return (
-
- );
- } else {
- return (
-
-
-
- );
- }
- };
-
- return (
- <>
-
- {lastMessage ? (
-
-
- {Object.entries(messageJson).map(([key, value]) => (
-
-
{key}:
-
- {value.toString()}
-
-
- ))}
-
-
-
Last Update:
-
- {new Date(messageJson.created_at).toISOString()}
-
-
-
- ) : (
-
- )}
-
- >
- );
-}
-
-export default DebugRawLiveWidget;
diff --git a/dashboard/src/pages/gr24/wheel/WheelPage.tsx b/dashboard/src/pages/gr24/wheel/WheelPage.tsx
deleted file mode 100644
index 2048a20e..00000000
--- a/dashboard/src/pages/gr24/wheel/WheelPage.tsx
+++ /dev/null
@@ -1,106 +0,0 @@
-import Layout from "@/components/Layout";
-import { useEffect, useState } from "react";
-import { Card } from "@/components/ui/card";
-import { Button } from "@/components/ui/button";
-import { vdmLiveWidgets, wheelLiveWidgets } from "@/consts/config";
-import DebugRawLiveWidget from "./widgets/DebugRawLiveWidget";
-
-function WheelPage() {
- const [selectingWidgets, setSelectingWidgets] = useState(false);
- const [widgets, setWidgets] = useState([
- {
- name: "Raw Debug Live",
- width: 600,
- height: 300,
- component: ,
- },
- ]);
-
- useEffect(() => {});
-
- function addToWidgets(widget) {
- if (!widgets.some((item) => item.name === widget.name)) {
- setWidgets((prevWidgets) => [...prevWidgets, widget]);
- }
- }
-
- function removeFromWidgets(widget) {
- setWidgets((prevWidgets) =>
- prevWidgets.filter((item) => item.name !== widget.name),
- );
- }
-
- const SelectWidgetsComponent = () => {
- return (
-
-
- Select Widgets
- {wheelLiveWidgets.map((widget) => (
-
-
{widget.name}
- {widgets.some((item) => item.name === widget.name) ? (
-
- ) : (
-
- )}
-
- ))}
-
-
- );
- };
-
- return (
- <>
-
-
-
-
-
- {selectingWidgets ? (
-
- ) : (
-
- {widgets.map((widget) => (
-
- {widget.component}
-
- ))}
-
- )}
-
- >
- );
-}
-
-export default WheelPage;
diff --git a/dashboard/src/pages/gr24/wheel/widgets/DebugRawLiveWidget.tsx b/dashboard/src/pages/gr24/wheel/widgets/DebugRawLiveWidget.tsx
deleted file mode 100644
index c777a87c..00000000
--- a/dashboard/src/pages/gr24/wheel/widgets/DebugRawLiveWidget.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import { Loader2 } from "lucide-react";
-import useWebSocket, { ReadyState } from "react-use-websocket";
-import React, { useEffect, useState } from "react";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faCircleXmark } from "@fortawesome/free-regular-svg-icons";
-import { Mobile, initMobile } from "@/models/gr24/mobile";
-import { MAPACHE_WS_URL } from "@/consts/config";
-
-function DebugRawLiveWidget() {
- const [socketUrl] = React.useState(`${MAPACHE_WS_URL}/ws/gr24/wheel`);
- const { lastMessage, readyState } = useWebSocket(socketUrl);
- const [messageJson, setMessageJson] = useState(initMobile);
-
- useEffect(() => {
- if (lastMessage !== null) {
- const data = JSON.parse(lastMessage.data);
- setMessageJson(data);
- }
- }, [lastMessage]);
-
- const LoadingComponent = () => {
- if (readyState === ReadyState.CONNECTING) {
- return (
-
- );
- } else if (readyState === ReadyState.CLOSED) {
- return (
-
- );
- } else {
- return (
-
-
-
- );
- }
- };
-
- return (
- <>
-
- {lastMessage ? (
-
-
- {Object.entries(messageJson).map(([key, value]) => (
-
-
{key}:
-
- {value.toString()}
-
-
- ))}
-
-
-
Last Update:
-
- {new Date(messageJson.created_at).toISOString()}
-
-
-
- ) : (
-
- )}
-
- >
- );
-}
-
-export default DebugRawLiveWidget;
From 000a399801e2f024bd4ec19428d12348f6f16425 Mon Sep 17 00:00:00 2001
From: Bharat Kathi
Date: Wed, 19 Feb 2025 18:19:56 -0800
Subject: [PATCH 6/6] dashboard: get rid all gr24 dashboard
---
dashboard/src/main.tsx | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/dashboard/src/main.tsx b/dashboard/src/main.tsx
index fcd1533d..92f7e94a 100644
--- a/dashboard/src/main.tsx
+++ b/dashboard/src/main.tsx
@@ -7,7 +7,6 @@ import "/node_modules/react-resizable/css/styles.css";
import "mapbox-gl/dist/mapbox-gl.css";
import { Toaster } from "./components/ui/sonner.tsx";
import RegisterPage from "./pages/auth/RegisterPage.tsx";
-import DashboardPage from "./pages/gr24/dashboard/DashboardPage.tsx";
import App from "./App.tsx";
const router = createBrowserRouter([
@@ -19,14 +18,6 @@ const router = createBrowserRouter([
path: "/auth/register",
element: ,
},
- {
- path: "/dash",
- element: ,
- },
- {
- path: "/gr24/dash",
- element: ,
- },
]);
ReactDOM.createRoot(document.getElementById("root")!).render(