From 0ed45a9916787f68c0aa6bab9c97b090f2eebdd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=9C=D0=B0?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= <13werwolf13@mail.ru> Date: Tue, 18 Jan 2022 15:48:15 +0500 Subject: [PATCH] typo fix --- src/displayapp/screens/Clock.cpp | 23 ++--- src/displayapp/screens/WatchFaceTerminal.cpp | 83 +++++++++--------- src/displayapp/screens/WatchFaceTerminal.h | 88 ++++++++++---------- 3 files changed, 96 insertions(+), 98 deletions(-) diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index 837d5514..fd74683a 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -80,22 +80,17 @@ std::unique_ptr Clock::WatchFaceAnalogScreen() { } std::unique_ptr Clock::PineTimeStyleScreen() { - return std::make_unique(app, - dateTimeController, - batteryController, - bleController, - notificatioManager, - settingsController, - motionController); + return std::make_unique( + app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, motionController); } std::unique_ptr Clock::WatchFaceTerminalScreen() { return std::make_unique(app, - dateTimeController, - batteryController, - bleController, - notificatioManager, - settingsController, - heartRateController, - motionController); + dateTimeController, + batteryController, + bleController, + notificatioManager, + settingsController, + heartRateController, + motionController); } diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp index d4a298f5..dff5e3c6 100644 --- a/src/displayapp/screens/WatchFaceTerminal.cpp +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -17,13 +17,13 @@ using namespace Pinetime::Applications::Screens; WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController, - Controllers::NotificationManager& notificatioManager, - Controllers::Settings& settingsController, - Controllers::HeartRateController& heartRateController, - Controllers::MotionController& motionController) + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::NotificationManager& notificatioManager, + Controllers::Settings& settingsController, + Controllers::HeartRateController& heartRateController, + Controllers::MotionController& motionController) : Screen(app), currentDateTime {{}}, dateTimeController {dateTimeController}, @@ -115,7 +115,7 @@ void WatchFaceTerminal::Refresh() { bleState = bleController.IsConnected(); if (bleState.IsUpdated()) { - if(bleState.Get() == true) { + if (bleState.Get() == true) { lv_label_set_text(bleIcon, BleIcon::GetIcon(true)); } else { lv_label_set_text(bleIcon, BleIcon::GetIcon(false)); @@ -126,8 +126,8 @@ void WatchFaceTerminal::Refresh() { lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); notificationState = notificatioManager.AreNewNotificationsAvailable(); - if(notificationState.IsUpdated()) { - if(notificationState.Get() == true) + if (notificationState.IsUpdated()) { + if (notificationState.Get() == true) lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true)); else lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); @@ -135,16 +135,16 @@ void WatchFaceTerminal::Refresh() { currentDateTime = dateTimeController.CurrentDateTime(); - if(currentDateTime.IsUpdated()) { + if (currentDateTime.IsUpdated()) { auto newDateTime = currentDateTime.Get(); auto dp = date::floor(newDateTime); - auto time = date::make_time(newDateTime-dp); + auto time = date::make_time(newDateTime - dp); auto yearMonthDay = date::year_month_day(dp); - auto year = (int)yearMonthDay.year(); - auto month = static_cast((unsigned)yearMonthDay.month()); - auto day = (unsigned)yearMonthDay.day(); + auto year = (int) yearMonthDay.year(); + auto month = static_cast((unsigned) yearMonthDay.month()); + auto day = (unsigned) yearMonthDay.day(); auto dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); int hour = time.hours().count(); @@ -158,21 +158,21 @@ void WatchFaceTerminal::Refresh() { char ampmChar[3]; if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) { - sprintf(hoursChar, "%02d", hour); - } else { - if (hour == 0 && hour != 12) { - hour = 12; - sprintf(ampmChar, "AM"); - } else if (hour == 12 && hour != 0) { - hour = 12; - sprintf(ampmChar, "PM"); - } else if (hour < 12 && hour != 0) { - sprintf(ampmChar, "AM"); - } else if (hour > 12 && hour != 0) { - hour = hour - 12; - sprintf(ampmChar, "PM"); - } - sprintf(hoursChar, "%02d", hour); + sprintf(hoursChar, "%02d", hour); + } else { + if (hour == 0 && hour != 12) { + hour = 12; + sprintf(ampmChar, "AM"); + } else if (hour == 12 && hour != 0) { + hour = 12; + sprintf(ampmChar, "PM"); + } else if (hour < 12 && hour != 0) { + sprintf(ampmChar, "AM"); + } else if (hour > 12 && hour != 0) { + hour = hour - 12; + sprintf(ampmChar, "PM"); + } + sprintf(hoursChar, "%02d", hour); } char secondsChar[5]; @@ -184,12 +184,8 @@ void WatchFaceTerminal::Refresh() { sprintf(battStr, "[BATT]#387b54 %d%\%#", batteryValue); lv_label_set_text(batteryPercent, battStr); - if(hoursChar[0] != displayedChar[0] || - hoursChar[1] != displayedChar[1] || - minutesChar[0] != displayedChar[2] || - minutesChar[1] != displayedChar[3] || - secondsChar[0] != displayedChar[4] || - secondsChar[1] != displayedChar[5]) { + if (hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] || + minutesChar[1] != displayedChar[3] || secondsChar[0] != displayedChar[4] || secondsChar[1] != displayedChar[5]) { displayedChar[0] = hoursChar[0]; displayedChar[1] = hoursChar[1]; displayedChar[2] = minutesChar[0]; @@ -204,7 +200,15 @@ void WatchFaceTerminal::Refresh() { } char timeStr[42]; - sprintf(timeStr, "[TIME]#11cc55 %c%c:%c%c:%c%c %s#", hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1], secondsChar[0], secondsChar[1], ampmChar); + sprintf(timeStr, + "[TIME]#11cc55 %c%c:%c%c:%c%c %s#", + hoursChar[0], + hoursChar[1], + minutesChar[0], + minutesChar[1], + secondsChar[0], + secondsChar[1], + ampmChar); lv_label_set_text(label_time, timeStr); } @@ -215,7 +219,6 @@ void WatchFaceTerminal::Refresh() { sprintf(dateStr, "[DATE]#007fff %04d.%02d.%02d#", short(year), char(month), char(day)); lv_label_set_text(label_date, dateStr); - currentYear = year; currentMonth = month; currentDayOfWeek = dayOfWeek; @@ -225,9 +228,9 @@ void WatchFaceTerminal::Refresh() { heartbeat = heartRateController.HeartRate(); heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped; - if(heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) { + if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) { char heartbeatBuffer[28]; - if(heartbeatRunning.Get()) + if (heartbeatRunning.Get()) sprintf(heartbeatBuffer, "[L_HR]#ee3311 %d bpm#", heartbeat.Get()); else sprintf(heartbeatBuffer, "[L_HR]#ee3311 ---#"); diff --git a/src/displayapp/screens/WatchFaceTerminal.h b/src/displayapp/screens/WatchFaceTerminal.h index 0f98910d..2cd9fc5b 100644 --- a/src/displayapp/screens/WatchFaceTerminal.h +++ b/src/displayapp/screens/WatchFaceTerminal.h @@ -23,60 +23,60 @@ namespace Pinetime { class WatchFaceTerminal : public Screen { public: WatchFaceTerminal(DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController, - Controllers::NotificationManager& notificatioManager, - Controllers::Settings& settingsController, - Controllers::HeartRateController& heartRateController, - Controllers::MotionController& motionController); + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::NotificationManager& notificatioManager, + Controllers::Settings& settingsController, + Controllers::HeartRateController& heartRateController, + Controllers::MotionController& motionController); ~WatchFaceTerminal() override; - void Refresh() override; + void Refresh() override; - void OnObjectEvent(lv_obj_t *pObj, lv_event_t i); + void OnObjectEvent(lv_obj_t* pObj, lv_event_t i); private: - char displayedChar[8]; + char displayedChar[8]; - 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; + 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; - DirtyValue batteryPercentRemaining {}; - DirtyValue bleState {}; - DirtyValue> currentDateTime{}; - DirtyValue motionSensorOk {}; - DirtyValue stepCount {}; - DirtyValue heartbeat {}; - DirtyValue heartbeatRunning {}; - DirtyValue notificationState {}; + DirtyValue batteryPercentRemaining {}; + DirtyValue bleState {}; + DirtyValue> currentDateTime {}; + DirtyValue motionSensorOk {}; + DirtyValue stepCount {}; + DirtyValue heartbeat {}; + DirtyValue heartbeatRunning {}; + DirtyValue notificationState {}; - lv_obj_t* label_time; - lv_obj_t* label_date; - lv_obj_t* label_prompt_1; - lv_obj_t* label_prompt_2; - lv_obj_t* backgroundLabel; - lv_obj_t* batteryIcon; - lv_obj_t* bleIcon; - lv_obj_t* batteryPlug; - lv_obj_t* batteryPercent; - lv_obj_t* heartbeatIcon; - lv_obj_t* heartbeatValue; - lv_obj_t* heartbeatBpm; - lv_obj_t* stepValue; - lv_obj_t* notificationIcon; + lv_obj_t* label_time; + lv_obj_t* label_date; + lv_obj_t* label_prompt_1; + lv_obj_t* label_prompt_2; + lv_obj_t* backgroundLabel; + lv_obj_t* batteryIcon; + lv_obj_t* bleIcon; + lv_obj_t* batteryPlug; + lv_obj_t* batteryPercent; + lv_obj_t* heartbeatIcon; + lv_obj_t* heartbeatValue; + lv_obj_t* heartbeatBpm; + lv_obj_t* stepValue; + lv_obj_t* notificationIcon; - Controllers::DateTime& dateTimeController; - Controllers::Battery& batteryController; - Controllers::Ble& bleController; - Controllers::NotificationManager& notificatioManager; - Controllers::Settings& settingsController; - Controllers::HeartRateController& heartRateController; - Controllers::MotionController& motionController; + Controllers::DateTime& dateTimeController; + Controllers::Battery& batteryController; + Controllers::Ble& bleController; + Controllers::NotificationManager& notificatioManager; + Controllers::Settings& settingsController; + Controllers::HeartRateController& heartRateController; + Controllers::MotionController& motionController; - lv_task_t* taskRefresh; + lv_task_t* taskRefresh; }; } }