mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-10-22 15:11:51 +02:00
new file: doc/lvgl_align.png add ref for alignment names in lvgl
modified: src/displayapp/apps/CMakeLists.txt uncomment wome watchfaces modified: src/displayapp/screens/WatchFaceCasioStyleG7710.cpp add alarm, overlaps with heartbeat modified: src/displayapp/screens/WatchFaceCasioStyleG7710.h new file: todo.log
This commit is contained in:
parent
6ce316dc06
commit
5e19e042c0
BIN
doc/lvgl_align.png
Normal file
BIN
doc/lvgl_align.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
|
@ -23,12 +23,12 @@ if(DEFINED ENABLE_WATCHFACES)
|
||||||
set(WATCHFACE_TYPES ${ENABLE_WATCHFACES} CACHE STRING "List of watch faces to build into the firmware")
|
set(WATCHFACE_TYPES ${ENABLE_WATCHFACES} CACHE STRING "List of watch faces to build into the firmware")
|
||||||
else()
|
else()
|
||||||
set(DEFAULT_WATCHFACE_TYPES "WatchFace::Meow")
|
set(DEFAULT_WATCHFACE_TYPES "WatchFace::Meow")
|
||||||
#set(DEFAULT_WATCHFACE_TYPES "WatchFace::Digital")
|
set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Digital")
|
||||||
#set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Analog")
|
#set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Analog")
|
||||||
#set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::PineTimeStyle")
|
#set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::PineTimeStyle")
|
||||||
#set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Terminal")
|
#set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Terminal")
|
||||||
set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Infineat")
|
set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Infineat")
|
||||||
#set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::CasioStyleG7710")
|
set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::CasioStyleG7710")
|
||||||
set(WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}" CACHE STRING "List of watch faces to build into the firmware")
|
set(WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}" CACHE STRING "List of watch faces to build into the firmware")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,12 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include "displayapp/screens/BatteryIcon.h"
|
#include "displayapp/screens/BatteryIcon.h"
|
||||||
#include "displayapp/screens/BleIcon.h"
|
#include "displayapp/screens/BleIcon.h"
|
||||||
|
#include "displayapp/screens/AlarmIcon.h"
|
||||||
#include "displayapp/screens/NotificationIcon.h"
|
#include "displayapp/screens/NotificationIcon.h"
|
||||||
#include "displayapp/screens/Symbols.h"
|
#include "displayapp/screens/Symbols.h"
|
||||||
#include "components/battery/BatteryController.h"
|
#include "components/battery/BatteryController.h"
|
||||||
#include "components/ble/BleController.h"
|
#include "components/ble/BleController.h"
|
||||||
|
#include "components/alarm/AlarmController.h"
|
||||||
#include "components/ble/NotificationManager.h"
|
#include "components/ble/NotificationManager.h"
|
||||||
#include "components/heartrate/HeartRateController.h"
|
#include "components/heartrate/HeartRateController.h"
|
||||||
#include "components/motion/MotionController.h"
|
#include "components/motion/MotionController.h"
|
||||||
|
@ -17,6 +19,7 @@ using namespace Pinetime::Applications::Screens;
|
||||||
WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(Controllers::DateTime& dateTimeController,
|
WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(Controllers::DateTime& dateTimeController,
|
||||||
const Controllers::Battery& batteryController,
|
const Controllers::Battery& batteryController,
|
||||||
const Controllers::Ble& bleController,
|
const Controllers::Ble& bleController,
|
||||||
|
Controllers::AlarmController& alarmController,
|
||||||
Controllers::NotificationManager& notificatioManager,
|
Controllers::NotificationManager& notificatioManager,
|
||||||
Controllers::Settings& settingsController,
|
Controllers::Settings& settingsController,
|
||||||
Controllers::HeartRateController& heartRateController,
|
Controllers::HeartRateController& heartRateController,
|
||||||
|
@ -27,6 +30,7 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(Controllers::DateTime& dateTi
|
||||||
dateTimeController {dateTimeController},
|
dateTimeController {dateTimeController},
|
||||||
batteryController {batteryController},
|
batteryController {batteryController},
|
||||||
bleController {bleController},
|
bleController {bleController},
|
||||||
|
alarmController {alarmController},
|
||||||
notificatioManager {notificatioManager},
|
notificatioManager {notificatioManager},
|
||||||
settingsController {settingsController},
|
settingsController {settingsController},
|
||||||
heartRateController {heartRateController},
|
heartRateController {heartRateController},
|
||||||
|
@ -168,6 +172,23 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(Controllers::DateTime& dateTi
|
||||||
lv_label_set_text_static(stepIcon, Symbols::shoe);
|
lv_label_set_text_static(stepIcon, Symbols::shoe);
|
||||||
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
|
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
|
||||||
|
|
||||||
|
alarmIcon = lv_label_create(lv_scr_act(), nullptr);
|
||||||
|
lv_obj_set_style_local_text_color(alarmIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
|
||||||
|
lv_label_set_text_static(alarmIcon, Symbols::notbell);
|
||||||
|
lv_obj_align(alarmIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2);
|
||||||
|
|
||||||
|
labelAlarm = lv_label_create(lv_scr_act(), nullptr);
|
||||||
|
lv_obj_set_style_local_text_color(labelAlarm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
|
||||||
|
// lv_obj_set_style_local_text_font(labelAlarm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_teko);
|
||||||
|
lv_obj_align(labelAlarm, alarmIcon, LV_ALIGN_OUT_RIGHT_MID, 3, 0);
|
||||||
|
lv_label_set_text_static(labelAlarm, "00:00");
|
||||||
|
|
||||||
|
labelTimeAmPmAlarm = lv_label_create(lv_scr_act(), nullptr);
|
||||||
|
// lv_obj_set_style_local_text_font(labelTimeAmPmAlarm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_teko);
|
||||||
|
lv_label_set_text_static(labelTimeAmPmAlarm, "");
|
||||||
|
lv_obj_set_style_local_text_color(labelTimeAmPmAlarm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
|
||||||
|
lv_obj_align(labelTimeAmPmAlarm, labelAlarm, LV_ALIGN_OUT_RIGHT_MID, 3, 0);
|
||||||
|
|
||||||
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
|
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
@ -310,6 +331,41 @@ void WatchFaceCasioStyleG7710::Refresh() {
|
||||||
lv_obj_realign(stepValue);
|
lv_obj_realign(stepValue);
|
||||||
lv_obj_realign(stepIcon);
|
lv_obj_realign(stepIcon);
|
||||||
}
|
}
|
||||||
|
alarmState = alarmController.State()==Pinetime::Controllers::AlarmController::AlarmState::Set;
|
||||||
|
// sets the icon as bell or barred bell
|
||||||
|
lv_label_set_text_static(alarmIcon, AlarmIcon::GetIcon(alarmState));
|
||||||
|
//displays the time of the alarm or nothing if the alarm is not set
|
||||||
|
if (alarmState) {
|
||||||
|
uint8_t alarmHours = alarmController.Hours();
|
||||||
|
uint8_t alarmMinutes = alarmController.Minutes();
|
||||||
|
//handles the am pm format.
|
||||||
|
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
|
||||||
|
char ampmChar[3] = "AM";
|
||||||
|
if (alarmHours == 0) {
|
||||||
|
alarmHours = 12;
|
||||||
|
} else if (alarmHours == 12) {
|
||||||
|
ampmChar[0]='P';
|
||||||
|
} else if (alarmHours > 12) {
|
||||||
|
alarmHours = alarmHours - 12;
|
||||||
|
ampmChar[0]='P';
|
||||||
|
}
|
||||||
|
lv_label_set_text(labelTimeAmPmAlarm, ampmChar);
|
||||||
|
// lv_obj_set_style_local_text_font(labelTimeAmPmAlarm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_teko);
|
||||||
|
lv_obj_align(labelTimeAmPmAlarm, labelAlarm, LV_ALIGN_OUT_RIGHT_MID, 3, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
lv_label_set_text_fmt(labelAlarm, "%02d:%02d", alarmHours, alarmMinutes);
|
||||||
|
|
||||||
|
lv_obj_align(alarmIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2);
|
||||||
|
lv_obj_align(labelAlarm, alarmIcon, LV_ALIGN_OUT_RIGHT_MID, 3, 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lv_label_set_text_static(labelAlarm, Symbols::none);
|
||||||
|
lv_obj_align(alarmIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2);
|
||||||
|
lv_obj_align(labelAlarm, alarmIcon, LV_ALIGN_OUT_RIGHT_MID, 3, 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WatchFaceCasioStyleG7710::IsAvailable(Pinetime::Controllers::FS& filesystem) {
|
bool WatchFaceCasioStyleG7710::IsAvailable(Pinetime::Controllers::FS& filesystem) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace Pinetime {
|
||||||
WatchFaceCasioStyleG7710(Controllers::DateTime& dateTimeController,
|
WatchFaceCasioStyleG7710(Controllers::DateTime& dateTimeController,
|
||||||
const Controllers::Battery& batteryController,
|
const Controllers::Battery& batteryController,
|
||||||
const Controllers::Ble& bleController,
|
const Controllers::Ble& bleController,
|
||||||
|
Controllers::AlarmController& alarmController,
|
||||||
Controllers::NotificationManager& notificatioManager,
|
Controllers::NotificationManager& notificatioManager,
|
||||||
Controllers::Settings& settingsController,
|
Controllers::Settings& settingsController,
|
||||||
Controllers::HeartRateController& heartRateController,
|
Controllers::HeartRateController& heartRateController,
|
||||||
|
@ -46,6 +47,7 @@ namespace Pinetime {
|
||||||
Utility::DirtyValue<bool> powerPresent {};
|
Utility::DirtyValue<bool> powerPresent {};
|
||||||
Utility::DirtyValue<bool> bleState {};
|
Utility::DirtyValue<bool> bleState {};
|
||||||
Utility::DirtyValue<bool> bleRadioEnabled {};
|
Utility::DirtyValue<bool> bleRadioEnabled {};
|
||||||
|
bool alarmState {};
|
||||||
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::minutes>> currentDateTime {};
|
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::minutes>> currentDateTime {};
|
||||||
Utility::DirtyValue<uint32_t> stepCount {};
|
Utility::DirtyValue<uint32_t> stepCount {};
|
||||||
Utility::DirtyValue<uint8_t> heartbeat {};
|
Utility::DirtyValue<uint8_t> heartbeat {};
|
||||||
|
@ -76,6 +78,9 @@ namespace Pinetime {
|
||||||
lv_obj_t* line_day_of_year;
|
lv_obj_t* line_day_of_year;
|
||||||
lv_obj_t* backgroundLabel;
|
lv_obj_t* backgroundLabel;
|
||||||
lv_obj_t* bleIcon;
|
lv_obj_t* bleIcon;
|
||||||
|
lv_obj_t* labelAlarm;
|
||||||
|
lv_obj_t* labelTimeAmPmAlarm;
|
||||||
|
lv_obj_t* alarmIcon;
|
||||||
lv_obj_t* batteryPlug;
|
lv_obj_t* batteryPlug;
|
||||||
lv_obj_t* label_battery_value;
|
lv_obj_t* label_battery_value;
|
||||||
lv_obj_t* heartbeatIcon;
|
lv_obj_t* heartbeatIcon;
|
||||||
|
@ -90,6 +95,7 @@ namespace Pinetime {
|
||||||
Controllers::DateTime& dateTimeController;
|
Controllers::DateTime& dateTimeController;
|
||||||
const Controllers::Battery& batteryController;
|
const Controllers::Battery& batteryController;
|
||||||
const Controllers::Ble& bleController;
|
const Controllers::Ble& bleController;
|
||||||
|
Controllers::AlarmController& alarmController;
|
||||||
Controllers::NotificationManager& notificatioManager;
|
Controllers::NotificationManager& notificatioManager;
|
||||||
Controllers::Settings& settingsController;
|
Controllers::Settings& settingsController;
|
||||||
Controllers::HeartRateController& heartRateController;
|
Controllers::HeartRateController& heartRateController;
|
||||||
|
@ -111,6 +117,7 @@ namespace Pinetime {
|
||||||
return new Screens::WatchFaceCasioStyleG7710(controllers.dateTimeController,
|
return new Screens::WatchFaceCasioStyleG7710(controllers.dateTimeController,
|
||||||
controllers.batteryController,
|
controllers.batteryController,
|
||||||
controllers.bleController,
|
controllers.bleController,
|
||||||
|
controllers.alarmController,
|
||||||
controllers.notificationManager,
|
controllers.notificationManager,
|
||||||
controllers.settingsController,
|
controllers.settingsController,
|
||||||
controllers.heartRateController,
|
controllers.heartRateController,
|
||||||
|
|
Loading…
Reference in a new issue