shakewake: Simplify return code
This commit is contained in:
parent
6cf6455313
commit
a43463762c
|
@ -50,7 +50,6 @@ bool MotionController::Should_RaiseWake(bool isSleeping) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotionController::ShouldShakeWake(uint16_t thresh) {
|
bool MotionController::ShouldShakeWake(uint16_t thresh) {
|
||||||
bool wake = false;
|
|
||||||
auto diff = xTaskGetTickCount() - lastShakeTime;
|
auto diff = xTaskGetTickCount() - lastShakeTime;
|
||||||
lastShakeTime = xTaskGetTickCount();
|
lastShakeTime = xTaskGetTickCount();
|
||||||
/* Currently Polling at 10hz, If this ever goes faster scalar and EMA might need adjusting */
|
/* 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) {
|
||||||
// implemented without floats as .25Alpha
|
// implemented without floats as .25Alpha
|
||||||
accumulatedSpeed = (speed / 5) + ((accumulatedSpeed / 5) * 4);
|
accumulatedSpeed = (speed / 5) + ((accumulatedSpeed / 5) * 4);
|
||||||
|
|
||||||
if (accumulatedSpeed > thresh) {
|
return accumulatedSpeed > thresh;
|
||||||
wake = true;
|
|
||||||
}
|
|
||||||
return wake;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionController::IsSensorOk(bool isOk) {
|
void MotionController::IsSensorOk(bool isOk) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user