From 3f346b4849c3e98b9c881ec4a446381ac30d62c9 Mon Sep 17 00:00:00 2001 From: Chris Paulo Date: Tue, 17 Oct 2023 11:22:51 -0700 Subject: [PATCH] felix/vibrator: Update durations to match other projects Updated the duration of effects to match waveform durations. This will remove the added overhead durations which are not supposed to be part of the calculations for durations of effects. Bug: 305756647 Test: atest VibratorHalCs40l26TestSuitePrivate Change-Id: I66c761482b13969816630e89b9e79cfb729f6f5c Signed-off-by: Chris Paulo --- vibrator/cs40l26/Vibrator.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/vibrator/cs40l26/Vibrator.cpp b/vibrator/cs40l26/Vibrator.cpp index 5ad996a..7d5227e 100644 --- a/vibrator/cs40l26/Vibrator.cpp +++ b/vibrator/cs40l26/Vibrator.cpp @@ -55,11 +55,6 @@ static constexpr uint8_t VOLTAGE_SCALE_MAX = 100; static constexpr int8_t MAX_COLD_START_LATENCY_MS = 6; // I2C Transaction + DSP Return-From-Standby static constexpr int8_t MAX_PAUSE_TIMING_ERROR_MS = 1; // ALERT Irq Handling static constexpr uint32_t MAX_TIME_MS = UINT16_MAX; -static constexpr float SETTING_TIME_OVERHEAD = 26; // This time was combined by - // HAL set the effect to - // driver and the kernel - // executes the effect before - // chip play the effect static constexpr auto ASYNC_COMPLETION_TIMEOUT = std::chrono::milliseconds(100); static constexpr auto POLLING_TIMEOUT = 20; @@ -358,7 +353,7 @@ Vibrator::Vibrator(std::unique_ptr hwApiDefault, std::unique_ptr h mFfEffects.resize(WAVEFORM_MAX_INDEX); mEffectDurations.resize(WAVEFORM_MAX_INDEX); mEffectDurations = { - 1000, 100, 32, 1000, 300, 130, 150, 500, 100, 10, 12, 1000, 1000, 1000, + 1000, 100, 12, 1000, 300, 130, 150, 500, 100, 5, 12, 1000, 1000, 1000, }; /* 11+3 waveforms. The duration must < UINT16_MAX */ uint8_t effectIndex; @@ -701,8 +696,8 @@ ndk::ScopedAStatus Vibrator::getPrimitiveDuration(CompositePrimitive primitive, if (!status.isOk()) { return status; } - // Please check the overhead time detail in b/261841035 - *durationMs = mEffectDurations[effectIndex] + SETTING_TIME_OVERHEAD; + + *durationMs = mEffectDurations[effectIndex]; } else { *durationMs = 0; }