diff options
Diffstat (limited to 'src/displayapp/screens')
23 files changed, 302 insertions, 177 deletions
diff --git a/src/displayapp/screens/Alarm.cpp b/src/displayapp/screens/Alarm.cpp index 879e50d..69d84e2 100644 --- a/src/displayapp/screens/Alarm.cpp +++ b/src/displayapp/screens/Alarm.cpp @@ -29,7 +29,7 @@ static void btnEventHandler(lv_obj_t* obj, lv_event_t event) { static void StopAlarmTaskCallback(lv_task_t* task) { auto* screen = static_cast<Alarm*>(task->user_data); - screen->StopAlerting(); + screen->StopAlarm(); } Alarm::Alarm(DisplayApp* app, @@ -39,7 +39,7 @@ Alarm::Alarm(DisplayApp* app, : Screen(app), alarmController {alarmController}, settingsController {settingsController}, systemTask {systemTask} { time = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76); + lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont3); lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); alarmHours = alarmController.Hours(); @@ -48,13 +48,6 @@ Alarm::Alarm(DisplayApp* app, lv_obj_align(time, lv_scr_act(), LV_ALIGN_CENTER, 0, -25); - lblampm = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(lblampm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20); - lv_obj_set_style_local_text_color(lblampm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); - lv_label_set_text_static(lblampm, " "); - lv_label_set_align(lblampm, LV_LABEL_ALIGN_CENTER); - lv_obj_align(lblampm, lv_scr_act(), LV_ALIGN_CENTER, 0, 30); - btnHoursUp = lv_btn_create(lv_scr_act(), nullptr); btnHoursUp->user_data = this; lv_obj_set_event_cb(btnHoursUp, btnEventHandler); @@ -87,15 +80,13 @@ Alarm::Alarm(DisplayApp* app, txtMinDown = lv_label_create(btnMinutesDown, nullptr); lv_label_set_text_static(txtMinDown, "-"); - btnStop = lv_btn_create(lv_scr_act(), nullptr); - btnStop->user_data = this; - lv_obj_set_event_cb(btnStop, btnEventHandler); - lv_obj_set_size(btnStop, 115, 50); - lv_obj_align(btnStop, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); - lv_obj_set_style_local_bg_color(btnStop, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); - txtStop = lv_label_create(btnStop, nullptr); - lv_label_set_text_static(txtStop, Symbols::stop); - lv_obj_set_hidden(btnStop, true); + btnEnable = lv_btn_create(lv_scr_act(), nullptr); + btnEnable->user_data = this; + lv_obj_set_event_cb(btnEnable, btnEventHandler); + lv_obj_set_size(btnEnable, 115, 50); + lv_obj_align(btnEnable, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); + txtEnable = lv_label_create(btnEnable, nullptr); + SetEnableButtonState(); btnRecur = lv_btn_create(lv_scr_act(), nullptr); btnRecur->user_data = this; @@ -113,25 +104,14 @@ Alarm::Alarm(DisplayApp* app, txtInfo = lv_label_create(btnInfo, nullptr); lv_label_set_text_static(txtInfo, "i"); - enableSwitch = lv_switch_create(lv_scr_act(), nullptr); - enableSwitch->user_data = this; - lv_obj_set_event_cb(enableSwitch, btnEventHandler); - lv_obj_set_size(enableSwitch, 100, 50); - // Align to the center of 115px from edge - lv_obj_align(enableSwitch, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 7, 0); - - UpdateAlarmTime(); - - if (alarmController.State() == Controllers::AlarmController::AlarmState::Alerting) { - SetAlerting(); - } else { - SetSwitchState(LV_ANIM_OFF); + if (alarmController.State() == AlarmController::AlarmState::Alerting) { + OnAlarmStart(); } } Alarm::~Alarm() { if (alarmController.State() == AlarmController::AlarmState::Alerting) { - StopAlerting(); + StopAlarm(); } lv_obj_clean(lv_scr_act()); } @@ -139,8 +119,17 @@ Alarm::~Alarm() { void Alarm::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { using Pinetime::Controllers::AlarmController; if (event == LV_EVENT_CLICKED) { - if (obj == btnStop) { - StopAlerting(); + if (obj == btnEnable) { + if (alarmController.State() == AlarmController::AlarmState::Alerting) { + StopAlarm(); + return; + } + if (alarmController.State() == AlarmController::AlarmState::Set) { + alarmController.DisableAlarm(); + } else { + alarmController.ScheduleAlarm(); + } + SetEnableButtonState(); return; } if (obj == btnInfo) { @@ -151,19 +140,11 @@ void Alarm::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { HideInfo(); return; } - if (obj == enableSwitch) { - if (lv_switch_get_state(enableSwitch)) { - alarmController.ScheduleAlarm(); - } else { - alarmController.DisableAlarm(); - } - return; - } // If any other button was pressed, disable the alarm // this is to make it clear that the alarm won't be set until it is turned back on if (alarmController.State() == AlarmController::AlarmState::Set) { alarmController.DisableAlarm(); - lv_switch_off(enableSwitch, LV_ANIM_ON); + SetEnableButtonState(); } if (obj == btnMinutesUp) { if (alarmMinutes >= 59) { @@ -213,7 +194,7 @@ bool Alarm::OnButtonPushed() { return true; } if (alarmController.State() == AlarmController::AlarmState::Alerting) { - StopAlerting(); + StopAlarm(); return true; } return false; @@ -225,60 +206,43 @@ bool Alarm::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } void Alarm::UpdateAlarmTime() { - if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { - switch (alarmHours) { - case 0: - lv_label_set_text_static(lblampm, "AM"); - lv_label_set_text_fmt(time, "%02d:%02d", 12, alarmMinutes); - break; - case 1 ... 11: - lv_label_set_text_static(lblampm, "AM"); - lv_label_set_text_fmt(time, "%02d:%02d", alarmHours, alarmMinutes); - break; - case 12: - lv_label_set_text_static(lblampm, "PM"); - lv_label_set_text_fmt(time, "%02d:%02d", 12, alarmMinutes); - break; - case 13 ... 23: - lv_label_set_text_static(lblampm, "PM"); - lv_label_set_text_fmt(time, "%02d:%02d", alarmHours - 12, alarmMinutes); - break; - } - } else { - lv_label_set_text_fmt(time, "%02d:%02d", alarmHours, alarmMinutes); - } + lv_label_set_text_fmt(time, "%02d:%02d", alarmHours, alarmMinutes); alarmController.SetAlarmTime(alarmHours, alarmMinutes); } void Alarm::SetAlerting() { - lv_obj_set_hidden(enableSwitch, true); - lv_obj_set_hidden(btnStop, false); + SetEnableButtonState(); + OnAlarmStart(); +} + +void Alarm::OnAlarmStart() { taskStopAlarm = lv_task_create(StopAlarmTaskCallback, pdMS_TO_TICKS(60 * 1000), LV_TASK_PRIO_MID, this); systemTask.PushMessage(System::Messages::DisableSleeping); } -void Alarm::StopAlerting() { +void Alarm::StopAlarm() { alarmController.StopAlerting(); - SetSwitchState(LV_ANIM_OFF); + SetEnableButtonState(); if (taskStopAlarm != nullptr) { lv_task_del(taskStopAlarm); taskStopAlarm = nullptr; } systemTask.PushMessage(System::Messages::EnableSleeping); - lv_obj_set_hidden(enableSwitch, false); - lv_obj_set_hidden(btnStop, true); } -void Alarm::SetSwitchState(lv_anim_enable_t anim) { +void Alarm::SetEnableButtonState() { switch (alarmController.State()) { case AlarmController::AlarmState::Set: - lv_switch_on(enableSwitch, anim); + lv_label_set_text(txtEnable, "ON"); + lv_obj_set_style_local_bg_color(btnEnable, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); break; case AlarmController::AlarmState::Not_Set: - lv_switch_off(enableSwitch, anim); - break; - default: + lv_label_set_text(txtEnable, "OFF"); + lv_obj_set_style_local_bg_color(btnEnable, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); break; + case AlarmController::AlarmState::Alerting: + lv_label_set_text(txtEnable, Symbols::stop); + lv_obj_set_style_local_bg_color(btnEnable, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); } } diff --git a/src/displayapp/screens/Alarm.h b/src/displayapp/screens/Alarm.h index f74dd68..f5b54f7 100644 --- a/src/displayapp/screens/Alarm.h +++ b/src/displayapp/screens/Alarm.h @@ -36,7 +36,7 @@ namespace Pinetime { void OnButtonEvent(lv_obj_t* obj, lv_event_t event); bool OnButtonPushed() override; bool OnTouchEvent(TouchEvents event) override; - void StopAlerting(); + void StopAlarm(); private: uint8_t alarmHours; @@ -45,15 +45,16 @@ namespace Pinetime { Controllers::Settings& settingsController; System::SystemTask& systemTask; - lv_obj_t *time, *lblampm, *btnStop, *txtStop, *btnMinutesUp, *btnMinutesDown, *btnHoursUp, *btnHoursDown, *txtMinUp, - *txtMinDown, *txtHrUp, *txtHrDown, *btnRecur, *txtRecur, *btnInfo, *txtInfo, *enableSwitch; + lv_obj_t *time, *btnEnable, *txtEnable, *btnMinutesUp, *btnMinutesDown, *btnHoursUp, *btnHoursDown, *txtMinUp, *txtMinDown, + *txtHrUp, *txtHrDown, *btnRecur, *txtRecur, *btnInfo, *txtInfo; lv_obj_t* txtMessage = nullptr; lv_obj_t* btnMessage = nullptr; lv_task_t* taskStopAlarm = nullptr; enum class EnableButtonState { On, Off, Alerting }; + void SetEnableButtonState(); void SetRecurButtonState(); - void SetSwitchState(lv_anim_enable_t anim); + void OnAlarmStart(); void SetAlarm(); void ShowInfo(); void HideInfo(); diff --git a/src/displayapp/screens/BatteryInfo.cpp b/src/displayapp/screens/BatteryInfo.cpp index e17de9a..0377bdb 100644 --- a/src/displayapp/screens/BatteryInfo.cpp +++ b/src/displayapp/screens/BatteryInfo.cpp @@ -27,7 +27,7 @@ BatteryInfo::BatteryInfo(Pinetime::Applications::DisplayApp* app, Pinetime::Cont lv_obj_align(status, charging_bar, LV_ALIGN_OUT_BOTTOM_MID, 0, 20); percent = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(percent, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76); + lv_obj_set_style_local_text_font(percent, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont3); lv_label_set_text_fmt(percent, "%02i%%", batteryPercent); lv_label_set_align(percent, LV_LABEL_ALIGN_LEFT); lv_obj_align(percent, nullptr, LV_ALIGN_CENTER, 0, -60); diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp index c4d0264..dba79a4 100644 --- a/src/displayapp/screens/FlashLight.cpp +++ b/src/displayapp/screens/FlashLight.cpp @@ -24,7 +24,7 @@ FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app, brightnessLevel = brightnessController.Level(); flashLight = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); + lv_obj_set_style_local_text_font(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_label_set_text_static(flashLight, Symbols::highlight); lv_obj_align(flashLight, nullptr, LV_ALIGN_CENTER, 0, 0); diff --git a/src/displayapp/screens/HeartRate.cpp b/src/displayapp/screens/HeartRate.cpp index 513c40b..6f9154b 100644 --- a/src/displayapp/screens/HeartRate.cpp +++ b/src/displayapp/screens/HeartRate.cpp @@ -34,7 +34,7 @@ HeartRate::HeartRate(Pinetime::Applications::DisplayApp* app, bool isHrRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped; label_hr = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76); + lv_obj_set_style_local_text_font(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont3); if (isHrRunning) lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); diff --git a/src/displayapp/screens/Metronome.cpp b/src/displayapp/screens/Metronome.cpp index f6f269d..df5e772 100644 --- a/src/displayapp/screens/Metronome.cpp +++ b/src/displayapp/screens/Metronome.cpp @@ -34,8 +34,8 @@ Metronome::Metronome(DisplayApp* app, Controllers::MotorController& motorControl lv_arc_set_adjustable(bpmArc, true); lv_obj_align(bpmArc, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 0); - bpmValue = createLabel("120", bpmArc, LV_ALIGN_IN_TOP_MID, &jetbrains_mono_76, 0, 55); - createLabel("bpm", bpmValue, LV_ALIGN_OUT_BOTTOM_MID, &jetbrains_mono_bold_20, 0, 0); + bpmValue = createLabel("120", bpmArc, LV_ALIGN_IN_TOP_MID, &neofont3, 0, 55); + createLabel("bpm", bpmValue, LV_ALIGN_OUT_BOTTOM_MID, &neofont15, 0, 0); bpmTap = lv_btn_create(lv_scr_act(), nullptr); bpmTap->user_data = this; diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp index 23eb276..77b6518 100644 --- a/src/displayapp/screens/Motion.cpp +++ b/src/displayapp/screens/Motion.cpp @@ -37,6 +37,11 @@ Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionContr lv_obj_align(labelStep, chart, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); lv_label_set_text(labelStep, "Steps ---"); + labelLastY = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(labelLastY, "LastY 0"); + lv_label_set_align(labelLastY, LV_LABEL_ALIGN_RIGHT); + lv_obj_align(labelLastY, chart, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } @@ -58,4 +63,7 @@ void Motion::Refresh() { motionController.Y() / 0x10, motionController.Z() / 0x10); lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10); + + lv_label_set_text_fmt(labelLastY, "LastY %d", motionController.LastY() / 0x10); + lv_obj_align(labelLastY, chart, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); } diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h index 4d2bd4f..315660c 100644 --- a/src/displayapp/screens/Motion.h +++ b/src/displayapp/screens/Motion.h @@ -27,6 +27,7 @@ namespace Pinetime { lv_obj_t* label; lv_obj_t* labelStep; + lv_obj_t* labelLastY; lv_task_t* taskRefresh; }; } diff --git a/src/displayapp/screens/Paddle.cpp b/src/displayapp/screens/Paddle.cpp index 608eb64..9ad9ca5 100644 --- a/src/displayapp/screens/Paddle.cpp +++ b/src/displayapp/screens/Paddle.cpp @@ -16,7 +16,7 @@ Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::Li lv_obj_set_style_local_border_width(background, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 1); points = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(points, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); + lv_obj_set_style_local_text_font(points, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_label_set_text(points, "0000"); lv_obj_align(points, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 10); diff --git a/src/displayapp/screens/PassKey.cpp b/src/displayapp/screens/PassKey.cpp index 9e43a54..257ab22 100644 --- a/src/displayapp/screens/PassKey.cpp +++ b/src/displayapp/screens/PassKey.cpp @@ -6,7 +6,7 @@ using namespace Pinetime::Applications::Screens; PassKey::PassKey(Pinetime::Applications::DisplayApp* app, uint32_t key) : Screen(app) { passkeyLabel = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFF00)); - lv_obj_set_style_local_text_font(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); + lv_obj_set_style_local_text_font(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_label_set_text_fmt(passkeyLabel, "%06u", key); lv_obj_align(passkeyLabel, nullptr, LV_ALIGN_CENTER, 0, -20); diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index e807289..526e8ea 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -76,13 +76,13 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, // Display the time timeDD1 = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light); + lv_obj_set_style_local_text_font(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont3); lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); lv_label_set_text_static(timeDD1, "00"); lv_obj_align(timeDD1, timebar, LV_ALIGN_IN_TOP_MID, 5, 5); timeDD2 = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light); + lv_obj_set_style_local_text_font(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont3); lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); lv_label_set_text_static(timeDD2, "00"); lv_obj_align(timeDD2, timebar, LV_ALIGN_IN_BOTTOM_MID, 5, -5); @@ -292,7 +292,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, lv_obj_set_style_local_bg_opa(btnSet, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); lv_obj_set_event_cb(btnSet, event_handler); lbl_btnSet = lv_label_create(btnSet, nullptr); - lv_obj_set_style_local_text_font(lbl_btnSet, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); + lv_obj_set_style_local_text_font(lbl_btnSet, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_label_set_text_static(lbl_btnSet, Symbols::settings); lv_obj_set_hidden(btnSet, true); diff --git a/src/displayapp/screens/Steps.cpp b/src/displayapp/screens/Steps.cpp index 3e7f820..e0e860c 100644 --- a/src/displayapp/screens/Steps.cpp +++ b/src/displayapp/screens/Steps.cpp @@ -33,7 +33,7 @@ Steps::Steps(Pinetime::Applications::DisplayApp* app, lSteps = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); - lv_obj_set_style_local_text_font(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); + lv_obj_set_style_local_text_font(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_label_set_text_fmt(lSteps, "%li", stepsCount); lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -40); diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index 8749839..0f84f59 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -53,7 +53,7 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask) lapNr {} { time = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76); + lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont3); lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); lv_label_set_text(time, "00:00"); lv_obj_align(time, lv_scr_act(), LV_ALIGN_CENTER, 0, -45); diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h index e68a7af..ba5b46e 100644 --- a/src/displayapp/screens/Symbols.h +++ b/src/displayapp/screens/Symbols.h @@ -1,19 +1,101 @@ #pragma once + // For neofont: + // Layout for 3-byte codes: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + // U+F0000: 11110011 10110000 000000 000000 + // Neofont glyph: 11110011 10110zzz zzzzyy yyyyyy + // CDD DEEEAA ABBBCC + // \xF3 \xB[0-7] \x[8-B]. \x[8-B]. + // "\xF3\xB5\x80\x97" + +// h + (g<<1) + (f<<2) + (e<<3) + (d << 4) + (c << 5) + (b << 6) + (a << 7), \ +// 0 + (o<<1) + (n<<2) + (m<<3) + (l << 4) + (k << 5) + (j << 6) + (i << 7) \ + +#define G( \ + a,b,c, \ + d,e,f, \ + g,h,i, \ + j,k,l, \ + m,n,o \ +) { \ + ((char)( 0xF3 )), \ + ((char)( 0xB0 | (i<<2) | (j<<1) | k )), \ + ((char)( 0x80 | (l<<5) | (m<<4) | (n<<3) | (o<<2) | (a<<1) | b )), \ + ((char)( 0x80 | (c<<5) | (d<<4) | (e<<3) | (f<<2) | (g<<1) | h )), \ + 0 \ +} + +#define X 1 +#define _ 0 + namespace Pinetime { namespace Applications { namespace Screens { namespace Symbols { static constexpr const char* none = ""; - static constexpr const char* batteryFull = "\xEF\x89\x80"; - static constexpr const char* batteryEmpty = "\xEF\x89\x84"; - static constexpr const char* batteryThreeQuarter = "\xEF\x89\x81"; - static constexpr const char* batteryHalf = "\xEF\x89\x82"; - static constexpr const char* batteryOneQuarter = "\xEF\x89\x83"; - static constexpr const char* heartBeat = "\xEF\x88\x9E"; - static constexpr const char* bluetoothFull = "\xEF\x8A\x93"; - static constexpr const char* bluetooth = "\xEF\x8A\x94"; - static constexpr const char* plug = "\xEF\x87\xA6"; + static constexpr const char batteryFull[] = + // "\xEF\x89\x80"; + G(_, X, _, + X, X, X, + X, X, X, + X, X, X, + X, X, X); + static constexpr const char batteryEmpty[] = + // "\xEF\x89\x84"; + G(_, X, _, + X, _, X, + X, _, X, + X, _, X, // l is ignored! + X, X, X); + static constexpr const char batteryThreeQuarter[] = + // Was: "\xEF\x89\x81"; + G(_, X, _, + X, X, X, + X, _, X, + X, X, X, + X, X, X); + static constexpr const char batteryHalf[] = + // Was: "\xEF\x89\x82"; + G(_, X, _, + X, _, X, + X, X, X, + X, X, X, + X, X, X); + static constexpr const char batteryOneQuarter[] = + // Was: "\xEF\x89\x83"; + G(_, X, _, + X, _, X, + X, _, X, + X, X, X, + X, X, X); + static constexpr const char heartBeat[] = + // Was: "\xEF\x88\x9E" + G(_, _, _, + X, _, X, + X, X, X, + _, X, _, + _, _, _); + static constexpr const char bluetoothFull[] = + // "\xEF\x8A\x93"; + G(X, X, _, + _, X, X, + X, X, _, + _, X, X, + X, X, _); + static constexpr const char bluetooth[] = + // "\xEF\x8A\x94"; + G(_, X, _, + _, X, X, + X, X, _, + _, X, X, + _, X, _); + static constexpr const char plug[] = + // "\xEF\x87\xA6"; + G(X, _, X, + X, X, X, + X, X, X, + _, X, _, + _, X, _); static constexpr const char* shoe = "\xEF\x95\x8B"; static constexpr const char* clock = "\xEF\x80\x97"; static constexpr const char* info = "\xEF\x84\xA9"; @@ -34,12 +116,48 @@ namespace Pinetime { static constexpr const char* volumDown = "\xEF\x80\xA7"; static constexpr const char* stepForward = "\xEF\x81\x91"; static constexpr const char* stepBackward = "\xEF\x81\x88"; - static constexpr const char* play = "\xEF\x81\x8B"; - static constexpr const char* pause = "\xEF\x81\x8C"; - static constexpr const char* stop = "\xEF\x81\x8D"; - static constexpr const char* stopWatch = "\xEF\x8B\xB2"; - static constexpr const char* hourGlass = "\xEF\x89\x92"; - static constexpr const char* lapsFlag = "\xEF\x80\xA4"; + static constexpr const char play[] = + // "\xEF\x81\x8B"; + G(X, _, _, + X, X, _, + X, X, X, + X, X, _, + X, _, _); + static constexpr const char pause[] = + // "\xEF\x81\x8C"; + G(_, _, _, + X, _, X, + X, _, X, + X, _, X, + _, _, _); + static constexpr const char stop[] = + // "\xEF\x81\x8D"; + G(_, _, _, + X, X, X, + X, X, X, + X, X, X, + _, _, _); + static constexpr const char stopWatch[] = + // "\xEF\x8B\xB2"; + G(X, _, _, + X, X, _, + X, X, X, + X, X, _, + X, _, _); + static constexpr const char hourGlass[] = + // "\xEF\x89\x92"; + G(X, X, X, + X, X, X, + _, X, _, + X, X, X, + X, X, X); + static constexpr const char lapsFlag[] = + // "\xEF\x80\xA4"; + G(_, X, _, + X, _, X, + X, _, _, + X, _, X, + _, X, _); static constexpr const char* drum = "\xEF\x95\xA9"; static constexpr const char* chartLine = "\xEF\x88\x81"; static constexpr const char* eye = "\xEF\x81\xAE"; @@ -61,3 +179,7 @@ namespace Pinetime { } } } + +#undef G +#undef X +#undef _ diff --git a/src/displayapp/screens/Timer.cpp b/src/displayapp/screens/Timer.cpp index 5cd496c..332fcef 100644 --- a/src/displayapp/screens/Timer.cpp +++ b/src/displayapp/screens/Timer.cpp @@ -1,4 +1,5 @@ #include "displayapp/screens/Timer.h" + #include "displayapp/screens/Screen.h" #include "displayapp/screens/Symbols.h" #include <lvgl/lvgl.h> @@ -6,48 +7,62 @@ using namespace Pinetime::Applications::Screens; static void btnEventHandler(lv_obj_t* obj, lv_event_t event) { - auto* screen = static_cast<Timer*>(obj->user_data); + Timer* screen = static_cast<Timer*>(obj->user_data); screen->OnButtonEvent(obj, event); } -void Timer::CreateButtons() { +void Timer::createButtons() { btnMinutesUp = lv_btn_create(lv_scr_act(), nullptr); btnMinutesUp->user_data = this; lv_obj_set_event_cb(btnMinutesUp, btnEventHandler); - lv_obj_align(btnMinutesUp, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, -80); - lv_obj_set_height(btnMinutesUp, 40); - lv_obj_set_width(btnMinutesUp, 60); + lv_obj_set_size(btnMinutesUp, 60, 40); + lv_obj_align(btnMinutesUp, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, -85); txtMUp = lv_label_create(btnMinutesUp, nullptr); lv_label_set_text(txtMUp, "+"); btnMinutesDown = lv_btn_create(lv_scr_act(), nullptr); btnMinutesDown->user_data = this; lv_obj_set_event_cb(btnMinutesDown, btnEventHandler); - lv_obj_align(btnMinutesDown, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, +40); - lv_obj_set_height(btnMinutesDown, 40); - lv_obj_set_width(btnMinutesDown, 60); + lv_obj_set_size(btnMinutesDown, 60, 40); + lv_obj_align(btnMinutesDown, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, +35); txtMDown = lv_label_create(btnMinutesDown, nullptr); lv_label_set_text(txtMDown, "-"); btnSecondsUp = lv_btn_create(lv_scr_act(), nullptr); btnSecondsUp->user_data = this; lv_obj_set_event_cb(btnSecondsUp, btnEventHandler); - lv_obj_align(btnSecondsUp, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 10, -80); - lv_obj_set_height(btnSecondsUp, 40); - lv_obj_set_width(btnSecondsUp, 60); + lv_obj_set_size(btnSecondsUp, 60, 40); + lv_obj_align(btnSecondsUp, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -20, -85); txtSUp = lv_label_create(btnSecondsUp, nullptr); lv_label_set_text(txtSUp, "+"); btnSecondsDown = lv_btn_create(lv_scr_act(), nullptr); btnSecondsDown->user_data = this; lv_obj_set_event_cb(btnSecondsDown, btnEventHandler); - lv_obj_align(btnSecondsDown, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 10, +40); - lv_obj_set_height(btnSecondsDown, 40); - lv_obj_set_width(btnSecondsDown, 60); + lv_obj_set_size(btnSecondsDown, 60, 40); + lv_obj_align(btnSecondsDown, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -20, +35); txtSDown = lv_label_create(btnSecondsDown, nullptr); lv_label_set_text(txtSDown, "-"); } +void Timer::stop() { + int32_t secondsRemaining = timerController.GetSecondsRemaining(); + if (timerController.IsOvertime()) { + minutesToSet = 0; + secondsToSet = 0; + secondsRemaining = 0; + } else { + minutesToSet = secondsRemaining / 60; + secondsToSet = secondsRemaining % 60; + } + timerController.StopTimer(); + timerController.StopAlerting(); + lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); + lv_label_set_text_fmt(time, "%02lu:%02lu", secondsRemaining / 60, secondsRemaining % 60); + lv_label_set_text(txtPlayPause, Symbols::play); + createButtons(); +} + Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController) : Screen(app), running {true}, timerController {timerController} { backgroundLabel = lv_label_create(lv_scr_act(), nullptr); @@ -58,38 +73,58 @@ Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController) lv_label_set_text(backgroundLabel, ""); time = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76); - lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); + lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont3); + + int32_t seconds = timerController.GetSecondsRemaining(); + bool overtime = timerController.IsOvertime(); + + if (overtime) { + seconds = -seconds + 1; // "+ 1" is to not show -00:00 again after +00:00 + lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); + } else { + lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); + } - uint32_t seconds = timerController.GetTimeRemaining() / 1000; lv_label_set_text_fmt(time, "%02lu:%02lu", seconds / 60, seconds % 60); - lv_obj_align(time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -20); + lv_obj_align(time, lv_scr_act(), LV_ALIGN_CENTER, 0, -20); btnPlayPause = lv_btn_create(lv_scr_act(), nullptr); btnPlayPause->user_data = this; lv_obj_set_event_cb(btnPlayPause, btnEventHandler); - lv_obj_align(btnPlayPause, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, -10); - lv_obj_set_height(btnPlayPause, 40); + lv_obj_set_size(btnPlayPause, 115, 50); + lv_obj_align(btnPlayPause, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0); txtPlayPause = lv_label_create(btnPlayPause, nullptr); if (timerController.IsRunning()) { - lv_label_set_text(txtPlayPause, Symbols::pause); + lv_label_set_text(txtPlayPause, overtime ? Symbols::stop : Symbols::pause); } else { lv_label_set_text(txtPlayPause, Symbols::play); - CreateButtons(); + createButtons(); } - taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } Timer::~Timer() { lv_task_del(taskRefresh); lv_obj_clean(lv_scr_act()); + if (timerController.IsRunning() && timerController.IsOvertime()) { + timerController.StopTimer(); + timerController.StopAlerting(); + } } void Timer::Refresh() { if (timerController.IsRunning()) { - uint32_t seconds = timerController.GetTimeRemaining() / 1000; + int32_t seconds = timerController.GetSecondsRemaining(); + if (timerController.IsOvertime()) { + seconds = -seconds + 1; // "+ 1" is to not show -00:00 again after +00:00 + + // safety measures, lets not overflow counter as it will display badly + if (seconds >= 100 * 60) { + stop(); + return; + } + } lv_label_set_text_fmt(time, "%02lu:%02lu", seconds / 60, seconds % 60); } } @@ -98,17 +133,12 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { if (event == LV_EVENT_CLICKED) { if (obj == btnPlayPause) { if (timerController.IsRunning()) { - lv_label_set_text(txtPlayPause, Symbols::play); - uint32_t seconds = timerController.GetTimeRemaining() / 1000; - minutesToSet = seconds / 60; - secondsToSet = seconds % 60; - timerController.StopTimer(); - CreateButtons(); - + stop(); } else if (secondsToSet + minutesToSet > 0) { lv_label_set_text(txtPlayPause, Symbols::pause); timerController.StartTimer((secondsToSet + minutesToSet * 60) * 1000); + // inlined destroyButtons() lv_obj_del(btnSecondsDown); btnSecondsDown = nullptr; lv_obj_del(btnSecondsUp); @@ -158,9 +188,6 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { } void Timer::SetDone() { - lv_label_set_text(time, "00:00"); - lv_label_set_text(txtPlayPause, Symbols::play); - secondsToSet = 0; - minutesToSet = 0; - CreateButtons(); + lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); + lv_label_set_text(txtPlayPause, Symbols::stop); } diff --git a/src/displayapp/screens/Timer.h b/src/displayapp/screens/Timer.h index 93e84c8..1eee6d0 100644 --- a/src/displayapp/screens/Timer.h +++ b/src/displayapp/screens/Timer.h @@ -8,35 +8,31 @@ #include "components/timer/TimerController.h" namespace Pinetime::Applications::Screens { + class Timer : public Screen { public: enum class Modes { Normal, Done }; Timer(DisplayApp* app, Controllers::TimerController& timerController); + ~Timer() override; + void Refresh() override; void SetDone(); void OnButtonEvent(lv_obj_t* obj, lv_event_t event); private: - void CreateButtons(); bool running; uint8_t secondsToSet = 0; uint8_t minutesToSet = 0; Controllers::TimerController& timerController; + + void createButtons(); + void stop(); + lv_obj_t* backgroundLabel; - lv_obj_t* time; - lv_obj_t* msecTime; - lv_obj_t* btnPlayPause; - lv_obj_t* txtPlayPause; - lv_obj_t* btnMinutesUp; - lv_obj_t* btnMinutesDown; - lv_obj_t* btnSecondsUp; - lv_obj_t* btnSecondsDown; - lv_obj_t* txtMUp; - lv_obj_t* txtMDown; - lv_obj_t* txtSUp; - lv_obj_t* txtSDown; lv_task_t* taskRefresh; + lv_obj_t *time, *btnPlayPause, *txtPlayPause, *btnMinutesUp, *btnMinutesDown, *btnSecondsUp, *btnSecondsDown, *txtMUp, + *txtMDown, *txtSUp, *txtSDown; }; } diff --git a/src/displayapp/screens/WatchFaceAnalog24.cpp b/src/displayapp/screens/WatchFaceAnalog24.cpp index 29c1095..875c0f1 100644 --- a/src/displayapp/screens/WatchFaceAnalog24.cpp +++ b/src/displayapp/screens/WatchFaceAnalog24.cpp @@ -206,9 +206,8 @@ void WatchFaceAnalog24::Refresh() { } bleState = bleController.IsConnected(); - bleRadioEnabled = bleController.IsRadioEnabled(); - if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) { - lv_label_set_text(bleIcon, BleIcon::GetIcon(bleRadioEnabled.Get(), bleState.Get())); + if (bleState.IsUpdated()) { + lv_label_set_text(bleIcon, BleIcon::GetIcon(bleState.Get())); } notificationState = notificationManager.AreNewNotificationsAvailable(); diff --git a/src/displayapp/screens/WatchFaceAnalog24.h b/src/displayapp/screens/WatchFaceAnalog24.h index 0653bcf..5df8979 100644 --- a/src/displayapp/screens/WatchFaceAnalog24.h +++ b/src/displayapp/screens/WatchFaceAnalog24.h @@ -51,7 +51,6 @@ namespace Pinetime { DirtyValue<uint8_t> batteryPercentRemaining {0}; 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 {}; diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 6a91488..dc16f60 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -35,12 +35,12 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app, batteryIcon = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text_static(batteryIcon, Symbols::batteryFull); - lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0); + lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0); batteryPlug = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(batteryPlug, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFF0000)); lv_label_set_text_static(batteryPlug, Symbols::plug); - lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); + lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, 0, 0); bleIcon = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x0082FC)); @@ -57,7 +57,7 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app, lv_obj_set_style_local_text_color(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); label_time = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_extrabold_compressed); + lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 0, 0); diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index cd56c14..d2754ec 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -61,7 +61,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, lv_obj_align(btn1, nullptr, LV_ALIGN_IN_TOP_LEFT, buttonXOffset, barHeight); btn1_lvl = lv_label_create(btn1, nullptr); - lv_obj_set_style_local_text_font(btn1_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); + lv_obj_set_style_local_text_font(btn1_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_label_set_text_static(btn1_lvl, brightness.GetIcon()); btn2 = lv_btn_create(lv_scr_act(), nullptr); @@ -73,7 +73,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, lv_obj_t* lbl_btn; lbl_btn = lv_label_create(btn2, nullptr); - lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); + lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_label_set_text_static(lbl_btn, Symbols::highlight); btn3 = lv_btn_create(lv_scr_act(), nullptr); @@ -86,7 +86,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, lv_obj_align(btn3, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, buttonXOffset, 0); btn3_lvl = lv_label_create(btn3, nullptr); - lv_obj_set_style_local_text_font(btn3_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); + lv_obj_set_style_local_text_font(btn3_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); if (settingsController.GetNotificationStatus() == Controllers::Settings::Notification::ON) { lv_obj_add_state(btn3, LV_STATE_CHECKED); @@ -103,7 +103,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, lv_obj_align(btn4, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, - buttonXOffset, 0); lbl_btn = lv_label_create(btn4, nullptr); - lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); + lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_label_set_text_static(lbl_btn, Symbols::settings); lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); diff --git a/src/displayapp/screens/settings/SettingSetTime.cpp b/src/displayapp/screens/settings/SettingSetTime.cpp index 037611f..376790e 100644 --- a/src/displayapp/screens/settings/SettingSetTime.cpp +++ b/src/displayapp/screens/settings/SettingSetTime.cpp @@ -41,40 +41,40 @@ SettingSetTime::SettingSetTime(Pinetime::Applications::DisplayApp* app, hoursValue = static_cast<int>(dateTimeController.Hours()); lblHours = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(lblHours, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); + lv_obj_set_style_local_text_font(lblHours, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_label_set_text_fmt(lblHours, "%02d", hoursValue); lv_label_set_align(lblHours, LV_LABEL_ALIGN_CENTER); lv_obj_align(lblHours, lv_scr_act(), LV_ALIGN_CENTER, POS_X_HOURS, POS_Y_TEXT); lv_obj_set_auto_realign(lblHours, true); lv_obj_t* lblColon1 = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(lblColon1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); + lv_obj_set_style_local_text_font(lblColon1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_label_set_text_static(lblColon1, ":"); lv_label_set_align(lblColon1, LV_LABEL_ALIGN_CENTER); lv_obj_align(lblColon1, lv_scr_act(), LV_ALIGN_CENTER, (POS_X_HOURS + POS_X_MINUTES) / 2, POS_Y_TEXT + OFS_Y_COLON); minutesValue = static_cast<int>(dateTimeController.Minutes()); lblMinutes = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(lblMinutes, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); + lv_obj_set_style_local_text_font(lblMinutes, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_label_set_text_fmt(lblMinutes, "%02d", minutesValue); lv_label_set_align(lblMinutes, LV_LABEL_ALIGN_CENTER); lv_obj_align(lblMinutes, lv_scr_act(), LV_ALIGN_CENTER, POS_X_MINUTES, POS_Y_TEXT); lv_obj_set_auto_realign(lblMinutes, true); lv_obj_t* lblColon2 = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(lblColon2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); + lv_obj_set_style_local_text_font(lblColon2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_label_set_text_static(lblColon2, ":"); lv_label_set_align(lblColon2, LV_LABEL_ALIGN_CENTER); lv_obj_align(lblColon2, lv_scr_act(), LV_ALIGN_CENTER, (POS_X_MINUTES + POS_X_SECONDS) / 2, POS_Y_TEXT + OFS_Y_COLON); lv_obj_t* lblSeconds = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(lblSeconds, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); + lv_obj_set_style_local_text_font(lblSeconds, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_label_set_text_static(lblSeconds, "00"); lv_label_set_align(lblSeconds, LV_LABEL_ALIGN_CENTER); lv_obj_align(lblSeconds, lv_scr_act(), LV_ALIGN_CENTER, POS_X_SECONDS, POS_Y_TEXT); lblampm = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(lblampm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20); + lv_obj_set_style_local_text_font(lblampm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont15); lv_label_set_text_static(lblampm, " "); lv_label_set_align(lblampm, LV_LABEL_ALIGN_CENTER); lv_obj_align(lblampm, lv_scr_act(), LV_ALIGN_CENTER, POS_X_SECONDS, POS_Y_PLUS); diff --git a/src/displayapp/screens/settings/SettingSteps.cpp b/src/displayapp/screens/settings/SettingSteps.cpp index 5ca3eec..da0f182 100644 --- a/src/displayapp/screens/settings/SettingSteps.cpp +++ b/src/displayapp/screens/settings/SettingSteps.cpp @@ -43,7 +43,7 @@ SettingSteps::SettingSteps( lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); stepValue = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); + lv_obj_set_style_local_text_font(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); lv_label_set_text_fmt(stepValue, "%lu", settingsController.GetStepsGoal()); lv_label_set_align(stepValue, LV_LABEL_ALIGN_CENTER); lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); diff --git a/src/displayapp/screens/settings/SettingWakeUp.cpp b/src/displayapp/screens/settings/SettingWakeUp.cpp index e1b6e36..4fc0994 100644 --- a/src/displayapp/screens/settings/SettingWakeUp.cpp +++ b/src/displayapp/screens/settings/SettingWakeUp.cpp @@ -24,9 +24,9 @@ SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime:: lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5); lv_obj_set_style_local_border_width(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0); - lv_obj_set_pos(container1, 10, 60); + lv_obj_set_pos(container1, 10, 35); lv_obj_set_width(container1, LV_HOR_RES - 20); - lv_obj_set_height(container1, LV_VER_RES - 50); + lv_obj_set_height(container1, LV_VER_RES - 20); lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT); lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr); @@ -73,6 +73,14 @@ SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime:: lv_checkbox_set_checked(cbOption[optionsTotal], true); } optionsTotal++; + cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); + lv_checkbox_set_text_static(cbOption[optionsTotal], " Lower Wrist"); + cbOption[optionsTotal]->user_data = this; + lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); + if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::LowerWrist)) { + lv_checkbox_set_checked(cbOption[optionsTotal], true); + } + optionsTotal++; } SettingWakeUp::~SettingWakeUp() { |
