lowersleep: Implement Lower to Sleep functionality (#827)
This commit is contained in:
@@ -115,6 +115,20 @@ bool MotionController::ShouldShakeWake(uint16_t thresh) {
|
||||
return accumulatedSpeed > thresh;
|
||||
}
|
||||
|
||||
bool MotionController::ShouldLowerSleep() const {
|
||||
if (stats.yMean < 724 || DegreesRolled(stats.yMean, stats.zMean, stats.prevYMean, stats.prevZMean) < 30) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint8_t i = AccelStats::numHistory + 1; i < yHistory.Size(); i++) {
|
||||
if (yHistory[i] < 265) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MotionController::Init(Pinetime::Drivers::Bma421::DeviceTypes types) {
|
||||
switch (types) {
|
||||
case Drivers::Bma421::DeviceTypes::BMA421:
|
||||
|
@@ -46,6 +46,7 @@ namespace Pinetime {
|
||||
|
||||
bool ShouldShakeWake(uint16_t thresh);
|
||||
bool ShouldRaiseWake() const;
|
||||
bool ShouldLowerSleep() const;
|
||||
|
||||
int32_t CurrentShakeSpeed() const {
|
||||
return accumulatedSpeed;
|
||||
|
@@ -12,12 +12,7 @@ namespace Pinetime {
|
||||
enum class ClockType : uint8_t { H24, H12 };
|
||||
enum class Notification : uint8_t { On, Off, Sleep };
|
||||
enum class ChimesOption : uint8_t { None, Hours, HalfHours };
|
||||
enum class WakeUpMode : uint8_t {
|
||||
SingleTap = 0,
|
||||
DoubleTap = 1,
|
||||
RaiseWrist = 2,
|
||||
Shake = 3,
|
||||
};
|
||||
enum class WakeUpMode : uint8_t { SingleTap = 0, DoubleTap = 1, RaiseWrist = 2, Shake = 3, LowerWrist = 4 };
|
||||
enum class Colors : uint8_t {
|
||||
White,
|
||||
Silver,
|
||||
@@ -238,7 +233,7 @@ namespace Pinetime {
|
||||
}
|
||||
};
|
||||
|
||||
std::bitset<4> getWakeUpModes() const {
|
||||
std::bitset<5> getWakeUpModes() const {
|
||||
return settings.wakeUpMode;
|
||||
}
|
||||
|
||||
@@ -279,7 +274,7 @@ namespace Pinetime {
|
||||
private:
|
||||
Pinetime::Controllers::FS& fs;
|
||||
|
||||
static constexpr uint32_t settingsVersion = 0x0005;
|
||||
static constexpr uint32_t settingsVersion = 0x0006;
|
||||
|
||||
struct SettingsData {
|
||||
uint32_t version = settingsVersion;
|
||||
@@ -296,8 +291,9 @@ namespace Pinetime {
|
||||
|
||||
WatchFaceInfineat watchFaceInfineat;
|
||||
|
||||
std::bitset<4> wakeUpMode {0};
|
||||
std::bitset<5> wakeUpMode {0};
|
||||
uint16_t shakeWakeThreshold = 150;
|
||||
|
||||
Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user