Skip to content

Commit f993311

Browse files
FintasticManRiksu9000
authored andcommitted
shakewake: Fix names according to style guide
1 parent ada1823 commit f993311

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/components/motion/MotionController.cpp

+4-8
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ bool MotionController::Should_RaiseWake(bool isSleeping) {
4343
return false;
4444
}
4545

46-
bool MotionController::Should_ShakeWake(uint16_t thresh) {
46+
bool MotionController::ShouldShakeWake(uint16_t thresh) {
4747
bool wake = false;
4848
auto diff = xTaskGetTickCount() - lastShakeTime;
4949
lastShakeTime = xTaskGetTickCount();
5050
/* Currently Polling at 10hz, If this ever goes faster scalar and EMA might need adjusting */
5151
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);
5353
// implemented without floats as .25Alpha
54-
accumulatedspeed = (speed / 5) + ((accumulatedspeed / 5) * 4);
54+
accumulatedSpeed = (speed / 5) + ((accumulatedSpeed / 5) * 4);
5555

56-
if (accumulatedspeed > thresh) {
56+
if (accumulatedSpeed > thresh) {
5757
wake = true;
5858
}
5959
lastXForShake = x / 4;
@@ -62,10 +62,6 @@ bool MotionController::Should_ShakeWake(uint16_t thresh) {
6262
return wake;
6363
}
6464

65-
int32_t MotionController::currentShakeSpeed() {
66-
return accumulatedspeed;
67-
}
68-
6965
void MotionController::IsSensorOk(bool isOk) {
7066
isSensorOk = isOk;
7167
}

src/components/motion/MotionController.h

+8-4
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ namespace Pinetime {
4040
return currentTripSteps;
4141
}
4242

43-
bool Should_ShakeWake(uint16_t thresh);
43+
bool ShouldShakeWake(uint16_t thresh);
4444
bool Should_RaiseWake(bool isSleeping);
45-
int32_t currentShakeSpeed();
45+
46+
int32_t CurrentShakeSpeed() const {
47+
return accumulatedSpeed;
48+
}
49+
4650
void IsSensorOk(bool isOk);
4751

4852
bool IsSensorOk() const {
@@ -70,8 +74,8 @@ namespace Pinetime {
7074
int16_t lastXForShake = 0;
7175
int16_t lastYForShake = 0;
7276
int16_t lastZForShake = 0;
73-
int32_t accumulatedspeed = 0;
77+
int32_t accumulatedSpeed = 0;
7478
uint32_t lastShakeTime = 0;
7579
};
7680
}
77-
}
81+
}

src/displayapp/screens/settings/SettingShakeThreshold.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@ void SettingShakeThreshold::Refresh() {
9696
}
9797
if (calibrating == 2) {
9898

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);
101101
}
102102
if (xTaskGetTickCount() - vCalTime > pdMS_TO_TICKS(7500)) {
103103
lv_btn_set_state(calButton, LV_STATE_DEFAULT);
104104
lv_event_send(calButton, LV_EVENT_VALUE_CHANGED, nullptr);
105105
}
106106
}
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);
109109
vDecay = xTaskGetTickCount();
110110
} else if ((xTaskGetTickCount() - vDecay) > pdMS_TO_TICKS(1500)) {
111111
lv_arc_set_value(animArc, lv_arc_get_value(animArc) - 25);

src/systemtask/SystemTask.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ void SystemTask::UpdateMotion() {
470470
if ((settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) &&
471471
motionController.Should_RaiseWake(state == SystemTaskState::Sleeping)) ||
472472
(settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake) &&
473-
motionController.Should_ShakeWake(settingsController.GetShakeThreshold()))) {
473+
motionController.ShouldShakeWake(settingsController.GetShakeThreshold()))) {
474474
GoToRunning();
475475
}
476476
}

0 commit comments

Comments
 (0)