Skip to content

Commit

Permalink
chore: Add constexpr
Browse files Browse the repository at this point in the history
  • Loading branch information
pfeerick committed Aug 5, 2024
1 parent 6369d9e commit 9ecd8c2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions radio/src/haptic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "opentx.h"
#include "haptic.h"

constexpr uint8_t fullHaptic = 255;

hapticQueue::hapticQueue()
{
buzzTimeLeft = 0;
Expand All @@ -31,8 +33,8 @@ hapticQueue::hapticQueue()
t_queueWidx = 0;

hapticTick = 0;
intensity = 255;

intensity = fullHaptic;
}

void hapticQueue::heartbeat()
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 9ecd8c2

Please sign in to comment.