tirecheck-device-sdk 0.2.65 → 0.2.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +238 -31
- package/dist/index.d.cts +251 -2
- package/dist/index.d.mts +251 -2
- package/dist/index.d.ts +251 -2
- package/dist/index.mjs +238 -31
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -228,6 +228,14 @@ const bridgeTools = {
|
|
|
228
228
|
hexToDecimalArray(hex) {
|
|
229
229
|
return hex.match(/.{1,2}/g)?.map((byte) => Number.parseInt(byte, 16)) || [];
|
|
230
230
|
},
|
|
231
|
+
/** Combine little-endian bytes (low byte first) into a single integer. */
|
|
232
|
+
bytesToInt(bytes) {
|
|
233
|
+
return bytes.reduce((acc, byte, index) => acc + ((byte || 0) << 8 * index), 0);
|
|
234
|
+
},
|
|
235
|
+
/** Split an integer into `byteCount` little-endian bytes (low byte first). */
|
|
236
|
+
intToBytes(value, byteCount) {
|
|
237
|
+
return Array.from({ length: byteCount }, (_unused, index) => value >> 8 * index & 255);
|
|
238
|
+
},
|
|
231
239
|
getFwVersion(payload) {
|
|
232
240
|
if (payload?.length !== 3) {
|
|
233
241
|
console.warn("Could not process FwVersion ", payload);
|
|
@@ -246,9 +254,7 @@ const bridgeTools = {
|
|
|
246
254
|
},
|
|
247
255
|
convertBarToKpaByte(deviceId, value) {
|
|
248
256
|
if (!value) return 0;
|
|
249
|
-
const
|
|
250
|
-
if (!deviceData) throw new Error(`Cannot convert bar to kpa byte, no device data found: ${deviceId}`);
|
|
251
|
-
const bitValue = deviceData.name.includes("030717") ? 6.7 : 5.0625;
|
|
257
|
+
const bitValue = this.usesKpaPressure(deviceId) ? 1 : 5.0625;
|
|
252
258
|
return ___default.round((value + 1) * 100 / bitValue);
|
|
253
259
|
},
|
|
254
260
|
convertSensorIdForBridge(sensorId) {
|
|
@@ -271,9 +277,7 @@ const bridgeTools = {
|
|
|
271
277
|
if (!___default.isNumber(value)) {
|
|
272
278
|
throw new TypeError("Value has to be a number");
|
|
273
279
|
}
|
|
274
|
-
const
|
|
275
|
-
if (!deviceData) throw new Error(`Cannot convert kpa byte to bar, no device data found: ${deviceId}`);
|
|
276
|
-
const bitValue = deviceData.name.includes("030717") ? 6.7 : 5.0625;
|
|
280
|
+
const bitValue = this.usesKpaPressure(deviceId) ? 1 : 5.0625;
|
|
277
281
|
const rawBar = value * bitValue / 100;
|
|
278
282
|
return ___default.round(Math.max(rawBar - decrementValue, 0), 1);
|
|
279
283
|
},
|
|
@@ -287,6 +291,9 @@ const bridgeTools = {
|
|
|
287
291
|
}
|
|
288
292
|
return false;
|
|
289
293
|
},
|
|
294
|
+
usesKpaPressure(deviceId) {
|
|
295
|
+
return this.isVersionGreaterThan(deviceId, "1.1.F");
|
|
296
|
+
},
|
|
290
297
|
convertSensorIdFromBridge(sensorId) {
|
|
291
298
|
if (sensorId.startsWith("B")) {
|
|
292
299
|
return Number.parseInt(sensorId, 16).toString();
|
|
@@ -1266,6 +1273,78 @@ const bridgeCommandStructures = {
|
|
|
1266
1273
|
}
|
|
1267
1274
|
}
|
|
1268
1275
|
},
|
|
1276
|
+
/**
|
|
1277
|
+
* kPa per-axle pressure layout used from FW 1.2.0 onwards (same sub-command 0x30 as `pressuresPerAxle`).
|
|
1278
|
+
* Each axle packs the same three values (set; min; max) but every value is a 2-byte little-endian raw kPa
|
|
1279
|
+
* uint16 (no 5.0625 bit scaling), so each axle is 6 bytes instead of 3. Selected at runtime via
|
|
1280
|
+
* `bridgeTools.usesKpaPressure(deviceId)`.
|
|
1281
|
+
*/
|
|
1282
|
+
pressuresPerAxleKpa: {
|
|
1283
|
+
id: [98, 48],
|
|
1284
|
+
name: "pressuresPerAxleKpa",
|
|
1285
|
+
structure: {
|
|
1286
|
+
axle01: {
|
|
1287
|
+
size: 6,
|
|
1288
|
+
description: "Axle 01 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1289
|
+
},
|
|
1290
|
+
axle02: {
|
|
1291
|
+
size: 6,
|
|
1292
|
+
description: "Axle 02 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1293
|
+
},
|
|
1294
|
+
axle03: {
|
|
1295
|
+
size: 6,
|
|
1296
|
+
description: "Axle 03 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1297
|
+
},
|
|
1298
|
+
axle04: {
|
|
1299
|
+
size: 6,
|
|
1300
|
+
description: "Axle 04 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1301
|
+
},
|
|
1302
|
+
axle05: {
|
|
1303
|
+
size: 6,
|
|
1304
|
+
description: "Axle 05 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1305
|
+
},
|
|
1306
|
+
axle06: {
|
|
1307
|
+
size: 6,
|
|
1308
|
+
description: "Axle 06 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1309
|
+
},
|
|
1310
|
+
axle07: {
|
|
1311
|
+
size: 6,
|
|
1312
|
+
description: "Axle 07 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1313
|
+
},
|
|
1314
|
+
axle08: {
|
|
1315
|
+
size: 6,
|
|
1316
|
+
description: "Axle 08 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1317
|
+
},
|
|
1318
|
+
axle09: {
|
|
1319
|
+
size: 6,
|
|
1320
|
+
description: "Axle 09 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1321
|
+
},
|
|
1322
|
+
axle10: {
|
|
1323
|
+
size: 6,
|
|
1324
|
+
description: "Axle 10 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1325
|
+
},
|
|
1326
|
+
axle11: {
|
|
1327
|
+
size: 6,
|
|
1328
|
+
description: "Axle 11 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1329
|
+
},
|
|
1330
|
+
axle12: {
|
|
1331
|
+
size: 6,
|
|
1332
|
+
description: "Axle 12 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1333
|
+
},
|
|
1334
|
+
axle13: {
|
|
1335
|
+
size: 6,
|
|
1336
|
+
description: "Axle 13 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1337
|
+
},
|
|
1338
|
+
axle14: {
|
|
1339
|
+
size: 6,
|
|
1340
|
+
description: "Axle 14 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1341
|
+
},
|
|
1342
|
+
axle15: {
|
|
1343
|
+
size: 6,
|
|
1344
|
+
description: "Axle 15 set pressure; min pressure; max pressure (2-byte little-endian kPa values)"
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
},
|
|
1269
1348
|
autolearnSettings: {
|
|
1270
1349
|
id: [98, 160],
|
|
1271
1350
|
name: "autolearnSettings",
|
|
@@ -1571,6 +1650,95 @@ const bridgeCommandStructures = {
|
|
|
1571
1650
|
version: "1.0.3"
|
|
1572
1651
|
}
|
|
1573
1652
|
}
|
|
1653
|
+
},
|
|
1654
|
+
idsPerWheel: {
|
|
1655
|
+
// base sub-command id, the actual axle is addressed via `0x20 + axleIndex` (0x20 - 0x2F)
|
|
1656
|
+
id: [98, 32],
|
|
1657
|
+
name: "idsPerWheel",
|
|
1658
|
+
structure: {
|
|
1659
|
+
wheel01: {
|
|
1660
|
+
size: 4,
|
|
1661
|
+
description: "Wheel 01 sensor ID (4-byte, little-endian)"
|
|
1662
|
+
},
|
|
1663
|
+
wheel02: {
|
|
1664
|
+
size: 4,
|
|
1665
|
+
description: "Wheel 02 sensor ID (4-byte, little-endian)"
|
|
1666
|
+
},
|
|
1667
|
+
wheel03: {
|
|
1668
|
+
size: 4,
|
|
1669
|
+
description: "Wheel 03 sensor ID (4-byte, little-endian)"
|
|
1670
|
+
},
|
|
1671
|
+
wheel04: {
|
|
1672
|
+
size: 4,
|
|
1673
|
+
description: "Wheel 04 sensor ID (4-byte, little-endian)"
|
|
1674
|
+
},
|
|
1675
|
+
wheel05: {
|
|
1676
|
+
size: 4,
|
|
1677
|
+
description: "Wheel 05 sensor ID (4-byte, little-endian)"
|
|
1678
|
+
},
|
|
1679
|
+
wheel06: {
|
|
1680
|
+
size: 4,
|
|
1681
|
+
description: "Wheel 06 sensor ID (4-byte, little-endian), left-outer position"
|
|
1682
|
+
},
|
|
1683
|
+
wheel07: {
|
|
1684
|
+
size: 4,
|
|
1685
|
+
description: "Wheel 07 sensor ID (4-byte, little-endian), left-inner position"
|
|
1686
|
+
},
|
|
1687
|
+
wheel08: {
|
|
1688
|
+
size: 4,
|
|
1689
|
+
description: "Wheel 08 sensor ID (4-byte, little-endian), center / spare position"
|
|
1690
|
+
},
|
|
1691
|
+
wheel09: {
|
|
1692
|
+
size: 4,
|
|
1693
|
+
description: "Wheel 09 sensor ID (4-byte, little-endian), right-inner position"
|
|
1694
|
+
},
|
|
1695
|
+
wheel10: {
|
|
1696
|
+
size: 4,
|
|
1697
|
+
description: "Wheel 10 sensor ID (4-byte, little-endian), right-outer position"
|
|
1698
|
+
},
|
|
1699
|
+
wheel11: {
|
|
1700
|
+
size: 4,
|
|
1701
|
+
description: "Wheel 11 sensor ID (4-byte, little-endian)"
|
|
1702
|
+
},
|
|
1703
|
+
wheel12: {
|
|
1704
|
+
size: 4,
|
|
1705
|
+
description: "Wheel 12 sensor ID (4-byte, little-endian)"
|
|
1706
|
+
},
|
|
1707
|
+
wheel13: {
|
|
1708
|
+
size: 4,
|
|
1709
|
+
description: "Wheel 13 sensor ID (4-byte, little-endian)"
|
|
1710
|
+
},
|
|
1711
|
+
wheel14: {
|
|
1712
|
+
size: 4,
|
|
1713
|
+
description: "Wheel 14 sensor ID (4-byte, little-endian)"
|
|
1714
|
+
},
|
|
1715
|
+
wheel15: {
|
|
1716
|
+
size: 4,
|
|
1717
|
+
description: "Wheel 15 sensor ID (4-byte, little-endian)"
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
},
|
|
1721
|
+
firmwareVersion: {
|
|
1722
|
+
id: [98, 144],
|
|
1723
|
+
name: "firmwareVersion",
|
|
1724
|
+
structure: {
|
|
1725
|
+
bluetoothStackVersion: {
|
|
1726
|
+
size: 20,
|
|
1727
|
+
description: "Bluetooth stack version + bootloader (e.g. BT stack 4.0.0.191)"
|
|
1728
|
+
},
|
|
1729
|
+
configurationDataVersion: {
|
|
1730
|
+
size: 4,
|
|
1731
|
+
description: "Configuration data version"
|
|
1732
|
+
},
|
|
1733
|
+
bleChipFwCompilationDate: {
|
|
1734
|
+
size: 7,
|
|
1735
|
+
description: "BLE chip FW compilation date: second, minute, hour, day, month, year (2-byte, big-endian)"
|
|
1736
|
+
},
|
|
1737
|
+
bluetoothChipFwVersion: {
|
|
1738
|
+
size: 4,
|
|
1739
|
+
description: "Bluetooth chip FW version: major.minor.patch + release type (e.g. 1.2.0 Release)"
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1574
1742
|
}
|
|
1575
1743
|
};
|
|
1576
1744
|
|
|
@@ -1980,12 +2148,13 @@ const bridgeCommands = {
|
|
|
1980
2148
|
);
|
|
1981
2149
|
return await this.writeCommand(deviceData, commandIds$1.writeData, subCommandIds.autolearnIdStatus, payload);
|
|
1982
2150
|
},
|
|
1983
|
-
async getAutolearnUnknownSensors(
|
|
1984
|
-
const
|
|
2151
|
+
async getAutolearnUnknownSensors(deviceId) {
|
|
2152
|
+
const deviceData = bridgeTools.getBridgeFromStore(deviceId);
|
|
2153
|
+
const result = await this.readCommand(deviceData, subCommandIds.autolearnUnknownSensors);
|
|
1985
2154
|
const structurized = bridgeTools.convertBytesToStructure(
|
|
1986
2155
|
bridgeCommandStructures.autolearnUnknownSensors.structure,
|
|
1987
2156
|
result.data,
|
|
1988
|
-
|
|
2157
|
+
deviceData.advertisingData.fwVersion
|
|
1989
2158
|
);
|
|
1990
2159
|
return { ...structurized, isFactory: result.isFactory };
|
|
1991
2160
|
},
|
|
@@ -2009,8 +2178,9 @@ const bridgeCommands = {
|
|
|
2009
2178
|
async getPressuresPerAxle(deviceId) {
|
|
2010
2179
|
const deviceData = bridgeTools.getBridgeFromStore(deviceId);
|
|
2011
2180
|
const result = await this.readCommand(deviceData, subCommandIds.pressurePerAxle);
|
|
2181
|
+
const structure = bridgeTools.usesKpaPressure(deviceId) ? bridgeCommandStructures.pressuresPerAxleKpa.structure : bridgeCommandStructures.pressuresPerAxle.structure;
|
|
2012
2182
|
const structurizedData = bridgeTools.convertBytesToStructure(
|
|
2013
|
-
|
|
2183
|
+
structure,
|
|
2014
2184
|
result.data,
|
|
2015
2185
|
deviceData.advertisingData.fwVersion
|
|
2016
2186
|
);
|
|
@@ -2018,8 +2188,9 @@ const bridgeCommands = {
|
|
|
2018
2188
|
},
|
|
2019
2189
|
async setPressuresPerAxle(deviceId, structurizedPayload) {
|
|
2020
2190
|
const deviceData = bridgeTools.getBridgeFromStore(deviceId);
|
|
2191
|
+
const structure = bridgeTools.usesKpaPressure(deviceId) ? bridgeCommandStructures.pressuresPerAxleKpa.structure : bridgeCommandStructures.pressuresPerAxle.structure;
|
|
2021
2192
|
const payload = bridgeTools.convertStructureToBytes(
|
|
2022
|
-
|
|
2193
|
+
structure,
|
|
2023
2194
|
structurizedPayload,
|
|
2024
2195
|
deviceData.advertisingData.fwVersion
|
|
2025
2196
|
);
|
|
@@ -2056,6 +2227,18 @@ const bridgeCommands = {
|
|
|
2056
2227
|
);
|
|
2057
2228
|
return structurizedData;
|
|
2058
2229
|
},
|
|
2230
|
+
async getFirmwareVersion(deviceId) {
|
|
2231
|
+
const deviceData = bridgeTools.getBridgeFromStore(deviceId);
|
|
2232
|
+
const result = await this.readCommand(deviceData, subCommandIds.firmwareVersion, {
|
|
2233
|
+
headerLength: 5,
|
|
2234
|
+
footerLength: 0
|
|
2235
|
+
});
|
|
2236
|
+
return bridgeTools.convertBytesToStructure(
|
|
2237
|
+
bridgeCommandStructures.firmwareVersion.structure,
|
|
2238
|
+
result.data,
|
|
2239
|
+
deviceData.advertisingData.fwVersion
|
|
2240
|
+
);
|
|
2241
|
+
},
|
|
2059
2242
|
async getSensorMeasurement(deviceId, positionId) {
|
|
2060
2243
|
const deviceData = bridgeTools.getBridgeFromStore(deviceId);
|
|
2061
2244
|
const isSpare = String(positionId).endsWith("0");
|
|
@@ -2069,7 +2252,7 @@ const bridgeCommands = {
|
|
|
2069
2252
|
const result = await this.writeCommand(deviceData, commandIds$1.sensorMeasurement, subCommandId, []);
|
|
2070
2253
|
return result;
|
|
2071
2254
|
},
|
|
2072
|
-
async readCommand(device, subCommandId) {
|
|
2255
|
+
async readCommand(device, subCommandId, { headerLength = 19, footerLength = 8 } = {}) {
|
|
2073
2256
|
const commandLength = 2;
|
|
2074
2257
|
const result = await this.promisify(device, [
|
|
2075
2258
|
...this.getCommandHeader(device),
|
|
@@ -2077,9 +2260,9 @@ const bridgeCommands = {
|
|
|
2077
2260
|
commandIds$1.readData,
|
|
2078
2261
|
subCommandId
|
|
2079
2262
|
]);
|
|
2080
|
-
const data = result.slice(
|
|
2081
|
-
const crc = result.slice(result.length -
|
|
2082
|
-
const isFactory = crc.every((n) => n === 0);
|
|
2263
|
+
const data = result.slice(headerLength, result.length - footerLength);
|
|
2264
|
+
const crc = result.slice(result.length - footerLength, result.length - footerLength + 4);
|
|
2265
|
+
const isFactory = crc.length === 4 && crc.every((n) => n === 0);
|
|
2083
2266
|
return { data, isFactory };
|
|
2084
2267
|
},
|
|
2085
2268
|
async writeCommand(device, commandId, subCommandId, payload) {
|
|
@@ -2216,7 +2399,7 @@ async function setVehicleLayout(deviceId, tcVehicle) {
|
|
|
2216
2399
|
}
|
|
2217
2400
|
await bridgeCommands.setVehicleLayout(deviceId, result);
|
|
2218
2401
|
}
|
|
2219
|
-
async function getConfiguration(deviceId) {
|
|
2402
|
+
async function getConfiguration(deviceId, includeVehicleData = false) {
|
|
2220
2403
|
const customerCANSettings = await bridgeCommands.getCustomerCANSettings(deviceId);
|
|
2221
2404
|
const workshopCANSettings = await bridgeCommands.getWorkshopCANSettings(deviceId);
|
|
2222
2405
|
const customerPressureThresholds = await bridgeCommands.getCustomerPressureThresholds(deviceId);
|
|
@@ -2227,7 +2410,7 @@ async function getConfiguration(deviceId) {
|
|
|
2227
2410
|
if (bridgeTools.isVersionGreaterThan(deviceId, "0.9.7")) {
|
|
2228
2411
|
autolearnSettings = await bridgeCommands.getAutolearnSettings(deviceId);
|
|
2229
2412
|
}
|
|
2230
|
-
|
|
2413
|
+
const configuration = {
|
|
2231
2414
|
customerCANSettings,
|
|
2232
2415
|
workshopCANSettings,
|
|
2233
2416
|
customerPressureThresholds,
|
|
@@ -2236,6 +2419,24 @@ async function getConfiguration(deviceId) {
|
|
|
2236
2419
|
pressuresPerAxle,
|
|
2237
2420
|
autolearnSettings
|
|
2238
2421
|
};
|
|
2422
|
+
if (includeVehicleData) {
|
|
2423
|
+
configuration.vehicleLayout = await bridgeCommands.getVehicleLayout(deviceId);
|
|
2424
|
+
configuration.axleInfo = [];
|
|
2425
|
+
for (let axleIndex = 0; axleIndex < 15; axleIndex++) {
|
|
2426
|
+
const axleBytes = await bridgeCommands.getAxleInfo(deviceId, axleIndex);
|
|
2427
|
+
configuration.axleInfo.push(
|
|
2428
|
+
bridgeTools.convertBytesToStructure(bridgeCommandStructures.idsPerWheel.structure, axleBytes)
|
|
2429
|
+
);
|
|
2430
|
+
}
|
|
2431
|
+
if (bridgeTools.isVersionGreaterThan(deviceId, "1.1.F")) {
|
|
2432
|
+
configuration.firmwareVersion = await bridgeCommands.getFirmwareVersion(deviceId);
|
|
2433
|
+
}
|
|
2434
|
+
if (bridgeTools.isVersionGreaterThan(deviceId, "0.9.7")) {
|
|
2435
|
+
configuration.autolearnIdStatus = await bridgeCommands.getAutolearnIdStatus(deviceId);
|
|
2436
|
+
configuration.autolearnUnknownSensors = await bridgeCommands.getAutolearnUnknownSensors(deviceId);
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
return configuration;
|
|
2239
2440
|
}
|
|
2240
2441
|
function bridgeVehiclesDifference(original, change) {
|
|
2241
2442
|
const differences = [];
|
|
@@ -2404,6 +2605,8 @@ async function setAxleInfo(deviceId, tcVehicle) {
|
|
|
2404
2605
|
async function setAxlesPressure(deviceId, axles) {
|
|
2405
2606
|
let data = [];
|
|
2406
2607
|
let bridgeAxlesPressureData;
|
|
2608
|
+
const width = bridgeTools.usesKpaPressure(deviceId) ? 2 : 1;
|
|
2609
|
+
const maxFallback = width === 2 ? 65535 : 255;
|
|
2407
2610
|
for (let index = 0; index < 15; index++) {
|
|
2408
2611
|
let { targetPressure, maxTargetPressure, minTargetPressure, isSpare } = axles[index] || {};
|
|
2409
2612
|
maxTargetPressure = bridgeTools.convertBarToKpaByte(deviceId, maxTargetPressure);
|
|
@@ -2417,14 +2620,19 @@ async function setAxlesPressure(deviceId, axles) {
|
|
|
2417
2620
|
if (!bridgeAxlesPressureData) {
|
|
2418
2621
|
bridgeAxlesPressureData = await bridgeCommands.getAxlesPressure(deviceId);
|
|
2419
2622
|
}
|
|
2420
|
-
|
|
2623
|
+
const base = index * width * 3;
|
|
2624
|
+
maxTargetPressure = bridgeTools.bytesToInt(bridgeAxlesPressureData.data.slice(base, base + width)) || maxFallback;
|
|
2421
2625
|
}
|
|
2422
2626
|
if (targetPressure > maxTargetPressure) {
|
|
2423
2627
|
targetPressure = maxTargetPressure;
|
|
2424
2628
|
} else if (targetPressure < minTargetPressure) {
|
|
2425
2629
|
targetPressure = minTargetPressure;
|
|
2426
2630
|
}
|
|
2427
|
-
data = data.concat([
|
|
2631
|
+
data = data.concat([
|
|
2632
|
+
...bridgeTools.intToBytes(maxTargetPressure, width),
|
|
2633
|
+
...bridgeTools.intToBytes(minTargetPressure, width),
|
|
2634
|
+
...bridgeTools.intToBytes(targetPressure, width)
|
|
2635
|
+
]);
|
|
2428
2636
|
}
|
|
2429
2637
|
await bridgeCommands.setAxlesPressure(deviceId, data);
|
|
2430
2638
|
}
|
|
@@ -2771,21 +2979,20 @@ async function assignTyres(deviceId, tcVehicle) {
|
|
|
2771
2979
|
}
|
|
2772
2980
|
async function assignAxlePressureLimits(deviceId, tcVehicle, tcVehicleAxle, axleIndex, bridgeAxlesPressureData) {
|
|
2773
2981
|
const axlesPressureData = bridgeAxlesPressureData ?? (await bridgeCommands.getAxlesPressure(deviceId)).data;
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2982
|
+
const width = bridgeTools.usesKpaPressure(deviceId) ? 2 : 1;
|
|
2983
|
+
const base = axleIndex * width * 3;
|
|
2984
|
+
const maxRaw = bridgeTools.bytesToInt(axlesPressureData.slice(base, base + width));
|
|
2985
|
+
const minRaw = bridgeTools.bytesToInt(axlesPressureData.slice(base + width, base + width * 2));
|
|
2986
|
+
const setRaw = bridgeTools.bytesToInt(axlesPressureData.slice(base + width * 2, base + width * 3));
|
|
2987
|
+
if (maxRaw) {
|
|
2988
|
+
tcVehicleAxle.maxTargetPressure = ___default.floor(bridgeTools.convertKpaByteToBar(deviceId, maxRaw), 1);
|
|
2779
2989
|
}
|
|
2780
|
-
if (
|
|
2781
|
-
tcVehicleAxle.minTargetPressure = ___default.ceil(
|
|
2782
|
-
bridgeTools.convertKpaByteToBar(deviceId, axlesPressureData[axleIndex * 3 + 1]),
|
|
2783
|
-
1
|
|
2784
|
-
);
|
|
2990
|
+
if (minRaw) {
|
|
2991
|
+
tcVehicleAxle.minTargetPressure = ___default.ceil(bridgeTools.convertKpaByteToBar(deviceId, minRaw), 1);
|
|
2785
2992
|
}
|
|
2786
|
-
if (
|
|
2993
|
+
if (setRaw) {
|
|
2787
2994
|
tcVehicleAxle.targetPressure = ___default.round(
|
|
2788
|
-
bridgeTools.convertKpaByteToBar(deviceId,
|
|
2995
|
+
bridgeTools.convertKpaByteToBar(deviceId, setRaw, void 0),
|
|
2789
2996
|
1
|
|
2790
2997
|
);
|
|
2791
2998
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -419,6 +419,78 @@ declare const _default: {
|
|
|
419
419
|
};
|
|
420
420
|
};
|
|
421
421
|
};
|
|
422
|
+
/**
|
|
423
|
+
* kPa per-axle pressure layout used from FW 1.2.0 onwards (same sub-command 0x30 as `pressuresPerAxle`).
|
|
424
|
+
* Each axle packs the same three values (set; min; max) but every value is a 2-byte little-endian raw kPa
|
|
425
|
+
* uint16 (no 5.0625 bit scaling), so each axle is 6 bytes instead of 3. Selected at runtime via
|
|
426
|
+
* `bridgeTools.usesKpaPressure(deviceId)`.
|
|
427
|
+
*/
|
|
428
|
+
pressuresPerAxleKpa: {
|
|
429
|
+
id: number[];
|
|
430
|
+
name: string;
|
|
431
|
+
structure: {
|
|
432
|
+
axle01: {
|
|
433
|
+
size: number;
|
|
434
|
+
description: string;
|
|
435
|
+
};
|
|
436
|
+
axle02: {
|
|
437
|
+
size: number;
|
|
438
|
+
description: string;
|
|
439
|
+
};
|
|
440
|
+
axle03: {
|
|
441
|
+
size: number;
|
|
442
|
+
description: string;
|
|
443
|
+
};
|
|
444
|
+
axle04: {
|
|
445
|
+
size: number;
|
|
446
|
+
description: string;
|
|
447
|
+
};
|
|
448
|
+
axle05: {
|
|
449
|
+
size: number;
|
|
450
|
+
description: string;
|
|
451
|
+
};
|
|
452
|
+
axle06: {
|
|
453
|
+
size: number;
|
|
454
|
+
description: string;
|
|
455
|
+
};
|
|
456
|
+
axle07: {
|
|
457
|
+
size: number;
|
|
458
|
+
description: string;
|
|
459
|
+
};
|
|
460
|
+
axle08: {
|
|
461
|
+
size: number;
|
|
462
|
+
description: string;
|
|
463
|
+
};
|
|
464
|
+
axle09: {
|
|
465
|
+
size: number;
|
|
466
|
+
description: string;
|
|
467
|
+
};
|
|
468
|
+
axle10: {
|
|
469
|
+
size: number;
|
|
470
|
+
description: string;
|
|
471
|
+
};
|
|
472
|
+
axle11: {
|
|
473
|
+
size: number;
|
|
474
|
+
description: string;
|
|
475
|
+
};
|
|
476
|
+
axle12: {
|
|
477
|
+
size: number;
|
|
478
|
+
description: string;
|
|
479
|
+
};
|
|
480
|
+
axle13: {
|
|
481
|
+
size: number;
|
|
482
|
+
description: string;
|
|
483
|
+
};
|
|
484
|
+
axle14: {
|
|
485
|
+
size: number;
|
|
486
|
+
description: string;
|
|
487
|
+
};
|
|
488
|
+
axle15: {
|
|
489
|
+
size: number;
|
|
490
|
+
description: string;
|
|
491
|
+
};
|
|
492
|
+
};
|
|
493
|
+
};
|
|
422
494
|
autolearnSettings: {
|
|
423
495
|
id: number[];
|
|
424
496
|
name: string;
|
|
@@ -501,7 +573,87 @@ declare const _default: {
|
|
|
501
573
|
};
|
|
502
574
|
};
|
|
503
575
|
};
|
|
504
|
-
autolearnIdStatus:
|
|
576
|
+
autolearnIdStatus: {
|
|
577
|
+
id: number[];
|
|
578
|
+
name: string;
|
|
579
|
+
structure: {
|
|
580
|
+
axle01: {
|
|
581
|
+
size: number;
|
|
582
|
+
description: string;
|
|
583
|
+
display: "reverseHex";
|
|
584
|
+
};
|
|
585
|
+
axle02: {
|
|
586
|
+
size: number;
|
|
587
|
+
description: string;
|
|
588
|
+
display: "reverseHex";
|
|
589
|
+
};
|
|
590
|
+
axle03: {
|
|
591
|
+
size: number;
|
|
592
|
+
description: string;
|
|
593
|
+
display: "reverseHex";
|
|
594
|
+
};
|
|
595
|
+
axle04: {
|
|
596
|
+
size: number;
|
|
597
|
+
description: string;
|
|
598
|
+
display: "reverseHex";
|
|
599
|
+
};
|
|
600
|
+
axle05: {
|
|
601
|
+
size: number;
|
|
602
|
+
description: string;
|
|
603
|
+
display: "reverseHex";
|
|
604
|
+
};
|
|
605
|
+
axle06: {
|
|
606
|
+
size: number;
|
|
607
|
+
description: string;
|
|
608
|
+
display: "reverseHex";
|
|
609
|
+
};
|
|
610
|
+
axle07: {
|
|
611
|
+
size: number;
|
|
612
|
+
description: string;
|
|
613
|
+
display: "reverseHex";
|
|
614
|
+
};
|
|
615
|
+
axle08: {
|
|
616
|
+
size: number;
|
|
617
|
+
description: string;
|
|
618
|
+
display: "reverseHex";
|
|
619
|
+
};
|
|
620
|
+
axle09: {
|
|
621
|
+
size: number;
|
|
622
|
+
description: string;
|
|
623
|
+
display: "reverseHex";
|
|
624
|
+
};
|
|
625
|
+
axle10: {
|
|
626
|
+
size: number;
|
|
627
|
+
description: string;
|
|
628
|
+
display: "reverseHex";
|
|
629
|
+
};
|
|
630
|
+
axle11: {
|
|
631
|
+
size: number;
|
|
632
|
+
description: string;
|
|
633
|
+
display: "reverseHex";
|
|
634
|
+
};
|
|
635
|
+
axle12: {
|
|
636
|
+
size: number;
|
|
637
|
+
description: string;
|
|
638
|
+
display: "reverseHex";
|
|
639
|
+
};
|
|
640
|
+
axle13: {
|
|
641
|
+
size: number;
|
|
642
|
+
description: string;
|
|
643
|
+
display: "reverseHex";
|
|
644
|
+
};
|
|
645
|
+
axle14: {
|
|
646
|
+
size: number;
|
|
647
|
+
description: string;
|
|
648
|
+
display: "reverseHex";
|
|
649
|
+
};
|
|
650
|
+
axle15: {
|
|
651
|
+
size: number;
|
|
652
|
+
description: string;
|
|
653
|
+
display: "reverseHex";
|
|
654
|
+
};
|
|
655
|
+
};
|
|
656
|
+
};
|
|
505
657
|
autolearnUnknownSensors: {
|
|
506
658
|
id: number[];
|
|
507
659
|
name: string;
|
|
@@ -645,6 +797,94 @@ declare const _default: {
|
|
|
645
797
|
};
|
|
646
798
|
};
|
|
647
799
|
};
|
|
800
|
+
idsPerWheel: {
|
|
801
|
+
id: number[];
|
|
802
|
+
name: string;
|
|
803
|
+
structure: {
|
|
804
|
+
wheel01: {
|
|
805
|
+
size: number;
|
|
806
|
+
description: string;
|
|
807
|
+
};
|
|
808
|
+
wheel02: {
|
|
809
|
+
size: number;
|
|
810
|
+
description: string;
|
|
811
|
+
};
|
|
812
|
+
wheel03: {
|
|
813
|
+
size: number;
|
|
814
|
+
description: string;
|
|
815
|
+
};
|
|
816
|
+
wheel04: {
|
|
817
|
+
size: number;
|
|
818
|
+
description: string;
|
|
819
|
+
};
|
|
820
|
+
wheel05: {
|
|
821
|
+
size: number;
|
|
822
|
+
description: string;
|
|
823
|
+
};
|
|
824
|
+
wheel06: {
|
|
825
|
+
size: number;
|
|
826
|
+
description: string;
|
|
827
|
+
};
|
|
828
|
+
wheel07: {
|
|
829
|
+
size: number;
|
|
830
|
+
description: string;
|
|
831
|
+
};
|
|
832
|
+
wheel08: {
|
|
833
|
+
size: number;
|
|
834
|
+
description: string;
|
|
835
|
+
};
|
|
836
|
+
wheel09: {
|
|
837
|
+
size: number;
|
|
838
|
+
description: string;
|
|
839
|
+
};
|
|
840
|
+
wheel10: {
|
|
841
|
+
size: number;
|
|
842
|
+
description: string;
|
|
843
|
+
};
|
|
844
|
+
wheel11: {
|
|
845
|
+
size: number;
|
|
846
|
+
description: string;
|
|
847
|
+
};
|
|
848
|
+
wheel12: {
|
|
849
|
+
size: number;
|
|
850
|
+
description: string;
|
|
851
|
+
};
|
|
852
|
+
wheel13: {
|
|
853
|
+
size: number;
|
|
854
|
+
description: string;
|
|
855
|
+
};
|
|
856
|
+
wheel14: {
|
|
857
|
+
size: number;
|
|
858
|
+
description: string;
|
|
859
|
+
};
|
|
860
|
+
wheel15: {
|
|
861
|
+
size: number;
|
|
862
|
+
description: string;
|
|
863
|
+
};
|
|
864
|
+
};
|
|
865
|
+
};
|
|
866
|
+
firmwareVersion: {
|
|
867
|
+
id: number[];
|
|
868
|
+
name: string;
|
|
869
|
+
structure: {
|
|
870
|
+
bluetoothStackVersion: {
|
|
871
|
+
size: number;
|
|
872
|
+
description: string;
|
|
873
|
+
};
|
|
874
|
+
configurationDataVersion: {
|
|
875
|
+
size: number;
|
|
876
|
+
description: string;
|
|
877
|
+
};
|
|
878
|
+
bleChipFwCompilationDate: {
|
|
879
|
+
size: number;
|
|
880
|
+
description: string;
|
|
881
|
+
};
|
|
882
|
+
bluetoothChipFwVersion: {
|
|
883
|
+
size: number;
|
|
884
|
+
description: string;
|
|
885
|
+
};
|
|
886
|
+
};
|
|
887
|
+
};
|
|
648
888
|
};
|
|
649
889
|
|
|
650
890
|
type DeepPartial<T> = T extends object ? {
|
|
@@ -732,6 +972,15 @@ interface BridgeConfiguration {
|
|
|
732
972
|
pressuresPerAxle: BridgeCommandStructurized<typeof _default.pressuresPerAxle.structure>;
|
|
733
973
|
/** only available after 0.9.8 fw */
|
|
734
974
|
autolearnSettings?: BridgeCommandStructurized<typeof _default.autolearnSettings.structure>;
|
|
975
|
+
vehicleLayout?: BridgeCommandStructurized<typeof _default.vehicleLayout.structure>;
|
|
976
|
+
/** Per-axle wheel sensor IDs, indexed by axle (0-14). Each entry holds the 15 wheel slots of one axle. */
|
|
977
|
+
axleInfo?: BridgeCommandStructurized<typeof _default.idsPerWheel.structure>[];
|
|
978
|
+
/** Parsed 0x90 SW Version DID (BT stack, config data version, BLE chip compilation date, BT chip FW version). */
|
|
979
|
+
firmwareVersion?: BridgeCommandStructurized<typeof _default.firmwareVersion.structure>;
|
|
980
|
+
/** only available after 0.9.7 fw */
|
|
981
|
+
autolearnIdStatus?: BridgeCommandStructurized<typeof _default.autolearnIdStatus.structure>;
|
|
982
|
+
/** only available after 0.9.7 fw */
|
|
983
|
+
autolearnUnknownSensors?: BridgeCommandStructurized<typeof _default.autolearnUnknownSensors.structure>;
|
|
735
984
|
}
|
|
736
985
|
interface BridgeReading {
|
|
737
986
|
date: number;
|
|
@@ -963,7 +1212,7 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
|
|
|
963
1212
|
connect: (deviceId: string, accessLevel: BridgeAccessLevel) => Promise<void>;
|
|
964
1213
|
getVehicle: (deviceId: string) => Promise<BridgeTcVehicle>;
|
|
965
1214
|
setVehicle: (deviceId: string, tcVehicle: BridgeTcVehicle) => Promise<void>;
|
|
966
|
-
getConfiguration: (deviceId: string) => Promise<BridgeConfiguration>;
|
|
1215
|
+
getConfiguration: (deviceId: string, includeVehicleData?: boolean) => Promise<BridgeConfiguration>;
|
|
967
1216
|
setConfiguration: (deviceId: string, bridgeConfiguration: BridgeConfiguration) => Promise<void>;
|
|
968
1217
|
getSensorReading: (deviceId: string, positionId: number) => Promise<BridgeReading>;
|
|
969
1218
|
getVehicleReadings: (deviceId: string, tcVehicle: BridgeTcVehicle) => Promise<BridgeReading[]>;
|