diff options
Diffstat (limited to 'src/displayapp/screens/Motion.cpp')
| -rw-r--r-- | src/displayapp/screens/Motion.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp index 3ceac47..2acfbae 100644 --- a/src/displayapp/screens/Motion.cpp +++ b/src/displayapp/screens/Motion.cpp @@ -14,7 +14,7 @@ #define REDRAW_FRAME_HZ 40 #define REDRAW_FRAME_MS (1000 / REDRAW_FRAME_HZ) #define REDRAW_FRAME_TICKS (REDRAW_FRAME_MS / APX_TICK_PERIOD_MS) -#define G_SCALE (9.8*0.001) +#define G_SCALE 0.001 using namespace Pinetime::Applications::Screens; @@ -83,7 +83,7 @@ void Motion::Refresh() { current_jump_length = 0; jumping = true; } - double current_jump_accel = 1 - G_scaled; + double current_jump_accel = (1.0 - G_scaled) * 9.8; 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; @@ -110,13 +110,15 @@ void Motion::Refresh() { started = true; } last_redraw_frame_time = current_time; - uint16_t G_uint16 = G < 0xffff ? G : 0xffff; - lv_chart_set_next(chart, ser1, 1000 - ((int16_t)G_uint16)); - labelText[4] = '0'+(G_uint16%10); G_uint16 /= 10; - labelText[3] = '0'+(G_uint16%10); G_uint16 /= 10; - labelText[2] = '0'+(G_uint16%10); G_uint16 /= 10; - labelText[1] = '0'+(G_uint16%10); G_uint16 /= 10; - labelText[0] = '0'+G_uint16 + { + uint16_t G_uint16 = G < 0xffff ? G : 0xffff; + lv_chart_set_next(chart, ser1, 1000 - ((int16_t)G_uint16)); + labelText[4] = '0'+(G_uint16%10); G_uint16 /= 10; + labelText[3] = '0'+(G_uint16%10); G_uint16 /= 10; + labelText[2] = '0'+(G_uint16%10); G_uint16 /= 10; + labelText[1] = '0'+(G_uint16%10); G_uint16 /= 10; + labelText[0] = '0'+G_uint16; + } lv_label_set_text_static(label, labelText); if (jump_started_or_ended) { if (new_record) { |
