diff --git a/src/android/AndroidManifest.xml b/src/android/AndroidManifest.xml index 8e3fedca8..5242f7d60 100644 --- a/src/android/AndroidManifest.xml +++ b/src/android/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/src/echelonconnectsport.cpp b/src/echelonconnectsport.cpp index c0895d6a4..dfdb5947d 100644 --- a/src/echelonconnectsport.cpp +++ b/src/echelonconnectsport.cpp @@ -169,15 +169,28 @@ void echelonconnectsport::characteristicChanged(const QLowEnergyCharacteristic & KCal = 0; Distance += ((Speed / 3600000.0) * ((double)lastRefresh.msecsTo(QDateTime::currentDateTime())) ); - CrankRevs += ((double)(lastRefresh.msecsTo(QDateTime::currentDateTime())) * ((double)Cadence / 60000.0) ); - LastCrankEventTime += (uint16_t)((lastRefresh.msecsTo(QDateTime::currentDateTime())) * 1.024); + double cadenceAdd = ((double)(lastRefresh.msecsTo(QDateTime::currentDateTime())) * ((double)Cadence / 60000.0) ); + static double crankRevsLocal = 0; + static uint16_t lastCrankEventTimeLocal = 0; + + crankRevsLocal += cadenceAdd; + lastCrankEventTimeLocal += (uint16_t)((lastRefresh.msecsTo(QDateTime::currentDateTime())) * 1.024); lastRefresh = QDateTime::currentDateTime(); + // crank rotation done + if(((uint16_t)(crankRevsLocal)) > ((uint16_t)(CrankRevs))) + { + CrankRevs = crankRevsLocal; + LastCrankEventTime = lastCrankEventTimeLocal; + } + debug("Current Local elapsed: " + GetElapsedFromPacket(newValue).toString()); debug("Current Speed: " + QString::number(Speed)); debug("Current Calculate Distance: " + QString::number(Distance)); debug("Current Cadence: " + QString::number(Cadence)); debug("Current Distance: " + QString::number(distance)); + debug("Local Current CrankRevs: " + QString::number(crankRevsLocal)); + debug("Local Last CrankEventTime: " + QString::number(lastCrankEventTimeLocal)); debug("Current CrankRevs: " + QString::number(CrankRevs)); debug("Last CrankEventTime: " + QString::number(LastCrankEventTime)); debug("Current Watt: " + QString::number(watts())); diff --git a/src/main.cpp b/src/main.cpp index af078e874..9b6706448 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -200,7 +200,7 @@ int main(int argc, char *argv[]) #endif qInstallMessageHandler(myMessageOutput); - qDebug() << "version 1.3.0"; + qDebug() << "version 1.3.1"; #ifndef Q_OS_ANDROID if(!forceQml)