2021-06-12 13:06:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "systemtask/SystemTask.h"
|
|
|
|
#include "components/motor/MotorController.h"
|
2021-11-28 20:47:19 +00:00
|
|
|
#include "displayapp/screens/Screen.h"
|
2021-06-12 13:06:58 +00:00
|
|
|
|
2021-08-13 19:03:27 +00:00
|
|
|
namespace Pinetime {
|
|
|
|
namespace Applications {
|
|
|
|
namespace Screens {
|
2021-06-12 13:06:58 +00:00
|
|
|
|
2021-08-13 19:03:27 +00:00
|
|
|
class Metronome : public Screen {
|
|
|
|
public:
|
|
|
|
Metronome(DisplayApp* app, Controllers::MotorController& motorController, System::SystemTask& systemTask);
|
|
|
|
~Metronome() override;
|
2021-08-14 19:53:35 +00:00
|
|
|
void Refresh() override;
|
2021-08-13 19:03:27 +00:00
|
|
|
void OnEvent(lv_obj_t* obj, lv_event_t event);
|
2021-10-04 08:13:45 +00:00
|
|
|
bool OnTouchEvent(TouchEvents event) override;
|
2021-06-12 13:06:58 +00:00
|
|
|
|
2021-08-13 19:03:27 +00:00
|
|
|
private:
|
|
|
|
TickType_t startTime = 0;
|
|
|
|
TickType_t tappedTime = 0;
|
|
|
|
Controllers::MotorController& motorController;
|
|
|
|
System::SystemTask& systemTask;
|
|
|
|
int16_t bpm = 120;
|
|
|
|
uint8_t bpb = 4;
|
|
|
|
uint8_t counter = 1;
|
2021-06-12 13:06:58 +00:00
|
|
|
|
2021-08-13 19:03:27 +00:00
|
|
|
bool metronomeStarted = false;
|
2021-10-04 08:13:45 +00:00
|
|
|
bool allowExit = false;
|
2021-06-12 13:06:58 +00:00
|
|
|
|
2021-08-13 19:03:27 +00:00
|
|
|
lv_obj_t *bpmArc, *bpmTap, *bpmValue;
|
|
|
|
lv_obj_t *bpbDropdown, *currentBpbText;
|
2022-05-09 15:16:08 +00:00
|
|
|
lv_obj_t* playPause;
|
2021-07-19 13:26:12 +00:00
|
|
|
|
2021-08-14 19:53:35 +00:00
|
|
|
lv_task_t* taskRefresh;
|
2021-08-13 19:03:27 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2021-06-12 13:06:58 +00:00
|
|
|
}
|