124 lines
4.3 KiB
C++
124 lines
4.3 KiB
C++
#pragma once
|
|
|
|
#include <lvgl/src/lv_core/lv_obj.h>
|
|
#include <chrono>
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <displayapp/Controllers.h>
|
|
#include "displayapp/screens/Screen.h"
|
|
#include "components/datetime/DateTimeController.h"
|
|
#include "utility/DirtyValue.h"
|
|
|
|
namespace Pinetime {
|
|
namespace Controllers {
|
|
class Settings;
|
|
class Battery;
|
|
class Ble;
|
|
class NotificationManager;
|
|
class HeartRateController;
|
|
class MotionController;
|
|
}
|
|
|
|
struct CalendarEntry {
|
|
char* name;
|
|
uint32_t duration;
|
|
};
|
|
|
|
namespace Applications {
|
|
namespace Screens {
|
|
|
|
class WatchFaceTerminal : public Screen {
|
|
public:
|
|
WatchFaceTerminal(Controllers::DateTime& dateTimeController,
|
|
const Controllers::Battery& batteryController,
|
|
const Controllers::Ble& bleController,
|
|
Controllers::NotificationManager& notificationManager,
|
|
Controllers::Settings& settingsController,
|
|
Controllers::HeartRateController& heartRateController,
|
|
Controllers::MotionController& motionController);
|
|
~WatchFaceTerminal() override;
|
|
|
|
void Refresh() override;
|
|
|
|
private:
|
|
Utility::DirtyValue<int> batteryPercentRemaining {};
|
|
Utility::DirtyValue<bool> powerPresent {};
|
|
Utility::DirtyValue<bool> bleState {};
|
|
Utility::DirtyValue<bool> bleRadioEnabled {};
|
|
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds>> currentDateTime {};
|
|
Utility::DirtyValue<uint32_t> stepCount {};
|
|
Utility::DirtyValue<uint8_t> heartbeat {};
|
|
Utility::DirtyValue<bool> heartbeatRunning {};
|
|
Utility::DirtyValue<bool> notificationState {};
|
|
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
|
|
|
|
CalendarEntry calendar[18] = {
|
|
{"Enjoy the last vestiges of sunlight", 15*2},
|
|
{"Present FuckTime", 30*2},
|
|
{"Enjoy the crisp night air", 10*2},
|
|
{"Party @ David's", 60*2},
|
|
{"Savor the moment", 10*2},
|
|
{"Sleep", 60*2}, // 8*
|
|
{"Wake up", 10*2},
|
|
{"Morning Work", 60*2}, // 4*
|
|
{"Eat Lunch", 60*2},
|
|
{"Afternoon Work", 60*2}, // 4*
|
|
{"Get groceries", 20*2},
|
|
{"Prepare dinner", 30*2},
|
|
{"Eat", 60*2},
|
|
{"Sleep", 60*2}, // 8*
|
|
{"Rave", 30*2},
|
|
{"Repeat", 10*2},
|
|
{"Wake up", 10*2},
|
|
{"Work", 300*2},
|
|
};
|
|
|
|
uint32_t calIndex = 0;
|
|
uint32_t currentDuration = 0;
|
|
|
|
lv_obj_t * progress_line;
|
|
lv_point_t progress_points[2];
|
|
lv_obj_t* label_now;
|
|
lv_obj_t* label_next;
|
|
lv_obj_t* label_prompt_1;
|
|
lv_obj_t* label_prompt_2;
|
|
lv_obj_t* batteryValue;
|
|
lv_obj_t* heartbeatValue;
|
|
lv_obj_t* stepValue;
|
|
lv_obj_t* notificationIcon;
|
|
lv_obj_t* connectState;
|
|
|
|
Controllers::DateTime& dateTimeController;
|
|
const Controllers::Battery& batteryController;
|
|
const Controllers::Ble& bleController;
|
|
Controllers::NotificationManager& notificationManager;
|
|
Controllers::Settings& settingsController;
|
|
Controllers::HeartRateController& heartRateController;
|
|
Controllers::MotionController& motionController;
|
|
|
|
lv_task_t* taskRefresh;
|
|
};
|
|
}
|
|
|
|
template <>
|
|
struct WatchFaceTraits<WatchFace::Terminal> {
|
|
static constexpr WatchFace watchFace = WatchFace::Terminal;
|
|
static constexpr const char* name = "Terminal";
|
|
|
|
static Screens::Screen* Create(AppControllers& controllers) {
|
|
return new Screens::WatchFaceTerminal(controllers.dateTimeController,
|
|
controllers.batteryController,
|
|
controllers.bleController,
|
|
controllers.notificationManager,
|
|
controllers.settingsController,
|
|
controllers.heartRateController,
|
|
controllers.motionController);
|
|
};
|
|
|
|
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {
|
|
return true;
|
|
}
|
|
};
|
|
}
|
|
}
|