tirecheck-device-sdk 0.2.40 → 0.2.42

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 CHANGED
@@ -509,7 +509,7 @@ const bridgeOtaAdvertisingParser = {
509
509
 
510
510
  const deviceMeta = {
511
511
  bridge: {
512
- nameRegex: /(030303|030321)/,
512
+ nameRegex: /^(030303|030321)$/,
513
513
  communication: {
514
514
  serviceId: "4880c12c-fdcb-4077-8920-a450d7f9b907",
515
515
  // message from device
@@ -881,7 +881,7 @@ const bridgeCommandStructures = {
881
881
  baudRate: {
882
882
  size: 2,
883
883
  description: "Baud rate",
884
- version: "1.0.5"
884
+ version: "1.0.6"
885
885
  }
886
886
  }
887
887
  },
@@ -4051,6 +4051,13 @@ function normalizeSimulatedDevice(device) {
4051
4051
  throw new Error(`Simulator is not supported for device type: ${device.type}`);
4052
4052
  }
4053
4053
  function calculateEceStatusByte(positionId, simulatorData, advertisingData) {
4054
+ const sensor = simulatorData.sensors[positionId];
4055
+ if ([254, 255].includes(sensor.eceStatus)) return sensor.eceStatus;
4056
+ const axleIndex = Math.floor(positionId / 100) - 1;
4057
+ const axle = simulatorData.vehicle.axles[axleIndex];
4058
+ if (!sensor.pressure || !axle || axle.targetPressure === void 0) return 0;
4059
+ const sensorPressure = sensor.pressure.meas ?? sensor.pressure.bar;
4060
+ const percentageDifference = (sensorPressure - axle.targetPressure) / axle.targetPressure * 100;
4054
4061
  const customerPressureThresholdsDecimal = bridgeTools.hexToDecimalArray(
4055
4062
  simulatorData.configuration.customerPressureThresholds.axle01
4056
4063
  );
@@ -4060,13 +4067,6 @@ function calculateEceStatusByte(positionId, simulatorData, advertisingData) {
4060
4067
  underinflationWarning: customerPressureThresholdsDecimal[2],
4061
4068
  underinflationCritical: customerPressureThresholdsDecimal[3]
4062
4069
  };
4063
- const sensor = simulatorData.sensors[positionId];
4064
- const axleIndex = Math.floor(positionId / 100) - 1;
4065
- const axle = simulatorData.vehicle.axles[axleIndex];
4066
- if (!axle || axle.targetPressure === void 0) return 0;
4067
- if (!sensor.pressure) return 0;
4068
- const sensorPressure = sensor.pressure.meas ?? sensor.pressure.bar;
4069
- const percentageDifference = (sensorPressure - axle.targetPressure) / axle.targetPressure * 100;
4070
4070
  const usesNewValues = (advertisingData.fwVersion || "") > "0.8.F";
4071
4071
  if (percentageDifference >= pressureThresholds.overinflationCritical) {
4072
4072
  return usesNewValues ? 3 : 4;
package/dist/index.mjs CHANGED
@@ -502,7 +502,7 @@ const bridgeOtaAdvertisingParser = {
502
502
 
503
503
  const deviceMeta = {
504
504
  bridge: {
505
- nameRegex: /(030303|030321)/,
505
+ nameRegex: /^(030303|030321)$/,
506
506
  communication: {
507
507
  serviceId: "4880c12c-fdcb-4077-8920-a450d7f9b907",
508
508
  // message from device
@@ -874,7 +874,7 @@ const bridgeCommandStructures = {
874
874
  baudRate: {
875
875
  size: 2,
876
876
  description: "Baud rate",
877
- version: "1.0.5"
877
+ version: "1.0.6"
878
878
  }
879
879
  }
880
880
  },
@@ -4044,6 +4044,13 @@ function normalizeSimulatedDevice(device) {
4044
4044
  throw new Error(`Simulator is not supported for device type: ${device.type}`);
4045
4045
  }
4046
4046
  function calculateEceStatusByte(positionId, simulatorData, advertisingData) {
4047
+ const sensor = simulatorData.sensors[positionId];
4048
+ if ([254, 255].includes(sensor.eceStatus)) return sensor.eceStatus;
4049
+ const axleIndex = Math.floor(positionId / 100) - 1;
4050
+ const axle = simulatorData.vehicle.axles[axleIndex];
4051
+ if (!sensor.pressure || !axle || axle.targetPressure === void 0) return 0;
4052
+ const sensorPressure = sensor.pressure.meas ?? sensor.pressure.bar;
4053
+ const percentageDifference = (sensorPressure - axle.targetPressure) / axle.targetPressure * 100;
4047
4054
  const customerPressureThresholdsDecimal = bridgeTools.hexToDecimalArray(
4048
4055
  simulatorData.configuration.customerPressureThresholds.axle01
4049
4056
  );
@@ -4053,13 +4060,6 @@ function calculateEceStatusByte(positionId, simulatorData, advertisingData) {
4053
4060
  underinflationWarning: customerPressureThresholdsDecimal[2],
4054
4061
  underinflationCritical: customerPressureThresholdsDecimal[3]
4055
4062
  };
4056
- const sensor = simulatorData.sensors[positionId];
4057
- const axleIndex = Math.floor(positionId / 100) - 1;
4058
- const axle = simulatorData.vehicle.axles[axleIndex];
4059
- if (!axle || axle.targetPressure === void 0) return 0;
4060
- if (!sensor.pressure) return 0;
4061
- const sensorPressure = sensor.pressure.meas ?? sensor.pressure.bar;
4062
- const percentageDifference = (sensorPressure - axle.targetPressure) / axle.targetPressure * 100;
4063
4063
  const usesNewValues = (advertisingData.fwVersion || "") > "0.8.F";
4064
4064
  if (percentageDifference >= pressureThresholds.overinflationCritical) {
4065
4065
  return usesNewValues ? 3 : 4;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tirecheck-device-sdk",
3
- "version": "0.2.40",
3
+ "version": "0.2.42",
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",