Skip to content

Commit

Permalink
trying to stabilize cadence on echelonconnectsport
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Viola <[email protected]>
  • Loading branch information
cagnulein authored and Roberto Viola committed Dec 5, 2020
1 parent 2e94a16 commit 481e256
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="org.cagnulen.qdomyoszwift" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.2.6" android:versionCode="10" android:installLocation="auto">
<manifest package="org.cagnulen.qdomyoszwift" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.3.1" android:versionCode="12" android:installLocation="auto">
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
<!-- %%INSERT_PERMISSIONS -->
Expand Down
17 changes: 15 additions & 2 deletions src/echelonconnectsport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 481e256

Please sign in to comment.