Skip to content

Commit db9a422

Browse files
committed
add firmware date to new field
1 parent b979d93 commit db9a422

File tree

5 files changed

+26
-8
lines changed

5 files changed

+26
-8
lines changed

gui/public/i18n/en/translation.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ tracker-settings-update = Update now
407407
tracker-settings-update-title = Firmware version
408408
tracker-settings-current-version = Current
409409
tracker-settings-latest-version = Latest
410+
tracker-settings-build-date = Build Date
410411
411412
412413
## Tracker part card info

gui/src/components/tracker/TrackerSettings.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,15 @@ export function TrackerSettingsPage() {
208208
Firmware version
209209
</Typography>
210210
<div className="flex gap-2 flex-col">
211+
<div className="flex justify-between gap-2">
212+
<Typography id="tracker-settings-build-date" />
213+
<Typography
214+
whitespace="whitespace-pre-wrap"
215+
textAlign="text-end"
216+
>
217+
{tracker?.device?.hardwareInfo?.firmwareDate}
218+
</Typography>
219+
</div>
211220
<div className="flex justify-between gap-2">
212221
<Typography id="tracker-settings-current-version" />
213222
<Typography

server/core/src/main/java/dev/slimevr/protocol/datafeed/DataFeedBuilder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,19 @@ public static int createHardwareInfo(FlatBufferBuilder fbb, Device device) {
3939
? fbb.createString(device.getManufacturer())
4040
: 0;
4141

42+
int firmwareDateOffset = device.getFirmwareDate() != null
43+
? fbb.createString(device.getFirmwareDate())
44+
: 0;
45+
4246
int hardwareIdentifierOffset = fbb.createString(device.getHardwareIdentifier());
4347

4448
HardwareInfo.startHardwareInfo(fbb);
4549
HardwareInfo.addFirmwareVersion(fbb, nameOffset);
4650
HardwareInfo.addManufacturer(fbb, manufacturerOffset);
4751
HardwareInfo.addHardwareIdentifier(fbb, hardwareIdentifierOffset);
4852

53+
HardwareInfo.addFirmwareDate(fbb, firmwareDateOffset);
54+
4955
if (device instanceof UDPDevice udpDevice) {
5056
var address = udpDevice.getIpAddress().getAddress();
5157
HardwareInfo
@@ -68,6 +74,7 @@ public static int createHardwareInfo(FlatBufferBuilder fbb, Device device) {
6874

6975
HardwareInfo.addMcuId(fbb, device.getMcuType().getSolarType());
7076
HardwareInfo.addOfficialBoardType(fbb, device.getBoardType().getSolarType());
77+
7178
return HardwareInfo.endHardwareInfo(fbb);
7279
}
7380

server/core/src/main/java/dev/slimevr/tracking/trackers/Device.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ open class Device(val magSupport: Boolean = false) {
1313
open val id: Int = nextLocalDeviceId.incrementAndGet()
1414
open var name: String? = null
1515
open var firmwareVersion: String? = null
16+
open var firmwareDate: String? = null
1617
open var manufacturer: String? = null
1718
open val trackers: MutableMap<Int, Tracker> = ConcurrentHashMap()
1819

server/core/src/main/java/dev/slimevr/tracking/trackers/hid/HIDCommon.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class HIDCommon {
145145
var mcu_id: Int? = null
146146
// var imu_id: Int? = null
147147
// var mag_id: Int? = null
148-
// var fw_date: Int? = null
148+
var fw_date: Int? = null
149149
var fw_major: Int? = null
150150
var fw_minor: Int? = null
151151
var fw_patch: Int? = null
@@ -164,7 +164,7 @@ class HIDCommon {
164164
// imu_id = dataReceived[i + 8].toUByte().toInt()
165165
// mag_id = dataReceived[i + 9].toUByte().toInt()
166166
// ushort little endian
167-
// fw_date = dataReceived[i + 11].toUByte().toInt() shl 8 or dataReceived[i + 10].toUByte().toInt()
167+
fw_date = dataReceived[i + 11].toUByte().toInt() shl 8 or dataReceived[i + 10].toUByte().toInt()
168168
fw_major = dataReceived[i + 12].toUByte().toInt()
169169
fw_minor = dataReceived[i + 13].toUByte().toInt()
170170
fw_patch = dataReceived[i + 14].toUByte().toInt()
@@ -248,12 +248,12 @@ class HIDCommon {
248248
device.mcuType = mcuType!!
249249
}
250250
}
251-
// if (fw_date != null) {
252-
// val firmwareYear = 2020 + (fw_date shr 9 and 127)
253-
// val firmwareMonth = fw_date shr 5 and 15
254-
// val firmwareDay = fw_date and 31
255-
// val firmwareDate = String.format("%04d-%02d-%02d", firmwareYear, firmwareMonth, firmwareDay)
256-
// }
251+
if (fw_date != null) {
252+
val firmwareYear = 2020 + (fw_date shr 9 and 127)
253+
val firmwareMonth = fw_date shr 5 and 15
254+
val firmwareDay = fw_date and 31
255+
device.firmwareDate = String.format("%04d-%02d-%02d", firmwareYear, firmwareMonth, firmwareDay)
256+
}
257257
if (fw_major != null && fw_minor != null && fw_patch != null) {
258258
device.firmwareVersion = "$fw_major.$fw_minor.$fw_patch"
259259
}

0 commit comments

Comments
 (0)