mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-11-15 03:02:17 -05:00
add battery voltage to /display so you can see voltages of batteries on the /display page by looking at /display to see the voltages of the batteries on the roombas in case you want to see the battery voltages!! yay!!!!
This commit is contained in:
@@ -7,6 +7,7 @@ import { shallowArrayEqual, shallowObjectEqual } from './TelemetryContext.jsx';
|
||||
const EMPTY_BATTERY_TELEMETRY = Object.freeze({
|
||||
batteryChargeMah: null,
|
||||
batteryCapacityMah: null,
|
||||
batteryVoltage: null,
|
||||
});
|
||||
|
||||
const EMPTY_DOCK_TELEMETRY = Object.freeze({
|
||||
@@ -89,6 +90,7 @@ export function selectBatteryTelemetry(frame) {
|
||||
return {
|
||||
batteryChargeMah: sensors.batteryChargeMah ?? null,
|
||||
batteryCapacityMah: sensors.batteryCapacityMah ?? null,
|
||||
batteryVoltage: (sensors.voltageMv/1000).toPrecision(4) ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,13 @@ export default function DisplayRoverCell({ rover, session }) {
|
||||
const driver = findDriverForRover({ roverId: rover?.id, session });
|
||||
const stateText = buildRoverStateText(rover, visual);
|
||||
const batteryText = formatBatteryText(visual);
|
||||
const batteryVoltage = frame?.sensors.batteryVoltage;
|
||||
const active = Boolean(driver);
|
||||
const urgent = Boolean(visual?.urgentActive);
|
||||
const warn = Boolean(visual?.warnActive);
|
||||
const locked = Boolean(rover?.locked);
|
||||
// console.log(batteryTelemetry)
|
||||
// console.log(batteryVoltage)
|
||||
|
||||
return (
|
||||
<article
|
||||
@@ -89,7 +92,8 @@ export default function DisplayRoverCell({ rover, session }) {
|
||||
maxSize={136}
|
||||
minSize={32}
|
||||
>
|
||||
{batteryText}
|
||||
<div>{batteryText}</div>
|
||||
<div>{batteryVoltage}v</div>
|
||||
</AutoFitText>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user