Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/homeform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/homeform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
105 changes: 93 additions & 12 deletions src/inner_templates/floating/floating.htm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
font-size: 24px;
}

.treadmill-only {
display: none;
}

.overlay {
position: absolute;
top: 0;
Expand Down Expand Up @@ -73,20 +77,24 @@ <h2 style="color: #FFFFFF; font-family: sans-serif">Peloton Workout in progress!
<tr class="speed" sort-order="0">
<td class="icon">🏃</td>
<td style="text-align: left">SPEED</td>
<td class="speed-avg-title"><small>AVG</small></td>
<td class="speed-avg">0.0</td>
<td class="speed-avg-title"><small class="non-treadmill">AVG</small><button class="treadmill-only" style="width: 30px; font-size: 18px; color: white; background-color:#4C70BF; border: none; cursor: pointer;"
onclick="SpeedMinus()">-</button></td>
<td class="speed-avg"><span class="speed-avg-value">0.0</span><span class="treadmill-only"><br><small style="font-size: 10px; color: #888;">AVG</small></span></td>
<td class="speed-value values"><b>0.0</b></td>
<td class="speed-max-title"><small>MAX</small></td>
<td class="speed-max">0.0</td>
<td class="speed-max-title"><small class="non-treadmill">MAX</small><button class="treadmill-only" style="width: 30px; font-size: 18px; color: white; background-color:#4C70BF; border: none; cursor: pointer;"
onclick="SpeedPlus()">+</button></td>
<td class="speed-max"><span class="speed-max-value">0.0</span><span class="treadmill-only"><br><small style="font-size: 10px; color: #888;">MAX</small></span></td>
</tr>
<tr class="inclination" sort-order="1">
<td class="icon">📐</td>
<td style="text-align: left">INCLINE</td>
<td><small>AVG</small></td>
<td class="inclination-avg">0.0</td>
<td class="inclination-avg-title"><small class="non-treadmill">AVG</small><button class="treadmill-only" style="width: 30px; font-size: 18px; color: white; background-color:#4C70BF; border: none; cursor: pointer;"
onclick="InclinationMinus()">-</button></td>
<td class="inclination-avg"><span class="inclination-avg-value">0.0</span><span class="treadmill-only"><br><small style="font-size: 10px; color: #888;">AVG</small></span></td>
<td class="inclination-value values"><b>0.0</b></td>
<td><small>MAX</small></td>
<td class="inclination-max">0.0</td>
<td class="inclination-max-title"><small class="non-treadmill">MAX</small><button class="treadmill-only" style="width: 30px; font-size: 18px; color: white; background-color:#4C70BF; border: none; cursor: pointer;"
onclick="InclinationPlus()">+</button></td>
<td class="inclination-max"><span class="inclination-max-value">0.0</span><span class="treadmill-only"><br><small style="font-size: 10px; color: #888;">MAX</small></span></td>
</tr>
<tr class="pace" sort-order="2">
<td class="icon">🏃</td>
Expand Down Expand Up @@ -306,6 +314,62 @@ <h2 style="color: #FFFFFF; font-family: sans-serif">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',
Expand Down Expand Up @@ -611,6 +675,7 @@ <h2 style="color: #FFFFFF; font-family: sans-serif">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',
Expand Down Expand Up @@ -673,6 +738,8 @@ <h2 style="color: #FFFFFF; font-family: sans-serif">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)
Expand Down Expand Up @@ -789,6 +856,10 @@ <h2 style="color: #FFFFFF; font-family: sans-serif">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') {
Expand Down Expand Up @@ -837,14 +908,24 @@ <h2 style="color: #FFFFFF; font-family: sans-serif">Peloton Workout in progress!

$('.speed-value').html("<b>" + speed.toFixed(1) + "</b>");
}
$('.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("<b>" + inclination.toFixed(1) + "/" + target_inclination.toFixed(1) + "</b>");
else
$('.inclination-value').html("<b>" + inclination.toFixed(1) + "</b>");
$('.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("<b>" + elevation.toFixed(1) + "</b>");
if (tile_target_cadence_enabled && target_cadence > 0)
$('.cadence-value').html("<b>" + cadence.toFixed(0) + "/" + target_cadence.toFixed(0) + "</b>");
Expand Down
Loading
Loading