TrainingPeaks PWX support L/R balance

.. on import and export, using the "pwrright" element.

.. this is not part of the public PWX schema but has
   been used by ipbike when writing PWX, and may or may
   not be supported by TrainingPeaks.com
This commit is contained in:
Irvin Sirotić
2016-01-15 16:23:21 +00:00
committed by Mark Liversedge
parent 7f551ff079
commit 70c03e8b5d
2 changed files with 39966 additions and 0 deletions

View File

@@ -220,6 +220,15 @@ PwxFileReader::PwxFromDomDoc(QDomDocument doc, QStringList&) const
// the TP upload web-service happy with zero values
if (add.watts == 1) add.watts = 0.0;
} else add.watts = 0.0;
// lrbalance
QDomElement lrbalance = node.firstChildElement("pwrright");
if (!lrbalance.isNull()) {
if (add.watts == 0) {
add.lrbalance = 50.0;
} else {
add.lrbalance =(add.watts-lrbalance.text().toDouble())/add.watts*100.0;
}
} else add.lrbalance = 0.0;
// torq
QDomElement torq = node.firstChildElement("torq");
if (!torq.isNull()) add.nm = torq.text().toDouble();
@@ -831,6 +840,14 @@ PwxFileReader::writeRideFile(Context *context, const RideFile *ride, QFile &file
pwr.appendChild(text);
sample.appendChild(pwr);
}
// lrbalance
if (ride->areDataPresent()->lrbalance) {
int rwatts = point->watts ? (point->watts - (point->watts * (point->lrbalance/100))) : 0;
QDomElement lrbalance = doc.createElement("pwrright");
text = doc.createTextNode(QString("%1").arg(rwatts));
lrbalance.appendChild(text);
sample.appendChild(lrbalance);
}
// torq
if (ride->areDataPresent()->nm) {
QDomElement torq = doc.createElement("torq");

39949
test/rides/IpBike_902.pwx Normal file

File diff suppressed because it is too large Load Diff