File tree 4 files changed +17
-17
lines changed
displayapp/screens/settings
4 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -43,17 +43,17 @@ bool MotionController::Should_RaiseWake(bool isSleeping) {
43
43
return false ;
44
44
}
45
45
46
- bool MotionController::Should_ShakeWake (uint16_t thresh) {
46
+ bool MotionController::ShouldShakeWake (uint16_t thresh) {
47
47
bool wake = false ;
48
48
auto diff = xTaskGetTickCount () - lastShakeTime;
49
49
lastShakeTime = xTaskGetTickCount ();
50
50
/* Currently Polling at 10hz, If this ever goes faster scalar and EMA might need adjusting */
51
51
int32_t speed = std::abs (z + (y / 2 ) + (x / 4 ) - lastYForShake - lastZForShake) / diff * 100 ;
52
- // (.2 * speed) + ((1 - .2) * accumulatedspeed );
52
+ // (.2 * speed) + ((1 - .2) * accumulatedSpeed );
53
53
// implemented without floats as .25Alpha
54
- accumulatedspeed = (speed / 5 ) + ((accumulatedspeed / 5 ) * 4 );
54
+ accumulatedSpeed = (speed / 5 ) + ((accumulatedSpeed / 5 ) * 4 );
55
55
56
- if (accumulatedspeed > thresh) {
56
+ if (accumulatedSpeed > thresh) {
57
57
wake = true ;
58
58
}
59
59
lastXForShake = x / 4 ;
@@ -62,10 +62,6 @@ bool MotionController::Should_ShakeWake(uint16_t thresh) {
62
62
return wake;
63
63
}
64
64
65
- int32_t MotionController::currentShakeSpeed () {
66
- return accumulatedspeed;
67
- }
68
-
69
65
void MotionController::IsSensorOk (bool isOk) {
70
66
isSensorOk = isOk;
71
67
}
Original file line number Diff line number Diff line change @@ -40,9 +40,13 @@ namespace Pinetime {
40
40
return currentTripSteps;
41
41
}
42
42
43
- bool Should_ShakeWake (uint16_t thresh);
43
+ bool ShouldShakeWake (uint16_t thresh);
44
44
bool Should_RaiseWake (bool isSleeping);
45
- int32_t currentShakeSpeed ();
45
+
46
+ int32_t CurrentShakeSpeed () const {
47
+ return accumulatedSpeed;
48
+ }
49
+
46
50
void IsSensorOk (bool isOk);
47
51
48
52
bool IsSensorOk () const {
@@ -70,8 +74,8 @@ namespace Pinetime {
70
74
int16_t lastXForShake = 0 ;
71
75
int16_t lastYForShake = 0 ;
72
76
int16_t lastZForShake = 0 ;
73
- int32_t accumulatedspeed = 0 ;
77
+ int32_t accumulatedSpeed = 0 ;
74
78
uint32_t lastShakeTime = 0 ;
75
79
};
76
80
}
77
- }
81
+ }
Original file line number Diff line number Diff line change @@ -96,16 +96,16 @@ void SettingShakeThreshold::Refresh() {
96
96
}
97
97
if (calibrating == 2 ) {
98
98
99
- if ((motionController.currentShakeSpeed () - 300 ) > lv_arc_get_value (positionArc)) {
100
- lv_arc_set_value (positionArc, (int16_t ) motionController.currentShakeSpeed () - 300 );
99
+ if ((motionController.CurrentShakeSpeed () - 300 ) > lv_arc_get_value (positionArc)) {
100
+ lv_arc_set_value (positionArc, (int16_t ) motionController.CurrentShakeSpeed () - 300 );
101
101
}
102
102
if (xTaskGetTickCount () - vCalTime > pdMS_TO_TICKS (7500 )) {
103
103
lv_btn_set_state (calButton, LV_STATE_DEFAULT);
104
104
lv_event_send (calButton, LV_EVENT_VALUE_CHANGED, nullptr );
105
105
}
106
106
}
107
- if (motionController.currentShakeSpeed () - 300 > lv_arc_get_value (animArc)) {
108
- lv_arc_set_value (animArc, (uint16_t ) motionController.currentShakeSpeed () - 300 );
107
+ if (motionController.CurrentShakeSpeed () - 300 > lv_arc_get_value (animArc)) {
108
+ lv_arc_set_value (animArc, (uint16_t ) motionController.CurrentShakeSpeed () - 300 );
109
109
vDecay = xTaskGetTickCount ();
110
110
} else if ((xTaskGetTickCount () - vDecay) > pdMS_TO_TICKS (1500 )) {
111
111
lv_arc_set_value (animArc, lv_arc_get_value (animArc) - 25 );
Original file line number Diff line number Diff line change @@ -470,7 +470,7 @@ void SystemTask::UpdateMotion() {
470
470
if ((settingsController.isWakeUpModeOn (Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) &&
471
471
motionController.Should_RaiseWake (state == SystemTaskState::Sleeping)) ||
472
472
(settingsController.isWakeUpModeOn (Pinetime::Controllers::Settings::WakeUpMode::Shake) &&
473
- motionController.Should_ShakeWake (settingsController.GetShakeThreshold ()))) {
473
+ motionController.ShouldShakeWake (settingsController.GetShakeThreshold ()))) {
474
474
GoToRunning ();
475
475
}
476
476
}
You can’t perform that action at this time.
0 commit comments