Skip to content
Open
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
5 changes: 5 additions & 0 deletions gui/public/i18n/en/translation.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ tracker-table-column-name = Name
tracker-table-column-type = Type
tracker-table-column-battery = Battery
tracker-table-column-ping = Ping
tracker-table-column-packet_loss = Packet Loss
tracker-table-column-tps = TPS
tracker-table-column-temperature = Temp. °C
tracker-table-column-linear-acceleration = Accel. X/Y/Z
Expand Down Expand Up @@ -370,6 +371,10 @@ tracker-infos-magnetometer-status-v1 = { $status ->
[ENABLED] Enabled
}

tracker-infos-packet_loss = Packet Loss
tracker-infos-packets_lost = Packets Lost
tracker-infos-packets_received = Packets Received

## Tracker settings
tracker-settings-back = Go back to trackers list
tracker-settings-title = Tracker settings
Expand Down
28 changes: 28 additions & 0 deletions gui/src/components/tracker/TrackerSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,34 @@ export function TrackerSettingsPage() {
{tracker?.device?.hardwareInfo?.networkProtocolVersion || '--'}
</Typography>
</div>
{tracker?.device?.hardwareStatus?.packetsReceived !== null && (
<>
<div className="flex justify-between">
<Typography>
{l10n.getString('tracker-infos-packet_loss')}
</Typography>
<Typography>
{((tracker?.device?.hardwareStatus?.packetLoss ?? 0) * 100).toFixed(0)}%
</Typography>
</div>
<div className="flex justify-between">
<Typography>
{l10n.getString('tracker-infos-packets_lost')}
</Typography>
<Typography>
{tracker?.device?.hardwareStatus?.packetsLost ?? '0'}
</Typography>
</div>
<div className="flex justify-between">
<Typography>
{l10n.getString('tracker-infos-packets_received')}
</Typography>
<Typography>
{tracker?.device?.hardwareStatus?.packetsReceived ?? '0'}
</Typography>
</div>
</>
)}
</div>
{tracker?.tracker && (
<IMUVisualizerWidget tracker={tracker?.tracker} />
Expand Down
20 changes: 20 additions & 0 deletions gui/src/components/tracker/TrackerWifi.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
import { WifiIcon } from '@/components/commons/icon/WifiIcon';
import { Typography } from '@/components/commons/Typography';
import { Tooltip } from '@/components/commons/Tooltip';

export function TrackerWifi({
rssi,
ping,
rssiShowNumeric,
disabled,
packetLoss,
packetsLost,
packetsReceived,
showPacketLoss = false,
textColor = 'primary',
}: {
rssi: number | null;
ping: number | null;
packetLoss?: number | null;
packetsLost?: number | null;
packetsReceived?: number | null;
showPacketLoss?: boolean;
rssiShowNumeric?: boolean;
disabled?: boolean;
textColor?: string;
Expand All @@ -31,6 +40,17 @@ export function TrackerWifi({
{rssi} dBm
</Typography>
)}
{showPacketLoss && packetsReceived != null && (
<Tooltip
preferedDirection="top"
content={<Typography id="tracker-infos-packet_loss" />}
>
<Typography
color={textColor}
whitespace="whitespace-nowrap"
>{`${((packetLoss ?? 0) * 100).toFixed(0)}% (${packetsLost ?? 0} / ${packetsReceived})`}</Typography>
</Tooltip>
)}
</div>
)) || (
<div className="flex flex-col justify-center w-12">
Expand Down
7 changes: 6 additions & 1 deletion gui/src/components/tracker/TrackersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ function Row({
ping={device?.hardwareStatus?.ping}
disabled={tracker.status === TrackerStatusEnum.DISCONNECTED}
textColor={fontColor}
showPacketLoss
packetLoss={device.hardwareStatus.packetLoss}
packetsLost={device.hardwareStatus.packetsLost}
packetsReceived={device.hardwareStatus.packetsReceived}
/>
)}
</Cell>
Expand Down Expand Up @@ -330,7 +334,7 @@ export function TrackersTable({
'minmax(150px, 1.5fr)', // Name
'minmax(100px, 1fr)', // Type
'minmax(60px, 1fr)', // Battery
'6rem', // Ping (w-24)
'8rem', // Ping (w-24)
'minmax(60px, 1fr)', // TPS
config?.devSettings?.preciseRotation ? '11rem' : '8rem', // Rotation
'minmax(60px, 1fr)', // Temp
Expand All @@ -354,6 +358,7 @@ export function TrackersTable({
<Header name={'tracker-table-column-type'} />
<Header name={'tracker-table-column-battery'} />
<Header name={'tracker-table-column-ping'} />
<Header name={'tracker-table-column-packet_loss'} />
<Header name={'tracker-table-column-tps'} />
<Header name={'tracker-table-column-rotation'} />
<Header name={'tracker-table-column-temperature'} last={!moreInfo} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,17 @@ public static int createDeviceData(
HardwareStatus.addRssi(fbb, (short) tracker.getSignalStrength().floatValue());
}

if (tracker.getPacketLoss() != null) {
HardwareStatus.addPacketLoss(fbb, tracker.getPacketLoss());
}

if (tracker.getPacketsLost() != null) {
HardwareStatus.addPacketsLost(fbb, tracker.getPacketsLost());
}

if (tracker.getPacketsReceived() != null) {
HardwareStatus.addPacketsReceived(fbb, tracker.getPacketsReceived());
}

int hardwareDataOffset = HardwareStatus.endHardwareStatus(fbb);
int hardwareInfoOffset = DataFeedBuilder.createHardwareInfo(fbb, device);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ class Tracker @JvmOverloads constructor(
var signalStrength: Int? = null
var temperature: Float? = null
var button: Int? = null
var packetsReceived: Int? = null
var packetsLost: Int? = null
var packetLoss: Float? = null
var customName: String? = null
var magStatus: MagnetometerStatus = magStatus
private set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ class HIDCommon {
var svr_status: Int? = null
// var status: Int? = null // raw status from tracker
var rssi: Int? = null
var packets_received: Int? = null
var packets_lost: Int? = null
var windows_hit: Int? = null
var windows_missed: Int? = null

// Tracker packets
when (packetType) {
Expand Down Expand Up @@ -207,6 +211,10 @@ class HIDCommon {
3 -> { // status
svr_status = dataReceived[i + 2].toUByte().toInt()
// status = dataReceived[i + 3].toUByte().toInt()
packets_received = dataReceived[i + 4].toUByte().toInt()
packets_lost = dataReceived[i + 5].toUByte().toInt()
windows_hit = dataReceived[i + 6].toUByte().toInt()
windows_missed = dataReceived[i + 7].toUByte().toInt()
rssi = dataReceived[i + 15].toUByte().toInt()
}

Expand Down Expand Up @@ -296,6 +304,11 @@ class HIDCommon {
if (rssi != null) {
tracker.signalStrength = -rssi
}
if (packets_received != null && packets_lost != null) {
tracker.packetsReceived = packets_received
tracker.packetsLost = packets_lost
tracker.packetLoss = if (packets_lost == 0) 0.0f else packets_lost.toFloat() / (packets_received + packets_lost).toFloat()
}

// Assign rotation and acceleration
if (packetType == 1 || packetType == 4) {
Expand Down
Loading