incyclist-devices 1.4.3 → 1.4.4
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.
|
@@ -64,6 +64,7 @@ class DaumClassicCyclingMode extends PowerMeterCyclingMode_1.default {
|
|
|
64
64
|
power = 0;
|
|
65
65
|
}
|
|
66
66
|
if (distanceBike < distancePrev) {
|
|
67
|
+
this.logger.logEvent({ message: '~~~ distance overflow', distanceBike, distancePrev });
|
|
67
68
|
let v = speed / 3.6;
|
|
68
69
|
let duration = this.prevUpdateTS === 0 ? 0 : ((ts - this.prevUpdateTS) / 1000);
|
|
69
70
|
distanceInternal = distancePrev + Math.round(v * duration);
|
|
@@ -111,8 +111,11 @@ class DaumPremiumDevice extends DaumAdapter_1.default {
|
|
|
111
111
|
else {
|
|
112
112
|
info.person = true;
|
|
113
113
|
}
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
if (!this.getCyclingMode().getModeProperty('eppSupport')) {
|
|
115
|
+
const gear = yield this.bike.setGear(this.data.gear || (opts.gear || 10));
|
|
116
|
+
return gear;
|
|
117
|
+
}
|
|
118
|
+
return;
|
|
116
119
|
}
|
|
117
120
|
catch (err) {
|
|
118
121
|
console.error(err);
|
package/lib/daum/premium/bike.js
CHANGED
|
@@ -710,17 +710,27 @@ class Daum8i {
|
|
|
710
710
|
});
|
|
711
711
|
}
|
|
712
712
|
setPerson(person) {
|
|
713
|
+
this.logger.logEvent({ message: 'setPerson() request' });
|
|
713
714
|
return this.sendReservedDaum8iCommand(utils_1.ReservedCommands.PERSON_SET, 'BF', (0, utils_1.getPersonData)(person))
|
|
714
715
|
.then((res) => {
|
|
715
716
|
const buffer = Buffer.from(res);
|
|
716
|
-
|
|
717
|
+
const success = buffer.readInt16LE(0) === utils_1.ReservedCommands.PERSON_SET;
|
|
718
|
+
this.logger.logEvent({ message: 'setPerson() response', success, buffer });
|
|
719
|
+
if (!success)
|
|
720
|
+
throw new Error('Illegal Response');
|
|
721
|
+
return true;
|
|
717
722
|
});
|
|
718
723
|
}
|
|
719
724
|
programUploadInit() {
|
|
725
|
+
this.logger.logEvent({ message: 'programUploadInit() request' });
|
|
720
726
|
return this.sendReservedDaum8iCommand(utils_1.ReservedCommands.PROGRAM_LIST_BEGIN, 'BF')
|
|
721
727
|
.then((res) => {
|
|
722
728
|
const buffer = Buffer.from(res);
|
|
723
|
-
|
|
729
|
+
const success = buffer.readInt16LE(0) === utils_1.ReservedCommands.PROGRAM_LIST_BEGIN;
|
|
730
|
+
this.logger.logEvent({ message: 'programUploadInit() response', success, buffer });
|
|
731
|
+
if (!success)
|
|
732
|
+
throw new Error('Illegal Response');
|
|
733
|
+
return true;
|
|
724
734
|
});
|
|
725
735
|
}
|
|
726
736
|
programUploadStart(bikeType, route) {
|
|
@@ -740,12 +750,15 @@ class Daum8i {
|
|
|
740
750
|
payload.writeInt16LE(0, 30);
|
|
741
751
|
payload.writeInt32LE(7, 32);
|
|
742
752
|
payload.writeInt32LE(epp.length, 36);
|
|
753
|
+
this.logger.logEvent({ message: 'programUploadStart() request' });
|
|
743
754
|
return this.sendReservedDaum8iCommand(utils_1.ReservedCommands.PROGRAM_LIST_NEW_PROGRAM, 'BF', payload)
|
|
744
755
|
.then((res) => {
|
|
745
756
|
const buffer = Buffer.from(res);
|
|
746
757
|
if (buffer.readInt16LE(0) === utils_1.ReservedCommands.PROGRAM_LIST_NEW_PROGRAM) {
|
|
758
|
+
this.logger.logEvent({ message: 'programUploadStart() response', success: true });
|
|
747
759
|
return epp;
|
|
748
760
|
}
|
|
761
|
+
this.logger.logEvent({ message: 'programUploadStart() response', success: false });
|
|
749
762
|
throw new Error('Illegal Response');
|
|
750
763
|
});
|
|
751
764
|
}
|
|
@@ -759,22 +772,31 @@ class Daum8i {
|
|
|
759
772
|
payload.writeInt32LE(offset, 4);
|
|
760
773
|
const chunk = Buffer.from(epp.slice(offset, offset + size));
|
|
761
774
|
chunk.copy(payload, 8);
|
|
775
|
+
this.logger.logEvent({ message: 'programUploadSendBlock() request', offset, size });
|
|
762
776
|
return this.sendReservedDaum8iCommand(utils_1.ReservedCommands.PROGRAM_LIST_CONTINUE_PROGRAM, 'BF', payload)
|
|
763
777
|
.then((res) => {
|
|
764
778
|
const buffer = Buffer.from(res);
|
|
765
779
|
let success = buffer.readInt16LE(0) === utils_1.ReservedCommands.PROGRAM_LIST_CONTINUE_PROGRAM;
|
|
766
780
|
success = success && (buffer.readInt16LE(2) === 1);
|
|
767
781
|
success = success && (buffer.readInt8(4) === 1);
|
|
782
|
+
this.logger.logEvent({ message: 'programUploadSendBlock() response' });
|
|
768
783
|
if (!success)
|
|
769
784
|
throw new Error('Illegal Response');
|
|
770
|
-
return
|
|
785
|
+
return true;
|
|
786
|
+
;
|
|
771
787
|
});
|
|
772
788
|
}
|
|
773
789
|
programUploadDone() {
|
|
790
|
+
this.logger.logEvent({ message: 'programUploadDone() request' });
|
|
774
791
|
return this.sendReservedDaum8iCommand(utils_1.ReservedCommands.PROGRAM_LIST_END, 'BF')
|
|
775
792
|
.then((res) => {
|
|
776
793
|
const buffer = Buffer.from(res);
|
|
777
|
-
|
|
794
|
+
const success = buffer.readInt16LE(0) === utils_1.ReservedCommands.PROGRAM_LIST_END;
|
|
795
|
+
this.logger.logEvent({ message: 'programUploadDone() response', success });
|
|
796
|
+
if (!success)
|
|
797
|
+
throw new Error('Illegal Response');
|
|
798
|
+
return true;
|
|
799
|
+
;
|
|
778
800
|
});
|
|
779
801
|
}
|
|
780
802
|
programUpload(bikeType, route) {
|
|
@@ -798,10 +820,16 @@ class Daum8i {
|
|
|
798
820
|
startProgram(programId = 1) {
|
|
799
821
|
const payload = Buffer.alloc(2);
|
|
800
822
|
payload.writeInt16LE(programId, 0);
|
|
823
|
+
this.logger.logEvent({ message: 'startProgram() request', programId });
|
|
801
824
|
return this.sendReservedDaum8iCommand(utils_1.ReservedCommands.PROGRAM_LIST_START, 'BF', payload)
|
|
802
825
|
.then((res) => {
|
|
803
826
|
const buffer = Buffer.from(res);
|
|
804
|
-
|
|
827
|
+
const success = buffer.readInt16LE(0) === utils_1.ReservedCommands.PROGRAM_LIST_START;
|
|
828
|
+
this.logger.logEvent({ message: 'startProgram() request', programId, success });
|
|
829
|
+
if (!success)
|
|
830
|
+
throw new Error('Illegal Response');
|
|
831
|
+
return true;
|
|
832
|
+
;
|
|
805
833
|
});
|
|
806
834
|
}
|
|
807
835
|
setGear(gear) {
|