Skip to content

Commit b58395f

Browse files
committed
πŸ› fix(input_service): correct time unit conversion for press delays
- multiply `LongPressTime` and `DebounceTime` by 1000 in `OnInputChanged` to convert from milliseconds to microseconds - apply same conversion in `GetPressDelay` method for consistency
1 parent 240501a commit b58395f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

β€Žsrc/services/input_service/input_service.cppβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ void InputService::OnInputChanged(Input& input, const bool active, const uint32_
200200
SendInputEventHelper(input, InputEventType::ACTIVE);
201201
} else {
202202
SendInputEventHelper(input, InputEventType::INACTIVE);
203-
if (duration >= LongPressTime.value) {
203+
if (duration >= LongPressTime.value * 1000) {
204204
SendInputEventHelper(input, InputEventType::LONG);
205-
} else if (duration >= DebounceTime.value) {
205+
} else if (duration >= DebounceTime.value * 1000) {
206206
// Note that debouncing works only one-way here.
207207
// If the input becomes inactive for just a nanosecond, it will interrupt the long press.
208208
SendInputEventHelper(input, InputEventType::SHORT);

β€Žsrc/services/input_service/input_service.hppβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class InputService : public InputServiceBase {
3333
etl::pair<uint16_t, uint32_t> GetEmergencyReasons(uint32_t now);
3434

3535
uint32_t GetPressDelay(bool long_press = false) {
36-
return long_press ? LongPressTime.value : DebounceTime.value;
36+
return (long_press ? LongPressTime.value : DebounceTime.value) * 1000;
3737
}
3838

3939
private:

0 commit comments

Comments
Β (0)