mirror of
https://github.com/gdsports/USBHost_t36
synced 2024-11-24 01:52:23 -05:00
AntPlus fixes
https://forum.pjrc.com/threads/43110-Ant-libarary-and-USB-driver-for-Teensy-3-5-6?p=157155&viewfull=1#post157155
This commit is contained in:
parent
5c6d3c9e32
commit
f890ec1955
@ -877,12 +877,18 @@ public:
|
|||||||
user_onHeartRateMonitor = f;
|
user_onHeartRateMonitor = f;
|
||||||
}
|
}
|
||||||
void onSpeedCadence(void (*f)(float speed, float distance, float rpm), uint32_t devid=0) {
|
void onSpeedCadence(void (*f)(float speed, float distance, float rpm), uint32_t devid=0) {
|
||||||
|
profileSetup_SPDCAD(&ant.dcfg[PROFILE_SPDCAD], devid);
|
||||||
|
memset(&spdcad, 0, sizeof(spdcad));
|
||||||
user_onSpeedCadence = f;
|
user_onSpeedCadence = f;
|
||||||
}
|
}
|
||||||
void onSpeed(void (*f)(float speed, float distance), uint32_t devid=0) {
|
void onSpeed(void (*f)(float speed, float distance), uint32_t devid=0) {
|
||||||
|
profileSetup_SPEED(&ant.dcfg[PROFILE_SPEED], devid);
|
||||||
|
memset(&spd, 0, sizeof(spd));
|
||||||
user_onSpeed = f;
|
user_onSpeed = f;
|
||||||
}
|
}
|
||||||
void onCadence(void (*f)(float rpm), uint32_t devid=0) {
|
void onCadence(void (*f)(float rpm), uint32_t devid=0) {
|
||||||
|
profileSetup_CADENCE(&ant.dcfg[PROFILE_CADENCE], devid);
|
||||||
|
memset(&cad, 0, sizeof(cad));
|
||||||
user_onCadence = f;
|
user_onCadence = f;
|
||||||
}
|
}
|
||||||
void setWheelCircumference(float meters) {
|
void setWheelCircumference(float meters) {
|
||||||
|
@ -1130,9 +1130,9 @@ void AntPlus::payload_SPDCAD(TDCONFIG *cfg, const uint8_t *data, const size_t da
|
|||||||
uint16_t speedTime = data[5] | (data[6] << 8);
|
uint16_t speedTime = data[5] | (data[6] << 8);
|
||||||
uint16_t speedCt = data[7] | (data[8] << 8);
|
uint16_t speedCt = data[7] | (data[8] << 8);
|
||||||
if (cadenceTime == spdcad.previous.cadenceTime
|
if (cadenceTime == spdcad.previous.cadenceTime
|
||||||
&& cadenceCt != spdcad.previous.cadenceCt
|
&& cadenceCt == spdcad.previous.cadenceCt
|
||||||
&& speedTime != spdcad.previous.speedTime
|
&& speedTime == spdcad.previous.speedTime
|
||||||
&& speedCt != spdcad.previous.speedCt) {
|
&& speedCt == spdcad.previous.speedCt) {
|
||||||
return; // no change
|
return; // no change
|
||||||
}
|
}
|
||||||
uint16_t cadence = (60 * (cadenceCt - spdcad.previous.cadenceCt) * 1024) / (cadenceTime - spdcad.previous.cadenceTime);
|
uint16_t cadence = (60 * (cadenceCt - spdcad.previous.cadenceCt) * 1024) / (cadenceTime - spdcad.previous.cadenceTime);
|
||||||
|
Loading…
Reference in New Issue
Block a user