diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-04-01 22:53:10 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-04-01 22:56:55 (GMT) |
| commit | b9f3e0d8bdb4ed02a9364fe1d025e441dc7c8ded (patch) | |
| tree | 6833dcfffee37a710b4366331084d09e02727ff6 /src/displayapp/screens | |
| parent | 2557f8ed6226916d1a82905e7fed3987b3f774f5 (diff) | |
.
Diffstat (limited to 'src/displayapp/screens')
| -rw-r--r-- | src/displayapp/screens/Motion.cpp | 14 | ||||
| -rw-r--r-- | src/displayapp/screens/Motion.h | 4 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp index 601fbbf..6a0b543 100644 --- a/src/displayapp/screens/Motion.cpp +++ b/src/displayapp/screens/Motion.cpp @@ -18,8 +18,8 @@ using namespace Pinetime::Applications::Screens; -Motion::Motion(Pinetime::Applications::DisplayApp* app, System::SystemTask& systemTask, Controllers::MotionController& motionController) - : Screen(app), motionController {motionController}, systemTask {systemTask} { +Motion::Motion(Pinetime::Applications::DisplayApp* app, System::SystemTask& systemTask, Controllers::MotionController& motionController, Controllers::MotorController& motorController) + : Screen(app), motionController {motionController}, motorController {motorController}, systemTask {systemTask} { systemTask.PushMessage(Pinetime::System::Messages::DisableSleeping); chart = lv_chart_create(lv_scr_act(), NULL); @@ -122,7 +122,9 @@ void Motion::Refresh() { lv_label_set_text_static(label, labelText); if (jump_started_or_ended) { if (new_record) { - lv_label_set_text_fmt(recordLabel, "%f", ((float)current_jump_length)); + uint32_t a = (current_jump_length*100000.0); + lv_label_set_text_fmt(recordLabel, "%d.%03d", a/1000, a%1000); + motorController.RunForDuration(35); } lv_color_t color; if (jumping) { @@ -130,7 +132,11 @@ void Motion::Refresh() { } else { double best_jump_length = records[0].jump_length; if (current_jump_length * 100 > best_jump_length) { - lv_label_set_text_fmt(lastLabel, "%f", ((float)current_jump_length)); + uint32_t a = (current_jump_length*100000.0); + lv_label_set_text_fmt(recordLabel, "%d.%03d", a/1000, a%1000); + if (!new_record && current_jump_length > 0.05) { + motorController.RunForDuration(11); + } } color = LV_COLOR_ORANGE; } diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h index 2554ffd..421bf4d 100644 --- a/src/displayapp/screens/Motion.h +++ b/src/displayapp/screens/Motion.h @@ -6,6 +6,7 @@ #include "displayapp/screens/Screen.h" #include <lvgl/src/lv_core/lv_style.h> #include <lvgl/src/lv_core/lv_obj.h> +#include <components/motor/MotorController.h> #include <components/motion/MotionController.h> namespace Pinetime { @@ -14,13 +15,14 @@ namespace Pinetime { class Motion : public Screen { public: - Motion(DisplayApp* app, System::SystemTask& systemTask, Controllers::MotionController& motionController); + Motion(DisplayApp* app, System::SystemTask& systemTask, Controllers::MotionController& motionController, Controllers::MotorController& motorController); ~Motion() override; void Refresh() override; private: Controllers::MotionController& motionController; + Controllers::MotorController& motorController; System::SystemTask& systemTask; // bool calibrating = true; bool started = false; |
