From b4fd3efc4ddc04010e772a4537e4ba549839c3ec Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Mon, 13 Nov 2023 10:28:27 +1000 Subject: [PATCH] chore: Add constexpr --- radio/src/haptic.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/radio/src/haptic.cpp b/radio/src/haptic.cpp index 3f51146e899..ddf4f128823 100644 --- a/radio/src/haptic.cpp +++ b/radio/src/haptic.cpp @@ -22,6 +22,8 @@ #include "opentx.h" #include "haptic.h" +constexpr uint8_t fullHaptic = 255; + hapticQueue::hapticQueue() { buzzTimeLeft = 0; @@ -31,8 +33,8 @@ hapticQueue::hapticQueue() t_queueWidx = 0; hapticTick = 0; - - intensity = 255; + + intensity = fullHaptic; } void hapticQueue::heartbeat() @@ -43,7 +45,7 @@ void hapticQueue::heartbeat() if (buzzTimeLeft > 0) { buzzTimeLeft--; // time gets counted down #if defined(HAPTIC_PWM) - if (intensity < 255) { + if (intensity < fullHaptic) { hapticOn(intensity); } else { hapticOn(HAPTIC_STRENGTH() * 20); @@ -88,7 +90,7 @@ void hapticQueue::play(uint8_t tLen, uint8_t tPause, uint8_t tFlags) } else { buzzTimeLeft = tLen; buzzPause = tPause; - intensity = 255; + intensity = fullHaptic; } t_queueWidx = t_queueRidx; }