diff --git a/doc/lvgl_align.png b/doc/lvgl_align.png new file mode 100644 index 00000000..189c573e Binary files /dev/null and b/doc/lvgl_align.png differ diff --git a/src/displayapp/apps/CMakeLists.txt b/src/displayapp/apps/CMakeLists.txt index 1e567700..c7a188f2 100644 --- a/src/displayapp/apps/CMakeLists.txt +++ b/src/displayapp/apps/CMakeLists.txt @@ -23,12 +23,12 @@ if(DEFINED ENABLE_WATCHFACES) set(WATCHFACE_TYPES ${ENABLE_WATCHFACES} CACHE STRING "List of watch faces to build into the firmware") else() 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::PineTimeStyle") #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::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") endif() diff --git a/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp b/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp index c695f852..ea0bc887 100644 --- a/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp +++ b/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp @@ -4,10 +4,12 @@ #include #include "displayapp/screens/BatteryIcon.h" #include "displayapp/screens/BleIcon.h" +#include "displayapp/screens/AlarmIcon.h" #include "displayapp/screens/NotificationIcon.h" #include "displayapp/screens/Symbols.h" #include "components/battery/BatteryController.h" #include "components/ble/BleController.h" +#include "components/alarm/AlarmController.h" #include "components/ble/NotificationManager.h" #include "components/heartrate/HeartRateController.h" #include "components/motion/MotionController.h" @@ -17,6 +19,7 @@ using namespace Pinetime::Applications::Screens; WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(Controllers::DateTime& dateTimeController, const Controllers::Battery& batteryController, const Controllers::Ble& bleController, + Controllers::AlarmController& alarmController, Controllers::NotificationManager& notificatioManager, Controllers::Settings& settingsController, Controllers::HeartRateController& heartRateController, @@ -27,6 +30,7 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(Controllers::DateTime& dateTi dateTimeController {dateTimeController}, batteryController {batteryController}, bleController {bleController}, + alarmController {alarmController}, notificatioManager {notificatioManager}, settingsController {settingsController}, heartRateController {heartRateController}, @@ -168,6 +172,23 @@ WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(Controllers::DateTime& dateTi lv_label_set_text_static(stepIcon, Symbols::shoe); 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); Refresh(); } @@ -310,6 +331,41 @@ void WatchFaceCasioStyleG7710::Refresh() { lv_obj_realign(stepValue); 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) { diff --git a/src/displayapp/screens/WatchFaceCasioStyleG7710.h b/src/displayapp/screens/WatchFaceCasioStyleG7710.h index 0f46a692..7d429451 100644 --- a/src/displayapp/screens/WatchFaceCasioStyleG7710.h +++ b/src/displayapp/screens/WatchFaceCasioStyleG7710.h @@ -30,6 +30,7 @@ namespace Pinetime { WatchFaceCasioStyleG7710(Controllers::DateTime& dateTimeController, const Controllers::Battery& batteryController, const Controllers::Ble& bleController, + Controllers::AlarmController& alarmController, Controllers::NotificationManager& notificatioManager, Controllers::Settings& settingsController, Controllers::HeartRateController& heartRateController, @@ -46,6 +47,7 @@ namespace Pinetime { Utility::DirtyValue powerPresent {}; Utility::DirtyValue bleState {}; Utility::DirtyValue bleRadioEnabled {}; + bool alarmState {}; Utility::DirtyValue> currentDateTime {}; Utility::DirtyValue stepCount {}; Utility::DirtyValue heartbeat {}; @@ -76,6 +78,9 @@ namespace Pinetime { lv_obj_t* line_day_of_year; lv_obj_t* backgroundLabel; lv_obj_t* bleIcon; + lv_obj_t* labelAlarm; + lv_obj_t* labelTimeAmPmAlarm; + lv_obj_t* alarmIcon; lv_obj_t* batteryPlug; lv_obj_t* label_battery_value; lv_obj_t* heartbeatIcon; @@ -90,6 +95,7 @@ namespace Pinetime { Controllers::DateTime& dateTimeController; const Controllers::Battery& batteryController; const Controllers::Ble& bleController; + Controllers::AlarmController& alarmController; Controllers::NotificationManager& notificatioManager; Controllers::Settings& settingsController; Controllers::HeartRateController& heartRateController; @@ -111,6 +117,7 @@ namespace Pinetime { return new Screens::WatchFaceCasioStyleG7710(controllers.dateTimeController, controllers.batteryController, controllers.bleController, + controllers.alarmController, controllers.notificationManager, controllers.settingsController, controllers.heartRateController, diff --git a/todo.log b/todo.log new file mode 100644 index 00000000..e7d50d9f --- /dev/null +++ b/todo.log @@ -0,0 +1,3 @@ +replace alarm info by timer info when timer is ongoing +add a shortcut for a 1min timer on the right +