Skip to content

Commit

Permalink
Colours for speed tile on Echelon Stride aren't correct? #1718
Browse files Browse the repository at this point in the history
  • Loading branch information
cagnulein committed Oct 23, 2023
1 parent 6409eab commit e55577d
Showing 1 changed file with 40 additions and 21 deletions.
61 changes: 40 additions & 21 deletions src/homeform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3727,29 +3727,48 @@ void homeform::update() {
QStringLiteral(" MAX: ") +
QString::number(((treadmill *)bluetoothManager->device())->currentVerticalOscillation().max(), 'f', 0));

if (bluetoothManager->device()->currentSpeed().value() < 9) {
speed->setValueFontColor(QStringLiteral("white"));
this->pace->setValueFontColor(QStringLiteral("white"));
} else if (bluetoothManager->device()->currentSpeed().value() < 10) {
speed->setValueFontColor(QStringLiteral("limegreen"));
this->pace->setValueFontColor(QStringLiteral("limegreen"));
} else if (bluetoothManager->device()->currentSpeed().value() < 11) {
speed->setValueFontColor(QStringLiteral("gold"));
this->pace->setValueFontColor(QStringLiteral("gold"));
} else if (bluetoothManager->device()->currentSpeed().value() < 12) {
speed->setValueFontColor(QStringLiteral("orange"));
this->pace->setValueFontColor(QStringLiteral("orange"));
} else if (bluetoothManager->device()->currentSpeed().value() < 13) {
speed->setValueFontColor(QStringLiteral("darkorange"));
this->pace->setValueFontColor(QStringLiteral("darkorange"));
} else if (bluetoothManager->device()->currentSpeed().value() < 14) {
speed->setValueFontColor(QStringLiteral("orangered"));
this->pace->setValueFontColor(QStringLiteral("orangered"));
// if there is no training program, the color is based on presets
if (!trainProgram || trainProgram->currentRow().speed == -1) {
if (bluetoothManager->device()->currentSpeed().value() < 9) {
speed->setValueFontColor(QStringLiteral("white"));
this->pace->setValueFontColor(QStringLiteral("white"));
} else if (bluetoothManager->device()->currentSpeed().value() < 10) {
speed->setValueFontColor(QStringLiteral("limegreen"));
this->pace->setValueFontColor(QStringLiteral("limegreen"));
} else if (bluetoothManager->device()->currentSpeed().value() < 11) {
speed->setValueFontColor(QStringLiteral("gold"));
this->pace->setValueFontColor(QStringLiteral("gold"));
} else if (bluetoothManager->device()->currentSpeed().value() < 12) {
speed->setValueFontColor(QStringLiteral("orange"));
this->pace->setValueFontColor(QStringLiteral("orange"));
} else if (bluetoothManager->device()->currentSpeed().value() < 13) {
speed->setValueFontColor(QStringLiteral("darkorange"));
this->pace->setValueFontColor(QStringLiteral("darkorange"));
} else if (bluetoothManager->device()->currentSpeed().value() < 14) {
speed->setValueFontColor(QStringLiteral("orangered"));
this->pace->setValueFontColor(QStringLiteral("orangered"));
} else {
speed->setValueFontColor(QStringLiteral("red"));
this->pace->setValueFontColor(QStringLiteral("red"));
}
bluetoothManager->device()->currentSpeed().setColor(speed->valueFontColor());
} else {
speed->setValueFontColor(QStringLiteral("red"));
this->pace->setValueFontColor(QStringLiteral("red"));
if (bluetoothManager->device()->currentSpeed().value() <= trainProgram->currentRow().upper_speed &&
bluetoothManager->device()->currentSpeed().value() >= trainProgram->currentRow().lower_speed) {
this->target_zone->setValueFontColor(QStringLiteral("limegreen"));
this->pace->setValueFontColor(QStringLiteral("limegreen"));
} else if (bluetoothManager->device()->currentSpeed().value() <=
(trainProgram->currentRow().upper_speed + 0.2) &&
bluetoothManager->device()->currentSpeed().value() >=
(trainProgram->currentRow().lower_speed - 0.2)) {
this->target_zone->setValueFontColor(QStringLiteral("orange"));
this->pace->setValueFontColor(QStringLiteral("orange"));
} else {
this->target_zone->setValueFontColor(QStringLiteral("red"));
this->pace->setValueFontColor(QStringLiteral("red"));
}
bluetoothManager->device()->currentSpeed().setColor(speed->valueFontColor());
}
bluetoothManager->device()->currentSpeed().setColor(speed->valueFontColor());

this->target_pace->setValue(
((treadmill *)bluetoothManager->device())->lastRequestedPace().toString(QStringLiteral("m:ss")));
Expand Down

0 comments on commit e55577d

Please sign in to comment.