diff --git a/packages/client/src/components/atoms/BatteryIcon.tsx b/packages/client/src/components/atoms/BatteryIcon.tsx
index 5b0afc10..e228899a 100644
--- a/packages/client/src/components/atoms/BatteryIcon.tsx
+++ b/packages/client/src/components/atoms/BatteryIcon.tsx
@@ -1,5 +1,3 @@
-import { useEffect, useState } from "react";
-
import { usePacket } from "@/contexts/PacketContext";
function BatteryIconComponent() {
diff --git a/packages/client/src/components/atoms/FaultCard.tsx b/packages/client/src/components/atoms/FaultCard.tsx
index 35d122f2..4e31a565 100644
--- a/packages/client/src/components/atoms/FaultCard.tsx
+++ b/packages/client/src/components/atoms/FaultCard.tsx
@@ -20,7 +20,7 @@ function FaultCard(props: FaultCardProps) {
diff --git a/packages/client/src/components/containers/TabsContainer.tsx b/packages/client/src/components/containers/TabsContainer.tsx
index d67f2bcc..7171eaed 100644
--- a/packages/client/src/components/containers/TabsContainer.tsx
+++ b/packages/client/src/components/containers/TabsContainer.tsx
@@ -4,7 +4,7 @@ import { Fragment } from "react";
import NavBar from "@/components/tabs/NavBar";
import { type SolarCarRoutes, routes } from "@/objects/TabRoutes";
-function TabsContainer(props: any) {
+function TabsContainer() {
const router = useRouter();
const { slug } = router.query;
diff --git a/packages/client/src/components/global/Loading.tsx b/packages/client/src/components/global/Loading.tsx
index fa5a84ae..06f41a5f 100644
--- a/packages/client/src/components/global/Loading.tsx
+++ b/packages/client/src/components/global/Loading.tsx
@@ -1,5 +1,5 @@
import Image from "next/image";
-import { use, useEffect, useMemo, useState } from "react";
+import { useMemo } from "react";
import { twMerge } from "tailwind-merge";
import { LOADINGSTAGES } from "@/components/global/LoadingWrapper";
diff --git a/packages/client/src/components/molecules/HeroMolecules/CarGraphicComponent.tsx b/packages/client/src/components/molecules/HeroMolecules/CarGraphicComponent.tsx
index c77ed67d..9f21e58f 100644
--- a/packages/client/src/components/molecules/HeroMolecules/CarGraphicComponent.tsx
+++ b/packages/client/src/components/molecules/HeroMolecules/CarGraphicComponent.tsx
@@ -5,10 +5,7 @@ import * as THREE from "three";
import { CarModelComponent } from "@/components/molecules/HeroMolecules/CarMolecules/CarModelComponent";
import { RoadComponent } from "@/components/molecules/HeroMolecules/CarMolecules/RoadComponent";
-import type {
- FaultLocations,
- IndicationLocations,
-} from "@/components/molecules/HeroMolecules/HeroTypes";
+import type { IndicationLocations } from "@/components/molecules/HeroMolecules/HeroTypes";
import { ISeverity } from "@/components/molecules/HeroMolecules/HeroTypes";
import { usePacket } from "@/contexts/PacketContext";
import { ContactShadows, OrbitControls } from "@react-three/drei";
diff --git a/packages/client/src/components/molecules/HeroMolecules/CarMolecules/RoadComponent.tsx b/packages/client/src/components/molecules/HeroMolecules/CarMolecules/RoadComponent.tsx
index ea27c98f..02670ef8 100644
--- a/packages/client/src/components/molecules/HeroMolecules/CarMolecules/RoadComponent.tsx
+++ b/packages/client/src/components/molecules/HeroMolecules/CarMolecules/RoadComponent.tsx
@@ -11,7 +11,6 @@ interface roadComponentProps {
}
export function RoadComponent(props: roadComponentProps) {
const geometry = new PlaneGeometry(0.5, props.size * 5);
- const planeGeom = new PlaneGeometry(9, props.size * 7);
return (
<>
-
+
);
}
diff --git a/packages/client/src/components/tabs/BatteryTab.tsx b/packages/client/src/components/tabs/BatteryTab.tsx
index f0b05417..fe5f9621 100644
--- a/packages/client/src/components/tabs/BatteryTab.tsx
+++ b/packages/client/src/components/tabs/BatteryTab.tsx
@@ -1,14 +1,7 @@
import PISTransformer from "@/components/transformers/PISTransformer";
-import { usePacket } from "@/contexts/PacketContext";
import Battery from "@/objects/PIS/PIS.battery";
function BatteryTab() {
- const { currentPacket } = usePacket();
-
- const fakeBatteryData = currentPacket.Battery;
-
- const fakeAuxBMSData = currentPacket.AuxBms;
-
return (
diff --git a/packages/client/src/components/tabs/NavBar.tsx b/packages/client/src/components/tabs/NavBar.tsx
index 0e4d4057..9c62c9d7 100644
--- a/packages/client/src/components/tabs/NavBar.tsx
+++ b/packages/client/src/components/tabs/NavBar.tsx
@@ -6,12 +6,12 @@ import { type SolarCarRoutes, routes } from "@/objects/TabRoutes";
import Tab from "@mui/material/Tab";
import Tabs from "@mui/material/Tabs";
-function NavBar(props: any): JSX.Element {
+function NavBar(): JSX.Element {
const router = useRouter();
const getCurrentPath = () => {
let currIndex = "1";
- routes.map((route: SolarCarRoutes, i: number) => {
+ routes.map((route: SolarCarRoutes) => {
if (route.path === router.pathname) {
currIndex = route.value.toString();
}
diff --git a/packages/client/src/contexts/AppStateContext.tsx b/packages/client/src/contexts/AppStateContext.tsx
index c179188e..e63016f1 100644
--- a/packages/client/src/contexts/AppStateContext.tsx
+++ b/packages/client/src/contexts/AppStateContext.tsx
@@ -77,15 +77,15 @@ export function AppStateContextProvider({ children }: Props) {
}));
};
- const saveSettingsToLocalStorage = () => {
- localStorage.setItem("settings", JSON.stringify(currentAppState));
- };
-
useEffect(() => {
fetchSettingsFromLocalStorage();
}, []);
useEffect(() => {
+ const saveSettingsToLocalStorage = () => {
+ localStorage.setItem("settings", JSON.stringify(currentAppState));
+ };
+
if (!currentAppState.loading) {
saveSettingsToLocalStorage();
}
diff --git a/packages/client/src/contexts/FaultsContext.tsx b/packages/client/src/contexts/FaultsContext.tsx
index ec213d7f..6668d00b 100644
--- a/packages/client/src/contexts/FaultsContext.tsx
+++ b/packages/client/src/contexts/FaultsContext.tsx
@@ -36,43 +36,44 @@ function incrementOrDropFaultTimer(faults: Map
) {
export function FaultsContextProvider({ children }: Props) {
const faults = Faults();
const trueFaultsRef = useRef(new Map());
- function processFaultSection(section: I_PIS) {
- Object.keys(section).forEach((key) => {
- const value = section[key];
- if (Array.isArray(value)) {
- value.forEach((fault) => {
- if (fault?.data[0]?.value === false) {
- return;
- }
- const existingFault = trueFaultsRef.current.get(fault.name);
- // reset fault timer
- if (existingFault) {
- trueFaultsRef.current.set(fault.name, {
- ...existingFault,
- faultTimer: 0,
- });
- return;
- }
- // add to trueFaults
- const newFault: IFaults = {
- faultTimer: 0,
- severity: fault?.data[0]?.severity as ISeverity,
- indicationLocation: fault?.data[0]
- ?.indicationLocation as FaultLocations,
- value: !!fault?.data[0]?.value,
- name: fault.name,
- };
- trueFaultsRef.current.set(fault.name, newFault);
- });
- } else {
- processFaultSection(value as I_PIS);
- }
- });
- }
+
const currentFaults = useMemo(() => {
+ function processFaultSection(section: I_PIS) {
+ Object.keys(section).forEach((key) => {
+ const value = section[key];
+ if (Array.isArray(value)) {
+ value.forEach((fault) => {
+ if (fault?.data[0]?.value === false) {
+ return;
+ }
+ const existingFault = trueFaultsRef.current.get(fault.name);
+ // reset fault timer
+ if (existingFault) {
+ trueFaultsRef.current.set(fault.name, {
+ ...existingFault,
+ faultTimer: 0,
+ });
+ return;
+ }
+ // add to trueFaults
+ const newFault: IFaults = {
+ faultTimer: 0,
+ severity: fault?.data[0]?.severity as ISeverity,
+ indicationLocation: fault?.data[0]
+ ?.indicationLocation as FaultLocations,
+ value: !!fault?.data[0]?.value,
+ name: fault.name,
+ };
+ trueFaultsRef.current.set(fault.name, newFault);
+ });
+ } else {
+ processFaultSection(value as I_PIS);
+ }
+ });
+ }
+
processFaultSection(faults);
incrementOrDropFaultTimer(trueFaultsRef.current);
- console.log(trueFaultsRef.current);
return trueFaultsRef.current;
}, [faults]);
return (
diff --git a/packages/client/src/contexts/PacketContext.tsx b/packages/client/src/contexts/PacketContext.tsx
index 7bd5a183..2811a984 100644
--- a/packages/client/src/contexts/PacketContext.tsx
+++ b/packages/client/src/contexts/PacketContext.tsx
@@ -38,6 +38,7 @@ export function PacketContextProvider({
function onPacket(packet: ITelemetryData) {
setCurrentPacket(packet);
}
+
useEffect(() => {
if (isFaking) {
const interval = setInterval(() => {
diff --git a/packages/client/src/objects/PIS/PIS.faults.tsx b/packages/client/src/objects/PIS/PIS.faults.tsx
index 55e0d67d..1b8877aa 100644
--- a/packages/client/src/objects/PIS/PIS.faults.tsx
+++ b/packages/client/src/objects/PIS/PIS.faults.tsx
@@ -4,7 +4,6 @@ import {
} from "@/components/molecules/HeroMolecules/HeroTypes";
import { usePacket } from "@/contexts/PacketContext";
import type I_PIS from "@/objects/PIS/PIS.interface";
-import { UnitType } from "@/objects/PIS/PIS.interface";
const Faults = (): I_PIS => {
const { currentPacket } = usePacket();
diff --git a/packages/client/src/objects/telemetry-data.interface.ts b/packages/client/src/objects/telemetry-data.interface.ts
index fedb6057..bc082366 100644
--- a/packages/client/src/objects/telemetry-data.interface.ts
+++ b/packages/client/src/objects/telemetry-data.interface.ts
@@ -1,7 +1,3 @@
-enum Motor {
- RightMotor = 1,
- LeftMotor = 0,
-}
export default interface ITelemetryData {
PacketTitle: string;
TimeStamp: number;