Skip to content

Commit 2c09b33

Browse files
cagnuleinclaude
andcommitted
Apply bike resistance gain to FTMS target-resistance-level writes
Fixes resistance mismatch on bikes like the Toputure TEB5, which internally amplifies the received resistance level (~25% higher than requested). The FTMS_SET_INDOOR_BIKE_SIMULATION_PARAMS branch already applied bike_resistance_gain_f/offset, but the FTMS_SET_TARGET_RESISTANCE_LEVEL branch used by TEB5 sent the raw value. Default gain is 1.0, so this is a no-op for anyone not configuring it. Fixes discussion #4793 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent be5a34b commit 2c09b33

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/devices/ftmsbike/ftmsbike.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ void ftmsbike::forceResistance(resistance_t requestResistance) {
356356
uint8_t write[] = {FTMS_SET_TARGET_RESISTANCE_LEVEL, 0x00};
357357
if(_3G_Cardio_RB || SL010)
358358
requestResistance = requestResistance * 10;
359+
requestResistance = (resistance_t)qRound(((double)requestResistance) * bikeResistanceGain);
359360
write[1] = ((uint8_t)(requestResistance));
360361
writeCharacteristic(write, sizeof(write),
361362
QStringLiteral("forceResistance ") + QString::number(requestResistance));

0 commit comments

Comments
 (0)