Skip to content

Commit

Permalink
Add collector health
Browse files Browse the repository at this point in the history
  • Loading branch information
Seth10001 committed Jul 14, 2024
1 parent 835b413 commit 9d70026
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/controllers/live.server.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import MPPT_RX3 from "../shared/models/MPPT/RX3";
import MPPT_RX4 from "../shared/models/MPPT/RX4";
import MPPT_RX5 from "../shared/models/MPPT/RX5";
import GPS from "../shared/models/GPS/GPS";
import Alive from "../shared/models/PI/Alive"
import DistanceTraveled from "../shared/models/Stats/DistanceTraveled";
import LapCount from "../shared/models/Stats/LapCount";
import PowerBoard_RX0 from "../shared/models/PowerBoard/RX0";
Expand Down Expand Up @@ -66,6 +67,9 @@ exports.data = async (req, res: Response<DataResponse>) => {
powerBoard: {
rx0: await getMostRecent(PowerBoard_RX0),
rx1: await getMostRecent(PowerBoard_RX1),
},
pi: {
alive: await getMostRecent(Alive),
}
})
};
15 changes: 15 additions & 0 deletions client/src/pages/LiveTelemetry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ function LiveTelemetry() {
Power Board
</Nav.Link>
</Nav.Item>
<Nav.Item>
<Nav.Link as={NavLink} to="/collector-health">
Collector Health
</Nav.Link>
</Nav.Item>
</Nav>

<Routes>
Expand Down Expand Up @@ -292,6 +297,16 @@ function LiveTelemetry() {
<TelemetryCAN config={powerBoardShape} data={data?.powerBoard} />
}
/>
<Route
path="/collector-health"
element={
<>
<br />
<p>Last heard from the PI on {String(data?.pi?.alive?.createdAt)}</p>
<br />
</>
}
/>
</Routes>
</>
);
Expand Down
4 changes: 4 additions & 0 deletions client/src/shared/sdk/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { DistanceTraveled_Type } from "../models/Stats/DistanceTraveled";
import { LapCount_Type } from "../models/Stats/LapCount";
import PowerBoard_RX0 from "../models/PowerBoard/RX0";
import PowerBoard_RX1 from "../models/PowerBoard/RX1";
import Alive from "../models/PI/Alive";

export const INCHES_PER_MILE = 63360;
/**
Expand Down Expand Up @@ -67,6 +68,9 @@ export interface CanData {
rx0: PowerBoard_RX0;
rx1: PowerBoard_RX1;
};
pi: {
alive: Alive;
}
}

export interface DataResponse extends CanData {
Expand Down

0 comments on commit 9d70026

Please sign in to comment.