Skip to content

Commit a434637

Browse files
FintasticManRiksu9000
authored andcommitted
shakewake: Simplify return code
1 parent 6cf6455 commit a434637

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

src/components/motion/MotionController.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ bool MotionController::Should_RaiseWake(bool isSleeping) {
5050
}
5151

5252
bool MotionController::ShouldShakeWake(uint16_t thresh) {
53-
bool wake = false;
5453
auto diff = xTaskGetTickCount() - lastShakeTime;
5554
lastShakeTime = xTaskGetTickCount();
5655
/* Currently Polling at 10hz, If this ever goes faster scalar and EMA might need adjusting */
@@ -59,10 +58,7 @@ bool MotionController::ShouldShakeWake(uint16_t thresh) {
5958
// implemented without floats as .25Alpha
6059
accumulatedSpeed = (speed / 5) + ((accumulatedSpeed / 5) * 4);
6160

62-
if (accumulatedSpeed > thresh) {
63-
wake = true;
64-
}
65-
return wake;
61+
return accumulatedSpeed > thresh;
6662
}
6763

6864
void MotionController::IsSensorOk(bool isOk) {

0 commit comments

Comments
 (0)