Skip to content

Commit 3dcdb5e

Browse files
committed
Fix: haptic strength scaling is now bidirectional
Fix: haptic strength scaling is now bidirectional
1 parent d2081fd commit 3dcdb5e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/haptic_feedback.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,16 @@ void haptic_feedback_update(
175175
} else if (should_be_playing) {
176176
const CfgHapticTone *tone = get_haptic_tone(hf);
177177
if (tone->strength > 0.0f) {
178-
foc_play_tone(0, tone->frequency, tone->strength * strength_scale(hf, md->speed));
178+
foc_play_tone(
179+
0, tone->frequency, tone->strength * strength_scale(hf, fabsf(md->speed))
180+
);
179181
}
180182

181183
if (hf->cfg->vibrate.strength > 0.0f) {
182184
motor_control_play_tone(
183185
mc,
184186
hf->cfg->vibrate.frequency,
185-
hf->cfg->vibrate.strength * strength_scale(hf, md->speed)
187+
hf->cfg->vibrate.strength * strength_scale(hf, fabsf(md->speed))
186188
);
187189
}
188190

0 commit comments

Comments
 (0)