incyclist-devices 1.4.2 → 1.4.3
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.
|
@@ -55,15 +55,19 @@ class DaumClassicCyclingMode extends PowerMeterCyclingMode_1.default {
|
|
|
55
55
|
let power = data.power || 0;
|
|
56
56
|
let speed = data.speed || 0;
|
|
57
57
|
let slope = (prevData.slope !== undefined ? prevData.slope : prevRequest.slope || 0);
|
|
58
|
-
let
|
|
58
|
+
let distanceBike = data.distanceInternal || 0;
|
|
59
|
+
let distancePrev = prevData.distanceInternal || 0;
|
|
60
|
+
let distanceInternal = distanceBike;
|
|
61
|
+
let ts = Date.now();
|
|
59
62
|
if (!bikeData.pedalRpm || bikeData.isPedalling === false) {
|
|
60
63
|
speed = 0;
|
|
61
64
|
power = 0;
|
|
62
65
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
if (distanceBike < distancePrev) {
|
|
67
|
+
let v = speed / 3.6;
|
|
68
|
+
let duration = this.prevUpdateTS === 0 ? 0 : ((ts - this.prevUpdateTS) / 1000);
|
|
69
|
+
distanceInternal = distancePrev + Math.round(v * duration);
|
|
70
|
+
}
|
|
67
71
|
data.speed = parseFloat(speed.toFixed(1));
|
|
68
72
|
data.power = Math.round(power);
|
|
69
73
|
data.distanceInternal = Math.round(distanceInternal);
|
package/lib/daum/premium/bike.js
CHANGED
|
@@ -592,7 +592,6 @@ class Daum8i {
|
|
|
592
592
|
.then((res) => {
|
|
593
593
|
const resData = Uint8Array.from(res, x => x.charCodeAt(0));
|
|
594
594
|
const cmd = (0, utils_1.esc2bin)(resData);
|
|
595
|
-
console.log('~~~ cmd', cmd);
|
|
596
595
|
return cmd;
|
|
597
596
|
});
|
|
598
597
|
}
|
|
@@ -764,7 +763,6 @@ class Daum8i {
|
|
|
764
763
|
.then((res) => {
|
|
765
764
|
const buffer = Buffer.from(res);
|
|
766
765
|
let success = buffer.readInt16LE(0) === utils_1.ReservedCommands.PROGRAM_LIST_CONTINUE_PROGRAM;
|
|
767
|
-
console.log('~~ Buffer', buffer, buffer.readInt16LE(2), buffer.readInt8(4));
|
|
768
766
|
success = success && (buffer.readInt16LE(2) === 1);
|
|
769
767
|
success = success && (buffer.readInt8(4) === 1);
|
|
770
768
|
if (!success)
|