Fixes in CT support to ensure Gradient/Slope is being defaulted and updated properly between the CTConroller and TrainTool.

Fix to preselect ERG mode in workoutTree.
This commit is contained in:
Jaime
2013-01-27 22:02:52 -05:00
parent 5b64be2ae0
commit c1410814f1
2 changed files with 12 additions and 3 deletions

View File

@@ -76,7 +76,7 @@ ComputrainerController::getRealtimeData(RealtimeData &rtData)
{
int Buttons, Status;
bool calibration;
double Power, HeartRate, Cadence, Speed, RRC, Load;
double Power, HeartRate, Cadence, Speed, RRC, Load, Gradient;
uint8_t ss[24];
if(!myComputrainer->isRunning())
@@ -123,8 +123,10 @@ ComputrainerController::getRealtimeData(RealtimeData &rtData)
// BUTTONS
//
// ADJUST LOAD
// ADJUST LOAD & GRADIENT
Load = myComputrainer->getLoad();
Gradient = myComputrainer->getGradient();
// the calls to the parent will determine which mode we are on (ERG/SPIN) and adjust load/slop appropiately
if ((Buttons&CT_PLUS) && !(Buttons&CT_F3)) {
parent->Higher();
}
@@ -132,6 +134,7 @@ ComputrainerController::getRealtimeData(RealtimeData &rtData)
parent->Lower();
}
rtData.setLoad(Load);
rtData.setSlope(Gradient);
#if 0 // F3 now toggles calibration
// FFWD/REWIND

View File

@@ -360,6 +360,8 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), h
recordFile = NULL;
status = 0;
status |= RT_MODE_ERGO; // ergo mode by default
mode = ERG;
displayWorkoutLap = displayLap = 0;
pwrcount = 0;
cadcount = 0;
@@ -472,7 +474,9 @@ TrainTool::configChanged()
if (Devices.count()) {
deviceTree->setCurrentItem(allDevices->child(0));
}
// And select default workout to Ergo
QModelIndex firstWorkout = sortModel->index(0, 0, QModelIndex());
workoutTree->setCurrentIndex(firstWorkout);
// Athlete
FTP=285; // default to 285 if zones are not set
int range = main->zones()->whichRange(QDate::currentDate());
@@ -1025,6 +1029,7 @@ void TrainTool::guiUpdate() // refreshes the telemetry
if (Devices[dev].type == DEV_CT) {
memcpy((uint8_t*)rtData.spinScan, (uint8_t*)local.spinScan, 24);
rtData.setLoad(local.getLoad()); // and get load in case it was adjusted
rtData.setSlope(local.getSlope()); // and get slope in case it was adjusted
// to within defined limits
}
@@ -1070,6 +1075,7 @@ void TrainTool::guiUpdate() // refreshes the telemetry
displayHeartRate = rtData.getHr();
displaySpeed = rtData.getSpeed();
load = rtData.getLoad();
slope = rtData.getSlope();
// virtual speed
double crr = 0.004f; // typical for asphalt surfaces