diff --git a/src/homeform.cpp b/src/homeform.cpp
index 3bd5dbc57e..e9d1c0436e 100644
--- a/src/homeform.cpp
+++ b/src/homeform.cpp
@@ -558,6 +558,10 @@ homeform::homeform(QQmlApplicationEngine *engine, bluetooth *bl) {
&homeform::pelotonOffset_Minus);
connect(this->innerTemplateManager, &TemplateInfoSenderBuilder::gears_Plus, this, &homeform::gearUp);
connect(this->innerTemplateManager, &TemplateInfoSenderBuilder::gears_Minus, this, &homeform::gearDown);
+ connect(this->innerTemplateManager, &TemplateInfoSenderBuilder::speed_Plus, this, &homeform::speedPlus);
+ connect(this->innerTemplateManager, &TemplateInfoSenderBuilder::speed_Minus, this, &homeform::speedMinus);
+ connect(this->innerTemplateManager, &TemplateInfoSenderBuilder::inclination_Plus, this, &homeform::inclinationPlus);
+ connect(this->innerTemplateManager, &TemplateInfoSenderBuilder::inclination_Minus, this, &homeform::inclinationMinus);
connect(this->innerTemplateManager, &TemplateInfoSenderBuilder::pelotonOffset, this, &homeform::pelotonOffset);
connect(this->innerTemplateManager, &TemplateInfoSenderBuilder::pelotonAskStart, this, &homeform::pelotonAskStart);
connect(this->innerTemplateManager, &TemplateInfoSenderBuilder::peloton_start_workout, this,
@@ -1610,6 +1614,22 @@ void homeform::gearDown() {
}
}
+void homeform::speedPlus() {
+ Plus(QStringLiteral("speed"));
+}
+
+void homeform::speedMinus() {
+ Minus(QStringLiteral("speed"));
+}
+
+void homeform::inclinationPlus() {
+ Plus(QStringLiteral("inclination"));
+}
+
+void homeform::inclinationMinus() {
+ Minus(QStringLiteral("inclination"));
+}
+
void homeform::ftmsAccessoryConnected(smartspin2k *d) {
connect(this, &homeform::autoResistanceChanged, d, &smartspin2k::autoResistanceChanged);
connect(d, &smartspin2k::gearUp, this, &homeform::gearUp);
diff --git a/src/homeform.h b/src/homeform.h
index 9aab989ebb..11660accdd 100644
--- a/src/homeform.h
+++ b/src/homeform.h
@@ -1056,6 +1056,10 @@ class homeform : public QObject {
void sortTilesTimeout();
void gearUp();
void gearDown();
+ void speedPlus();
+ void speedMinus();
+ void inclinationPlus();
+ void inclinationMinus();
void changeTimestamp(QTime source, QTime actual);
void pelotonOffset_Plus();
void pelotonOffset_Minus();
diff --git a/src/inner_templates/floating/floating.htm b/src/inner_templates/floating/floating.htm
index ee9e9148fb..4acdc630b7 100644
--- a/src/inner_templates/floating/floating.htm
+++ b/src/inner_templates/floating/floating.htm
@@ -39,6 +39,10 @@
font-size: 24px;
}
+ .treadmill-only {
+ display: none;
+ }
+
.overlay {
position: absolute;
top: 0;
@@ -73,20 +77,24 @@
Peloton Workout in progress!
🏃
SPEED
- AVG
- 0.0
+ AVG -
+ 0.0 AVG
0.0
- MAX
- 0.0
+ MAX +
+ 0.0 MAX
📐
INCLINE
- AVG
- 0.0
+ AVG -
+ 0.0 AVG
0.0
- MAX
- 0.0
+ MAX +
+ 0.0 MAX
🏃
@@ -306,6 +314,62 @@ Peloton Workout in progress!
});
}
+ function SpeedPlus() {
+ let el = new MainWSQueueElement({
+ msg: 'speed_plus',
+ }, function (msg) {
+ if (msg.msg === 'R_speed_plus') {
+ return msg.content;
+ }
+ return null;
+ }, 15000, 1);
+ el.enqueue().catch(function (err) {
+ console.error('Error is ' + err);
+ });
+ }
+
+ function SpeedMinus() {
+ let el = new MainWSQueueElement({
+ msg: 'speed_minus',
+ }, function (msg) {
+ if (msg.msg === 'R_speed_minus') {
+ return msg.content;
+ }
+ return null;
+ }, 15000, 1);
+ el.enqueue().catch(function (err) {
+ console.error('Error is ' + err);
+ });
+ }
+
+ function InclinationPlus() {
+ let el = new MainWSQueueElement({
+ msg: 'inclination_plus',
+ }, function (msg) {
+ if (msg.msg === 'R_inclination_plus') {
+ return msg.content;
+ }
+ return null;
+ }, 15000, 1);
+ el.enqueue().catch(function (err) {
+ console.error('Error is ' + err);
+ });
+ }
+
+ function InclinationMinus() {
+ let el = new MainWSQueueElement({
+ msg: 'inclination_minus',
+ }, function (msg) {
+ if (msg.msg === 'R_inclination_minus') {
+ return msg.content;
+ }
+ return null;
+ }, 15000, 1);
+ el.enqueue().catch(function (err) {
+ console.error('Error is ' + err);
+ });
+ }
+
function Lap() {
let el = new MainWSQueueElement({
msg: 'lap',
@@ -611,6 +675,7 @@ Peloton Workout in progress!
'speed_color', 'pace_color', 'power_zone_color', 'target_power_zone_color', 'cadence_color', 'heart_color', 'watts_color',
'peloton_resistance_color', 'target_resistance', 'target_peloton_resistance',
'target_cadence', 'target_power', 'peloton_offset', 'peloton_ask_start', 'target_speed', 'target_pace_h', 'target_pace_m', 'target_pace_s',
+ 'deviceType', 'TREADMILL_TYPE',
'inclination', 'inclination_lapavg',
'inclination_lapmax', 'target_inclination', 'power_zone', 'power_zone_lapavg', 'power_zone_lapmax', 'target_power_zone', 'jouls',
'row_remaining_time_s', 'row_remaining_time_m', 'row_remaining_time_h' , 'autoresistance', 'gears', 'elevation', 'pace_s' , 'pace_m',
@@ -673,6 +738,8 @@ Peloton Workout in progress!
var peloton_offset = 0;
var gears = 0;
var nextrow = "";
+ var deviceType = -1;
+ var TREADMILL_TYPE = -1;
for (let key of keys_arr) {
if (msg.content[key] === undefined || msg.content[key] === null)
@@ -789,6 +856,10 @@ Peloton Workout in progress!
peloton_offset = msg.content[key];
} else if (key === 'gears') {
gears = msg.content[key];
+ } else if (key === 'deviceType') {
+ deviceType = msg.content[key];
+ } else if (key === 'TREADMILL_TYPE') {
+ TREADMILL_TYPE = msg.content[key];
} else if (key === 'peloton_resistance_color') {
$('.pelotonresistance-value').css('color', msg.content[key]);
} else if (key === 'heart_color') {
@@ -837,14 +908,24 @@ Peloton Workout in progress!
$('.speed-value').html("" + speed.toFixed(1) + " ");
}
- $('.speed-avg').html(speed_lapavg.toFixed(1));
- $('.speed-max').html(speed_lapmax.toFixed(1));
+ $('.speed-avg-value').html(speed_lapavg.toFixed(1));
+ $('.speed-max-value').html(speed_lapmax.toFixed(1));
if (tile_target_inclination_enabled && target_inclination > 0)
$('.inclination-value').html("" + inclination.toFixed(1) + "/" + target_inclination.toFixed(1) + " ");
else
$('.inclination-value').html("" + inclination.toFixed(1) + " ");
- $('.inclination-avg').html(inclination_lapavg.toFixed(1));
- $('.inclination-max').html(inclination_lapmax.toFixed(1));
+ $('.inclination-avg-value').html(inclination_lapavg.toFixed(1));
+ $('.inclination-max-value').html(inclination_lapmax.toFixed(1));
+
+ // Show/hide treadmill-only controls based on device type
+ if (deviceType === TREADMILL_TYPE && TREADMILL_TYPE !== -1) {
+ $('.treadmill-only').show();
+ $('.non-treadmill').hide();
+ } else {
+ $('.treadmill-only').hide();
+ $('.non-treadmill').show();
+ }
+
$('.elevation-value').html("" + elevation.toFixed(1) + " ");
if (tile_target_cadence_enabled && target_cadence > 0)
$('.cadence-value').html("" + cadence.toFixed(0) + "/" + target_cadence.toFixed(0) + " ");
diff --git a/src/inner_templates/floating/hfloating.htm b/src/inner_templates/floating/hfloating.htm
index 635b804a11..cdd728fae3 100644
--- a/src/inner_templates/floating/hfloating.htm
+++ b/src/inner_templates/floating/hfloating.htm
@@ -197,6 +197,10 @@
font-size: 24px;
}
+ .treadmill-only {
+ display: none;
+ }
+
/* Metric selector panel */
.metric-selector-panel {
display: none;
@@ -247,20 +251,24 @@ Peloton Workout in progress!
🏃
SPEED
- AVG
- 0.0
+ AVG -
+ 0.0 AVG
0.0
- MAX
- 0.0
+ MAX +
+ 0.0 MAX
📐
INCLINE
- AVG
- 0.0
+ AVG -
+ 0.0 AVG
0.0
- MAX
- 0.0
+ MAX +
+ 0.0 MAX
🏃
@@ -826,6 +834,62 @@ Select metrics to display
});
}
+ function SpeedPlus() {
+ let el = new MainWSQueueElement({
+ msg: 'speed_plus',
+ }, function (msg) {
+ if (msg.msg === 'R_speed_plus') {
+ return msg.content;
+ }
+ return null;
+ }, 15000, 1);
+ el.enqueue().catch(function (err) {
+ console.error('Error is ' + err);
+ });
+ }
+
+ function SpeedMinus() {
+ let el = new MainWSQueueElement({
+ msg: 'speed_minus',
+ }, function (msg) {
+ if (msg.msg === 'R_speed_minus') {
+ return msg.content;
+ }
+ return null;
+ }, 15000, 1);
+ el.enqueue().catch(function (err) {
+ console.error('Error is ' + err);
+ });
+ }
+
+ function InclinationPlus() {
+ let el = new MainWSQueueElement({
+ msg: 'inclination_plus',
+ }, function (msg) {
+ if (msg.msg === 'R_inclination_plus') {
+ return msg.content;
+ }
+ return null;
+ }, 15000, 1);
+ el.enqueue().catch(function (err) {
+ console.error('Error is ' + err);
+ });
+ }
+
+ function InclinationMinus() {
+ let el = new MainWSQueueElement({
+ msg: 'inclination_minus',
+ }, function (msg) {
+ if (msg.msg === 'R_inclination_minus') {
+ return msg.content;
+ }
+ return null;
+ }, 15000, 1);
+ el.enqueue().catch(function (err) {
+ console.error('Error is ' + err);
+ });
+ }
+
// Function to clear/lap
function Lap() {
let el = new MainWSQueueElement({
@@ -1072,6 +1136,7 @@ Select metrics to display
'speed_color', 'pace_color', 'power_zone_color', 'target_power_zone_color', 'cadence_color', 'heart_color', 'watts_color',
'peloton_resistance_color', 'target_resistance', 'target_peloton_resistance',
'target_cadence', 'target_power', 'peloton_offset', 'peloton_ask_start', 'target_speed', 'target_pace_h', 'target_pace_m', 'target_pace_s',
+ 'deviceType', 'TREADMILL_TYPE',
'inclination', 'inclination_lapavg',
'inclination_lapmax', 'target_inclination', 'power_zone', 'power_zone_lapavg', 'power_zone_lapmax', 'target_power_zone', 'jouls',
'row_remaining_time_s', 'row_remaining_time_m', 'row_remaining_time_h' , 'autoresistance', 'gears', 'elevation', 'pace_s' , 'pace_m',
@@ -1137,6 +1202,8 @@ Select metrics to display
var peloton_offset = 0;
var gears = 0;
var nextrow = "";
+ var deviceType = -1;
+ var TREADMILL_TYPE = -1;
// Get values from message
for (let key of keys_arr) {
@@ -1255,6 +1322,10 @@ Select metrics to display
peloton_offset = msg.content[key];
} else if (key === 'gears') {
gears = msg.content[key];
+ } else if (key === 'deviceType') {
+ deviceType = msg.content[key];
+ } else if (key === 'TREADMILL_TYPE') {
+ TREADMILL_TYPE = msg.content[key];
} else if (key === 'peloton_resistance_color') {
$('.pelotonresistance-value').css('color', msg.content[key]);
} else if (key === 'heart_color') {
@@ -1336,7 +1407,9 @@ Select metrics to display
target_power: target_power,
peloton_offset: peloton_offset,
gears: gears,
- nextrow: nextrow
+ nextrow: nextrow,
+ deviceType: deviceType,
+ TREADMILL_TYPE: TREADMILL_TYPE
});
}
return null;
@@ -1356,8 +1429,8 @@ Select metrics to display
} else {
$('.speed-value').html("" + data.speed.toFixed(1) + " ");
}
- $('.speed-avg').html(data.speed_lapavg.toFixed(1));
- $('.speed-max').html(data.speed_lapmax.toFixed(1));
+ $('.speed-avg-value').html(data.speed_lapavg.toFixed(1));
+ $('.speed-max-value').html(data.speed_lapmax.toFixed(1));
// Inclination
if (tile_target_inclination_enabled && data.target_inclination > 0) {
@@ -1365,8 +1438,17 @@ Select metrics to display
} else {
$('.inclination-value').html("" + data.inclination.toFixed(1) + " ");
}
- $('.inclination-avg').html(data.inclination_lapavg.toFixed(1));
- $('.inclination-max').html(data.inclination_lapmax.toFixed(1));
+ $('.inclination-avg-value').html(data.inclination_lapavg.toFixed(1));
+ $('.inclination-max-value').html(data.inclination_lapmax.toFixed(1));
+
+ // Show/hide treadmill-only controls based on device type
+ if (data.deviceType === data.TREADMILL_TYPE && data.TREADMILL_TYPE !== undefined) {
+ $('.treadmill-only').show();
+ $('.non-treadmill').hide();
+ } else {
+ $('.treadmill-only').hide();
+ $('.non-treadmill').show();
+ }
// Elevation
$('.elevation-value').html("" + data.elevation.toFixed(1) + " ");
diff --git a/src/templateinfosenderbuilder.cpp b/src/templateinfosenderbuilder.cpp
index 770dffb05e..36ad66cda2 100644
--- a/src/templateinfosenderbuilder.cpp
+++ b/src/templateinfosenderbuilder.cpp
@@ -1084,6 +1084,42 @@ void TemplateInfoSenderBuilder::onGearsMinus(const QJsonValue &msgContent, Templ
tempSender->send(out.toJson());
}
+void TemplateInfoSenderBuilder::onSpeedPlus(const QJsonValue &msgContent, TemplateInfoSender *tempSender) {
+ Q_UNUSED(msgContent);
+ QJsonObject main, outObj;
+ emit speed_Plus();
+ main[QStringLiteral("msg")] = QStringLiteral("R_speed_plus");
+ QJsonDocument out(main);
+ tempSender->send(out.toJson());
+}
+
+void TemplateInfoSenderBuilder::onSpeedMinus(const QJsonValue &msgContent, TemplateInfoSender *tempSender) {
+ Q_UNUSED(msgContent);
+ QJsonObject main, outObj;
+ emit speed_Minus();
+ main[QStringLiteral("msg")] = QStringLiteral("R_speed_minus");
+ QJsonDocument out(main);
+ tempSender->send(out.toJson());
+}
+
+void TemplateInfoSenderBuilder::onInclinationPlus(const QJsonValue &msgContent, TemplateInfoSender *tempSender) {
+ Q_UNUSED(msgContent);
+ QJsonObject main, outObj;
+ emit inclination_Plus();
+ main[QStringLiteral("msg")] = QStringLiteral("R_inclination_plus");
+ QJsonDocument out(main);
+ tempSender->send(out.toJson());
+}
+
+void TemplateInfoSenderBuilder::onInclinationMinus(const QJsonValue &msgContent, TemplateInfoSender *tempSender) {
+ Q_UNUSED(msgContent);
+ QJsonObject main, outObj;
+ emit inclination_Minus();
+ main[QStringLiteral("msg")] = QStringLiteral("R_inclination_minus");
+ QJsonDocument out(main);
+ tempSender->send(out.toJson());
+}
+
void TemplateInfoSenderBuilder::onPelotonStartWorkout(const QJsonValue &msgContent, TemplateInfoSender *tempSender) {
Q_UNUSED(msgContent);
QJsonObject main, outObj;
@@ -1255,6 +1291,18 @@ void TemplateInfoSenderBuilder::onDataReceived(const QByteArray &data) {
} else if (msg == QStringLiteral("gears_minus")) {
onGearsMinus(jsonObject[QStringLiteral("content")], sender);
return;
+ } else if (msg == QStringLiteral("speed_plus")) {
+ onSpeedPlus(jsonObject[QStringLiteral("content")], sender);
+ return;
+ } else if (msg == QStringLiteral("speed_minus")) {
+ onSpeedMinus(jsonObject[QStringLiteral("content")], sender);
+ return;
+ } else if (msg == QStringLiteral("inclination_plus")) {
+ onInclinationPlus(jsonObject[QStringLiteral("content")], sender);
+ return;
+ } else if (msg == QStringLiteral("inclination_minus")) {
+ onInclinationMinus(jsonObject[QStringLiteral("content")], sender);
+ return;
} else if (msg == QStringLiteral("peloton_start_workout")) {
onPelotonStartWorkout(jsonObject[QStringLiteral("content")], sender);
return;
diff --git a/src/templateinfosenderbuilder.h b/src/templateinfosenderbuilder.h
index 1c66a9f2a7..0784ffe976 100644
--- a/src/templateinfosenderbuilder.h
+++ b/src/templateinfosenderbuilder.h
@@ -34,6 +34,10 @@ class TemplateInfoSenderBuilder : public QObject {
void pelotonOffset_Minus();
void gears_Plus();
void gears_Minus();
+ void speed_Plus();
+ void speed_Minus();
+ void inclination_Plus();
+ void inclination_Minus();
int pelotonOffset();
bool pelotonAskStart();
void peloton_start_workout();
@@ -79,6 +83,10 @@ class TemplateInfoSenderBuilder : public QObject {
void onPelotonOffsetMinus(const QJsonValue &msgContent, TemplateInfoSender *tempSender);
void onGearsPlus(const QJsonValue &msgContent, TemplateInfoSender *tempSender);
void onGearsMinus(const QJsonValue &msgContent, TemplateInfoSender *tempSender);
+ void onSpeedPlus(const QJsonValue &msgContent, TemplateInfoSender *tempSender);
+ void onSpeedMinus(const QJsonValue &msgContent, TemplateInfoSender *tempSender);
+ void onInclinationPlus(const QJsonValue &msgContent, TemplateInfoSender *tempSender);
+ void onInclinationMinus(const QJsonValue &msgContent, TemplateInfoSender *tempSender);
void onPelotonStartWorkout(const QJsonValue &msgContent, TemplateInfoSender *tempSender);
void onPelotonAbortWorkout(const QJsonValue &msgContent, TemplateInfoSender *tempSender);
void onFloatingClose(const QJsonValue &msgContent, TemplateInfoSender *tempSender);