diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-04-10 13:50:02 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-04-10 14:07:49 (GMT) |
| commit | 34a6369f793bb36a3f66eba87535159819c65f2b (patch) | |
| tree | 65e206128ee042de8372d915966c8981246be9fb /src/displayapp/screens/Jumpscore.h | |
| parent | 4d8a0d3300345b71dcbd7e86d1e7c4cfcc3cf200 (diff) | |
Add jumpscore app
Diffstat (limited to 'src/displayapp/screens/Jumpscore.h')
| -rw-r--r-- | src/displayapp/screens/Jumpscore.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/displayapp/screens/Jumpscore.h b/src/displayapp/screens/Jumpscore.h new file mode 100644 index 0000000..0785254 --- /dev/null +++ b/src/displayapp/screens/Jumpscore.h @@ -0,0 +1,69 @@ +#pragma once + +#include <cstdint> +#include <chrono> +#include "systemtask/SystemTask.h" +#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> + +#define DEBUG_JUMPSCORE_APP 1 +#define JUMPSCORE_NO_CHART 1 +#define JUMPSCORE_ICON 1 + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class Jumpscore : public Screen { + public: + Jumpscore(DisplayApp* app, System::SystemTask& systemTask, Controllers::MotionController& motionController, Controllers::MotorController& motorController); + ~Jumpscore() override; + + void Refresh() override; + + private: + Controllers::MotionController& motionController; + Controllers::MotorController& motorController; + System::SystemTask& systemTask; + // bool calibrating = true; + bool started = false; + bool jumping = false; + bool new_record = true; + TickType_t last_frame_time = 0; + TickType_t last_redraw_frame_time = 0; + // uint8_t dropped_frames = 0; + double last_jump_length = 0; + double best_jump_length = 0; // Best jump length in this session + lv_color_t color; + double current_jump_length; + double current_jump_speed; + struct Record { + double jump_length; + }; + Record records[5] = { {-1}, {-1}, {-1}, {-1}, {-1} }; + char labelText[6] = { '0', '0', '0', '0', '0', 0 }; +#ifndef JUMPSCORE_NO_CHART + lv_obj_t* chart; + lv_chart_series_t* ser1; +#endif + lv_obj_t* icon; + lv_obj_t* bar; + lv_obj_t* label; + lv_obj_t* recordLabel; + lv_obj_t* lastLabel; + + lv_task_t* taskRefresh; +#ifdef DEBUG_JUMPSCORE_APP + lv_obj_t* infoLabel; + int32_t frame_count = 0; + int32_t max_frame_ms = 0; + int32_t avg_frame_ms = 0; + int32_t total_frames_ms = 0; +#endif + }; + } + } +} |
