summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2022-04-01 21:25:34 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-04-01 21:27:01 (GMT)
commit6c5fe5cf5b2018f9e601aefe3b8de1e117502b69 (patch)
tree49baf300dacb0044d40bd31de895c91303e3e3f6
parent79fc7313648ac07885f17e51260f44e858410d22 (diff)
some fixes
-rw-r--r--src/displayapp/screens/Motion.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp
index 9ad6a16..ba25084 100644
--- a/src/displayapp/screens/Motion.cpp
+++ b/src/displayapp/screens/Motion.cpp
@@ -51,12 +51,12 @@ Motion::Motion(Pinetime::Applications::DisplayApp* app, System::SystemTask& syst
// lv_label_set_recolor(label, true);
lastLabel = lv_label_create(lv_scr_act(), NULL);
- lv_obj_align(lastLabel, label, LV_ALIGN_IN_TOP_MID, 0, 0);
+ lv_obj_align(lastLabel, label, LV_ALIGN_OUT_BOTTOM_MID, 0, 0);
recordLabel = lv_label_create(lv_scr_act(), NULL);
- lv_obj_align(recordLabel, lastLabel, LV_ALIGN_IN_TOP_MID, 0, 0);
+ lv_obj_align(recordLabel, lastLabel, LV_ALIGN_OUT_BOTTOM_MID, 0, 0);
- taskRefresh = lv_task_create(RefreshTaskCallback, FRAME_MS, LV_TASK_PRIO_HIGH, this);
+ taskRefresh = lv_task_create(RefreshTaskCallback, FRAME_MS, LV_TASK_PRIO_MID, this);
}
Motion::~Motion() {
@@ -75,15 +75,15 @@ void Motion::Refresh() {
uint16_t current_time = xTaskGetTickCount();
if (started) {
uint16_t current_frame_ms = current_time - last_frame_time;
- G *= G_SCALE;
- if (G < 1) {
+ double G_scaled = G * G_SCALE;
+ if (G_scaled < 1) {
if (!jumping) {
jump_started_or_ended = true;
current_jump_speed = 0;
current_jump_length = 0;
jumping = true;
}
- double current_jump_accel = 1 - G;
+ double current_jump_accel = 1 - G_scaled;
double current_frame_s = current_frame_ms * 0.001;
current_jump_speed += current_jump_accel * current_frame_s;
current_jump_length += current_jump_speed * current_frame_s;