raisewake: Improve raise to wake algorithm
This new algorithm calculates the number of degrees that the wrist has rolled, and checks if that is above a threshold. First it checks if the wrist is still enough for the acceleration values to be considered mostly from gravity. It does this by calculating the mean over the past 2 SystemTask loops, and checking that the variance from that mean is below a threshold. Then it calculates the angle the wrist is being held at, and calculates the difference from the angle some time ago. If this difference is above the threshold, it wakes the watch.
This commit is contained in:
@@ -45,7 +45,7 @@ namespace Pinetime {
|
||||
}
|
||||
|
||||
bool ShouldShakeWake(uint16_t thresh);
|
||||
bool ShouldRaiseWake(bool isSleeping);
|
||||
bool ShouldRaiseWake() const;
|
||||
|
||||
int32_t CurrentShakeSpeed() const {
|
||||
return accumulatedSpeed;
|
||||
@@ -86,7 +86,6 @@ namespace Pinetime {
|
||||
|
||||
int16_t lastX = 0;
|
||||
int16_t x = 0;
|
||||
int16_t lastYForRaiseWake = 0;
|
||||
static constexpr uint8_t histSize = 8;
|
||||
Utility::CircularBuffer<int16_t, histSize> yHistory = {};
|
||||
Utility::CircularBuffer<int16_t, histSize> zHistory = {};
|
||||
|
||||
Reference in New Issue
Block a user