107 lines
3.4 KiB
C++
107 lines
3.4 KiB
C++
#pragma once
|
|
|
|
#include <lvgl/lvgl.h>
|
|
#include <chrono>
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include "displayapp/screens/Screen.h"
|
|
#include "components/datetime/DateTimeController.h"
|
|
|
|
namespace Pinetime {
|
|
namespace Controllers {
|
|
class Settings;
|
|
class Battery;
|
|
class Ble;
|
|
class NotificationManager;
|
|
class MotionController;
|
|
}
|
|
|
|
namespace Applications {
|
|
namespace Screens {
|
|
|
|
class WatchFaceInfineat : public Screen {
|
|
public:
|
|
static constexpr int nLines = 9;
|
|
WatchFaceInfineat(Controllers::DateTime& dateTimeController,
|
|
const Controllers::Battery& batteryController,
|
|
const Controllers::Ble& bleController,
|
|
Controllers::NotificationManager& notificationManager,
|
|
Controllers::Settings& settingsController,
|
|
Controllers::MotionController& motionController,
|
|
Controllers::FS& fs);
|
|
|
|
~WatchFaceInfineat() override;
|
|
|
|
bool OnTouchEvent(TouchEvents event) override;
|
|
bool OnButtonPushed() override;
|
|
void UpdateSelected(lv_obj_t* object, lv_event_t event);
|
|
void CloseMenu();
|
|
|
|
void Refresh() override;
|
|
|
|
static bool IsAvailable(Pinetime::Controllers::FS& filesystem);
|
|
|
|
private:
|
|
char displayedChar[5] {};
|
|
|
|
uint16_t currentYear = 1970;
|
|
Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
|
|
Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
|
|
uint8_t currentDay = 0;
|
|
uint32_t savedTick = 0;
|
|
uint8_t chargingBatteryPercent = 101; // not a mistake ;)
|
|
|
|
DirtyValue<uint8_t> batteryPercentRemaining {};
|
|
DirtyValue<bool> isCharging {};
|
|
DirtyValue<bool> bleState {};
|
|
DirtyValue<bool> bleRadioEnabled {};
|
|
DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
|
|
DirtyValue<bool> motionSensorOk {};
|
|
DirtyValue<uint32_t> stepCount {};
|
|
DirtyValue<bool> notificationState {};
|
|
|
|
// Lines making up the side cover
|
|
lv_obj_t* lineBattery;
|
|
|
|
lv_point_t lineBatteryPoints[2];
|
|
|
|
lv_obj_t* logoPine;
|
|
|
|
lv_obj_t* timeContainer;
|
|
lv_obj_t* labelHour;
|
|
lv_obj_t* labelMinutes;
|
|
lv_obj_t* labelTimeAmPm;
|
|
lv_obj_t* dateContainer;
|
|
lv_obj_t* labelDate;
|
|
lv_obj_t* bleIcon;
|
|
lv_obj_t* stepIcon;
|
|
lv_obj_t* stepValue;
|
|
lv_obj_t* notificationIcon;
|
|
lv_obj_t* btnClose;
|
|
lv_obj_t* btnNextColor;
|
|
lv_obj_t* btnToggleCover;
|
|
lv_obj_t* btnPrevColor;
|
|
lv_obj_t* btnSettings;
|
|
lv_obj_t* labelBtnSettings;
|
|
lv_obj_t* lblToggle;
|
|
|
|
lv_obj_t* lines[nLines];
|
|
|
|
Controllers::DateTime& dateTimeController;
|
|
const Controllers::Battery& batteryController;
|
|
const Controllers::Ble& bleController;
|
|
Controllers::NotificationManager& notificationManager;
|
|
Controllers::Settings& settingsController;
|
|
Controllers::MotionController& motionController;
|
|
|
|
void SetBatteryLevel(uint8_t batteryPercent);
|
|
void ToggleBatteryIndicatorColor(bool showSideCover);
|
|
|
|
lv_task_t* taskRefresh;
|
|
lv_font_t* font_teko = nullptr;
|
|
lv_font_t* font_bebas = nullptr;
|
|
};
|
|
}
|
|
}
|
|
}
|