tirecheck-device-sdk 0.2.62 → 0.2.64
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 +5 -4
- package/dist/index.mjs +5 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -362,7 +362,7 @@ const bridgeTools = {
|
|
|
362
362
|
}
|
|
363
363
|
};
|
|
364
364
|
function getBridgeFromStore(deviceId) {
|
|
365
|
-
const deviceData = store.devices[deviceId];
|
|
365
|
+
const deviceData = store.devices[deviceId] ?? store.simulatedDevices[deviceId];
|
|
366
366
|
if (!deviceData) throw new Error(`No device data found: ${deviceId}`);
|
|
367
367
|
if (deviceData.type !== "bridge") throw new Error("Device is not bridge");
|
|
368
368
|
return deviceData;
|
|
@@ -2492,7 +2492,7 @@ async function getSensorReading(deviceId, positionId) {
|
|
|
2492
2492
|
sensorStatus: payload[3],
|
|
2493
2493
|
eceStatus: payload[4],
|
|
2494
2494
|
pressureIssue: getPressureIssue$1(deviceId, payload[4]),
|
|
2495
|
-
...getPressureAndTemperatureReadingObjects(payload[0], payload[1]),
|
|
2495
|
+
...getPressureAndTemperatureReadingObjects(payload[0], payload[1], payload[6]),
|
|
2496
2496
|
byteReading: value
|
|
2497
2497
|
};
|
|
2498
2498
|
}
|
|
@@ -2573,16 +2573,17 @@ async function resetAutolearnStatuses(deviceId, positionIds) {
|
|
|
2573
2573
|
}
|
|
2574
2574
|
await bridgeCommands.setAutolearnIdStatus(deviceId, statuses);
|
|
2575
2575
|
}
|
|
2576
|
-
function getPressureAndTemperatureReadingObjects(rawPressure, rawTemperature) {
|
|
2576
|
+
function getPressureAndTemperatureReadingObjects(rawPressure, rawTemperature, sensorType) {
|
|
2577
2577
|
if (rawTemperature === 255 || rawPressure === 0) {
|
|
2578
2578
|
return {
|
|
2579
2579
|
pressure: void 0,
|
|
2580
2580
|
temperature: void 0
|
|
2581
2581
|
};
|
|
2582
2582
|
}
|
|
2583
|
+
const bitValue = sensorType === 1 ? 6.7 : 5.0625;
|
|
2583
2584
|
const ambientTemperature = 20;
|
|
2584
2585
|
const measuredTemperature = rawTemperature - 40;
|
|
2585
|
-
const measuredPressureAbsolute = rawPressure /
|
|
2586
|
+
const measuredPressureAbsolute = rawPressure * (bitValue / 100);
|
|
2586
2587
|
const compensatedPressureAbsolute = measuredPressureAbsolute * (273 + ambientTemperature) / (273 + measuredTemperature);
|
|
2587
2588
|
return {
|
|
2588
2589
|
pressure: {
|
package/dist/index.mjs
CHANGED
|
@@ -355,7 +355,7 @@ const bridgeTools = {
|
|
|
355
355
|
}
|
|
356
356
|
};
|
|
357
357
|
function getBridgeFromStore(deviceId) {
|
|
358
|
-
const deviceData = store.devices[deviceId];
|
|
358
|
+
const deviceData = store.devices[deviceId] ?? store.simulatedDevices[deviceId];
|
|
359
359
|
if (!deviceData) throw new Error(`No device data found: ${deviceId}`);
|
|
360
360
|
if (deviceData.type !== "bridge") throw new Error("Device is not bridge");
|
|
361
361
|
return deviceData;
|
|
@@ -2485,7 +2485,7 @@ async function getSensorReading(deviceId, positionId) {
|
|
|
2485
2485
|
sensorStatus: payload[3],
|
|
2486
2486
|
eceStatus: payload[4],
|
|
2487
2487
|
pressureIssue: getPressureIssue$1(deviceId, payload[4]),
|
|
2488
|
-
...getPressureAndTemperatureReadingObjects(payload[0], payload[1]),
|
|
2488
|
+
...getPressureAndTemperatureReadingObjects(payload[0], payload[1], payload[6]),
|
|
2489
2489
|
byteReading: value
|
|
2490
2490
|
};
|
|
2491
2491
|
}
|
|
@@ -2566,16 +2566,17 @@ async function resetAutolearnStatuses(deviceId, positionIds) {
|
|
|
2566
2566
|
}
|
|
2567
2567
|
await bridgeCommands.setAutolearnIdStatus(deviceId, statuses);
|
|
2568
2568
|
}
|
|
2569
|
-
function getPressureAndTemperatureReadingObjects(rawPressure, rawTemperature) {
|
|
2569
|
+
function getPressureAndTemperatureReadingObjects(rawPressure, rawTemperature, sensorType) {
|
|
2570
2570
|
if (rawTemperature === 255 || rawPressure === 0) {
|
|
2571
2571
|
return {
|
|
2572
2572
|
pressure: void 0,
|
|
2573
2573
|
temperature: void 0
|
|
2574
2574
|
};
|
|
2575
2575
|
}
|
|
2576
|
+
const bitValue = sensorType === 1 ? 6.7 : 5.0625;
|
|
2576
2577
|
const ambientTemperature = 20;
|
|
2577
2578
|
const measuredTemperature = rawTemperature - 40;
|
|
2578
|
-
const measuredPressureAbsolute = rawPressure /
|
|
2579
|
+
const measuredPressureAbsolute = rawPressure * (bitValue / 100);
|
|
2579
2580
|
const compensatedPressureAbsolute = measuredPressureAbsolute * (273 + ambientTemperature) / (273 + measuredTemperature);
|
|
2580
2581
|
return {
|
|
2581
2582
|
pressure: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tirecheck-device-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.64",
|
|
4
4
|
"description": "SDK for working with various devices produced by Tirecheck via Bluetooth (CAN Bridge, Routers, Sensors, FlexiGauge, PressureStick, etc)",
|
|
5
5
|
"author": "Leonid Buneev <leonid.buneev@tirecheck.com>",
|
|
6
6
|
"license": "ISC",
|