Add averaging to wake threshold. Makes it take more then just a "flick" to turn on
This commit is contained in:
parent
3ebf002f9d
commit
6d74820698
|
@ -50,7 +50,10 @@ bool MotionController::Should_ShakeWake(uint16_t thresh) {
|
||||||
auto diff = xTaskGetTickCount() - lastShakeTime;
|
auto diff = xTaskGetTickCount() - lastShakeTime;
|
||||||
lastShakeTime = xTaskGetTickCount();
|
lastShakeTime = xTaskGetTickCount();
|
||||||
int32_t speed = std::abs(y + z - lastYForShake - lastZForShake) / diff * 10;
|
int32_t speed = std::abs(y + z - lastYForShake - lastZForShake) / diff * 10;
|
||||||
if (speed > thresh) {
|
//(.2 * speed) + ((1 - .2) * accumulatedspeed);
|
||||||
|
//implemented without floats as .25Alpha
|
||||||
|
accumulatedspeed = (speed/4) + ((accumulatedspeed/4)*3);
|
||||||
|
if (accumulatedspeed > thresh) {
|
||||||
wake = true;
|
wake = true;
|
||||||
}
|
}
|
||||||
lastXForShake = x;
|
lastXForShake = x;
|
||||||
|
|
|
@ -65,6 +65,7 @@ namespace Pinetime {
|
||||||
int16_t lastXForShake = 0;
|
int16_t lastXForShake = 0;
|
||||||
int16_t lastYForShake = 0;
|
int16_t lastYForShake = 0;
|
||||||
int16_t lastZForShake = 0;
|
int16_t lastZForShake = 0;
|
||||||
|
int32_t accumulatedspeed = 0;
|
||||||
uint32_t lastShakeTime = 0;
|
uint32_t lastShakeTime = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@ namespace Pinetime {
|
||||||
private:
|
private:
|
||||||
Pinetime::Controllers::FS& fs;
|
Pinetime::Controllers::FS& fs;
|
||||||
|
|
||||||
static constexpr uint32_t settingsVersion = 0x0004;
|
static constexpr uint32_t settingsVersion = 0x0003;
|
||||||
struct SettingsData {
|
struct SettingsData {
|
||||||
uint32_t version = settingsVersion;
|
uint32_t version = settingsVersion;
|
||||||
uint32_t stepsGoal = 10000;
|
uint32_t stepsGoal = 10000;
|
||||||
|
@ -187,7 +187,7 @@ namespace Pinetime {
|
||||||
PineTimeStyle PTS;
|
PineTimeStyle PTS;
|
||||||
|
|
||||||
std::bitset<4> wakeUpMode {0};
|
std::bitset<4> wakeUpMode {0};
|
||||||
uint16_t shakeWakeThreshold = 300;
|
uint16_t shakeWakeThreshold = 150;
|
||||||
Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium;
|
Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user