mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-04-06 02:01:58 +02:00
add firmware date to new field
This commit is contained in:
@@ -407,6 +407,7 @@ tracker-settings-update = Update now
|
||||
tracker-settings-update-title = Firmware version
|
||||
tracker-settings-current-version = Current
|
||||
tracker-settings-latest-version = Latest
|
||||
tracker-settings-build-date = Build Date
|
||||
|
||||
|
||||
## Tracker part card info
|
||||
|
||||
@@ -208,6 +208,15 @@ export function TrackerSettingsPage() {
|
||||
Firmware version
|
||||
</Typography>
|
||||
<div className="flex gap-2 flex-col">
|
||||
<div className="flex justify-between gap-2">
|
||||
<Typography id="tracker-settings-build-date" />
|
||||
<Typography
|
||||
whitespace="whitespace-pre-wrap"
|
||||
textAlign="text-end"
|
||||
>
|
||||
{tracker?.device?.hardwareInfo?.firmwareDate}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="flex justify-between gap-2">
|
||||
<Typography id="tracker-settings-current-version" />
|
||||
<Typography
|
||||
|
||||
@@ -39,6 +39,10 @@ public class DataFeedBuilder {
|
||||
? fbb.createString(device.getManufacturer())
|
||||
: 0;
|
||||
|
||||
int firmwareDateOffset = device.getFirmwareDate() != null
|
||||
? fbb.createString(device.getFirmwareDate())
|
||||
: 0;
|
||||
|
||||
int hardwareIdentifierOffset = fbb.createString(device.getHardwareIdentifier());
|
||||
|
||||
HardwareInfo.startHardwareInfo(fbb);
|
||||
@@ -46,6 +50,8 @@ public class DataFeedBuilder {
|
||||
HardwareInfo.addManufacturer(fbb, manufacturerOffset);
|
||||
HardwareInfo.addHardwareIdentifier(fbb, hardwareIdentifierOffset);
|
||||
|
||||
HardwareInfo.addFirmwareDate(fbb, firmwareDateOffset);
|
||||
|
||||
if (device instanceof UDPDevice udpDevice) {
|
||||
var address = udpDevice.getIpAddress().getAddress();
|
||||
HardwareInfo
|
||||
@@ -68,6 +74,7 @@ public class DataFeedBuilder {
|
||||
|
||||
HardwareInfo.addMcuId(fbb, device.getMcuType().getSolarType());
|
||||
HardwareInfo.addOfficialBoardType(fbb, device.getBoardType().getSolarType());
|
||||
|
||||
return HardwareInfo.endHardwareInfo(fbb);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ open class Device(val magSupport: Boolean = false) {
|
||||
open val id: Int = nextLocalDeviceId.incrementAndGet()
|
||||
open var name: String? = null
|
||||
open var firmwareVersion: String? = null
|
||||
open var firmwareDate: String? = null
|
||||
open var manufacturer: String? = null
|
||||
open val trackers: MutableMap<Int, Tracker> = ConcurrentHashMap()
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ class HIDCommon {
|
||||
var button: Int? = null
|
||||
// var imu_id: Int? = null
|
||||
// var mag_id: Int? = null
|
||||
// var fw_date: Int? = null
|
||||
var fw_date: Int? = null
|
||||
var fw_major: Int? = null
|
||||
var fw_minor: Int? = null
|
||||
var fw_patch: Int? = null
|
||||
@@ -165,7 +165,7 @@ class HIDCommon {
|
||||
// imu_id = dataReceived[i + 8].toUByte().toInt()
|
||||
// mag_id = dataReceived[i + 9].toUByte().toInt()
|
||||
// ushort little endian
|
||||
// fw_date = dataReceived[i + 11].toUByte().toInt() shl 8 or dataReceived[i + 10].toUByte().toInt()
|
||||
fw_date = dataReceived[i + 11].toUByte().toInt() shl 8 or dataReceived[i + 10].toUByte().toInt()
|
||||
fw_major = dataReceived[i + 12].toUByte().toInt()
|
||||
fw_minor = dataReceived[i + 13].toUByte().toInt()
|
||||
fw_patch = dataReceived[i + 14].toUByte().toInt()
|
||||
@@ -280,12 +280,12 @@ class HIDCommon {
|
||||
// Nothing to do now..
|
||||
}
|
||||
}
|
||||
// if (fw_date != null) {
|
||||
// val firmwareYear = 2020 + (fw_date shr 9 and 127)
|
||||
// val firmwareMonth = fw_date shr 5 and 15
|
||||
// val firmwareDay = fw_date and 31
|
||||
// val firmwareDate = String.format("%04d-%02d-%02d", firmwareYear, firmwareMonth, firmwareDay)
|
||||
// }
|
||||
if (fw_date != null) {
|
||||
val firmwareYear = 2020 + (fw_date shr 9 and 127)
|
||||
val firmwareMonth = fw_date shr 5 and 15
|
||||
val firmwareDay = fw_date and 31
|
||||
device.firmwareDate = String.format("%04d-%02d-%02d", firmwareYear, firmwareMonth, firmwareDay)
|
||||
}
|
||||
if (fw_major != null && fw_minor != null && fw_patch != null) {
|
||||
device.firmwareVersion = "$fw_major.$fw_minor.$fw_patch"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user