From 319030d9e16e833cf8bff569a9ecfa452165ea27 Mon Sep 17 00:00:00 2001 From: "James A. Jerkins" Date: Thu, 23 Dec 2021 20:30:14 -0600 Subject: Add airplane mode feature Implements 'Airplane mode' feature to disable and enable bluetooth/ble Adds airplaneMode as a non-persisted setting Adds a setting menu for switching airplane mode on and off Displays an airplane symbol on the Digital watch face and the PineTimeStyle watch face when airplane mode is enabled Always enables bluetooth/ble on boot (disable airplane mode) Alphabetizes the settings menu options Style cleanups Closes #632 --- src/CMakeLists.txt | 1 + src/components/ble/BleController.cpp | 8 +- src/components/ble/BleController.h | 9 ++- src/components/ble/NimbleController.cpp | 44 ++++++++--- src/components/ble/NimbleController.h | 28 ++++--- src/components/settings/Settings.h | 39 +++++++++- src/displayapp/Apps.h | 3 +- src/displayapp/DisplayApp.cpp | 8 ++ src/displayapp/Messages.h | 3 +- src/displayapp/fonts/README.md | 2 +- src/displayapp/fonts/jetbrains_mono_bold_20.c | 74 ++++++++++-------- src/displayapp/screens/BleIcon.cpp | 10 ++- src/displayapp/screens/BleIcon.h | 6 +- src/displayapp/screens/PineTimeStyle.cpp | 6 +- src/displayapp/screens/PineTimeStyle.h | 7 +- src/displayapp/screens/Symbols.h | 1 + src/displayapp/screens/WatchFaceDigital.cpp | 2 +- src/displayapp/screens/WatchFaceDigital.h | 7 +- .../screens/settings/SettingAirplaneMode.cpp | 89 ++++++++++++++++++++++ .../screens/settings/SettingAirplaneMode.h | 30 ++++++++ src/displayapp/screens/settings/Settings.cpp | 22 +++--- src/systemtask/Messages.h | 1 + src/systemtask/SystemTask.cpp | 6 +- 23 files changed, 307 insertions(+), 99 deletions(-) create mode 100644 src/displayapp/screens/settings/SettingAirplaneMode.cpp create mode 100644 src/displayapp/screens/settings/SettingAirplaneMode.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 809544c9..ae8eece8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -448,6 +448,7 @@ list(APPEND SOURCE_FILES displayapp/screens/settings/SettingPineTimeStyle.cpp displayapp/screens/settings/SettingSetDate.cpp displayapp/screens/settings/SettingSetTime.cpp + displayapp/screens/settings/SettingAirplaneMode.cpp ## Watch faces displayapp/icons/bg_clock.c diff --git a/src/components/ble/BleController.cpp b/src/components/ble/BleController.cpp index a80c9719..0e1c5d7e 100644 --- a/src/components/ble/BleController.cpp +++ b/src/components/ble/BleController.cpp @@ -2,12 +2,12 @@ using namespace Pinetime::Controllers; -void Ble::Connect() { - isConnected = true; +void Ble::SetConnectState(Ble::ConnectStates newState) { + connectionState = newState; } -void Ble::Disconnect() { - isConnected = false; +Ble::ConnectStates Ble::GetConnectState() const { + return connectionState; } void Ble::StartFirmwareUpdate() { diff --git a/src/components/ble/BleController.h b/src/components/ble/BleController.h index 72b87663..2714c0c3 100644 --- a/src/components/ble/BleController.h +++ b/src/components/ble/BleController.h @@ -10,13 +10,14 @@ namespace Pinetime { using BleAddress = std::array; enum class FirmwareUpdateStates { Idle, Running, Validated, Error }; enum class AddressTypes { Public, Random, RPA_Public, RPA_Random }; + enum class ConnectStates { Disconnected, Connected, Airplane }; Ble() = default; bool IsConnected() const { - return isConnected; + return (connectionState == ConnectStates::Connected); } - void Connect(); - void Disconnect(); + void SetConnectState(ConnectStates newState); + ConnectStates GetConnectState() const; void StartFirmwareUpdate(); void StopFirmwareUpdate(); @@ -56,7 +57,7 @@ namespace Pinetime { } private: - bool isConnected = false; + ConnectStates connectionState = ConnectStates::Disconnected; bool isFirmwareUpdating = false; uint32_t firmwareUpdateTotalBytes = 0; uint32_t firmwareUpdateCurrentBytes = 0; diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index d8510bd3..d85ec5dc 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -23,14 +23,14 @@ using namespace Pinetime::Controllers; NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask, - Pinetime::Controllers::Ble& bleController, + Ble& bleController, DateTime& dateTimeController, - Pinetime::Controllers::NotificationManager& notificationManager, - Controllers::Battery& batteryController, + NotificationManager& notificationManager, + Battery& batteryController, Pinetime::Drivers::SpiNorFlash& spiNorFlash, - Controllers::HeartRateController& heartRateController, - Controllers::MotionController& motionController, - Controllers::FS& fs) + HeartRateController& heartRateController, + MotionController& motionController, + FS& fs) : systemTask {systemTask}, bleController {bleController}, dateTimeController {dateTimeController}, @@ -184,7 +184,9 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { case BLE_GAP_EVENT_ADV_COMPLETE: NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_ADV_COMPLETE"); NRF_LOG_INFO("reason=%d; status=%0X", event->adv_complete.reason, event->connect.status); - StartAdvertising(); + if (bleController.GetConnectState() == Ble::ConnectStates::Disconnected) { + StartAdvertising(); + } break; case BLE_GAP_EVENT_CONNECT: @@ -197,12 +199,12 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { currentTimeClient.Reset(); alertNotificationClient.Reset(); connectionHandle = BLE_HS_CONN_HANDLE_NONE; - bleController.Disconnect(); + bleController.SetConnectState(Ble::ConnectStates::Disconnected); fastAdvCount = 0; StartAdvertising(); } else { connectionHandle = event->connect.conn_handle; - bleController.Connect(); + bleController.SetConnectState(Ble::ConnectStates::Connected); systemTask.PushMessage(Pinetime::System::Messages::BleConnected); // Service discovery is deferred via systemtask } @@ -220,9 +222,11 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { currentTimeClient.Reset(); alertNotificationClient.Reset(); connectionHandle = BLE_HS_CONN_HANDLE_NONE; - bleController.Disconnect(); - fastAdvCount = 0; - StartAdvertising(); + if (bleController.GetConnectState() == Ble::ConnectStates::Connected) { + bleController.SetConnectState(Ble::ConnectStates::Disconnected); + fastAdvCount = 0; + StartAdvertising(); + } break; case BLE_GAP_EVENT_CONN_UPDATE: @@ -376,6 +380,22 @@ void NimbleController::NotifyBatteryLevel(uint8_t level) { } } +void NimbleController::SwitchAirplaneMode(bool enabled) { + if (enabled) { + if (bleController.IsConnected()) { + bleController.SetConnectState(Ble::ConnectStates::Airplane); + ble_gap_terminate(connectionHandle, BLE_ERR_REM_USER_CONN_TERM); + } else { + bleController.SetConnectState(Ble::ConnectStates::Airplane); + ble_gap_adv_stop(); + } + } else { + bleController.SetConnectState(Ble::ConnectStates::Disconnected); + fastAdvCount = 0; + StartAdvertising(); + } +} + void NimbleController::PersistBond(struct ble_gap_conn_desc& desc) { union ble_store_key key; union ble_store_value our_sec, peer_sec, peer_cccd_set[MYNEWT_VAL(BLE_STORE_MAX_CCCDS)] = {0}; diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h index 2b300e63..7219ba6b 100644 --- a/src/components/ble/NimbleController.h +++ b/src/components/ble/NimbleController.h @@ -14,6 +14,7 @@ #include "components/ble/CurrentTimeService.h" #include "components/ble/DeviceInformationService.h" #include "components/ble/DfuService.h" +#include "components/ble/FSService.h" #include "components/ble/HeartRateService.h" #include "components/ble/ImmediateAlertService.h" #include "components/ble/MusicService.h" @@ -22,7 +23,6 @@ #include "components/ble/MotionService.h" #include "components/ble/weather/WeatherService.h" #include "components/fs/FS.h" -#include "components/ble/FSService.h" namespace Pinetime { namespace Drivers { @@ -42,18 +42,19 @@ namespace Pinetime { public: NimbleController(Pinetime::System::SystemTask& systemTask, - Pinetime::Controllers::Ble& bleController, + Ble& bleController, DateTime& dateTimeController, - Pinetime::Controllers::NotificationManager& notificationManager, - Controllers::Battery& batteryController, + NotificationManager& notificationManager, + Battery& batteryController, Pinetime::Drivers::SpiNorFlash& spiNorFlash, - Controllers::HeartRateController& heartRateController, - Controllers::MotionController& motionController, - Pinetime::Controllers::FS& fs); + HeartRateController& heartRateController, + MotionController& motionController, + FS& fs); void Init(); void StartAdvertising(); int OnGAPEvent(ble_gap_event* event); + /* these are not implemented yet int OnDiscoveryEvent(uint16_t i, const ble_gatt_error* pError, const ble_gatt_svc* pSvc); int OnCTSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_chr* characteristic); int OnANSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_chr* characteristic); @@ -62,6 +63,7 @@ namespace Pinetime { const ble_gatt_error* error, uint16_t characteristicValueHandle, const ble_gatt_dsc* descriptor); + */ void StartDiscovery(); @@ -83,7 +85,9 @@ namespace Pinetime { void RestartFastAdv() { fastAdvCount = 0; - } + }; + + void SwitchAirplaneMode(bool enabled); private: void PersistBond(struct ble_gap_conn_desc& desc); @@ -91,12 +95,12 @@ namespace Pinetime { static constexpr const char* deviceName = "InfiniTime"; Pinetime::System::SystemTask& systemTask; - Pinetime::Controllers::Ble& bleController; + Ble& bleController; DateTime& dateTimeController; - Pinetime::Controllers::NotificationManager& notificationManager; + NotificationManager& notificationManager; Pinetime::Drivers::SpiNorFlash& spiNorFlash; - Pinetime::Controllers::FS& fs; - Pinetime::Controllers::DfuService dfuService; + FS& fs; + DfuService dfuService; DeviceInformationService deviceInformationService; CurrentTimeClient currentTimeClient; diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 2d7973d8..a1529fec 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -17,7 +17,23 @@ namespace Pinetime { RaiseWrist = 2, }; enum class Colors : uint8_t { - White, Silver, Gray, Black, Red, Maroon, Yellow, Olive, Lime, Green, Cyan, Teal, Blue, Navy, Magenta, Purple, Orange + White, + Silver, + Gray, + Black, + Red, + Maroon, + Yellow, + Olive, + Lime, + Green, + Cyan, + Teal, + Blue, + Navy, + Magenta, + Purple, + Orange }; struct PineTimeStyle { Colors ColorTime = Colors::Teal; @@ -146,18 +162,29 @@ namespace Pinetime { } settings.brightLevel = level; }; + Controllers::BrightnessController::Levels GetBrightness() const { return settings.brightLevel; }; - void SetStepsGoal( uint32_t goal ) { - if ( goal != settings.stepsGoal ) { + void SetStepsGoal(uint32_t goal) { + if (goal != settings.stepsGoal) { settingsChanged = true; } settings.stepsGoal = goal; }; - uint32_t GetStepsGoal() const { return settings.stepsGoal; }; + uint32_t GetStepsGoal() const { + return settings.stepsGoal; + }; + + void SetAirplaneMode(bool mode) { + airplaneMode = mode; + }; + + bool GetAirplaneMode() const { + return airplaneMode; + }; private: Pinetime::Controllers::FS& fs; @@ -185,6 +212,10 @@ namespace Pinetime { uint8_t appMenu = 0; uint8_t settingsMenu = 0; + /* airplaneMode is intentionally not saved with the other watch settings and initialized + * to off (false) on every boot because we always want ble to be enabled on startup + */ + bool airplaneMode = false; void LoadSettingsFromFile(); void SaveSettingsToFile(); diff --git a/src/displayapp/Apps.h b/src/displayapp/Apps.h index b2f55ccd..971c36b7 100644 --- a/src/displayapp/Apps.h +++ b/src/displayapp/Apps.h @@ -37,7 +37,8 @@ namespace Pinetime { SettingPineTimeStyle, SettingSetDate, SettingSetTime, - Error, + SettingAirplaneMode, + Error }; } } diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 233f433d..d3896b18 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -48,6 +48,7 @@ #include "displayapp/screens/settings/SettingPineTimeStyle.h" #include "displayapp/screens/settings/SettingSetDate.h" #include "displayapp/screens/settings/SettingSetTime.h" +#include "displayapp/screens/settings/SettingAirplaneMode.h" #include "libs/lv_conf.h" @@ -289,6 +290,9 @@ void DisplayApp::Refresh() { case Messages::BleFirmwareUpdateStarted: LoadApp(Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down); break; + case Messages::AirplaneModeToggle: + PushMessageToSystemTask(System::Messages::AirplaneModeToggle); + break; case Messages::UpdateDateTime: // Added to remove warning // What should happen here? @@ -420,6 +424,10 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) currentScreen = std::make_unique(this, settingsController); ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; + case Apps::SettingAirplaneMode: + currentScreen = std::make_unique(this, settingsController); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + break; case Apps::BatteryInfo: currentScreen = std::make_unique(this, batteryController); ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); diff --git a/src/displayapp/Messages.h b/src/displayapp/Messages.h index b22d6c3c..4d52df20 100644 --- a/src/displayapp/Messages.h +++ b/src/displayapp/Messages.h @@ -20,7 +20,8 @@ namespace Pinetime { DimScreen, RestoreBrightness, ShowPairingKey, - AlarmTriggered + AlarmTriggered, + AirplaneModeToggle }; } } diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md index 8a260846..40ecd3e2 100644 --- a/src/displayapp/fonts/README.md +++ b/src/displayapp/fonts/README.md @@ -13,7 +13,7 @@ * Do not enable font compression and horizontal subpixel hinting * Load the file `JetBrainsMono-Bold.tff` (use the file in this repo to ensure the version matches) and specify the following range : `0x20-0x7f, 0x410-0x44f` * Add a 2nd font, load the file `FontAwesome5-Solid+Brands+Regular.woff` and specify the following - range : `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf201, 0xf06e, 0xf015` + range : `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf201, 0xf06e, 0xf015, 0xf072` * Click on Convert, and download the file `jetbrains_mono_bold_20.c` and copy it in `src/DisplayApp/Fonts` * Add the font .c file path to src/CMakeLists.txt * Add an LV_FONT_DECLARE line in src/libs/lv_conf.h diff --git a/src/displayapp/fonts/jetbrains_mono_bold_20.c b/src/displayapp/fonts/jetbrains_mono_bold_20.c index d8705528..944e47a1 100644 --- a/src/displayapp/fonts/jetbrains_mono_bold_20.c +++ b/src/displayapp/fonts/jetbrains_mono_bold_20.c @@ -840,6 +840,16 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xf8, 0xf, 0x80, 0xf8, 0x3e, 0x0, 0xff, 0xf0, 0x0, 0x3f, 0x80, 0x0, + /* U+F072 "" */ + 0x1, 0xc0, 0x0, 0x7, 0xc0, 0x0, 0x7, 0x80, + 0x0, 0xf, 0x80, 0x0, 0x1f, 0x0, 0x0, 0x1f, + 0x0, 0x38, 0x3e, 0x0, 0x78, 0x7e, 0x0, 0x7f, + 0xff, 0xe0, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xf3, + 0xff, 0xff, 0xe7, 0xff, 0xff, 0xdf, 0xff, 0xfc, + 0x3c, 0x3f, 0x0, 0x70, 0x7c, 0x0, 0x1, 0xf0, + 0x0, 0x3, 0xe0, 0x0, 0x7, 0x80, 0x0, 0xf, + 0x0, 0x0, 0x1c, 0x0, 0x0, + /* U+F095 "" */ 0x0, 0x0, 0x0, 0x0, 0x3e, 0x0, 0x7, 0xf0, 0x0, 0x7f, 0x0, 0x7, 0xf0, 0x0, 0xff, 0x0, @@ -1220,31 +1230,32 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 3028, .adv_w = 280, .box_w = 13, .box_h = 17, .ofs_x = 2, .ofs_y = -1}, {.bitmap_index = 3056, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 3104, .adv_w = 360, .box_w = 23, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3148, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3201, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3220, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3270, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3306, .adv_w = 320, .box_w = 20, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3354, .adv_w = 320, .box_w = 21, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3394, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 3437, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3475, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3513, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3551, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3589, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3627, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3663, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 3701, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3730, .adv_w = 280, .box_w = 16, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 3768, .adv_w = 400, .box_w = 25, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3834, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 3883, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3933, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3993, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 4046, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 4107, .adv_w = 360, .box_w = 22, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 4162, .adv_w = 360, .box_w = 22, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 4215, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 3148, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3209, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3262, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3281, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3331, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3367, .adv_w = 320, .box_w = 20, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3415, .adv_w = 320, .box_w = 21, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3455, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 3498, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3536, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3574, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3612, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3650, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3688, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3724, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 3762, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3791, .adv_w = 280, .box_w = 16, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 3829, .adv_w = 400, .box_w = 25, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3895, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 3944, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3994, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 4054, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 4107, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 4168, .adv_w = 360, .box_w = 22, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 4223, .adv_w = 360, .box_w = 22, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 4276, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- @@ -1253,10 +1264,11 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { static const uint16_t unicode_list_2[] = { 0x0, 0x14, 0x16, 0x23, 0x26, 0x27, 0x28, 0x39, - 0x47, 0x4a, 0x4b, 0x4c, 0x50, 0x68, 0x6d, 0x94, - 0x128, 0x184, 0x1e5, 0x1fb, 0x200, 0x21d, 0x23f, 0x240, - 0x241, 0x242, 0x243, 0x251, 0x292, 0x293, 0x2f1, 0x3dc, - 0x3fc, 0x45c, 0x54a, 0x55f, 0x568, 0x59e, 0x59f, 0x6a8 + 0x47, 0x4a, 0x4b, 0x4c, 0x50, 0x68, 0x6d, 0x71, + 0x94, 0x128, 0x184, 0x1e5, 0x1fb, 0x200, 0x21d, 0x23f, + 0x240, 0x241, 0x242, 0x243, 0x251, 0x292, 0x293, 0x2f1, + 0x3dc, 0x3fc, 0x45c, 0x54a, 0x55f, 0x568, 0x59e, 0x59f, + 0x6a8 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -1272,7 +1284,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 61441, .range_length = 1705, .glyph_id_start = 160, - .unicode_list = unicode_list_2, .glyph_id_ofs_list = NULL, .list_length = 40, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_2, .glyph_id_ofs_list = NULL, .list_length = 41, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -1321,7 +1333,7 @@ lv_font_t jetbrains_mono_bold_20 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8 .underline_position = -3, .underline_thickness = 1, #endif diff --git a/src/displayapp/screens/BleIcon.cpp b/src/displayapp/screens/BleIcon.cpp index 5058f3eb..a30d23bd 100644 --- a/src/displayapp/screens/BleIcon.cpp +++ b/src/displayapp/screens/BleIcon.cpp @@ -2,9 +2,11 @@ #include "displayapp/screens/Symbols.h" using namespace Pinetime::Applications::Screens; -const char* BleIcon::GetIcon(bool isConnected) { - if (isConnected) +const char* BleIcon::GetIcon(Pinetime::Controllers::Ble::ConnectStates state) { + if (state == Pinetime::Controllers::Ble::ConnectStates::Connected) return Symbols::bluetooth; + else if (state == Pinetime::Controllers::Ble::ConnectStates::Airplane) + return Symbols::airplane; else - return ""; -} \ No newline at end of file + return Symbols::none; +} diff --git a/src/displayapp/screens/BleIcon.h b/src/displayapp/screens/BleIcon.h index c1398d2a..d7410eae 100644 --- a/src/displayapp/screens/BleIcon.h +++ b/src/displayapp/screens/BleIcon.h @@ -1,12 +1,14 @@ #pragma once +#include "components/ble/BleController.h" + namespace Pinetime { namespace Applications { namespace Screens { class BleIcon { public: - static const char* GetIcon(bool isConnected); + static const char* GetIcon(Pinetime::Controllers::Ble::ConnectStates state); }; } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index d4368691..e7b1f393 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -208,10 +208,10 @@ void PineTimeStyle::SetBatteryIcon() { } void PineTimeStyle::AlignIcons() { - if (notificationState.Get() && bleState.Get()) { + if (notificationState.Get() && bleState.Get() != Pinetime::Controllers::Ble::ConnectStates::Disconnected) { lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 8, 25); lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25); - } else if (notificationState.Get() && !bleState.Get()) { + } else if (notificationState.Get() && bleState.Get() == Pinetime::Controllers::Ble::ConnectStates::Disconnected) { lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); } else { lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); @@ -234,7 +234,7 @@ void PineTimeStyle::Refresh() { } } - bleState = bleController.IsConnected(); + bleState = bleController.GetConnectState(); if (bleState.IsUpdated()) { lv_label_set_text(bleIcon, BleIcon::GetIcon(bleState.Get())); AlignIcons(); diff --git a/src/displayapp/screens/PineTimeStyle.h b/src/displayapp/screens/PineTimeStyle.h index 8382c53c..c5136fc2 100644 --- a/src/displayapp/screens/PineTimeStyle.h +++ b/src/displayapp/screens/PineTimeStyle.h @@ -6,6 +6,7 @@ #include #include "displayapp/screens/Screen.h" #include "components/datetime/DateTimeController.h" +#include "components/ble/BleController.h" namespace Pinetime { namespace Controllers { @@ -36,13 +37,13 @@ namespace Pinetime { 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; + Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown; + Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown; uint8_t currentDay = 0; DirtyValue batteryPercentRemaining {}; DirtyValue isCharging {}; - DirtyValue bleState {}; + DirtyValue bleState {}; DirtyValue> currentDateTime {}; DirtyValue motionSensorOk {}; DirtyValue stepCount {}; diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h index e68a7af6..5ba8f953 100644 --- a/src/displayapp/screens/Symbols.h +++ b/src/displayapp/screens/Symbols.h @@ -44,6 +44,7 @@ namespace Pinetime { static constexpr const char* chartLine = "\xEF\x88\x81"; static constexpr const char* eye = "\xEF\x81\xAE"; static constexpr const char* home = "\xEF\x80\x95"; + static constexpr const char* airplane = "\xEF\x81\xB2"; // lv_font_sys_48.c static constexpr const char* settings = "\xEE\xA4\x82"; // e902 diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 87695793..8f06553f 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -119,7 +119,7 @@ void WatchFaceDigital::Refresh() { lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); } - bleState = bleController.IsConnected(); + bleState = bleController.GetConnectState(); if (bleState.IsUpdated()) { lv_label_set_text(bleIcon, BleIcon::GetIcon(bleState.Get())); } diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index 627154c8..addb539a 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -6,6 +6,7 @@ #include #include "displayapp/screens/Screen.h" #include "components/datetime/DateTimeController.h" +#include "components/ble/BleController.h" namespace Pinetime { namespace Controllers { @@ -38,13 +39,13 @@ namespace Pinetime { 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; + Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown; + Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown; uint8_t currentDay = 0; DirtyValue batteryPercentRemaining {}; DirtyValue powerPresent {}; - DirtyValue bleState {}; + DirtyValue bleState {}; DirtyValue> currentDateTime {}; DirtyValue motionSensorOk {}; DirtyValue stepCount {}; diff --git a/src/displayapp/screens/settings/SettingAirplaneMode.cpp b/src/displayapp/screens/settings/SettingAirplaneMode.cpp new file mode 100644 index 00000000..0a364ded --- /dev/null +++ b/src/displayapp/screens/settings/SettingAirplaneMode.cpp @@ -0,0 +1,89 @@ +#include "displayapp/screens/settings/SettingAirplaneMode.h" +#include +#include "displayapp/DisplayApp.h" +#include "displayapp/Messages.h" +#include "displayapp/screens/Styles.h" +#include "displayapp/screens/Screen.h" +#include "displayapp/screens/Symbols.h" + +using namespace Pinetime::Applications::Screens; + +namespace { + static void event_handler(lv_obj_t* obj, lv_event_t event) { + SettingAirplaneMode* screen = static_cast(obj->user_data); + screen->UpdateSelected(obj, event); + } +} + +constexpr std::array SettingAirplaneMode::options; + +SettingAirplaneMode::SettingAirplaneMode(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) + : Screen(app), settingsController {settingsController} { + + lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr); + + lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); + lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10); + 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_width(container1, LV_HOR_RES - 20); + lv_obj_set_height(container1, LV_VER_RES - 50); + lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT); + + lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_static(title, "Airplane mode"); + lv_label_set_align(title, LV_LABEL_ALIGN_CENTER); + lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15); + + lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_label_set_text_static(icon, Symbols::airplane); + lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); + lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); + + for (unsigned int i = 0; i < options.size(); i++) { + cbOption[i] = lv_checkbox_create(container1, nullptr); + lv_checkbox_set_text(cbOption[i], options[i]); + cbOption[i]->user_data = this; + lv_obj_set_event_cb(cbOption[i], event_handler); + SetRadioButtonStyle(cbOption[i]); + } + + if (settingsController.GetAirplaneMode() == false) { + lv_checkbox_set_checked(cbOption[0], true); + priorMode = false; + } else { + lv_checkbox_set_checked(cbOption[1], true); + priorMode = true; + } +} + +SettingAirplaneMode::~SettingAirplaneMode() { + lv_obj_clean(lv_scr_act()); + // Do not call SaveSettings - see src/components/settings/Settings.h + if (priorMode != settingsController.GetAirplaneMode()) { + app->PushMessage(Pinetime::Applications::Display::Messages::AirplaneModeToggle); + } +} + +void SettingAirplaneMode::UpdateSelected(lv_obj_t* object, lv_event_t event) { + if (event == LV_EVENT_VALUE_CHANGED) { + for (unsigned int i = 0; i < options.size(); i++) { + if (object == cbOption[i]) { + lv_checkbox_set_checked(cbOption[i], true); + + if (i == 0) { + settingsController.SetAirplaneMode(false); + }; + if (i == 1) { + settingsController.SetAirplaneMode(true); + }; + + } else { + lv_checkbox_set_checked(cbOption[i], false); + } + } + } +} diff --git a/src/displayapp/screens/settings/SettingAirplaneMode.h b/src/displayapp/screens/settings/SettingAirplaneMode.h new file mode 100644 index 00000000..fcc02228 --- /dev/null +++ b/src/displayapp/screens/settings/SettingAirplaneMode.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include +#include + +#include "components/settings/Settings.h" +#include "displayapp/screens/Screen.h" + +namespace Pinetime { + + namespace Applications { + namespace Screens { + + class SettingAirplaneMode : public Screen { + public: + SettingAirplaneMode(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); + ~SettingAirplaneMode() override; + + void UpdateSelected(lv_obj_t* object, lv_event_t event); + + private: + static constexpr std::array options = {" No", " Yes"}; + Controllers::Settings& settingsController; + lv_obj_t* cbOption[options.size()]; + bool priorMode; + }; + } + } +} diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index 392c12e0..6be00f57 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -36,10 +36,10 @@ bool Settings::OnTouchEvent(Pinetime::Applications::TouchEvents event) { std::unique_ptr Settings::CreateScreen1() { std::array applications {{ - {Symbols::sun, "Display", Apps::SettingDisplay}, - {Symbols::eye, "Wake Up", Apps::SettingWakeUp}, - {Symbols::clock, "Time format", Apps::SettingTimeFormat}, - {Symbols::home, "Watch face", Apps::SettingWatchFace}, + {Symbols::list, "About", Apps::SysInfo}, + {Symbols::airplane, "Airplane mode", Apps::SettingAirplaneMode}, + {Symbols::batteryHalf, "Battery", Apps::BatteryInfo}, + {Symbols::sun, "Display", Apps::SettingDisplay} }}; return std::make_unique(0, 3, app, settingsController, applications); @@ -48,10 +48,10 @@ std::unique_ptr Settings::CreateScreen1() { std::unique_ptr Settings::CreateScreen2() { std::array applications {{ - {Symbols::shoe, "Steps", Apps::SettingSteps}, + {Symbols::check, "Firmware", Apps::FirmwareValidation}, + {Symbols::paintbrush, "PTS colors", Apps::SettingPineTimeStyle}, {Symbols::clock, "Set date", Apps::SettingSetDate}, - {Symbols::clock, "Set time", Apps::SettingSetTime}, - {Symbols::batteryHalf, "Battery", Apps::BatteryInfo} + {Symbols::clock, "Set time", Apps::SettingSetTime} }}; return std::make_unique(1, 3, app, settingsController, applications); @@ -60,10 +60,10 @@ std::unique_ptr Settings::CreateScreen2() { std::unique_ptr Settings::CreateScreen3() { std::array applications {{ - {Symbols::paintbrush, "PTS Colors", Apps::SettingPineTimeStyle}, - {Symbols::check, "Firmware", Apps::FirmwareValidation}, - {Symbols::list, "About", Apps::SysInfo}, - {Symbols::none, "None", Apps::None}, + {Symbols::shoe, "Steps", Apps::SettingSteps}, + {Symbols::clock, "Time format", Apps::SettingTimeFormat}, + {Symbols::eye, "Wake up", Apps::SettingWakeUp}, + {Symbols::home, "Watch face", Apps::SettingWatchFace} }}; return std::make_unique(2, 3, app, settingsController, applications); diff --git a/src/systemtask/Messages.h b/src/systemtask/Messages.h index cc30fdc6..886505b5 100644 --- a/src/systemtask/Messages.h +++ b/src/systemtask/Messages.h @@ -29,6 +29,7 @@ namespace Pinetime { BatteryPercentageUpdated, StartFileTransfer, StopFileTransfer, + AirplaneModeToggle }; } } diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index a95d479d..5ce223a6 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -261,7 +261,7 @@ void SystemTask::Work() { displayApp.PushMessage(Pinetime::Applications::Display::Messages::GoToRunning); heartRateApp.PushMessage(Pinetime::Applications::HeartRateTask::Messages::WakeUp); - if (!bleController.IsConnected()) { + if (bleController.GetConnectState() == Controllers::Ble::ConnectStates::Disconnected) { nimbleController.RestartFastAdv(); } @@ -424,7 +424,9 @@ void SystemTask::Work() { motorController.RunForDuration(35); displayApp.PushMessage(Pinetime::Applications::Display::Messages::ShowPairingKey); break; - + case Messages::AirplaneModeToggle: + nimbleController.SwitchAirplaneMode(settingsController.GetAirplaneMode()); + break; default: break; } -- cgit v1.2.3-70-g09d2 From d5b78ecd6690180f4f0891780dc7fe7a8ef91212 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Sat, 29 Jan 2022 22:08:52 +0100 Subject: SystemTask: remove unused ble includes Remove unused includes. The firmware still compiles fine without the includes. --- src/systemtask/SystemTask.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src') diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index e71ebc17..6460cd4b 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -1,13 +1,4 @@ #include "systemtask/SystemTask.h" -#define min // workaround: nimble's min/max macros conflict with libstdc++ -#define max -#include -#include -#include -#include -#include -#undef max -#undef min #include #include #include -- cgit v1.2.3-70-g09d2 From 04eca81a956ad84a5604096515da1ac148fe8921 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Sat, 29 Jan 2022 23:34:09 +0100 Subject: Notifications: use motorController object instead of class function We get the motoroController object, so store and use it. --- src/displayapp/screens/Notifications.cpp | 24 +++++++++++++++--------- src/displayapp/screens/Notifications.h | 5 ++++- 2 files changed, 19 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 8fe08a82..3a39dacf 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -17,6 +17,7 @@ Notifications::Notifications(DisplayApp* app, : Screen(app), notificationManager {notificationManager}, alertNotificationService {alertNotificationService}, + motorController {motorController}, systemTask {systemTask}, mode {mode} { notificationManager.ClearNewNotificationFlag(); @@ -29,7 +30,8 @@ Notifications::Notifications(DisplayApp* app, notification.category, notificationManager.NbNotifications(), mode, - alertNotificationService); + alertNotificationService, + motorController); validDisplay = true; } else { currentItem = std::make_unique("Notification", @@ -38,7 +40,8 @@ Notifications::Notifications(DisplayApp* app, notification.category, notificationManager.NbNotifications(), Modes::Preview, - alertNotificationService); + alertNotificationService, + motorController); } if (mode == Modes::Preview) { @@ -66,7 +69,7 @@ Notifications::Notifications(DisplayApp* app, Notifications::~Notifications() { lv_task_del(taskRefresh); // make sure we stop any vibrations before exiting - Controllers::MotorController::StopRinging(); + motorController.StopRinging(); systemTask.PushMessage(System::Messages::EnableSleeping); lv_obj_clean(lv_scr_act()); } @@ -87,7 +90,7 @@ void Notifications::Refresh() { void Notifications::OnPreviewInteraction() { systemTask.PushMessage(System::Messages::EnableSleeping); - Controllers::MotorController::StopRinging(); + motorController.StopRinging(); if (timeoutLine != nullptr) { lv_obj_del(timeoutLine); timeoutLine = nullptr; @@ -125,7 +128,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { previousNotification.category, notificationManager.NbNotifications(), mode, - alertNotificationService); + alertNotificationService, + motorController); } return true; case Pinetime::Applications::TouchEvents::SwipeUp: { @@ -150,7 +154,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { nextNotification.category, notificationManager.NbNotifications(), mode, - alertNotificationService); + alertNotificationService, + motorController); } return true; default: @@ -171,8 +176,9 @@ Notifications::NotificationItem::NotificationItem(const char* title, Controllers::NotificationManager::Categories category, uint8_t notifNb, Modes mode, - Pinetime::Controllers::AlertNotificationService& alertNotificationService) - : mode {mode}, alertNotificationService {alertNotificationService} { + Pinetime::Controllers::AlertNotificationService& alertNotificationService, + Pinetime::Controllers::MotorController& motorController) + : mode {mode}, alertNotificationService {alertNotificationService}, motorController {motorController} { lv_obj_t* container1 = lv_cont_create(lv_scr_act(), NULL); lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222)); @@ -269,7 +275,7 @@ void Notifications::NotificationItem::OnCallButtonEvent(lv_obj_t* obj, lv_event_ return; } - Controllers::MotorController::StopRinging(); + motorController.StopRinging(); if (obj == bt_accept) { alertNotificationService.AcceptIncomingCall(); diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h index 2f444c7c..f49d3b3a 100644 --- a/src/displayapp/screens/Notifications.h +++ b/src/displayapp/screens/Notifications.h @@ -39,7 +39,8 @@ namespace Pinetime { Controllers::NotificationManager::Categories, uint8_t notifNb, Modes mode, - Pinetime::Controllers::AlertNotificationService& alertNotificationService); + Pinetime::Controllers::AlertNotificationService& alertNotificationService, + Pinetime::Controllers::MotorController& motorController); ~NotificationItem(); bool IsRunning() const { return running; @@ -56,6 +57,7 @@ namespace Pinetime { lv_obj_t* label_reject; Modes mode; Pinetime::Controllers::AlertNotificationService& alertNotificationService; + Pinetime::Controllers::MotorController& motorController; bool running = true; }; @@ -66,6 +68,7 @@ namespace Pinetime { }; Pinetime::Controllers::NotificationManager& notificationManager; Pinetime::Controllers::AlertNotificationService& alertNotificationService; + Pinetime::Controllers::MotorController& motorController; System::SystemTask& systemTask; Modes mode = Modes::Normal; std::unique_ptr currentItem; -- cgit v1.2.3-70-g09d2 From a2a70f8eda56b4cf859f456b2f842e4833cd3dbf Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Sat, 29 Jan 2022 23:45:22 +0100 Subject: MotorController: no need to make this function a class function The `StopRinging()` function was used just in `Notifications.h` screen. That screen already has access to a `motorController` object. --- src/components/motor/MotorController.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/motor/MotorController.h b/src/components/motor/MotorController.h index c9326d57..b5a592b1 100644 --- a/src/components/motor/MotorController.h +++ b/src/components/motor/MotorController.h @@ -12,7 +12,7 @@ namespace Pinetime { void Init(); void RunForDuration(uint8_t motorDuration); void StartRinging(); - static void StopRinging(); + void StopRinging(); private: static void Ring(void* p_context); -- cgit v1.2.3-70-g09d2 From 4aaa3a3b49b3b70509345f83ebe1c4f4bacd524d Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Tue, 15 Feb 2022 23:56:42 +0100 Subject: SettingShakeThreshold: add missing SystemTask.h, relative include SettingShakeThreshold.h uses SystemTask, but doesn't include the header. Fixing that for the simulator. For consistency make the header include a relative to src include. --- src/displayapp/screens/settings/SettingShakeThreshold.cpp | 2 +- src/displayapp/screens/settings/SettingShakeThreshold.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.cpp b/src/displayapp/screens/settings/SettingShakeThreshold.cpp index 1791b550..9d40fcf9 100644 --- a/src/displayapp/screens/settings/SettingShakeThreshold.cpp +++ b/src/displayapp/screens/settings/SettingShakeThreshold.cpp @@ -1,4 +1,4 @@ -#include "SettingShakeThreshold.h" +#include "displayapp/screens/settings/SettingShakeThreshold.h" #include #include "displayapp/DisplayApp.h" #include "displayapp/screens/Screen.h" diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.h b/src/displayapp/screens/settings/SettingShakeThreshold.h index b9ddd8b4..37f4a65e 100644 --- a/src/displayapp/screens/settings/SettingShakeThreshold.h +++ b/src/displayapp/screens/settings/SettingShakeThreshold.h @@ -5,6 +5,7 @@ #include "components/settings/Settings.h" #include "displayapp/screens/Screen.h" #include +#include "systemtask/SystemTask.h" namespace Pinetime { namespace Applications { -- cgit v1.2.3-70-g09d2 From b857fdb9f438cd9a3440c82face944323301cfad Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Tue, 15 Feb 2022 23:59:38 +0100 Subject: SystemTask: forward declare BatteryController to fix of cyclic dependency SystemTask.h included BatteryController.h, and BatteryController.h included SystemTask.h. If unlucky the class SystemTask isn't created yet when BatteryController wants to use it. Fix that cyclic dependency by forward declaring the BatteryController class and including it in the SystemTask.cpp file, where it is needed. --- src/systemtask/SystemTask.cpp | 1 + src/systemtask/SystemTask.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 6460cd4b..8d9cb1d1 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -4,6 +4,7 @@ #include #include "BootloaderVersion.h" +#include "components/battery/BatteryController.h" #include "components/ble/BleController.h" #include "drivers/Cst816s.h" #include "drivers/St7789.h" diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index abeffd2f..517ed1ae 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -13,7 +13,6 @@ #include #include "systemtask/SystemMonitor.h" -#include "components/battery/BatteryController.h" #include "components/ble/NimbleController.h" #include "components/ble/NotificationManager.h" #include "components/motor/MotorController.h" @@ -47,6 +46,7 @@ namespace Pinetime { class Hrs3300; } namespace Controllers { + class Battery; class TouchHandler; class ButtonHandler; } -- cgit v1.2.3-70-g09d2 From f829427c4186ec003d51c689c6831d076f3b0b69 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Wed, 16 Feb 2022 22:33:59 +0100 Subject: Remove unused and not compiling DropDownDemo For ease of use the simulator uses a globbing expression to get all screens source files. This one was picked up as well and lead to a compilation error. --- src/CMakeLists.txt | 1 - src/displayapp/screens/DropDownDemo.cpp | 57 --------------------------------- src/displayapp/screens/DropDownDemo.h | 27 ---------------- 3 files changed, 85 deletions(-) delete mode 100644 src/displayapp/screens/DropDownDemo.cpp delete mode 100644 src/displayapp/screens/DropDownDemo.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aec6ce04..39d80b05 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -626,7 +626,6 @@ set(INCLUDE_FILES displayapp/screens/InfiniPaint.h displayapp/screens/StopWatch.h displayapp/screens/Paddle.h - displayapp/screens/DropDownDemo.h displayapp/screens/BatteryIcon.h displayapp/screens/BleIcon.h displayapp/screens/NotificationIcon.h diff --git a/src/displayapp/screens/DropDownDemo.cpp b/src/displayapp/screens/DropDownDemo.cpp deleted file mode 100644 index cf239a2f..00000000 --- a/src/displayapp/screens/DropDownDemo.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "displayapp/screens/DropDownDemo.h" -#include -#include -#include "displayapp/DisplayApp.h" - -using namespace Pinetime::Applications::Screens; - -DropDownDemo::DropDownDemo(Pinetime::Applications::DisplayApp* app) : Screen(app) { - // Create the dropdown object, with many item, and fix its height - ddlist = lv_ddlist_create(lv_scr_act(), nullptr); - lv_ddlist_set_options(ddlist, - "Apple\n" - "Banana\n" - "Orange\n" - "Melon\n" - "Grape\n" - "Raspberry\n" - "A\n" - "B\n" - "C\n" - "D\n" - "E"); - lv_ddlist_set_fix_width(ddlist, 150); - lv_ddlist_set_draw_arrow(ddlist, true); - lv_ddlist_set_fix_height(ddlist, 150); - lv_obj_align(ddlist, nullptr, LV_ALIGN_IN_TOP_MID, 0, 20); -} - -DropDownDemo::~DropDownDemo() { - // Reset the touchmode - app->SetTouchMode(DisplayApp::TouchModes::Gestures); - lv_obj_clean(lv_scr_act()); -} - -bool DropDownDemo::Refresh() { - auto* list = static_cast(ddlist->ext_attr); - - // Switch touchmode to Polling if the dropdown is opened. This will allow to scroll inside the - // dropdown while it is opened. - // Disable the polling mode when the dropdown is closed to be able to handle the gestures. - if (list->opened) - app->SetTouchMode(DisplayApp::TouchModes::Polling); - else - app->SetTouchMode(DisplayApp::TouchModes::Gestures); - return running; -} - -bool DropDownDemo::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - // If the dropdown is opened, notify Display app that it doesn't need to handle the event - // (this will prevent displayApp from going back to the menu or clock scree). - auto* list = static_cast(ddlist->ext_attr); - if (list->opened) { - return true; - } else { - return false; - } -} diff --git a/src/displayapp/screens/DropDownDemo.h b/src/displayapp/screens/DropDownDemo.h deleted file mode 100644 index bcf0f45c..00000000 --- a/src/displayapp/screens/DropDownDemo.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include -#include "displayapp/screens/Screen.h" -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class DropDownDemo : public Screen { - public: - DropDownDemo(DisplayApp* app); - ~DropDownDemo() override; - - bool Refresh() override; - - bool OnTouchEvent(TouchEvents event) override; - - private: - lv_obj_t* ddlist; - - bool isDropDownOpened = false; - }; - } - } -} -- cgit v1.2.3-70-g09d2 From 407908686ac252615f35e5175fcb0c2fd19cce69 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Sun, 30 Jan 2022 14:31:13 +0100 Subject: Provide reference to BrightnessController in DisplayApp For the simulator I need a way to get to the brightnessController object and handle the set brightness-levels accoringly. This is done by the constructor expecting a brightnessController object instead of initializing one itself --- src/displayapp/DisplayApp.cpp | 2 ++ src/displayapp/DisplayApp.h | 3 ++- src/displayapp/DisplayAppRecovery.cpp | 1 + src/displayapp/DisplayAppRecovery.h | 2 ++ src/main.cpp | 3 +++ 5 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 495969b3..fdd1682b 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -97,6 +97,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, Pinetime::Controllers::MotionController& motionController, Pinetime::Controllers::TimerController& timerController, Pinetime::Controllers::AlarmController& alarmController, + Pinetime::Controllers::BrightnessController& brightnessController, Pinetime::Controllers::TouchHandler& touchHandler) : lcd {lcd}, lvgl {lvgl}, @@ -112,6 +113,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, motionController {motionController}, timerController {timerController}, alarmController {alarmController}, + brightnessController {brightnessController}, touchHandler {touchHandler} { } diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index 39fe6314..1eaefaa1 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -61,6 +61,7 @@ namespace Pinetime { Pinetime::Controllers::MotionController& motionController, Pinetime::Controllers::TimerController& timerController, Pinetime::Controllers::AlarmController& alarmController, + Pinetime::Controllers::BrightnessController& brightnessController, Pinetime::Controllers::TouchHandler& touchHandler); void Start(System::BootErrors error); void PushMessage(Display::Messages msg); @@ -87,10 +88,10 @@ namespace Pinetime { Pinetime::Controllers::MotionController& motionController; Pinetime::Controllers::TimerController& timerController; Pinetime::Controllers::AlarmController& alarmController; + Pinetime::Controllers::BrightnessController &brightnessController; Pinetime::Controllers::TouchHandler& touchHandler; Pinetime::Controllers::FirmwareValidator validator; - Controllers::BrightnessController brightnessController; TaskHandle_t taskHandle; diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp index fd7017a4..9d6eb22f 100644 --- a/src/displayapp/DisplayAppRecovery.cpp +++ b/src/displayapp/DisplayAppRecovery.cpp @@ -23,6 +23,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, Pinetime::Controllers::MotionController& motionController, Pinetime::Controllers::TimerController& timerController, Pinetime::Controllers::AlarmController& alarmController, + Pinetime::Controllers::BrightnessController& brightnessController, Pinetime::Controllers::TouchHandler& touchHandler) : lcd {lcd}, bleController {bleController} { diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h index 86e956d1..61f1c9bf 100644 --- a/src/displayapp/DisplayAppRecovery.h +++ b/src/displayapp/DisplayAppRecovery.h @@ -34,6 +34,7 @@ namespace Pinetime { class MotorController; class TimerController; class AlarmController; + class BrightnessController; } namespace System { @@ -57,6 +58,7 @@ namespace Pinetime { Pinetime::Controllers::MotionController& motionController, Pinetime::Controllers::TimerController& timerController, Pinetime::Controllers::AlarmController& alarmController, + Pinetime::Controllers::BrightnessController& brightnessController, Pinetime::Controllers::TouchHandler& touchHandler); void Start(); void Start(Pinetime::System::BootErrors){ Start(); }; diff --git a/src/main.cpp b/src/main.cpp index 81d297f5..fa492d08 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,6 +33,7 @@ #include "components/battery/BatteryController.h" #include "components/ble/BleController.h" #include "components/ble/NotificationManager.h" +#include "components/brightness/BrightnessController.h" #include "components/motor/MotorController.h" #include "components/datetime/DateTimeController.h" #include "components/heartrate/HeartRateController.h" @@ -114,6 +115,7 @@ Pinetime::Controllers::TimerController timerController; Pinetime::Controllers::AlarmController alarmController {dateTimeController}; Pinetime::Controllers::TouchHandler touchHandler(touchPanel, lvgl); Pinetime::Controllers::ButtonHandler buttonHandler; +Pinetime::Controllers::BrightnessController brightnessController {}; Pinetime::Applications::DisplayApp displayApp(lcd, lvgl, @@ -129,6 +131,7 @@ Pinetime::Applications::DisplayApp displayApp(lcd, motionController, timerController, alarmController, + brightnessController, touchHandler); Pinetime::System::SystemTask systemTask(spi, -- cgit v1.2.3-70-g09d2 From 69e4ab6be101e7993035b56db75f5c32eda713ac Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 20 Feb 2022 13:20:43 +0100 Subject: Manual squash merge of PR #932 (https://github.com/InfiniTimeOrg/InfiniTime/pull/932) from 13werwolf13 (https://github.com/13werwolf13). This PR adds a new Terminal watchface to InfiniTime! MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Squashed commit of the following: commit 23ea840b059c69667c8711265cecaf992791acb6 Author: Jean-François Milants Date: Sun Feb 20 13:14:27 2022 +0100 Terminal watch face : fix includes and a few code cleaning. commit 3c244def25e3ad8e1f56d708fb0864c122059948 Merge: 40790868 138a6552 Author: Jean-François Milants Date: Sun Feb 20 12:45:54 2022 +0100 Merge branch 'develop' of https://github.com/13werwolf13/InfiniTime into 13werwolf13-develop commit 138a65528a86799fd5c37f065023a92f222fe044 Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:13:00 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.h Co-authored-by: NeroBurner commit 35156166b2f7589bf005ec7c7192a4226578f6d9 Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:12:43 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit 757ca2dd438f1f314267a8b81a6034c576f1d6be Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:12:30 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit 60b6b4e5824d04faa3efa45173358d04fa68a368 Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:12:20 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit 6959d8c043013550a7a3e4e6588b234d3bb942b5 Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:11:46 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit 4d850281bedf342d0856da5eafc22e46d0767c56 Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:11:17 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit af483bee33c225fcb03432db1eb14c0453df0ae7 Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:10:57 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit 6bc6c1a637be4e514ecd0097d1dc9e4aacdba1db Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:10:40 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.h Co-authored-by: NeroBurner commit 25fdafc6aba0d9e0173103501de3802af261e2ae Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:06:10 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit 12e1b0f8c0202a7f62e3e1c297af850ce3526d13 Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:05:44 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit e6c0f32056e9fea878d270d761607ac5ddc263b0 Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:05:22 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.h Co-authored-by: NeroBurner commit 342ce8cd114f4af265078bc0cfa6b2d8831706d7 Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:05:06 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit 265fec5eeca27fcc1152a18e4af0273bcf119c46 Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:04:06 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit b4669be38be0df2b6a3505d5f7a770c71636be60 Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:03:29 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit 471a84390957ded2ac23ebfe1cb99408e3783b0f Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:03:10 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit 6853166cf546a4ce561195eba01f1b1fd6d56420 Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Wed Feb 2 09:02:51 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit bba34f69bfdd6b44f142c93644f71c9eda007290 Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Sat Jan 22 12:32:41 2022 +0500 some fixes commit 74eea9f5800f273249846e6e1c887d15ba6eb10b Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Sat Jan 22 12:32:17 2022 +0500 some fixes commit 1e4a6763d73c3ba39c680ad25f90813e6a6a36d1 Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Fri Jan 21 08:59:44 2022 +0500 no errors, no warnings, no work.. commit eb8bd4dc4ecbbf61f1e0f725fd2116ee25319fd6 Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Thu Jan 20 23:50:04 2022 +0500 add ble state text output commit fda1c088becb4a7f9ced451a0291694abe2249dc Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Thu Jan 20 22:25:35 2022 +0500 add ble state text output commit 68d3d9b343c0f37830bb640fab10b186faf73067 Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Thu Jan 20 22:22:20 2022 +0500 add ble state text output commit 0ed45a9916787f68c0aa6bab9c97b090f2eebdd5 Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Tue Jan 18 15:48:15 2022 +0500 typo fix commit 477a3a7f27c7486be2c8f985afab1f1739608fed Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Tue Jan 18 10:36:19 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit d6849888ea5cc152f04c5bf6fe2631e66296c357 Author: Марков Дмитрий <13werwolf13@mail.ru> Date: Tue Jan 18 10:36:09 2022 +0500 Update src/displayapp/screens/WatchFaceTerminal.cpp Co-authored-by: NeroBurner commit e2f7e318298b8a6f4d436cbbb1b92a738dacab7f Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Mon Jan 17 13:34:05 2022 +0500 typo fix commit fc246beb01d3feac4fd0b2fc9c45b38847e1d950 Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Sat Jan 15 15:26:25 2022 +0500 typo fix commit ebbb31abf10ad9f61a8a7ecfdf29c2aaeaf33c19 Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Fri Jan 14 10:08:29 2022 +0500 typo fix commit 3afedcaa28009f59e6960730e9349097ef455ea8 Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Thu Jan 13 12:34:39 2022 +0500 time format commit 471a4c942f7e3cfd5c52bd61152ede770da5e026 Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Thu Jan 13 12:27:10 2022 +0500 time format commit d3fd348de4b4a89c216a717de84fcc923cc099fe Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Thu Jan 13 12:26:49 2022 +0500 time format commit e540d103e3204649ff585742f8834d16136372d5 Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Thu Jan 13 11:28:31 2022 +0500 add patch commit 728830178f31f71785c49cdc6b83daea4e0a7df6 Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Wed Jan 12 22:08:07 2022 +0500 add menue item commit 4c5847669fa083f15ee3fdb404dadfdaef0f82aa Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Wed Jan 12 21:42:22 2022 +0500 typo fix commit 79273fe24f9162aca5508f07b17896149ad19839 Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Wed Jan 12 20:48:06 2022 +0500 typo fix commit 1808a78ad94d0dfe97b6410a93ba30560de22f4b Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Wed Jan 12 20:17:15 2022 +0500 typo fix commit 6dfa141dca176789da4e978f008eb842d9ec515a Author: Дмитрий Марков Date: Wed Jan 12 20:12:09 2022 +0500 typo fix commit 88f01902325505a9206ced4504aae0762042535d Author: Дмитрий Марков <13werwolf13@mail.ru> Date: Wed Jan 12 14:50:54 2022 +0500 add terminal watchface --- src/CMakeLists.txt | 1 + src/components/heartrate/Ppg.h | 2 + src/displayapp/screens/Clock.cpp | 24 ++- src/displayapp/screens/Clock.h | 1 + src/displayapp/screens/WatchFaceTerminal.cpp | 198 +++++++++++++++++++++ src/displayapp/screens/WatchFaceTerminal.h | 82 +++++++++ .../screens/settings/SettingWatchFace.cpp | 2 +- src/displayapp/screens/settings/SettingWatchFace.h | 2 +- 8 files changed, 303 insertions(+), 9 deletions(-) create mode 100644 src/displayapp/screens/WatchFaceTerminal.cpp create mode 100644 src/displayapp/screens/WatchFaceTerminal.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 39d80b05..5986d95f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -454,6 +454,7 @@ list(APPEND SOURCE_FILES displayapp/icons/bg_clock.c displayapp/screens/WatchFaceAnalog.cpp displayapp/screens/WatchFaceDigital.cpp + displayapp/screens/WatchFaceTerminal.cpp displayapp/screens/PineTimeStyle.cpp ## diff --git a/src/components/heartrate/Ppg.h b/src/components/heartrate/Ppg.h index ed79b082..7000c871 100644 --- a/src/components/heartrate/Ppg.h +++ b/src/components/heartrate/Ppg.h @@ -1,6 +1,8 @@ #pragma once #include +#include +#include #include "components/heartrate/Biquad.h" #include "components/heartrate/Ptagc.h" diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index 1415e8ec..fd74683a 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -9,6 +9,7 @@ #include "components/settings/Settings.h" #include "displayapp/DisplayApp.h" #include "displayapp/screens/WatchFaceDigital.h" +#include "displayapp/screens/WatchFaceTerminal.h" #include "displayapp/screens/WatchFaceAnalog.h" #include "displayapp/screens/PineTimeStyle.h" @@ -41,6 +42,9 @@ Clock::Clock(DisplayApp* app, case 2: return PineTimeStyleScreen(); break; + case 3: + return WatchFaceTerminalScreen(); + break; } return WatchFaceDigitalScreen(); }()} { @@ -76,11 +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); } diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h index fcecc6b3..50996a73 100644 --- a/src/displayapp/screens/Clock.h +++ b/src/displayapp/screens/Clock.h @@ -47,6 +47,7 @@ namespace Pinetime { std::unique_ptr WatchFaceDigitalScreen(); std::unique_ptr WatchFaceAnalogScreen(); std::unique_ptr PineTimeStyleScreen(); + std::unique_ptr WatchFaceTerminalScreen(); }; } } diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp new file mode 100644 index 00000000..033aad88 --- /dev/null +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -0,0 +1,198 @@ +#include +#include +#include "displayapp/screens/WatchFaceTerminal.h" +#include "displayapp/screens/BatteryIcon.h" +#include "displayapp/screens/NotificationIcon.h" +#include "displayapp/screens/Symbols.h" +#include "components/battery/BatteryController.h" +#include "components/ble/BleController.h" +#include "components/ble/NotificationManager.h" +#include "components/heartrate/HeartRateController.h" +#include "components/motion/MotionController.h" +#include "components/settings/Settings.h" + +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) + : Screen(app), + currentDateTime {{}}, + dateTimeController {dateTimeController}, + batteryController {batteryController}, + bleController {bleController}, + notificatioManager {notificatioManager}, + settingsController {settingsController}, + heartRateController {heartRateController}, + motionController {motionController} { + settingsController.SetClockFace(3); + + batteryIcon = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text(batteryIcon, Symbols::batteryFull); + lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, 2); + + batteryPlug = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text(batteryPlug, Symbols::plug); + lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); + + batteryValue = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_recolor(batteryValue, true); + lv_obj_align(batteryValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -20); + + connectState = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_recolor(connectState, true); + lv_label_set_text(connectState, "[STAT]#387b54 Disconnected#"); + lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40); + + notificationIcon = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); + lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 10, 0); + + label_date = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_recolor(label_date, true); + lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -40); + + label_prompt_1 = lv_label_create(lv_scr_act(), nullptr); + lv_obj_align(label_prompt_1, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -80); + lv_label_set_text(label_prompt_1, "user@watch:~ $ now"); + + label_prompt_2 = lv_label_create(lv_scr_act(), nullptr); + lv_obj_align(label_prompt_2, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60); + lv_label_set_text(label_prompt_2, "user@watch:~ $"); + + label_time = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_recolor(label_time, true); + lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -60); + + backgroundLabel = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_click(backgroundLabel, true); + lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); + lv_obj_set_size(backgroundLabel, 240, 240); + lv_obj_set_pos(backgroundLabel, 0, 0); + lv_label_set_text(backgroundLabel, ""); + + heartbeatValue = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_recolor(heartbeatValue, true); + lv_label_set_text(heartbeatValue, "[L_HR]#ee3311 0 bpm#"); + lv_obj_align(heartbeatValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 20); + + stepValue = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_recolor(stepValue, true); + lv_label_set_text(stepValue, "[STEP]#ee3377 0 steps#"); + lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0); + + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); + Refresh(); +} + +WatchFaceTerminal::~WatchFaceTerminal() { + lv_task_del(taskRefresh); + lv_obj_clean(lv_scr_act()); +} + +void WatchFaceTerminal::Refresh() { + powerPresent = batteryController.IsPowerPresent(); + if (powerPresent.IsUpdated()) { + lv_label_set_text_static(batteryPlug, BatteryIcon::GetPlugIcon(powerPresent.Get())); + } + + batteryPercentRemaining = batteryController.PercentRemaining(); + if (batteryPercentRemaining.IsUpdated()) { + auto batteryPercent = batteryPercentRemaining.Get(); + if (batteryPercent == 100) { + lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); + } else { + lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + } + lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); + lv_label_set_text_fmt(batteryValue, "[BATT]#387b54 %d%\%#", batteryPercent); + } + + bleState = bleController.IsConnected(); + if (bleState.IsUpdated()) { + if (bleState.Get()) { + lv_label_set_text_static(connectState, "[STAT]#387b54 Connected#"); + } else { + lv_label_set_text_static(connectState, "[STAT]#387b54 Disconnected#"); + } + } + + notificationState = notificatioManager.AreNewNotificationsAvailable(); + if (notificationState.IsUpdated()) { + if (notificationState.Get()) { + lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true)); + } else { + lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); + } + } + + currentDateTime = dateTimeController.CurrentDateTime(); + + if (currentDateTime.IsUpdated()) { + auto newDateTime = currentDateTime.Get(); + + auto dp = date::floor(newDateTime); + auto time = date::make_time(newDateTime - dp); + auto yearMonthDay = date::year_month_day(dp); + + auto year = static_cast(yearMonthDay.year()); + auto month = static_cast(static_cast(yearMonthDay.month())); + auto day = static_cast(yearMonthDay.day()); + auto dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); + + uint8_t hour = time.hours().count(); + uint8_t minute = time.minutes().count(); + uint8_t second = time.seconds().count(); + + if (displayedHour != hour || displayedMinute != minute || displayedSecond != second) { + displayedHour = hour; + displayedMinute = minute; + displayedSecond = second; + + if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { + char ampmChar[3] = "AM"; + if (hour == 0) { + hour = 12; + } else if (hour == 12) { + ampmChar[0] = 'P'; + } else if (hour > 12) { + hour = hour - 12; + ampmChar[0] = 'P'; + } + lv_label_set_text_fmt(label_time, "[TIME]#11cc55 %02d:%02d:%02d %s#", hour, minute, second, ampmChar); + } else { + lv_label_set_text_fmt(label_time, "[TIME]#11cc55 %02d:%02d:%02d", hour, minute, second); + } + } + + if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) { + lv_label_set_text_fmt(label_date, "[DATE]#007fff %04d.%02d.%02d#", short(year), char(month), char(day)); + + currentYear = year; + currentMonth = month; + currentDayOfWeek = dayOfWeek; + currentDay = day; + } + } + + heartbeat = heartRateController.HeartRate(); + heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped; + if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) { + if (heartbeatRunning.Get()) { + lv_label_set_text_fmt(heartbeatValue, "[L_HR]#ee3311 %d bpm#", heartbeat.Get()); + } else { + lv_label_set_text_static(heartbeatValue, "[L_HR]#ee3311 ---#"); + } + } + + stepCount = motionController.NbSteps(); + motionSensorOk = motionController.IsSensorOk(); + if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) { + lv_label_set_text_fmt(stepValue, "[STEP]#ee3377 %lu steps#", stepCount.Get()); + } +} diff --git a/src/displayapp/screens/WatchFaceTerminal.h b/src/displayapp/screens/WatchFaceTerminal.h new file mode 100644 index 00000000..c3df82b4 --- /dev/null +++ b/src/displayapp/screens/WatchFaceTerminal.h @@ -0,0 +1,82 @@ +#pragma once + +#include +#include +#include +#include +#include "displayapp/screens/Screen.h" +#include "components/datetime/DateTimeController.h" + +namespace Pinetime { + namespace Controllers { + class Settings; + class Battery; + class Ble; + class NotificationManager; + class HeartRateController; + class MotionController; + } + + namespace Applications { + namespace Screens { + + 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); + ~WatchFaceTerminal() override; + + void Refresh() override; + + private: + uint8_t displayedHour = -1; + uint8_t displayedMinute = -1; + uint8_t displayedSecond = -1; + + 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 powerPresent {}; + 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* batteryPlug; + lv_obj_t* batteryValue; + lv_obj_t* heartbeatValue; + lv_obj_t* stepValue; + lv_obj_t* notificationIcon; + lv_obj_t* connectState; + + 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; + }; + } + } +} diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp index a24eaa15..50085925 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.cpp +++ b/src/displayapp/screens/settings/SettingWatchFace.cpp @@ -14,7 +14,7 @@ namespace { } } -constexpr std::array SettingWatchFace::options; +constexpr std::array SettingWatchFace::options; SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) : Screen(app), settingsController {settingsController} { diff --git a/src/displayapp/screens/settings/SettingWatchFace.h b/src/displayapp/screens/settings/SettingWatchFace.h index ccba7d13..62427b4f 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.h +++ b/src/displayapp/screens/settings/SettingWatchFace.h @@ -20,7 +20,7 @@ namespace Pinetime { void UpdateSelected(lv_obj_t* object, lv_event_t event); private: - static constexpr std::array options = {" Digital face", " Analog face", " PineTimeStyle"}; + static constexpr std::array options = {" Digital face", " Analog face", " PineTimeStyle", " Terminal"}; Controllers::Settings& settingsController; lv_obj_t* cbOption[options.size()]; -- cgit v1.2.3-70-g09d2 From ef44b763d94cc6ff1be6f75ff3e638d7d356e99e Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 20 Feb 2022 15:40:49 +0100 Subject: Merge branch 'airplane-mode' of https://github.com/evergreen22/InfiniTime into evergreen22-airplane-mode Apply a few changes that were requested in the PR during the review. # Conflicts: # src/CMakeLists.txt # src/displayapp/Apps.h # src/displayapp/DisplayApp.cpp # src/displayapp/Messages.h # src/displayapp/screens/settings/Settings.cpp --- src/components/ble/BleController.cpp | 24 +++++-- src/components/ble/BleController.h | 16 +++-- src/components/ble/NimbleController.cpp | 35 +++++----- src/components/ble/NimbleController.h | 15 +---- src/components/settings/Settings.h | 10 +-- src/displayapp/DisplayApp.cpp | 4 +- src/displayapp/Messages.h | 2 +- src/displayapp/screens/BleIcon.cpp | 15 +++-- src/displayapp/screens/BleIcon.h | 2 +- src/displayapp/screens/PineTimeStyle.cpp | 20 ++++-- src/displayapp/screens/PineTimeStyle.h | 3 +- src/displayapp/screens/WatchFaceDigital.cpp | 7 +- src/displayapp/screens/WatchFaceDigital.h | 3 +- src/displayapp/screens/WatchFaceTerminal.cpp | 13 ++-- src/displayapp/screens/WatchFaceTerminal.h | 1 + .../screens/settings/SettingAirplaneMode.cpp | 74 ++++++++++++---------- .../screens/settings/SettingAirplaneMode.h | 7 +- src/displayapp/screens/settings/Settings.cpp | 37 +++++++---- src/displayapp/screens/settings/Settings.h | 3 +- src/systemtask/Messages.h | 2 +- src/systemtask/SystemTask.cpp | 10 ++- 21 files changed, 179 insertions(+), 124 deletions(-) (limited to 'src') diff --git a/src/components/ble/BleController.cpp b/src/components/ble/BleController.cpp index 0e1c5d7e..b6b7383a 100644 --- a/src/components/ble/BleController.cpp +++ b/src/components/ble/BleController.cpp @@ -2,12 +2,28 @@ using namespace Pinetime::Controllers; -void Ble::SetConnectState(Ble::ConnectStates newState) { - connectionState = newState; +bool Ble::IsConnected() const { + return isConnected; } -Ble::ConnectStates Ble::GetConnectState() const { - return connectionState; +void Ble::Connect() { + isConnected = true; +} + +void Ble::Disconnect() { + isConnected = false; +} + +bool Ble::IsRadioEnabled() const { + return isRadioEnabled; +} + +void Ble::EnableRadio() { + isRadioEnabled = true; +} + +void Ble::DisableRadio() { + isRadioEnabled = false; } void Ble::StartFirmwareUpdate() { diff --git a/src/components/ble/BleController.h b/src/components/ble/BleController.h index 2714c0c3..675ede2d 100644 --- a/src/components/ble/BleController.h +++ b/src/components/ble/BleController.h @@ -10,14 +10,15 @@ namespace Pinetime { using BleAddress = std::array; enum class FirmwareUpdateStates { Idle, Running, Validated, Error }; enum class AddressTypes { Public, Random, RPA_Public, RPA_Random }; - enum class ConnectStates { Disconnected, Connected, Airplane }; Ble() = default; - bool IsConnected() const { - return (connectionState == ConnectStates::Connected); - } - void SetConnectState(ConnectStates newState); - ConnectStates GetConnectState() const; + bool IsConnected() const; + void Connect(); + void Disconnect(); + + bool IsRadioEnabled() const; + void EnableRadio(); + void DisableRadio(); void StartFirmwareUpdate(); void StopFirmwareUpdate(); @@ -57,7 +58,8 @@ namespace Pinetime { } private: - ConnectStates connectionState = ConnectStates::Disconnected; + bool isConnected = false; + bool isRadioEnabled = true; bool isFirmwareUpdating = false; uint32_t firmwareUpdateTotalBytes = 0; uint32_t firmwareUpdateCurrentBytes = 0; diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index 94d2d155..f6ab6269 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -184,7 +184,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { case BLE_GAP_EVENT_ADV_COMPLETE: NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_ADV_COMPLETE"); NRF_LOG_INFO("reason=%d; status=%0X", event->adv_complete.reason, event->connect.status); - if (bleController.GetConnectState() == Ble::ConnectStates::Disconnected) { + if (bleController.IsRadioEnabled() && !bleController.IsConnected()) { StartAdvertising(); } break; @@ -199,12 +199,12 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { currentTimeClient.Reset(); alertNotificationClient.Reset(); connectionHandle = BLE_HS_CONN_HANDLE_NONE; - bleController.SetConnectState(Ble::ConnectStates::Disconnected); + bleController.Disconnect(); fastAdvCount = 0; StartAdvertising(); } else { connectionHandle = event->connect.conn_handle; - bleController.SetConnectState(Ble::ConnectStates::Connected); + bleController.Connect(); systemTask.PushMessage(Pinetime::System::Messages::BleConnected); // Service discovery is deferred via systemtask } @@ -222,8 +222,8 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { currentTimeClient.Reset(); alertNotificationClient.Reset(); connectionHandle = BLE_HS_CONN_HANDLE_NONE; - if (bleController.GetConnectState() == Ble::ConnectStates::Connected) { - bleController.SetConnectState(Ble::ConnectStates::Disconnected); + if(bleController.IsConnected()) { + bleController.Disconnect(); fastAdvCount = 0; StartAdvertising(); } @@ -401,19 +401,20 @@ void NimbleController::NotifyBatteryLevel(uint8_t level) { } } -void NimbleController::SwitchAirplaneMode(bool enabled) { - if (enabled) { - if (bleController.IsConnected()) { - bleController.SetConnectState(Ble::ConnectStates::Airplane); - ble_gap_terminate(connectionHandle, BLE_ERR_REM_USER_CONN_TERM); - } else { - bleController.SetConnectState(Ble::ConnectStates::Airplane); - ble_gap_adv_stop(); - } +void NimbleController::EnableRadio() { + bleController.EnableRadio(); + bleController.Disconnect(); + fastAdvCount = 0; + StartAdvertising(); +} + +void NimbleController::DisableRadio() { + bleController.DisableRadio(); + if (bleController.IsConnected()) { + ble_gap_terminate(connectionHandle, BLE_ERR_REM_USER_CONN_TERM); + bleController.Disconnect(); } else { - bleController.SetConnectState(Ble::ConnectStates::Disconnected); - fastAdvCount = 0; - StartAdvertising(); + ble_gap_adv_stop(); } } diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h index 7219ba6b..ad194212 100644 --- a/src/components/ble/NimbleController.h +++ b/src/components/ble/NimbleController.h @@ -53,18 +53,6 @@ namespace Pinetime { void Init(); void StartAdvertising(); int OnGAPEvent(ble_gap_event* event); - - /* these are not implemented yet - int OnDiscoveryEvent(uint16_t i, const ble_gatt_error* pError, const ble_gatt_svc* pSvc); - int OnCTSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_chr* characteristic); - int OnANSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_chr* characteristic); - int OnCurrentTimeReadResult(uint16_t connectionHandle, const ble_gatt_error* error, ble_gatt_attr* attribute); - int OnANSDescriptorDiscoveryEventCallback(uint16_t connectionHandle, - const ble_gatt_error* error, - uint16_t characteristicValueHandle, - const ble_gatt_dsc* descriptor); - */ - void StartDiscovery(); Pinetime::Controllers::MusicService& music() { @@ -87,7 +75,8 @@ namespace Pinetime { fastAdvCount = 0; }; - void SwitchAirplaneMode(bool enabled); + void EnableRadio(); + void DisableRadio(); private: void PersistBond(struct ble_gap_conn_desc& desc); diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 9878aac5..24a82607 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -202,12 +202,12 @@ namespace Pinetime { return settings.stepsGoal; }; - void SetAirplaneMode(bool mode) { - airplaneMode = mode; + void SetBleRadioEnabled(bool enabled) { + bleRadioEnabled = enabled; }; - bool GetAirplaneMode() const { - return airplaneMode; + bool GetBleRadioEnabled() const { + return bleRadioEnabled; }; private: @@ -240,7 +240,7 @@ namespace Pinetime { /* airplaneMode is intentionally not saved with the other watch settings and initialized * to off (false) on every boot because we always want ble to be enabled on startup */ - bool airplaneMode = false; + bool bleRadioEnabled = true; void LoadSettingsFromFile(); void SaveSettingsToFile(); diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 25ae9ad6..fdc6376c 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -293,8 +293,8 @@ void DisplayApp::Refresh() { case Messages::BleFirmwareUpdateStarted: LoadApp(Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down); break; - case Messages::AirplaneModeToggle: - PushMessageToSystemTask(System::Messages::AirplaneModeToggle); + case Messages::BleRadioEnableToggle: + PushMessageToSystemTask(System::Messages::BleRadioEnableToggle); break; case Messages::UpdateDateTime: // Added to remove warning diff --git a/src/displayapp/Messages.h b/src/displayapp/Messages.h index 62256b9e..58df4556 100644 --- a/src/displayapp/Messages.h +++ b/src/displayapp/Messages.h @@ -22,7 +22,7 @@ namespace Pinetime { ShowPairingKey, AlarmTriggered, Clock, - AirplaneModeToggle + BleRadioEnableToggle }; } } diff --git a/src/displayapp/screens/BleIcon.cpp b/src/displayapp/screens/BleIcon.cpp index a30d23bd..019f8039 100644 --- a/src/displayapp/screens/BleIcon.cpp +++ b/src/displayapp/screens/BleIcon.cpp @@ -2,11 +2,14 @@ #include "displayapp/screens/Symbols.h" using namespace Pinetime::Applications::Screens; -const char* BleIcon::GetIcon(Pinetime::Controllers::Ble::ConnectStates state) { - if (state == Pinetime::Controllers::Ble::ConnectStates::Connected) - return Symbols::bluetooth; - else if (state == Pinetime::Controllers::Ble::ConnectStates::Airplane) +const char* BleIcon::GetIcon(bool isRadioEnabled, bool isConnected) { + if(!isRadioEnabled) { return Symbols::airplane; - else - return Symbols::none; + } + + if (isConnected) { + return Symbols::bluetooth; + } + + return Symbols::none; } diff --git a/src/displayapp/screens/BleIcon.h b/src/displayapp/screens/BleIcon.h index d7410eae..d32dfad7 100644 --- a/src/displayapp/screens/BleIcon.h +++ b/src/displayapp/screens/BleIcon.h @@ -7,7 +7,7 @@ namespace Pinetime { namespace Screens { class BleIcon { public: - static const char* GetIcon(Pinetime::Controllers::Ble::ConnectStates state); + static const char* GetIcon(bool isRadioEnabled, bool isConnected); }; } } diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index f1f7f922..44bf47a4 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -42,6 +42,13 @@ namespace { auto* screen = static_cast(obj->user_data); screen->UpdateSelected(obj, event); } + + bool IsBleIconVisible(bool isRadioEnabled, bool isConnected) { + if(!isRadioEnabled) { + return true; + } + return isConnected; + } } PineTimeStyle::PineTimeStyle(DisplayApp* app, @@ -336,11 +343,13 @@ void PineTimeStyle::SetBatteryIcon() { lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); } + void PineTimeStyle::AlignIcons() { - if (notificationState.Get() && bleState.Get() != Pinetime::Controllers::Ble::ConnectStates::Disconnected) { + bool isBleIconVisible = IsBleIconVisible(bleRadioEnabled.Get(), bleState.Get()); + if (notificationState.Get() && isBleIconVisible) { lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 8, 25); lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25); - } else if (notificationState.Get() && bleState.Get() == Pinetime::Controllers::Ble::ConnectStates::Disconnected) { + } else if (notificationState.Get() && !isBleIconVisible) { lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); } else { lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); @@ -363,9 +372,10 @@ void PineTimeStyle::Refresh() { } } - bleState = bleController.GetConnectState(); - if (bleState.IsUpdated()) { - lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get())); + bleState = bleController.IsConnected(); + bleRadioEnabled = bleController.IsRadioEnabled(); + if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) { + lv_label_set_text(bleIcon, BleIcon::GetIcon(bleRadioEnabled.Get(), bleState.Get())); AlignIcons(); } diff --git a/src/displayapp/screens/PineTimeStyle.h b/src/displayapp/screens/PineTimeStyle.h index cb8f6804..5de9a5fa 100644 --- a/src/displayapp/screens/PineTimeStyle.h +++ b/src/displayapp/screens/PineTimeStyle.h @@ -51,7 +51,8 @@ namespace Pinetime { DirtyValue batteryPercentRemaining {}; DirtyValue isCharging {}; - DirtyValue bleState {}; + DirtyValue bleState {}; + DirtyValue bleRadioEnabled {}; DirtyValue> currentDateTime {}; DirtyValue motionSensorOk {}; DirtyValue stepCount {}; diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index fd36aa22..56155d52 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -119,9 +119,10 @@ void WatchFaceDigital::Refresh() { lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); } - bleState = bleController.GetConnectState(); - if (bleState.IsUpdated()) { - lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get())); + bleState = bleController.IsConnected(); + bleRadioEnabled = bleController.IsRadioEnabled(); + if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) { + lv_label_set_text(bleIcon, BleIcon::GetIcon(bleRadioEnabled.Get(), bleState.Get())); } lv_obj_realign(batteryIcon); lv_obj_realign(batteryPlug); diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index 6cf11310..d33434c0 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -46,7 +46,8 @@ namespace Pinetime { DirtyValue batteryPercentRemaining {}; DirtyValue powerPresent {}; - DirtyValue bleState {}; + DirtyValue bleState {}; + DirtyValue bleRadioEnabled {}; DirtyValue> currentDateTime {}; DirtyValue motionSensorOk {}; DirtyValue stepCount {}; diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp index 033aad88..ccfbdd0b 100644 --- a/src/displayapp/screens/WatchFaceTerminal.cpp +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -114,11 +114,16 @@ void WatchFaceTerminal::Refresh() { } bleState = bleController.IsConnected(); - if (bleState.IsUpdated()) { - if (bleState.Get()) { - lv_label_set_text_static(connectState, "[STAT]#387b54 Connected#"); + bleRadioEnabled = bleController.IsRadioEnabled(); + if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) { + if(!bleRadioEnabled.Get()) { + lv_label_set_text_static(connectState, "[STAT]#387b54 Disabled#"); } else { - lv_label_set_text_static(connectState, "[STAT]#387b54 Disconnected#"); + if (bleState.Get()) { + lv_label_set_text_static(connectState, "[STAT]#387b54 Connected#"); + } else { + lv_label_set_text_static(connectState, "[STAT]#387b54 Disconnected#"); + } } } diff --git a/src/displayapp/screens/WatchFaceTerminal.h b/src/displayapp/screens/WatchFaceTerminal.h index c3df82b4..78c7b8aa 100644 --- a/src/displayapp/screens/WatchFaceTerminal.h +++ b/src/displayapp/screens/WatchFaceTerminal.h @@ -47,6 +47,7 @@ namespace Pinetime { DirtyValue batteryPercentRemaining {}; DirtyValue powerPresent {}; DirtyValue bleState {}; + DirtyValue bleRadioEnabled {}; DirtyValue> currentDateTime {}; DirtyValue motionSensorOk {}; DirtyValue stepCount {}; diff --git a/src/displayapp/screens/settings/SettingAirplaneMode.cpp b/src/displayapp/screens/settings/SettingAirplaneMode.cpp index 0a364ded..85172787 100644 --- a/src/displayapp/screens/settings/SettingAirplaneMode.cpp +++ b/src/displayapp/screens/settings/SettingAirplaneMode.cpp @@ -9,13 +9,16 @@ using namespace Pinetime::Applications::Screens; namespace { - static void event_handler(lv_obj_t* obj, lv_event_t event) { - SettingAirplaneMode* screen = static_cast(obj->user_data); - screen->UpdateSelected(obj, event); + static void OnAirplaneModeEnabledEvent(lv_obj_t* obj, lv_event_t event) { + auto* screen = static_cast(obj->user_data); + screen->OnAirplaneModeEnabled(obj, event); } -} -constexpr std::array SettingAirplaneMode::options; + static void OnAirplaneModeDisabledEvent(lv_obj_t* obj, lv_event_t event) { + auto* screen = static_cast(obj->user_data); + screen->OnAirplaneModeDisabled(obj, event); + } +} SettingAirplaneMode::SettingAirplaneMode(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) : Screen(app), settingsController {settingsController} { @@ -43,47 +46,48 @@ SettingAirplaneMode::SettingAirplaneMode(Pinetime::Applications::DisplayApp* app lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); - for (unsigned int i = 0; i < options.size(); i++) { - cbOption[i] = lv_checkbox_create(container1, nullptr); - lv_checkbox_set_text(cbOption[i], options[i]); - cbOption[i]->user_data = this; - lv_obj_set_event_cb(cbOption[i], event_handler); - SetRadioButtonStyle(cbOption[i]); - } + cbEnabled = lv_checkbox_create(container1, nullptr); + lv_checkbox_set_text(cbEnabled, " Enable"); + cbEnabled->user_data = this; + lv_obj_set_event_cb(cbEnabled, OnAirplaneModeEnabledEvent); + SetRadioButtonStyle(cbEnabled); - if (settingsController.GetAirplaneMode() == false) { - lv_checkbox_set_checked(cbOption[0], true); - priorMode = false; - } else { - lv_checkbox_set_checked(cbOption[1], true); + cbDisabled = lv_checkbox_create(container1, nullptr); + lv_checkbox_set_text(cbDisabled, " Disable"); + cbDisabled->user_data = this; + lv_obj_set_event_cb(cbDisabled, OnAirplaneModeDisabledEvent); + SetRadioButtonStyle(cbDisabled); + + if (settingsController.GetBleRadioEnabled()) { + lv_checkbox_set_checked(cbDisabled, true); priorMode = true; + } else { + lv_checkbox_set_checked(cbEnabled, true); + priorMode = false; } } SettingAirplaneMode::~SettingAirplaneMode() { lv_obj_clean(lv_scr_act()); // Do not call SaveSettings - see src/components/settings/Settings.h - if (priorMode != settingsController.GetAirplaneMode()) { - app->PushMessage(Pinetime::Applications::Display::Messages::AirplaneModeToggle); + if (priorMode != settingsController.GetBleRadioEnabled()) { + app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle); } } -void SettingAirplaneMode::UpdateSelected(lv_obj_t* object, lv_event_t event) { +void SettingAirplaneMode::OnAirplaneModeEnabled(lv_obj_t* object, lv_event_t event) { if (event == LV_EVENT_VALUE_CHANGED) { - for (unsigned int i = 0; i < options.size(); i++) { - if (object == cbOption[i]) { - lv_checkbox_set_checked(cbOption[i], true); - - if (i == 0) { - settingsController.SetAirplaneMode(false); - }; - if (i == 1) { - settingsController.SetAirplaneMode(true); - }; - - } else { - lv_checkbox_set_checked(cbOption[i], false); - } - } + lv_checkbox_set_checked(cbEnabled, true); + lv_checkbox_set_checked(cbDisabled, false); + settingsController.SetBleRadioEnabled(false); } } + +void SettingAirplaneMode::OnAirplaneModeDisabled(lv_obj_t* object, lv_event_t event) { + if (event == LV_EVENT_VALUE_CHANGED) { + lv_checkbox_set_checked(cbEnabled, false); + lv_checkbox_set_checked(cbDisabled, true); + settingsController.SetBleRadioEnabled(true); + } +} + diff --git a/src/displayapp/screens/settings/SettingAirplaneMode.h b/src/displayapp/screens/settings/SettingAirplaneMode.h index fcc02228..b3478c64 100644 --- a/src/displayapp/screens/settings/SettingAirplaneMode.h +++ b/src/displayapp/screens/settings/SettingAirplaneMode.h @@ -17,12 +17,13 @@ namespace Pinetime { SettingAirplaneMode(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); ~SettingAirplaneMode() override; - void UpdateSelected(lv_obj_t* object, lv_event_t event); + void OnAirplaneModeEnabled(lv_obj_t* object, lv_event_t event); + void OnAirplaneModeDisabled(lv_obj_t* object, lv_event_t event); private: - static constexpr std::array options = {" No", " Yes"}; Controllers::Settings& settingsController; - lv_obj_t* cbOption[options.size()]; + lv_obj_t* cbEnabled; + lv_obj_t* cbDisabled; bool priorMode; }; } diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index 7bc90b47..981b4973 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -21,7 +21,11 @@ Settings::Settings(Pinetime::Applications::DisplayApp* app, Pinetime::Controller }, [this]() -> std::unique_ptr { return CreateScreen3(); - }}, + }, + [this]() -> std::unique_ptr { + return CreateScreen4(); + }, + }, Screens::ScreenListModes::UpDown} { } @@ -34,7 +38,6 @@ bool Settings::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } std::unique_ptr Settings::CreateScreen1() { - std::array applications {{ {Symbols::sun, "Display", Apps::SettingDisplay}, {Symbols::eye, "Wake Up", Apps::SettingWakeUp}, @@ -42,17 +45,17 @@ std::unique_ptr Settings::CreateScreen1() { {Symbols::home, "Watch face", Apps::SettingWatchFace}, }}; - return std::make_unique(0, 3, app, settingsController, applications); + return std::make_unique(0, 4, app, settingsController, applications); } std::unique_ptr Settings::CreateScreen2() { + std::array applications {{ + {Symbols::shoe, "Steps", Apps::SettingSteps}, + {Symbols::clock, "Set date", Apps::SettingSetDate}, + {Symbols::clock, "Set time", Apps::SettingSetTime}, + {Symbols::batteryHalf, "Battery", Apps::BatteryInfo}}}; - std::array applications {{{Symbols::shoe, "Steps", Apps::SettingSteps}, - {Symbols::clock, "Set date", Apps::SettingSetDate}, - {Symbols::clock, "Set time", Apps::SettingSetTime}, - {Symbols::batteryHalf, "Battery", Apps::BatteryInfo}}}; - - return std::make_unique(1, 3, app, settingsController, applications); + return std::make_unique(1, 4, app, settingsController, applications); } std::unique_ptr Settings::CreateScreen3() { @@ -61,8 +64,20 @@ std::unique_ptr Settings::CreateScreen3() { {Symbols::clock, "Chimes", Apps::SettingChimes}, {Symbols::tachometer, "Shake Calib.", Apps::SettingShakeThreshold}, {Symbols::check, "Firmware", Apps::FirmwareValidation}, - {Symbols::list, "About", Apps::SysInfo} + {Symbols::list, "Airplane mode", Apps::SettingAirplaneMode} + }}; + + return std::make_unique(2, 4, app, settingsController, applications); +} + +std::unique_ptr Settings::CreateScreen4() { + + std::array applications {{ + {Symbols::list, "About", Apps::SysInfo}, + {Symbols::none, "None", Apps::None}, + {Symbols::none, "None", Apps::None}, + {Symbols::none, "None", Apps::None} }}; - return std::make_unique(2, 3, app, settingsController, applications); + return std::make_unique(3, 4, app, settingsController, applications); } diff --git a/src/displayapp/screens/settings/Settings.h b/src/displayapp/screens/settings/Settings.h index 6c54cdeb..be090075 100644 --- a/src/displayapp/screens/settings/Settings.h +++ b/src/displayapp/screens/settings/Settings.h @@ -19,11 +19,12 @@ namespace Pinetime { private: Controllers::Settings& settingsController; - ScreenList<3> screens; + ScreenList<4> screens; std::unique_ptr CreateScreen1(); std::unique_ptr CreateScreen2(); std::unique_ptr CreateScreen3(); + std::unique_ptr CreateScreen4(); }; } } diff --git a/src/systemtask/Messages.h b/src/systemtask/Messages.h index ad13244f..2e3456a2 100644 --- a/src/systemtask/Messages.h +++ b/src/systemtask/Messages.h @@ -31,7 +31,7 @@ namespace Pinetime { BatteryPercentageUpdated, StartFileTransfer, StopFileTransfer, - AirplaneModeToggle + BleRadioEnableToggle }; } } diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 75a71ecc..1e45fac1 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -254,7 +254,7 @@ void SystemTask::Work() { displayApp.PushMessage(Pinetime::Applications::Display::Messages::GoToRunning); heartRateApp.PushMessage(Pinetime::Applications::HeartRateTask::Messages::WakeUp); - if (bleController.GetConnectState() == Controllers::Ble::ConnectStates::Disconnected) { + if (bleController.IsRadioEnabled() && !bleController.IsConnected()) { nimbleController.RestartFastAdv(); } @@ -440,8 +440,12 @@ void SystemTask::Work() { motorController.RunForDuration(35); displayApp.PushMessage(Pinetime::Applications::Display::Messages::ShowPairingKey); break; - case Messages::AirplaneModeToggle: - nimbleController.SwitchAirplaneMode(settingsController.GetAirplaneMode()); + case Messages::BleRadioEnableToggle: + if(settingsController.GetBleRadioEnabled()) { + nimbleController.EnableRadio(); + } else { + nimbleController.DisableRadio(); + } break; default: break; -- cgit v1.2.3-70-g09d2 From 2803dd667f90bf8b19e45820235d3ab90490f96b Mon Sep 17 00:00:00 2001 From: avery Date: Tue, 22 Feb 2022 18:21:00 +0100 Subject: Use Bluetooth brand color for status text --- src/displayapp/screens/WatchFaceTerminal.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp index ccfbdd0b..c593e6bf 100644 --- a/src/displayapp/screens/WatchFaceTerminal.cpp +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -46,7 +46,7 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, connectState = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(connectState, true); - lv_label_set_text(connectState, "[STAT]#387b54 Disconnected#"); + lv_label_set_text(connectState, "[STAT]#0082fc Disconnected#"); lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40); notificationIcon = lv_label_create(lv_scr_act(), nullptr); @@ -117,12 +117,12 @@ void WatchFaceTerminal::Refresh() { bleRadioEnabled = bleController.IsRadioEnabled(); if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) { if(!bleRadioEnabled.Get()) { - lv_label_set_text_static(connectState, "[STAT]#387b54 Disabled#"); + lv_label_set_text_static(connectState, "[STAT]#0082fc Disabled#"); } else { if (bleState.Get()) { - lv_label_set_text_static(connectState, "[STAT]#387b54 Connected#"); + lv_label_set_text_static(connectState, "[STAT]#0082fc Connected#"); } else { - lv_label_set_text_static(connectState, "[STAT]#387b54 Disconnected#"); + lv_label_set_text_static(connectState, "[STAT]#0082fc Disconnected#"); } } } -- cgit v1.2.3-70-g09d2 From 8dae4c82990df8236faa57ef4b6ae00c92298a1d Mon Sep 17 00:00:00 2001 From: avery Date: Tue, 22 Feb 2022 18:42:54 +0100 Subject: terminal: Replace notification icon with a text entry --- src/displayapp/screens/WatchFaceTerminal.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp index c593e6bf..ebd463f9 100644 --- a/src/displayapp/screens/WatchFaceTerminal.cpp +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -50,8 +50,9 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40); notificationIcon = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); - lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 10, 0); + lv_label_set_recolor(notificationIcon, true); + lv_label_set_text(notificationIcon, "[NOTI]#387b54 ---"); + lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_LEFT_MID, 0, 60); label_date = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(label_date, true); @@ -62,7 +63,7 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, lv_label_set_text(label_prompt_1, "user@watch:~ $ now"); label_prompt_2 = lv_label_create(lv_scr_act(), nullptr); - lv_obj_align(label_prompt_2, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60); + lv_obj_align(label_prompt_2, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 80); lv_label_set_text(label_prompt_2, "user@watch:~ $"); label_time = lv_label_create(lv_scr_act(), nullptr); @@ -130,9 +131,9 @@ void WatchFaceTerminal::Refresh() { notificationState = notificatioManager.AreNewNotificationsAvailable(); if (notificationState.IsUpdated()) { if (notificationState.Get()) { - lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true)); + lv_label_set_text_static(notificationIcon, "[NOTI]#387b54 Unread"); } else { - lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); + lv_label_set_text_static(notificationIcon, "[NOTI]#387b54 ---"); } } -- cgit v1.2.3-70-g09d2 From 29f0bce46bd531ffa83f3445c0e0d893217aa50d Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Mon, 21 Feb 2022 22:50:20 +0100 Subject: Remove unused includes in HearRate and Motion.h The include `bits/unique_ptr.h` isn't used, so remove it. --- src/displayapp/screens/HeartRate.h | 1 - src/displayapp/screens/Motion.h | 1 - 2 files changed, 2 deletions(-) (limited to 'src') diff --git a/src/displayapp/screens/HeartRate.h b/src/displayapp/screens/HeartRate.h index baa0ccdd..2ad00351 100644 --- a/src/displayapp/screens/HeartRate.h +++ b/src/displayapp/screens/HeartRate.h @@ -3,7 +3,6 @@ #include #include #include "displayapp/screens/Screen.h" -#include #include "systemtask/SystemTask.h" #include #include diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h index d6997409..4d2bd4f2 100644 --- a/src/displayapp/screens/Motion.h +++ b/src/displayapp/screens/Motion.h @@ -3,7 +3,6 @@ #include #include #include "displayapp/screens/Screen.h" -#include #include #include #include -- cgit v1.2.3-70-g09d2 From a29e30c1876891e504ad62fb35d3b1be76b175a4 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Sat, 29 Jan 2022 23:30:03 +0100 Subject: Notifications: replace newlines in label-copy because of const char* title The variable `title` is defined as `const char*`, which means, that `strchr()` returns a `const char*` as well according to https://www.cplusplus.com/reference/cstring/strchr/ But in the same line the return value is assigned to a non-const `char*`, which shouldn't be allowed (error with `-pedantic`). Because the `lv_label` creates an internal copy of the title sting, just modify that one instead and replace newline in the copied string. --- src/displayapp/screens/Notifications.cpp | 19 +++++++++++-------- src/displayapp/screens/Notifications.h | 4 ---- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 3a39dacf..f9afd8c7 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -198,15 +198,18 @@ Notifications::NotificationItem::NotificationItem(const char* title, lv_obj_t* alert_type = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(alert_type, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x888888)); - if (title == nullptr) - title = "Notification"; - char* pchar; - pchar = strchr(title, '\n'); - while (pchar != nullptr) { - *pchar = ' '; - pchar = strchr(pchar + 1, '\n'); + if(title == nullptr) { + lv_label_set_text_static(alert_type, "Notification"); + } else { + // copy title to label and replace newlines with spaces + lv_label_set_text(alert_type, title); + char *pchar = strchr(lv_label_get_text(alert_type), '\n'); + while (pchar != nullptr) { + *pchar = ' '; + pchar = strchr(pchar + 1, '\n'); + } + lv_label_refr_text(alert_type); } - lv_label_set_text(alert_type, title); lv_label_set_long_mode(alert_type, LV_LABEL_LONG_SROLL_CIRC); lv_obj_set_width(alert_type, 180); lv_obj_align(alert_type, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 16); diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h index f49d3b3a..74160356 100644 --- a/src/displayapp/screens/Notifications.h +++ b/src/displayapp/screens/Notifications.h @@ -62,10 +62,6 @@ namespace Pinetime { }; private: - struct NotificationData { - const char* title; - const char* text; - }; Pinetime::Controllers::NotificationManager& notificationManager; Pinetime::Controllers::AlertNotificationService& alertNotificationService; Pinetime::Controllers::MotorController& motorController; -- cgit v1.2.3-70-g09d2 From 1bfee61ef9f136b186199fb41abf04bf63918574 Mon Sep 17 00:00:00 2001 From: avery Date: Tue, 22 Feb 2022 17:37:28 +0100 Subject: Replace Airplane mode icon --- src/displayapp/screens/settings/Settings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index 981b4973..dce0c071 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -64,7 +64,7 @@ std::unique_ptr Settings::CreateScreen3() { {Symbols::clock, "Chimes", Apps::SettingChimes}, {Symbols::tachometer, "Shake Calib.", Apps::SettingShakeThreshold}, {Symbols::check, "Firmware", Apps::FirmwareValidation}, - {Symbols::list, "Airplane mode", Apps::SettingAirplaneMode} + {Symbols::airplane, "Airplane mode", Apps::SettingAirplaneMode} }}; return std::make_unique(2, 4, app, settingsController, applications); -- cgit v1.2.3-70-g09d2 From f1c91e1ce0fb666449e751fc4a8216f1a672f95f Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sun, 20 Feb 2022 15:06:28 +0200 Subject: terminal watchface: remove icons and other fixes --- src/displayapp/screens/WatchFaceTerminal.cpp | 38 +++++++--------------------- src/displayapp/screens/WatchFaceTerminal.h | 2 -- 2 files changed, 9 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp index ccfbdd0b..08a9db5b 100644 --- a/src/displayapp/screens/WatchFaceTerminal.cpp +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -32,25 +32,15 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, motionController {motionController} { settingsController.SetClockFace(3); - batteryIcon = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(batteryIcon, Symbols::batteryFull); - lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, 2); - - batteryPlug = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(batteryPlug, Symbols::plug); - lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); - batteryValue = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(batteryValue, true); lv_obj_align(batteryValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -20); connectState = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(connectState, true); - lv_label_set_text(connectState, "[STAT]#387b54 Disconnected#"); lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40); notificationIcon = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 10, 0); label_date = lv_label_create(lv_scr_act(), nullptr); @@ -59,11 +49,11 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, label_prompt_1 = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(label_prompt_1, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -80); - lv_label_set_text(label_prompt_1, "user@watch:~ $ now"); + lv_label_set_text_static(label_prompt_1, "user@watch:~ $ now"); label_prompt_2 = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(label_prompt_2, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60); - lv_label_set_text(label_prompt_2, "user@watch:~ $"); + lv_label_set_text_static(label_prompt_2, "user@watch:~ $"); label_time = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(label_time, true); @@ -74,16 +64,14 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text(backgroundLabel, ""); + lv_label_set_text_static(backgroundLabel, ""); heartbeatValue = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(heartbeatValue, true); - lv_label_set_text(heartbeatValue, "[L_HR]#ee3311 0 bpm#"); lv_obj_align(heartbeatValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 20); stepValue = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(stepValue, true); - lv_label_set_text(stepValue, "[STEP]#ee3377 0 steps#"); lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0); taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); @@ -97,20 +85,12 @@ WatchFaceTerminal::~WatchFaceTerminal() { void WatchFaceTerminal::Refresh() { powerPresent = batteryController.IsPowerPresent(); - if (powerPresent.IsUpdated()) { - lv_label_set_text_static(batteryPlug, BatteryIcon::GetPlugIcon(powerPresent.Get())); - } - batteryPercentRemaining = batteryController.PercentRemaining(); - if (batteryPercentRemaining.IsUpdated()) { - auto batteryPercent = batteryPercentRemaining.Get(); - if (batteryPercent == 100) { - lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); - } else { - lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + if (batteryPercentRemaining.IsUpdated() || powerPresent.IsUpdated()) { + lv_label_set_text_fmt(batteryValue, "[BATT]#387b54 %d%%", batteryPercentRemaining.Get()); + if (batteryController.IsPowerPresent()) { + lv_label_ins_text(batteryValue, LV_LABEL_POS_LAST, " Charging"); } - lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); - lv_label_set_text_fmt(batteryValue, "[BATT]#387b54 %d%\%#", batteryPercent); } bleState = bleController.IsConnected(); @@ -130,9 +110,9 @@ void WatchFaceTerminal::Refresh() { notificationState = notificatioManager.AreNewNotificationsAvailable(); if (notificationState.IsUpdated()) { if (notificationState.Get()) { - lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); } else { - lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); } } diff --git a/src/displayapp/screens/WatchFaceTerminal.h b/src/displayapp/screens/WatchFaceTerminal.h index 78c7b8aa..d236da34 100644 --- a/src/displayapp/screens/WatchFaceTerminal.h +++ b/src/displayapp/screens/WatchFaceTerminal.h @@ -60,8 +60,6 @@ namespace Pinetime { lv_obj_t* label_prompt_1; lv_obj_t* label_prompt_2; lv_obj_t* backgroundLabel; - lv_obj_t* batteryIcon; - lv_obj_t* batteryPlug; lv_obj_t* batteryValue; lv_obj_t* heartbeatValue; lv_obj_t* stepValue; -- cgit v1.2.3-70-g09d2 From 1eaf258a633969abdd0e41fbcac9e17fe38eb409 Mon Sep 17 00:00:00 2001 From: medeyko Date: Mon, 7 Feb 2022 17:17:12 +0300 Subject: Update jetbrains_mono_bold_20.c Fix 0 (zero) symbol. For more details, #988 --- src/displayapp/fonts/jetbrains_mono_bold_20.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/displayapp/fonts/jetbrains_mono_bold_20.c b/src/displayapp/fonts/jetbrains_mono_bold_20.c index 944e47a1..6cd7aead 100644 --- a/src/displayapp/fonts/jetbrains_mono_bold_20.c +++ b/src/displayapp/fonts/jetbrains_mono_bold_20.c @@ -88,8 +88,8 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xe, 0x3, 0x80, 0xc0, 0x70, 0x18, 0xe, 0x0, /* U+0030 "0" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f, - 0xdf, 0xf7, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0xdf, 0xb7, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, 0x8f, 0xc0, /* U+0031 "1" */ -- cgit v1.2.3-70-g09d2 From 43399b3832df7375f9139d7bd3c082a49549c616 Mon Sep 17 00:00:00 2001 From: medeyko Date: Mon, 7 Feb 2022 17:25:56 +0300 Subject: Update README.md --- src/displayapp/fonts/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md index 40ecd3e2..5007060e 100644 --- a/src/displayapp/fonts/README.md +++ b/src/displayapp/fonts/README.md @@ -31,6 +31,23 @@ Add new symbols: static constexpr const char* newSymbol = "\xEF\x86\x85"; ``` +#### Fix the zero symbol +If you don't wish the inner dot of the 0 (zero) symbol to stick to the boundary), edit `src/displayapp/fonts/jetbrains_mono_bold_20.c` and replace: + + /* U+0030 "0" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f, + 0xdf, 0xf7, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x8f, 0xc0, + +with + + /* U+0030 "0" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0xdf, 0xb7, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x8f, 0xc0, + +(there are two changes: 7f -> 7e and f7 -> b7) + ## Simple method to generate a font If you want to generate a basic font containing only numbers and letters, you can use the above settings but instead of specifying a range, simply list the characters you need in the Symbols field and leave the range blank. This is the approach used for the PineTimeStyle watchface. -- cgit v1.2.3-70-g09d2 From dd28359571088cc850d315b5c3689c69f54e5838 Mon Sep 17 00:00:00 2001 From: medeyko Date: Mon, 7 Feb 2022 17:31:18 +0300 Subject: Update README.md remove unnecessary ) --- src/displayapp/fonts/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md index 5007060e..a5f66b10 100644 --- a/src/displayapp/fonts/README.md +++ b/src/displayapp/fonts/README.md @@ -32,7 +32,7 @@ static constexpr const char* newSymbol = "\xEF\x86\x85"; ``` #### Fix the zero symbol -If you don't wish the inner dot of the 0 (zero) symbol to stick to the boundary), edit `src/displayapp/fonts/jetbrains_mono_bold_20.c` and replace: +If you don't wish the inner dot of the 0 (zero) symbol to stick to the boundary, edit `src/displayapp/fonts/jetbrains_mono_bold_20.c` and replace: /* U+0030 "0" */ 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f, -- cgit v1.2.3-70-g09d2 From dd47ba9782cb7a7a2268da5b493e6d385bdf08af Mon Sep 17 00:00:00 2001 From: medeyko Date: Mon, 7 Feb 2022 18:29:28 +0300 Subject: Update README.md More imperative tone --- src/displayapp/fonts/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md index a5f66b10..b4737681 100644 --- a/src/displayapp/fonts/README.md +++ b/src/displayapp/fonts/README.md @@ -31,8 +31,7 @@ Add new symbols: static constexpr const char* newSymbol = "\xEF\x86\x85"; ``` -#### Fix the zero symbol -If you don't wish the inner dot of the 0 (zero) symbol to stick to the boundary, edit `src/displayapp/fonts/jetbrains_mono_bold_20.c` and replace: +Then fix an error that happens during the font conversion (the inner dot of the 'zero' symbol sticks to the boundary): edit `src/displayapp/fonts/jetbrains_mono_bold_20.c` and replace: /* U+0030 "0" */ 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f, -- cgit v1.2.3-70-g09d2 From 5613449bfb16ed7bac672621f0f6c13afb1e1718 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Fri, 19 Nov 2021 23:14:19 +0100 Subject: Settings: more specific read and write mode For each filesystem interaction be more specific if we want to read from the file or write to it. Doing a non-creating read on the loading of the settings file, otherwise an empty file could be created, and when reading that empty file for the initial settings I would expect an error (or random data) when reading. --- src/components/settings/Settings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/components/settings/Settings.cpp b/src/components/settings/Settings.cpp index ef73ad1c..fee62daf 100644 --- a/src/components/settings/Settings.cpp +++ b/src/components/settings/Settings.cpp @@ -26,7 +26,7 @@ void Settings::LoadSettingsFromFile() { SettingsData bufferSettings; lfs_file_t settingsFile; - if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_RDWR | LFS_O_CREAT) != LFS_ERR_OK) { + if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_RDONLY) != LFS_ERR_OK) { return; } fs.FileRead(&settingsFile, reinterpret_cast(&bufferSettings), sizeof(settings)); @@ -39,7 +39,7 @@ void Settings::LoadSettingsFromFile() { void Settings::SaveSettingsToFile() { lfs_file_t settingsFile; - if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_RDWR | LFS_O_CREAT) != LFS_ERR_OK) { + if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_WRONLY | LFS_O_CREAT) != LFS_ERR_OK) { return; } fs.FileWrite(&settingsFile, reinterpret_cast(&settings), sizeof(settings)); -- cgit v1.2.3-70-g09d2 From 30797b37bc509b24c86364f6d7b55be642a6dfb4 Mon Sep 17 00:00:00 2001 From: Yehoshua Pesach Wallach Date: Fri, 28 Jan 2022 14:34:59 +0200 Subject: removed SetClockFace from watchface Constructors --- src/displayapp/screens/WatchFaceAnalog.cpp | 1 - src/displayapp/screens/WatchFaceDigital.cpp | 1 - 2 files changed, 2 deletions(-) (limited to 'src') diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index f027a744..f1b91444 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -57,7 +57,6 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app, bleController {bleController}, notificationManager {notificationManager}, settingsController {settingsController} { - settingsController.SetClockFace(1); sHour = 99; sMinute = 99; diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 56155d52..59bde839 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -32,7 +32,6 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app, settingsController {settingsController}, heartRateController {heartRateController}, motionController {motionController} { - settingsController.SetClockFace(0); batteryIcon = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text_static(batteryIcon, Symbols::batteryFull); -- cgit v1.2.3-70-g09d2 From 5d974434ef2211c8feb7fe464bc9e2da3a3e1771 Mon Sep 17 00:00:00 2001 From: avery Date: Sat, 5 Mar 2022 13:01:50 +0100 Subject: Replace notif entry with "You have mail." text --- src/displayapp/screens/WatchFaceTerminal.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp index ebd463f9..d1d22305 100644 --- a/src/displayapp/screens/WatchFaceTerminal.cpp +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -50,9 +50,7 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40); notificationIcon = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_recolor(notificationIcon, true); - lv_label_set_text(notificationIcon, "[NOTI]#387b54 ---"); - lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_LEFT_MID, 0, 60); + lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_LEFT_MID, 0, -100); label_date = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(label_date, true); @@ -63,7 +61,7 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, lv_label_set_text(label_prompt_1, "user@watch:~ $ now"); label_prompt_2 = lv_label_create(lv_scr_act(), nullptr); - lv_obj_align(label_prompt_2, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 80); + lv_obj_align(label_prompt_2, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60); lv_label_set_text(label_prompt_2, "user@watch:~ $"); label_time = lv_label_create(lv_scr_act(), nullptr); @@ -131,9 +129,9 @@ void WatchFaceTerminal::Refresh() { notificationState = notificatioManager.AreNewNotificationsAvailable(); if (notificationState.IsUpdated()) { if (notificationState.Get()) { - lv_label_set_text_static(notificationIcon, "[NOTI]#387b54 Unread"); + lv_label_set_text_static(notificationIcon, "You have mail."); } else { - lv_label_set_text_static(notificationIcon, "[NOTI]#387b54 ---"); + lv_label_set_text_static(notificationIcon, ""); } } -- cgit v1.2.3-70-g09d2 From 8844ea60b1ccb174e431f1dd96c72c5bb53c227b Mon Sep 17 00:00:00 2001 From: avery Date: Sun, 6 Mar 2022 14:01:20 +0100 Subject: Remove unnecessary line --- src/displayapp/screens/WatchFaceTerminal.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp index e77d594b..3a47fc53 100644 --- a/src/displayapp/screens/WatchFaceTerminal.cpp +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -38,7 +38,6 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, connectState = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(connectState, true); - lv_label_set_text(connectState, "[STAT]#0082fc Disconnected#"); lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40); notificationIcon = lv_label_create(lv_scr_act(), nullptr); -- cgit v1.2.3-70-g09d2 From 5fe5cee9ef76fdb57810a4434517ebc6442393fb Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Sun, 20 Feb 2022 14:45:59 +0100 Subject: Add missing nrf_log.h includes shadowed by SystemMonitor.h Some components were missing a `nrf_log.h` include. This missing include was accidentally provided by the SystemMonitor.h header, which was included by Systemtask.h --- src/components/ble/AlertNotificationClient.cpp | 1 + src/components/ble/DfuService.cpp | 1 + src/components/ble/HeartRateService.cpp | 1 + src/components/ble/MotionService.cpp | 1 + src/components/ble/NimbleController.cpp | 1 + 5 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/components/ble/AlertNotificationClient.cpp b/src/components/ble/AlertNotificationClient.cpp index 0f850874..335845e3 100644 --- a/src/components/ble/AlertNotificationClient.cpp +++ b/src/components/ble/AlertNotificationClient.cpp @@ -2,6 +2,7 @@ #include #include "components/ble/NotificationManager.h" #include "systemtask/SystemTask.h" +#include using namespace Pinetime::Controllers; constexpr ble_uuid16_t AlertNotificationClient::ansServiceUuid; diff --git a/src/components/ble/DfuService.cpp b/src/components/ble/DfuService.cpp index 71dcc7e6..cf99f01f 100644 --- a/src/components/ble/DfuService.cpp +++ b/src/components/ble/DfuService.cpp @@ -3,6 +3,7 @@ #include "components/ble/BleController.h" #include "drivers/SpiNorFlash.h" #include "systemtask/SystemTask.h" +#include using namespace Pinetime::Controllers; diff --git a/src/components/ble/HeartRateService.cpp b/src/components/ble/HeartRateService.cpp index f178af79..4824a6b3 100644 --- a/src/components/ble/HeartRateService.cpp +++ b/src/components/ble/HeartRateService.cpp @@ -1,6 +1,7 @@ #include "components/ble/HeartRateService.h" #include "components/heartrate/HeartRateController.h" #include "systemtask/SystemTask.h" +#include using namespace Pinetime::Controllers; diff --git a/src/components/ble/MotionService.cpp b/src/components/ble/MotionService.cpp index 6381915d..87923c23 100644 --- a/src/components/ble/MotionService.cpp +++ b/src/components/ble/MotionService.cpp @@ -1,6 +1,7 @@ #include "components/ble/MotionService.h" #include "components/motion/MotionController.h" #include "systemtask/SystemTask.h" +#include using namespace Pinetime::Controllers; diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index f6ab6269..0be7c0f7 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -2,6 +2,7 @@ #include #include +#include #define min // workaround: nimble's min/max macros conflict with libstdc++ #define max #include -- cgit v1.2.3-70-g09d2 From 187d99c0f710cf4827a026f02e41ebbd2b1271e2 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Thu, 27 Jan 2022 23:10:59 +0100 Subject: SystemMonitor: implement FreeRtosMonitor only if trace facility is set Split SystemMonitor into h and cpp file and move the logging code of the `Process` function into the cpp file. Depending of the `configUSE_TRACE_FACILITY` define from `src/FreeRTOSConfig.h` create either a "FreeRtosMonitor" or a "DummyMonitor". Make the `Process()` function non-const, as the FreeRtosMonitor changes the member variable `lastTick`. In `SystemTask.h` we then only need to use `SystemMonitor`, without knowledge of the `configUSE_TRACE_FACILITY` define. --- src/CMakeLists.txt | 2 ++ src/systemtask/SystemMonitor.cpp | 26 ++++++++++++++++++++++++++ src/systemtask/SystemMonitor.h | 40 ++++++---------------------------------- src/systemtask/SystemTask.h | 6 +----- 4 files changed, 35 insertions(+), 39 deletions(-) create mode 100644 src/systemtask/SystemMonitor.cpp (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 025fc330..ff0c9b0c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -516,6 +516,7 @@ list(APPEND SOURCE_FILES displayapp/lv_pinetime_theme.c systemtask/SystemTask.cpp + systemtask/SystemMonitor.cpp drivers/TwiMaster.cpp heartratetask/HeartRateTask.cpp @@ -577,6 +578,7 @@ list(APPEND RECOVERY_SOURCE_FILES FreeRTOS/port_cmsis.c systemtask/SystemTask.cpp + systemtask/SystemMonitor.cpp drivers/TwiMaster.cpp components/gfx/Gfx.cpp components/rle/RleDecoder.cpp diff --git a/src/systemtask/SystemMonitor.cpp b/src/systemtask/SystemMonitor.cpp new file mode 100644 index 00000000..90765e30 --- /dev/null +++ b/src/systemtask/SystemMonitor.cpp @@ -0,0 +1,26 @@ +#include "systemtask/SystemTask.h" +#if configUSE_TRACE_FACILITY == 1 +// FreeRtosMonitor +#include +#include +#include + +void Pinetime::System::SystemMonitor::Process() { + if (xTaskGetTickCount() - lastTick > 10000) { + NRF_LOG_INFO("---------------------------------------\nFree heap : %d", xPortGetFreeHeapSize()); + TaskStatus_t tasksStatus[10]; + auto nb = uxTaskGetSystemState(tasksStatus, 10, nullptr); + for (uint32_t i = 0; i < nb; i++) { + NRF_LOG_INFO("Task [%s] - %d", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark); + if (tasksStatus[i].usStackHighWaterMark < 20) + NRF_LOG_INFO("WARNING!!! Task %s task is nearly full, only %dB available", + tasksStatus[i].pcTaskName, + tasksStatus[i].usStackHighWaterMark * 4); + } + lastTick = xTaskGetTickCount(); + } +} +#else +// DummyMonitor +void Pinetime::System::SystemMonitor::Process() {} +#endif diff --git a/src/systemtask/SystemMonitor.h b/src/systemtask/SystemMonitor.h index 45c02c2c..08c87401 100644 --- a/src/systemtask/SystemMonitor.h +++ b/src/systemtask/SystemMonitor.h @@ -1,44 +1,16 @@ #pragma once -#include +#include // declares configUSE_TRACE_FACILITY #include -#include namespace Pinetime { namespace System { - struct DummyMonitor {}; - struct FreeRtosMonitor {}; - - template class SystemMonitor { - public: - SystemMonitor() = delete; - }; - - template <> class SystemMonitor { + class SystemMonitor { public: - void Process() const { - } - }; - - template <> class SystemMonitor { - public: - void Process() const { - if (xTaskGetTickCount() - lastTick > 10000) { - NRF_LOG_INFO("---------------------------------------\nFree heap : %d", xPortGetFreeHeapSize()); - auto nb = uxTaskGetSystemState(tasksStatus, 10, nullptr); - for (uint32_t i = 0; i < nb; i++) { - NRF_LOG_INFO("Task [%s] - %d", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark); - if (tasksStatus[i].usStackHighWaterMark < 20) - NRF_LOG_INFO("WARNING!!! Task %s task is nearly full, only %dB available", - tasksStatus[i].pcTaskName, - tasksStatus[i].usStackHighWaterMark * 4); - } - lastTick = xTaskGetTickCount(); - } - } - + void Process(); +#if configUSE_TRACE_FACILITY == 1 private: mutable TickType_t lastTick = 0; - mutable TaskStatus_t tasksStatus[10]; +#endif }; } -} \ No newline at end of file +} diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index 517ed1ae..c5b03792 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -148,11 +148,7 @@ namespace Pinetime { bool stepCounterMustBeReset = false; static constexpr TickType_t batteryMeasurementPeriod = pdMS_TO_TICKS(10 * 60 * 1000); -#if configUSE_TRACE_FACILITY == 1 - SystemMonitor monitor; -#else - SystemMonitor monitor; -#endif + SystemMonitor monitor; }; } } -- cgit v1.2.3-70-g09d2 From 204ad7ca2a8bf30caee7bc9b7395001c0d720b10 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sun, 27 Feb 2022 14:30:47 +0200 Subject: Update font readme, update fonts, add missing files --- src/displayapp/fonts/JetBrainsMono-Bold.ttf | Bin 173264 -> 210128 bytes src/displayapp/fonts/JetBrainsMono-Regular.ttf | Bin 0 -> 203952 bytes src/displayapp/fonts/README.md | 58 ++-- src/displayapp/fonts/jetbrains_mono_42.c | 20 +- src/displayapp/fonts/jetbrains_mono_76.c | 44 +-- src/displayapp/fonts/jetbrains_mono_bold_20.c | 362 ++++++++++++------------- src/displayapp/fonts/open_sans_light.c | 2 +- 7 files changed, 248 insertions(+), 238 deletions(-) create mode 100644 src/displayapp/fonts/JetBrainsMono-Regular.ttf (limited to 'src') diff --git a/src/displayapp/fonts/JetBrainsMono-Bold.ttf b/src/displayapp/fonts/JetBrainsMono-Bold.ttf index 0cd1cb66..0a928091 100644 Binary files a/src/displayapp/fonts/JetBrainsMono-Bold.ttf and b/src/displayapp/fonts/JetBrainsMono-Bold.ttf differ diff --git a/src/displayapp/fonts/JetBrainsMono-Regular.ttf b/src/displayapp/fonts/JetBrainsMono-Regular.ttf new file mode 100644 index 00000000..8da8aa40 Binary files /dev/null and b/src/displayapp/fonts/JetBrainsMono-Regular.ttf differ diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md index b4737681..c8fb0d35 100644 --- a/src/displayapp/fonts/README.md +++ b/src/displayapp/fonts/README.md @@ -7,20 +7,12 @@ ## Generate the fonts: * Open the [LVGL font converter](https://lvgl.io/tools/fontconverter) -* Name : jetbrains_mono_bold_20 -* Size : 20 -* Bpp : 1 bit-per-pixel -* Do not enable font compression and horizontal subpixel hinting -* Load the file `JetBrainsMono-Bold.tff` (use the file in this repo to ensure the version matches) and specify the following range : `0x20-0x7f, 0x410-0x44f` -* Add a 2nd font, load the file `FontAwesome5-Solid+Brands+Regular.woff` and specify the following - range : `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf201, 0xf06e, 0xf015, 0xf072` -* Click on Convert, and download the file `jetbrains_mono_bold_20.c` and copy it in `src/DisplayApp/Fonts` -* Add the font .c file path to src/CMakeLists.txt -* Add an LV_FONT_DECLARE line in src/libs/lv_conf.h +* Enter the settings for the font that you wish to convert +* Click on Convert, download the file and place it in `src/DisplayApp/Fonts` -Add new symbols: +### How to add new symbols: -* Browse the [cheatsheet](https://fontawesome.com/cheatsheet/free/solid) and find your new symbols +* Browse [this cheatsheet](https://fontawesome.com/cheatsheet/free/solid) and pick symbols * For each symbol, add its hex code (0xf641 for the 'Ad' icon, for example) to the *Range* list (Remember to keep this readme updated with newest range list) * Convert this hex value into a UTF-8 code @@ -31,7 +23,18 @@ Add new symbols: static constexpr const char* newSymbol = "\xEF\x86\x85"; ``` -Then fix an error that happens during the font conversion (the inner dot of the 'zero' symbol sticks to the boundary): edit `src/displayapp/fonts/jetbrains_mono_bold_20.c` and replace: +### Small font + +* Name: jetbrains_mono_bold_20 +* Size: 20 +* Bpp: 1 bit-per-pixel +* Do not enable font compression or horizontal subpixel rendering +* Load the file `JetBrainsMono-Bold.tff` (use the file in this repo to ensure the version matches) and specify the following range : `0x20-0x7e, 0x410-0x44f` +* Add a 2nd font, load the file `FontAwesome5-Solid+Brands+Regular.woff` and specify the following + range : `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf201, 0xf06e, 0xf015, 0xf072` +* Fix an error in the font conversion. + +Replace the following: /* U+0030 "0" */ 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f, @@ -47,25 +50,34 @@ with (there are two changes: 7f -> 7e and f7 -> b7) -## Simple method to generate a font -If you want to generate a basic font containing only numbers and letters, you can use the above settings but instead of specifying a range, simply list the characters you need in the Symbols field and leave the range blank. This is the approach used for the PineTimeStyle watchface. -This works well for fonts which will only be used to display numbers, but will fail if you try to add a colon or other punctuation. +### Medium font + +* Name: jetbrains_mono_42 +* Size: 42 +* Bpp: 1 bit-per-pixel +* Do not enable font compression or horizontal subpixel rendering +* Load the file `JetBrainsMono-Regular.tff` (use the file in this repo to ensure the version matches) and specify the following range : `0x25, 0x30-0x3a` + +### Large font +* Name: jetbrains_mono_76 +* Size: 76 +* Bpp: 1 bit-per-pixel +* Do not enable font compression or horizontal subpixel rendering +* Load the file `JetBrainsMono-Regular.tff` (use the file in this repo to ensure the version matches) and specify the following range : `0x25, 0x2D, 0x2F, 0x30-0x3a` + +### PineTimeStyle font -* Open the [LVGL font converter](https://lvgl.io/tools/fontconverter) * Name : open_sans_light * Size : 150 * Bpp : 1 bit-per-pixel -* Do not enable font compression and horizontal subpixel hinting +* Do not enable font compression or horizontal subpixel rendering * Load the file `open_sans_light.tff` (use the file in this repo to ensure the version matches) and specify the following symbols : `0123456789` -* Click on Convert, and download the file `open_sans_light.c` and copy it in `src/DisplayApp/Fonts` -* Add the font .c file path to src/CMakeLists.txt (search for jetbrains to find the appropriate location/format) -* Add an LV_FONT_DECLARE line in src/libs/lv_conf.h (as above) #### Navigation font To create the navigtion.ttf I use the web app [icomoon](https://icomoon.io/app) -this app can import the svg files from the folder *src/displayapp/icons/navigation/unique* and creat a ttf file the +this app can import the svg files from the folder *src/displayapp/icons/navigation/unique* and create a ttf file the project for the site is *lv_font_navi_80.json* you can import it to add or remove icons You can also use the online LVGL tool to create the .c @@ -74,5 +86,3 @@ ttf file : navigation.ttf name : lv_font_navi_80 size : 80px Bpp : 2 bit-per-pix $lv_font_conv --font navigation.ttf -r '0xe900-0xe929' --size 80 --format lvgl --bpp 2 --no-prefilter -o lv_font_navi_80.c - -#### I use the method above to create the other ttf diff --git a/src/displayapp/fonts/jetbrains_mono_42.c b/src/displayapp/fonts/jetbrains_mono_42.c index 6f25f5ab..b5218b95 100644 --- a/src/displayapp/fonts/jetbrains_mono_42.c +++ b/src/displayapp/fonts/jetbrains_mono_42.c @@ -61,13 +61,13 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xf8, /* U+0032 "2" */ - 0x3, 0xf8, 0x1, 0xff, 0xc0, 0x7f, 0xfe, 0x1f, - 0x7, 0xc7, 0xc0, 0x3c, 0xf0, 0x7, 0xbc, 0x0, + 0x3, 0xf8, 0x1, 0xff, 0xc0, 0xff, 0xfc, 0x1f, + 0x7, 0xc7, 0xc0, 0x7c, 0xf0, 0x7, 0xbc, 0x0, 0x7f, 0x80, 0xf, 0xf0, 0x1, 0xe0, 0x0, 0x3c, 0x0, 0x7, 0x80, 0x1, 0xf0, 0x0, 0x3c, 0x0, 0xf, 0x80, 0x1, 0xe0, 0x0, 0x7c, 0x0, 0x1f, - 0x0, 0x7, 0xc0, 0x1, 0xf0, 0x0, 0x7e, 0x0, - 0xf, 0x80, 0x3, 0xe0, 0x0, 0xf8, 0x0, 0x3e, + 0x0, 0x7, 0xc0, 0x1, 0xf0, 0x0, 0x7c, 0x0, + 0x1f, 0x0, 0x3, 0xc0, 0x0, 0xf0, 0x0, 0x3e, 0x0, 0xf, 0x80, 0x3, 0xe0, 0x0, 0xf8, 0x0, 0x3e, 0x0, 0x7, 0xff, 0xfe, 0xff, 0xff, 0xdf, 0xff, 0xf8, @@ -75,12 +75,12 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { /* U+0033 "3" */ 0x7f, 0xff, 0x8f, 0xff, 0xf1, 0xff, 0xfe, 0x0, 0x3, 0xc0, 0x0, 0xf0, 0x0, 0x3c, 0x0, 0xf, - 0x0, 0x3, 0xc0, 0x0, 0xf0, 0x0, 0x3e, 0x0, - 0x7, 0x80, 0x1, 0xfe, 0x0, 0x3f, 0xf0, 0x7, - 0xff, 0x0, 0x3, 0xf0, 0x0, 0x1e, 0x0, 0x3, - 0xc0, 0x0, 0x3c, 0x0, 0x7, 0x80, 0x0, 0xf0, + 0x0, 0x3, 0xe0, 0x0, 0x78, 0x0, 0x1e, 0x0, + 0x7, 0x80, 0x1, 0xfc, 0x0, 0x3f, 0xe0, 0x7, + 0xfe, 0x0, 0xff, 0xe0, 0x0, 0x3e, 0x0, 0x3, + 0xc0, 0x0, 0x7c, 0x0, 0x7, 0x80, 0x0, 0xf0, 0x0, 0x1e, 0x0, 0x3, 0xfc, 0x0, 0x7f, 0x80, - 0xf, 0xf0, 0x1, 0xef, 0x0, 0x79, 0xf0, 0x1f, + 0xf, 0xf0, 0x1, 0xff, 0x0, 0x79, 0xe0, 0x1f, 0x1f, 0x7, 0xc3, 0xff, 0xf0, 0x1f, 0xfc, 0x0, 0xfe, 0x0, @@ -245,7 +245,7 @@ lv_font_t jetbrains_mono_42 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8 .underline_position = -7, .underline_thickness = 2, #endif diff --git a/src/displayapp/fonts/jetbrains_mono_76.c b/src/displayapp/fonts/jetbrains_mono_76.c index 9c92e144..2200e393 100644 --- a/src/displayapp/fonts/jetbrains_mono_76.c +++ b/src/displayapp/fonts/jetbrains_mono_76.c @@ -175,30 +175,30 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* U+0032 "2" */ - 0x0, 0x7, 0xfc, 0x0, 0x0, 0x1f, 0xff, 0xe0, + 0x0, 0xf, 0xfc, 0x0, 0x0, 0x1f, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xfe, 0x0, 0xf, 0xff, 0xff, - 0xe0, 0x7, 0xff, 0xff, 0xfc, 0x3, 0xff, 0xff, - 0xff, 0x81, 0xff, 0xc0, 0x7f, 0xe0, 0xff, 0x80, + 0xc0, 0x7, 0xff, 0xff, 0xf8, 0x3, 0xff, 0xff, + 0xff, 0x1, 0xff, 0xc0, 0x7f, 0xe0, 0xff, 0x80, 0x7, 0xfc, 0x3f, 0xc0, 0x0, 0xff, 0x1f, 0xe0, 0x0, 0x1f, 0xe7, 0xf0, 0x0, 0x3, 0xf9, 0xfc, - 0x0, 0x0, 0xfe, 0xff, 0x0, 0x0, 0x1f, 0xff, + 0x0, 0x0, 0xfe, 0xff, 0x0, 0x0, 0x3f, 0xff, 0x80, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x1, 0xff, 0xf8, 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, 0x1f, 0xc0, 0x0, 0x0, 0x7, 0xf0, 0x0, 0x0, 0x1, 0xfc, 0x0, 0x0, 0x0, 0x7f, 0x0, 0x0, 0x0, - 0x3f, 0xc0, 0x0, 0x0, 0xf, 0xe0, 0x0, 0x0, - 0x7, 0xf8, 0x0, 0x0, 0x1, 0xfe, 0x0, 0x0, - 0x0, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xc0, 0x0, + 0x3f, 0x80, 0x0, 0x0, 0xf, 0xe0, 0x0, 0x0, + 0x7, 0xf8, 0x0, 0x0, 0x1, 0xfc, 0x0, 0x0, + 0x0, 0xff, 0x0, 0x0, 0x0, 0x3f, 0x80, 0x0, 0x0, 0x1f, 0xe0, 0x0, 0x0, 0xf, 0xf0, 0x0, - 0x0, 0x7, 0xfc, 0x0, 0x0, 0x3, 0xfe, 0x0, - 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x7f, 0xc0, - 0x0, 0x0, 0x3f, 0xe0, 0x0, 0x0, 0x1f, 0xf0, + 0x0, 0x7, 0xf8, 0x0, 0x0, 0x3, 0xfe, 0x0, + 0x0, 0x1, 0xff, 0x0, 0x0, 0x0, 0xff, 0x80, + 0x0, 0x0, 0x3f, 0xc0, 0x0, 0x0, 0x1f, 0xe0, 0x0, 0x0, 0xf, 0xf8, 0x0, 0x0, 0x7, 0xfc, 0x0, 0x0, 0x3, 0xfe, 0x0, 0x0, 0x1, 0xff, 0x0, 0x0, 0x0, 0xff, 0x80, 0x0, 0x0, 0x7f, 0xc0, 0x0, 0x0, 0x3f, 0xe0, 0x0, 0x0, 0x1f, - 0xf8, 0x0, 0x0, 0xf, 0xfc, 0x0, 0x0, 0x7, - 0xfe, 0x0, 0x0, 0x1, 0xff, 0x0, 0x0, 0x0, + 0xf0, 0x0, 0x0, 0xf, 0xf8, 0x0, 0x0, 0x7, + 0xfc, 0x0, 0x0, 0x3, 0xfe, 0x0, 0x0, 0x0, 0xff, 0x80, 0x0, 0x0, 0x7f, 0xc0, 0x0, 0x0, 0x3f, 0xe0, 0x0, 0x0, 0x1f, 0xf0, 0x0, 0x0, 0xf, 0xf8, 0x0, 0x0, 0x7, 0xfc, 0x0, 0x0, @@ -214,22 +214,22 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0x80, 0x0, 0x0, 0xf, 0xe0, 0x0, 0x0, 0x7, 0xf0, 0x0, 0x0, 0x3, 0xf8, 0x0, 0x0, 0x1, 0xfc, 0x0, 0x0, 0x0, 0xfe, 0x0, 0x0, - 0x0, 0x7f, 0x80, 0x0, 0x0, 0x1f, 0xc0, 0x0, - 0x0, 0xf, 0xe0, 0x0, 0x0, 0x7, 0xf0, 0x0, + 0x0, 0x7f, 0x80, 0x0, 0x0, 0x3f, 0xc0, 0x0, + 0x0, 0x1f, 0xe0, 0x0, 0x0, 0x7, 0xf0, 0x0, 0x0, 0x3, 0xf8, 0x0, 0x0, 0x1, 0xfc, 0x0, - 0x0, 0x0, 0xfe, 0x0, 0x0, 0x0, 0x7f, 0x80, + 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x7f, 0x80, 0x0, 0x0, 0x3f, 0xc0, 0x0, 0x0, 0x1f, 0xe0, - 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, 0x1, 0xff, + 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x1, 0xff, 0xfc, 0x0, 0x0, 0x7f, 0xff, 0xc0, 0x0, 0x1f, 0xff, 0xf8, 0x0, 0x7, 0xff, 0xff, 0x0, 0x1, - 0xff, 0xff, 0xe0, 0x0, 0x0, 0x1f, 0xfc, 0x0, - 0x0, 0x1, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xe0, + 0xff, 0xff, 0xe0, 0x0, 0x0, 0xf, 0xfc, 0x0, + 0x0, 0x1, 0xff, 0x0, 0x0, 0x0, 0x1f, 0xe0, 0x0, 0x0, 0x7, 0xf8, 0x0, 0x0, 0x0, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xc0, 0x0, 0x0, 0x7, 0xf0, 0x0, 0x0, 0x1, 0xfc, 0x0, 0x0, 0x0, 0x7f, 0x0, 0x0, 0x0, 0x1f, 0xc0, 0x0, 0x0, 0x7, 0xf0, 0x0, 0x0, 0x1, 0xfc, 0x0, 0x0, - 0x0, 0x7f, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x80, + 0x0, 0x7f, 0xfe, 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x1, 0xff, 0xf8, 0x0, 0x0, 0x7f, 0xff, 0x0, 0x0, 0x3f, 0xdf, 0xc0, 0x0, 0xf, 0xe7, 0xf8, 0x0, 0x7, 0xf9, @@ -466,10 +466,10 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 878, .adv_w = 730, .box_w = 34, .box_h = 56, .ofs_x = 7, .ofs_y = 0}, {.bitmap_index = 1116, .adv_w = 730, .box_w = 34, .box_h = 57, .ofs_x = 6, .ofs_y = 0}, {.bitmap_index = 1359, .adv_w = 730, .box_w = 34, .box_h = 57, .ofs_x = 5, .ofs_y = -1}, - {.bitmap_index = 1602, .adv_w = 730, .box_w = 32, .box_h = 56, .ofs_x = 6, .ofs_y = 0}, + {.bitmap_index = 1602, .adv_w = 730, .box_w = 32, .box_h = 56, .ofs_x = 5, .ofs_y = 0}, {.bitmap_index = 1826, .adv_w = 730, .box_w = 32, .box_h = 57, .ofs_x = 7, .ofs_y = -1}, {.bitmap_index = 2054, .adv_w = 730, .box_w = 36, .box_h = 58, .ofs_x = 5, .ofs_y = -1}, - {.bitmap_index = 2315, .adv_w = 730, .box_w = 36, .box_h = 56, .ofs_x = 5, .ofs_y = 0}, + {.bitmap_index = 2315, .adv_w = 730, .box_w = 36, .box_h = 56, .ofs_x = 6, .ofs_y = 0}, {.bitmap_index = 2567, .adv_w = 730, .box_w = 36, .box_h = 58, .ofs_x = 5, .ofs_y = -1}, {.bitmap_index = 2828, .adv_w = 730, .box_w = 36, .box_h = 57, .ofs_x = 5, .ofs_y = 0}, {.bitmap_index = 3085, .adv_w = 730, .box_w = 13, .box_h = 44, .ofs_x = 16, .ofs_y = -1} @@ -541,7 +541,7 @@ lv_font_t jetbrains_mono_76 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8 .underline_position = -12, .underline_thickness = 4, #endif diff --git a/src/displayapp/fonts/jetbrains_mono_bold_20.c b/src/displayapp/fonts/jetbrains_mono_bold_20.c index 6cd7aead..cc67532a 100644 --- a/src/displayapp/fonts/jetbrains_mono_bold_20.c +++ b/src/displayapp/fonts/jetbrains_mono_bold_20.c @@ -32,9 +32,9 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xef, 0xdf, 0xbf, 0x7e, 0xfd, 0xc0, /* U+0023 "#" */ - 0x8, 0xc3, 0x10, 0x66, 0x3f, 0xf7, 0xfe, 0x23, - 0x4, 0x61, 0x88, 0x31, 0x1f, 0xfb, 0xff, 0x19, - 0x82, 0x30, 0xc4, 0x0, + 0x8, 0xc3, 0x18, 0x62, 0x3f, 0xf7, 0xfe, 0x23, + 0xc, 0x61, 0x88, 0xff, 0xdf, 0xf8, 0x8c, 0x11, + 0x86, 0x30, 0xc4, 0x0, /* U+0024 "$" */ 0x8, 0x2, 0x0, 0x81, 0xfc, 0x7f, 0xba, 0x7e, @@ -93,11 +93,11 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x8f, 0xc0, /* U+0031 "1" */ - 0x1e, 0x3f, 0x3b, 0x99, 0xc8, 0xe0, 0x70, 0x38, + 0x1e, 0x3f, 0x3f, 0x99, 0xc8, 0xe0, 0x70, 0x38, 0x1c, 0xe, 0x7, 0x3, 0x81, 0xcf, 0xff, 0xfc, /* U+0032 "2" */ - 0x3e, 0x3f, 0xbc, 0xfc, 0x70, 0x38, 0x1c, 0x1c, + 0x3e, 0x3f, 0xbd, 0xfc, 0x70, 0x38, 0x1c, 0x1c, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0xf, 0xff, 0xfc, /* U+0033 "3" */ @@ -122,7 +122,7 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { /* U+0037 "7" */ 0xff, 0xff, 0xfe, 0x1f, 0x86, 0x3, 0x80, 0xe0, 0x30, 0x1c, 0x6, 0x3, 0x80, 0xc0, 0x70, 0x1c, - 0x6, 0x0, + 0xe, 0x0, /* U+0038 "8" */ 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xdc, 0xe3, @@ -157,7 +157,7 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x30, 0x30, 0x0, 0x0, 0x70, 0x70, /* U+0040 "@" */ - 0x1f, 0x7, 0xf9, 0xc3, 0x70, 0x3c, 0x7, 0x8f, + 0x1f, 0x7, 0xf9, 0xc3, 0x70, 0x3c, 0x7, 0x8e, 0xf3, 0xfe, 0x63, 0xcc, 0x79, 0x8f, 0x31, 0xe6, 0x3c, 0xff, 0x8e, 0xf8, 0x3, 0x80, 0x3e, 0x3, 0xc0, @@ -168,8 +168,8 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xf0, 0x30, /* U+0042 "B" */ - 0xfe, 0x3f, 0xce, 0x3b, 0x8e, 0xe3, 0xb8, 0xcf, - 0xe3, 0xfc, 0xe3, 0xb8, 0x7e, 0x1f, 0x8f, 0xff, + 0xfe, 0x3f, 0xce, 0x3b, 0x8e, 0xe3, 0xb8, 0xef, + 0xe3, 0xfc, 0xe3, 0xf8, 0x7e, 0x1f, 0x8f, 0xff, 0xbf, 0xc0, /* U+0043 "C" */ @@ -217,9 +217,9 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0xf, 0xff, 0xfc, /* U+004D "M" */ - 0xe1, 0xf8, 0x7f, 0x3f, 0xcf, 0xd2, 0xf7, 0xbd, - 0xef, 0x33, 0xc0, 0xf0, 0x3c, 0xf, 0x3, 0xc0, - 0xf0, 0x30, + 0xf3, 0xfc, 0xfd, 0x3f, 0xcf, 0xff, 0xff, 0xfe, + 0xdf, 0xb7, 0xe1, 0xf8, 0x7e, 0x1f, 0x87, 0xe1, + 0xf8, 0x70, /* U+004E "N" */ 0xe1, 0xf0, 0xfc, 0x7e, 0x3f, 0x9e, 0xcf, 0x67, @@ -245,7 +245,7 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xb8, 0x70, /* U+0053 "S" */ - 0x3f, 0x1f, 0xee, 0x3f, 0x87, 0xe0, 0x3c, 0x7, + 0x3f, 0x1f, 0xee, 0x3f, 0x87, 0xe0, 0x3e, 0x7, 0xf0, 0xfe, 0x3, 0xc0, 0x7e, 0x1f, 0xcf, 0x7f, 0x8f, 0xc0, @@ -260,7 +260,7 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { /* U+0056 "V" */ 0xc0, 0xf8, 0x7e, 0x1d, 0x86, 0x61, 0x9c, 0xe7, - 0x38, 0xcc, 0x33, 0xf, 0xc3, 0xf0, 0x78, 0x1e, + 0x38, 0xcc, 0x33, 0xe, 0xc3, 0xf0, 0x78, 0x1e, 0x7, 0x80, /* U+0057 "W" */ @@ -314,8 +314,8 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xc7, 0xe3, 0xf1, 0xf8, 0xfc, 0x7f, 0xf7, 0x70, /* U+0063 "c" */ - 0x3e, 0x3f, 0xb8, 0xfc, 0x7e, 0x7, 0x3, 0x81, - 0xc7, 0xe3, 0xbf, 0x8f, 0x80, + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe0, 0x38, 0xe, + 0x3, 0x87, 0xf3, 0xdf, 0xe3, 0xf0, /* U+0064 "d" */ 0x3, 0x81, 0xc0, 0xe7, 0x77, 0xff, 0x1f, 0x8f, @@ -382,12 +382,12 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xe, /* U+0072 "r" */ - 0xee, 0x7f, 0xb9, 0xfc, 0x7e, 0x3f, 0x3, 0x81, + 0xee, 0x7f, 0xb8, 0xfc, 0x7e, 0x3f, 0x3, 0x81, 0xc0, 0xe0, 0x70, 0x38, 0x0, /* U+0073 "s" */ 0x1f, 0x1f, 0xf7, 0x1d, 0xc0, 0x7c, 0xf, 0xe0, - 0x3c, 0x7, 0x71, 0xdf, 0xe3, 0xf0, + 0x3c, 0x7, 0x71, 0xdf, 0xf3, 0xf0, /* U+0074 "t" */ 0x1c, 0x7, 0x1, 0xc3, 0xff, 0xff, 0xc7, 0x1, @@ -399,12 +399,12 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xc7, 0xe3, 0xbf, 0x8f, 0x80, /* U+0076 "v" */ - 0xe0, 0xf8, 0x76, 0x19, 0x86, 0x73, 0x8c, 0xc3, + 0xc0, 0xf8, 0x7e, 0x1d, 0x86, 0x73, 0x8c, 0xc3, 0x30, 0xfc, 0x1e, 0x7, 0x81, 0xe0, /* U+0077 "w" */ - 0xe6, 0x36, 0x66, 0x66, 0x66, 0xf6, 0x6f, 0x66, - 0x96, 0x69, 0x62, 0x94, 0x39, 0xc3, 0x9c, 0x39, + 0xc6, 0x36, 0x66, 0x66, 0x66, 0xf6, 0x6f, 0x66, + 0x96, 0x69, 0x62, 0x94, 0x29, 0x43, 0x9c, 0x39, 0xc0, /* U+0078 "x" */ @@ -412,7 +412,7 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xe0, 0xfc, 0x73, 0x9c, 0xee, 0x1c, /* U+0079 "y" */ - 0xe1, 0xf8, 0x76, 0x19, 0xce, 0x73, 0x8c, 0xc3, + 0xe0, 0xf8, 0x76, 0x19, 0xce, 0x73, 0x8c, 0xc3, 0xf0, 0x7c, 0x1e, 0x7, 0x80, 0xe0, 0x30, 0x1c, 0x6, 0x3, 0x80, @@ -421,17 +421,17 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xe0, 0xe0, 0x7f, 0xff, 0xe0, /* U+007B "{" */ - 0x3, 0x87, 0xc3, 0x81, 0xc0, 0xe0, 0x70, 0x38, + 0x7, 0x87, 0xc3, 0x81, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0xfc, 0x7e, 0x3, 0x81, 0xc0, 0xe0, 0x70, - 0x38, 0x1c, 0xf, 0x81, 0xc0, + 0x30, 0x1c, 0xf, 0x83, 0xc0, /* U+007C "|" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, /* U+007D "}" */ - 0xf0, 0x3e, 0x1, 0xc0, 0x70, 0x1c, 0x7, 0x1, - 0xc0, 0x70, 0xf, 0xc3, 0xf1, 0xc0, 0x70, 0x1c, - 0x7, 0x1, 0xc0, 0x70, 0xf8, 0x3c, 0x0, + 0xf0, 0x7c, 0xe, 0x7, 0x3, 0x81, 0xc0, 0xe0, + 0x70, 0x1f, 0x8f, 0xce, 0x7, 0x3, 0x81, 0xc0, + 0x60, 0x70, 0xf8, 0x78, 0x0, /* U+007E "~" */ 0x78, 0xff, 0x3c, 0xcf, 0x3f, 0xc7, 0x80, @@ -447,8 +447,8 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xbf, 0xc0, /* U+0412 "В" */ - 0xfe, 0x3f, 0xce, 0x3b, 0x8e, 0xe3, 0xb8, 0xcf, - 0xe3, 0xfc, 0xe3, 0xb8, 0x7e, 0x1f, 0x8f, 0xff, + 0xfe, 0x3f, 0xce, 0x3b, 0x8e, 0xe3, 0xb8, 0xef, + 0xe3, 0xfc, 0xe3, 0xf8, 0x7e, 0x1f, 0x8f, 0xff, 0xbf, 0xc0, /* U+0413 "Г" */ @@ -470,9 +470,9 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x66, 0x66, 0x66, 0x6c, 0x63, /* U+0417 "З" */ - 0x1f, 0xf, 0xf3, 0xc7, 0x0, 0x60, 0x1c, 0x1e, - 0x3, 0xf0, 0xe, 0x0, 0xe0, 0x1f, 0x83, 0xf8, - 0xf7, 0xfc, 0x3e, 0x0, + 0x3f, 0x1f, 0xef, 0x1f, 0x87, 0x1, 0xc7, 0xc1, + 0xf8, 0xf, 0x1, 0xc0, 0x7e, 0x1f, 0xcf, 0x7f, + 0x8f, 0x80, /* U+0418 "И" */ 0xc3, 0xe3, 0xf1, 0xf8, 0xfc, 0xde, 0x6f, 0x37, @@ -494,9 +494,9 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xf8, 0x70, /* U+041C "М" */ - 0xe1, 0xf8, 0x7f, 0x3f, 0xcf, 0xd2, 0xf7, 0xbd, - 0xef, 0x33, 0xc0, 0xf0, 0x3c, 0xf, 0x3, 0xc0, - 0xf0, 0x30, + 0xf3, 0xfc, 0xfd, 0x3f, 0xcf, 0xff, 0xff, 0xfe, + 0xdf, 0xb7, 0xe1, 0xf8, 0x7e, 0x1f, 0x87, 0xe1, + 0xf8, 0x70, /* U+041D "Н" */ 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0xff, @@ -546,7 +546,7 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xf0, 0x1c, 0x7, 0x1, 0xc0, /* U+0427 "Ч" */ - 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0xce, + 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0x8f, 0xff, 0x3f, 0x81, 0xc0, 0xe0, 0x70, 0x38, 0x1c, /* U+0428 "Ш" */ @@ -593,8 +593,8 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x1f, 0x87, 0xe3, 0xff, 0xf3, 0xdc, /* U+0431 "б" */ - 0x1f, 0x3f, 0x9c, 0x1c, 0xe, 0xe7, 0xfb, 0x8f, - 0xc7, 0xe3, 0xf1, 0xf8, 0xfc, 0x77, 0xf1, 0xf0, + 0x1f, 0x3f, 0x9c, 0x1c, 0xe, 0xe7, 0xfb, 0x9f, + 0xc7, 0xe3, 0xf1, 0xf8, 0xfe, 0xf7, 0xf1, 0xf0, /* U+0432 "в" */ 0xff, 0x3f, 0xee, 0x3b, 0x8e, 0xfe, 0x3f, 0xee, @@ -619,7 +619,7 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x70, /* U+0437 "з" */ - 0x3f, 0x1f, 0xfe, 0x1c, 0x7, 0x1f, 0x87, 0xe0, + 0x3f, 0x1f, 0xfe, 0x1c, 0x7, 0x1f, 0x7, 0xe0, 0x1c, 0x7, 0xe1, 0xdf, 0xe3, 0xf0, /* U+0438 "и" */ @@ -632,8 +632,8 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xc7, 0xc3, /* U+043A "к" */ - 0xe1, 0xf8, 0xee, 0x33, 0x9c, 0xfe, 0x3f, 0x8e, - 0x73, 0x9c, 0xe3, 0xb8, 0x6e, 0x1c, + 0xe1, 0xf8, 0xee, 0x3b, 0x9c, 0xfe, 0x3f, 0x8e, + 0x73, 0x8c, 0xe3, 0xb8, 0x6e, 0x1c, /* U+043B "л" */ 0x3f, 0xcf, 0xf3, 0x9c, 0xe7, 0x39, 0xce, 0x73, @@ -644,7 +644,7 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xef, 0x33, 0xc0, 0xf0, 0x3c, 0xc, /* U+043D "н" */ - 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0xff, 0xff, + 0xe3, 0xf1, 0xf8, 0xfc, 0x7f, 0xff, 0xff, 0x8f, 0xc7, 0xe3, 0xf1, 0xf8, 0xe0, /* U+043E "о" */ @@ -661,15 +661,15 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x80, /* U+0441 "с" */ - 0x3e, 0x3f, 0xb8, 0xfc, 0x7e, 0x7, 0x3, 0x81, - 0xc7, 0xe3, 0xbf, 0x8f, 0x80, + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe0, 0x38, 0xe, + 0x3, 0x87, 0xf3, 0xdf, 0xe3, 0xf0, /* U+0442 "т" */ 0xff, 0xff, 0xf0, 0xe0, 0x38, 0xe, 0x3, 0x80, 0xe0, 0x38, 0xe, 0x3, 0x80, 0xe0, /* U+0443 "у" */ - 0xe1, 0xf8, 0x76, 0x19, 0xce, 0x73, 0x8c, 0xc3, + 0xe0, 0xf8, 0x76, 0x19, 0xce, 0x73, 0x8c, 0xc3, 0xf0, 0x7c, 0x1e, 0x7, 0x80, 0xe0, 0x30, 0x1c, 0x6, 0x3, 0x80, @@ -688,7 +688,7 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xc0, 0x70, /* U+0447 "ч" */ - 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3b, 0xfc, 0xfe, + 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0xfd, 0xfe, 0x7, 0x3, 0x81, 0xc0, 0xe0, /* U+0448 "ш" */ @@ -714,8 +714,8 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x1f, 0x87, 0xe1, 0xff, 0xef, 0xf0, /* U+044D "э" */ - 0x3e, 0x3f, 0xb8, 0xe0, 0x70, 0xf8, 0x7c, 0xf, - 0xc7, 0xe7, 0xbf, 0x8f, 0x80, + 0x1f, 0x1f, 0xe6, 0x3c, 0x7, 0xf, 0xc3, 0xf0, + 0x1d, 0x87, 0x73, 0xdf, 0xe1, 0xf0, /* U+044E "ю" */ 0xc7, 0xb3, 0xfc, 0xcf, 0x33, 0xfc, 0xff, 0x3c, @@ -1123,139 +1123,139 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 975, .adv_w = 192, .box_w = 5, .box_h = 3, .ofs_x = 3, .ofs_y = 13}, {.bitmap_index = 977, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 991, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1007, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1020, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1036, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1049, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1067, .adv_w = 192, .box_w = 9, .box_h = 15, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 1084, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1100, .adv_w = 192, .box_w = 10, .box_h = 16, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1120, .adv_w = 192, .box_w = 8, .box_h = 19, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 1139, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1157, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 1177, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1191, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1204, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1217, .adv_w = 192, .box_w = 9, .box_h = 15, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 1234, .adv_w = 192, .box_w = 9, .box_h = 15, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 1251, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1264, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1278, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1296, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1309, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1323, .adv_w = 192, .box_w = 12, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 1340, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1354, .adv_w = 192, .box_w = 10, .box_h = 15, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 1373, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1386, .adv_w = 192, .box_w = 9, .box_h = 18, .ofs_x = 2, .ofs_y = -2}, - {.bitmap_index = 1407, .adv_w = 192, .box_w = 3, .box_h = 18, .ofs_x = 5, .ofs_y = -2}, - {.bitmap_index = 1414, .adv_w = 192, .box_w = 10, .box_h = 18, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 1437, .adv_w = 192, .box_w = 10, .box_h = 5, .ofs_x = 1, .ofs_y = 5}, - {.bitmap_index = 1444, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1462, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1480, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1498, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1514, .adv_w = 192, .box_w = 11, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 1538, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1554, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 1575, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1595, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1611, .adv_w = 192, .box_w = 9, .box_h = 19, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1633, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1651, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1669, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1687, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1703, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1719, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1735, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1753, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1771, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1789, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1807, .adv_w = 192, .box_w = 10, .box_h = 16, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 1827, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1845, .adv_w = 192, .box_w = 10, .box_h = 17, .ofs_x = 2, .ofs_y = -3}, - {.bitmap_index = 1867, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1883, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1901, .adv_w = 192, .box_w = 11, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 1923, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 1944, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1962, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1980, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1996, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2014, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2032, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2046, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2062, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2076, .adv_w = 192, .box_w = 8, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2087, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 2107, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2120, .adv_w = 192, .box_w = 12, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2137, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2151, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2164, .adv_w = 192, .box_w = 9, .box_h = 16, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2182, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2196, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2210, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2224, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2237, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2250, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2263, .adv_w = 192, .box_w = 9, .box_h = 15, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 2280, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2293, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2307, .adv_w = 192, .box_w = 10, .box_h = 15, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 2326, .adv_w = 192, .box_w = 10, .box_h = 18, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 2349, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2363, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = -3}, - {.bitmap_index = 2381, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2394, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2408, .adv_w = 192, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 2426, .adv_w = 192, .box_w = 12, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2443, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2457, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 2471, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2484, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2498, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 2511, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 2561, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2610, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 2658, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 2708, .adv_w = 240, .box_w = 15, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2737, .adv_w = 360, .box_w = 23, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 2792, .adv_w = 280, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2831, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2874, .adv_w = 280, .box_w = 13, .box_h = 17, .ofs_x = 2, .ofs_y = -1}, - {.bitmap_index = 2902, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 2950, .adv_w = 280, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2989, .adv_w = 280, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 3028, .adv_w = 280, .box_w = 13, .box_h = 17, .ofs_x = 2, .ofs_y = -1}, - {.bitmap_index = 3056, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3104, .adv_w = 360, .box_w = 23, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3148, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3209, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3262, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3281, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3331, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3367, .adv_w = 320, .box_w = 20, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3415, .adv_w = 320, .box_w = 21, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3455, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 3498, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3536, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3574, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3612, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3650, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3688, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3724, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 3762, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3791, .adv_w = 280, .box_w = 16, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 3829, .adv_w = 400, .box_w = 25, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3895, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 3944, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3994, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 4054, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 4107, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 4168, .adv_w = 360, .box_w = 22, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 4223, .adv_w = 360, .box_w = 22, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 4276, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 1007, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1021, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1037, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1050, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1068, .adv_w = 192, .box_w = 9, .box_h = 15, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 1085, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1101, .adv_w = 192, .box_w = 10, .box_h = 16, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1121, .adv_w = 192, .box_w = 8, .box_h = 19, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 1140, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1158, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1178, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1192, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1205, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1218, .adv_w = 192, .box_w = 9, .box_h = 15, .ofs_x = 2, .ofs_y = -4}, + {.bitmap_index = 1235, .adv_w = 192, .box_w = 9, .box_h = 15, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 1252, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1265, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1279, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1297, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1310, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1324, .adv_w = 192, .box_w = 12, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1341, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1355, .adv_w = 192, .box_w = 10, .box_h = 15, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 1374, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1387, .adv_w = 192, .box_w = 9, .box_h = 18, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 1408, .adv_w = 192, .box_w = 3, .box_h = 18, .ofs_x = 5, .ofs_y = -2}, + {.bitmap_index = 1415, .adv_w = 192, .box_w = 9, .box_h = 18, .ofs_x = 2, .ofs_y = -2}, + {.bitmap_index = 1436, .adv_w = 192, .box_w = 10, .box_h = 5, .ofs_x = 1, .ofs_y = 5}, + {.bitmap_index = 1443, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1461, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1479, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1497, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1513, .adv_w = 192, .box_w = 11, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 1537, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1553, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1574, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1592, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1608, .adv_w = 192, .box_w = 9, .box_h = 19, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1630, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1648, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1666, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1684, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1700, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1716, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1732, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1750, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1768, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1786, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1804, .adv_w = 192, .box_w = 10, .box_h = 16, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 1824, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1842, .adv_w = 192, .box_w = 10, .box_h = 17, .ofs_x = 2, .ofs_y = -3}, + {.bitmap_index = 1864, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1880, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1898, .adv_w = 192, .box_w = 11, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 1920, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1941, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1959, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1977, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1993, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2011, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2029, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2043, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2059, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 2073, .adv_w = 192, .box_w = 8, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 2084, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 2104, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2117, .adv_w = 192, .box_w = 12, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2134, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2148, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 2161, .adv_w = 192, .box_w = 9, .box_h = 16, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 2179, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 2193, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2207, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2221, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 2234, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2247, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 2260, .adv_w = 192, .box_w = 9, .box_h = 15, .ofs_x = 2, .ofs_y = -4}, + {.bitmap_index = 2277, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2291, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2305, .adv_w = 192, .box_w = 10, .box_h = 15, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 2324, .adv_w = 192, .box_w = 10, .box_h = 18, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 2347, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2361, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = -3}, + {.bitmap_index = 2379, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2392, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2406, .adv_w = 192, .box_w = 11, .box_h = 13, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 2424, .adv_w = 192, .box_w = 12, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2441, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2455, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 2469, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2483, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2497, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2510, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 2560, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2609, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 2657, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 2707, .adv_w = 240, .box_w = 15, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2736, .adv_w = 360, .box_w = 23, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 2791, .adv_w = 280, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2830, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2873, .adv_w = 280, .box_w = 13, .box_h = 17, .ofs_x = 2, .ofs_y = -1}, + {.bitmap_index = 2901, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 2949, .adv_w = 280, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2988, .adv_w = 280, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 3027, .adv_w = 280, .box_w = 13, .box_h = 17, .ofs_x = 2, .ofs_y = -1}, + {.bitmap_index = 3055, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3103, .adv_w = 360, .box_w = 23, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3147, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3208, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3261, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3280, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3330, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3366, .adv_w = 320, .box_w = 20, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3414, .adv_w = 320, .box_w = 21, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3454, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 3497, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3535, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3573, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3611, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3649, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3687, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3723, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 3761, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3790, .adv_w = 280, .box_w = 16, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 3828, .adv_w = 400, .box_w = 25, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3894, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 3943, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3993, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 4053, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 4106, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 4167, .adv_w = 360, .box_w = 22, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 4222, .adv_w = 360, .box_w = 22, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 4275, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- diff --git a/src/displayapp/fonts/open_sans_light.c b/src/displayapp/fonts/open_sans_light.c index 15f0ddf6..84b78690 100644 --- a/src/displayapp/fonts/open_sans_light.c +++ b/src/displayapp/fonts/open_sans_light.c @@ -1248,7 +1248,7 @@ lv_font_t open_sans_light = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8 .underline_position = -11, .underline_thickness = 7, #endif -- cgit v1.2.3-70-g09d2 From 13c66dd54b6ffcd3ea529457c3d5a0864ca1bdae Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sun, 27 Feb 2022 14:53:06 +0200 Subject: Further updates to font readme. --- src/displayapp/fonts/README.md | 33 +- .../fonts/jetbrains_mono_extrabold_compressed.c | 772 +++++++++++---------- src/displayapp/fonts/lv_font_sys_48.c | 2 +- 3 files changed, 419 insertions(+), 388 deletions(-) (limited to 'src') diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md index c8fb0d35..2e900d12 100644 --- a/src/displayapp/fonts/README.md +++ b/src/displayapp/fonts/README.md @@ -29,9 +29,9 @@ static constexpr const char* newSymbol = "\xEF\x86\x85"; * Size: 20 * Bpp: 1 bit-per-pixel * Do not enable font compression or horizontal subpixel rendering -* Load the file `JetBrainsMono-Bold.tff` (use the file in this repo to ensure the version matches) and specify the following range : `0x20-0x7e, 0x410-0x44f` +* Load the file `JetBrainsMono-Bold.tff` (use the file in this repo to ensure the version matches) and specify the following range: `0x20-0x7e, 0x410-0x44f` * Add a 2nd font, load the file `FontAwesome5-Solid+Brands+Regular.woff` and specify the following - range : `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf201, 0xf06e, 0xf015, 0xf072` + range: `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf201, 0xf06e, 0xf015, 0xf072` * Fix an error in the font conversion. Replace the following: @@ -50,29 +50,44 @@ with (there are two changes: 7f -> 7e and f7 -> b7) - ### Medium font * Name: jetbrains_mono_42 * Size: 42 * Bpp: 1 bit-per-pixel * Do not enable font compression or horizontal subpixel rendering -* Load the file `JetBrainsMono-Regular.tff` (use the file in this repo to ensure the version matches) and specify the following range : `0x25, 0x30-0x3a` +* Load the file `JetBrainsMono-Regular.tff` (use the file in this repo to ensure the version matches) and specify the following range: `0x25, 0x30-0x3a` ### Large font * Name: jetbrains_mono_76 * Size: 76 * Bpp: 1 bit-per-pixel * Do not enable font compression or horizontal subpixel rendering -* Load the file `JetBrainsMono-Regular.tff` (use the file in this repo to ensure the version matches) and specify the following range : `0x25, 0x2D, 0x2F, 0x30-0x3a` +* Load the file `JetBrainsMono-Regular.tff` (use the file in this repo to ensure the version matches) and specify the following range: `0x25, 0x2D, 0x2F, 0x30-0x3a` + +### Digital watchface font + +* Name: jetbrains_mono_extrabold_compressed +* Size: 80 +* Bpp: 1 bit-per-pixel +* Do not enable font compression or horizontal subpixel rendering +* Load the file `JetBrainsMono-ExtraBold.tff` (use the file in this repo to ensure the version matches) and specify the following range: `0x30-0x3a` ### PineTimeStyle font -* Name : open_sans_light -* Size : 150 -* Bpp : 1 bit-per-pixel +* Name: open_sans_light +* Size: 150 +* Bpp: 1 bit-per-pixel +* Do not enable font compression or horizontal subpixel rendering +* Load the file `open_sans_light.tff` (use the file in this repo to ensure the version matches) and specify the following symbols: `0123456789` + +### Symbols font (Used in QuickSettings for example) + +* Name: lv_font_sys_48 +* Size: 48 +* Bpp: 1 bit-per-pixel * Do not enable font compression or horizontal subpixel rendering -* Load the file `open_sans_light.tff` (use the file in this repo to ensure the version matches) and specify the following symbols : `0123456789` +* Load the file `icons_sys_48.tff` (use the file in this repo to ensure the version matches) and specify the following range: `0xe902, 0xe904-0xe907, 0xe90b-0xe90c` #### Navigation font diff --git a/src/displayapp/fonts/jetbrains_mono_extrabold_compressed.c b/src/displayapp/fonts/jetbrains_mono_extrabold_compressed.c index c9917e40..ab0a5c4e 100644 --- a/src/displayapp/fonts/jetbrains_mono_extrabold_compressed.c +++ b/src/displayapp/fonts/jetbrains_mono_extrabold_compressed.c @@ -1,11 +1,15 @@ -#include "lvgl/lvgl.h" - /******************************************************************************* * Size: 80 px * Bpp: 1 * Opts: ******************************************************************************/ +#ifdef LV_LVGL_H_INCLUDE_SIMPLE +#include "lvgl.h" +#else +#include "lvgl/lvgl.h" +#endif + #ifndef JETBRAINS_MONO_EXTRABOLD_COMPRESSED #define JETBRAINS_MONO_EXTRABOLD_COMPRESSED 1 #endif @@ -17,418 +21,412 @@ *----------------*/ /*Store the image of the glyphs*/ -static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { - /* U+30 "0" */ - 0x0, 0x1, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, - 0xfe, 0x0, 0x0, 0x1f, 0xff, 0xff, 0xc0, 0x0, - 0x3f, 0xff, 0xff, 0xf8, 0x0, 0x3f, 0xff, 0xff, - 0xfe, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x80, 0x3f, - 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, - 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, - 0xff, 0xff, 0xff, 0x1f, 0xff, 0xe0, 0x3f, 0xff, - 0xcf, 0xff, 0xc0, 0x7, 0xff, 0xe7, 0xff, 0xc0, - 0x1, 0xff, 0xf7, 0xff, 0xc0, 0x0, 0x7f, 0xff, - 0xff, 0xe0, 0x0, 0x3f, 0xff, 0xff, 0xe0, 0x0, - 0xf, 0xff, 0xff, 0xf0, 0x0, 0x7, 0xff, 0xff, - 0xf8, 0x0, 0x3, 0xff, 0xff, 0xfc, 0x0, 0x1, - 0xff, 0xff, 0xfe, 0x0, 0x0, 0xff, 0xff, 0xff, - 0x0, 0x0, 0x7f, 0xff, 0xff, 0x80, 0x0, 0x3f, - 0xff, 0xff, 0xc0, 0x70, 0x1f, 0xff, 0xff, 0xe0, - 0x7c, 0xf, 0xff, 0xff, 0xf0, 0x7f, 0x7, 0xff, - 0xff, 0xf8, 0x3f, 0x83, 0xff, 0xff, 0xfc, 0x1f, - 0xc1, 0xff, 0xff, 0xfe, 0xf, 0xe0, 0xff, 0xff, - 0xff, 0x7, 0xf0, 0x7f, 0xff, 0xff, 0x83, 0xf8, - 0x3f, 0xff, 0xff, 0xc1, 0xfc, 0x1f, 0xff, 0xff, - 0xe0, 0xfe, 0xf, 0xff, 0xff, 0xf0, 0x7f, 0x7, - 0xff, 0xff, 0xf8, 0x3f, 0x83, 0xff, 0xff, 0xfc, - 0x1f, 0xc1, 0xff, 0xff, 0xfe, 0xf, 0xe0, 0xff, - 0xff, 0xff, 0x3, 0xe0, 0x7f, 0xff, 0xff, 0x80, - 0xe0, 0x3f, 0xff, 0xff, 0xc0, 0x0, 0x1f, 0xff, - 0xff, 0xe0, 0x0, 0xf, 0xff, 0xff, 0xf0, 0x0, - 0x7, 0xff, 0xff, 0xf8, 0x0, 0x3, 0xff, 0xff, - 0xfc, 0x0, 0x1, 0xff, 0xff, 0xfe, 0x0, 0x0, - 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xff, 0xff, - 0xc0, 0x0, 0x7f, 0xf9, 0xff, 0xf0, 0x0, 0x7f, - 0xfc, 0xff, 0xfc, 0x0, 0x7f, 0xfe, 0x7f, 0xff, - 0x80, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, - 0x7, 0xff, 0xff, 0xff, 0xff, 0x3, 0xff, 0xff, - 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0x80, - 0x3f, 0xff, 0xff, 0xff, 0x80, 0xf, 0xff, 0xff, - 0xff, 0x80, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, - 0x7f, 0xff, 0xff, 0x0, 0x0, 0xf, 0xff, 0xfc, - 0x0, 0x0, 0x0, 0x7f, 0xf0, 0x0, 0x0, - - /* U+31 "1" */ - 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0xf, 0xff, - 0xe0, 0x0, 0x0, 0x3f, 0xff, 0xe0, 0x0, 0x0, - 0x7f, 0xff, 0xe0, 0x0, 0x1, 0xff, 0xff, 0xe0, - 0x0, 0x3, 0xff, 0xff, 0xe0, 0x0, 0x7, 0xff, - 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xe0, 0x0, - 0x3f, 0xff, 0xff, 0xe0, 0x0, 0x7f, 0xff, 0xff, - 0xe0, 0x0, 0x7f, 0xff, 0xff, 0xe0, 0x0, 0x7f, - 0xfd, 0xff, 0xe0, 0x0, 0x7f, 0xf9, 0xff, 0xe0, - 0x0, 0x7f, 0xf1, 0xff, 0xe0, 0x0, 0x7f, 0xe1, - 0xff, 0xe0, 0x0, 0x7f, 0x81, 0xff, 0xe0, 0x0, - 0x7f, 0x1, 0xff, 0xe0, 0x0, 0x7c, 0x1, 0xff, - 0xe0, 0x0, 0x78, 0x1, 0xff, 0xe0, 0x0, 0x60, - 0x1, 0xff, 0xe0, 0x0, 0x40, 0x1, 0xff, 0xe0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, - 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, - 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, - 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, - 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, - 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, - 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, - 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, - 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, - 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, - 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, +static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { + /* U+0030 "0" */ + 0x0, 0x3, 0xff, 0x80, 0x0, 0x0, 0x3f, 0xff, + 0xe0, 0x0, 0x1, 0xff, 0xff, 0xf0, 0x0, 0xf, + 0xff, 0xff, 0xf8, 0x0, 0x3f, 0xff, 0xff, 0xf8, + 0x0, 0xff, 0xff, 0xff, 0xf8, 0x3, 0xff, 0xff, + 0xff, 0xf8, 0xf, 0xff, 0xff, 0xff, 0xf8, 0x3f, + 0xff, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xff, 0xff, + 0xf1, 0xff, 0xfc, 0x7, 0xff, 0xf3, 0xff, 0xe0, + 0x3, 0xff, 0xe7, 0xff, 0x80, 0x3, 0xff, 0xdf, + 0xfe, 0x0, 0x3, 0xff, 0xff, 0xfc, 0x0, 0x3, + 0xff, 0xff, 0xf0, 0x0, 0x7, 0xff, 0xff, 0xe0, + 0x0, 0xf, 0xff, 0xff, 0xc0, 0x0, 0x1f, 0xff, + 0xff, 0x80, 0x0, 0x3f, 0xff, 0xff, 0x0, 0x0, + 0x7f, 0xff, 0xfe, 0x0, 0x0, 0xff, 0xff, 0xfc, + 0x0, 0x1, 0xff, 0xff, 0xf8, 0x0, 0x3, 0xff, + 0xff, 0xf0, 0x0, 0x7, 0xff, 0xff, 0xe0, 0x7c, + 0xf, 0xff, 0xff, 0xc1, 0xfe, 0x1f, 0xff, 0xff, + 0x87, 0xfc, 0x3f, 0xff, 0xff, 0x1f, 0xfc, 0x7f, + 0xff, 0xfe, 0x3f, 0xf8, 0xff, 0xff, 0xfc, 0x7f, + 0xf1, 0xff, 0xff, 0xf8, 0xff, 0xe3, 0xff, 0xff, + 0xf1, 0xff, 0xc7, 0xff, 0xff, 0xe1, 0xff, 0xf, + 0xff, 0xff, 0xc1, 0xfc, 0x1f, 0xff, 0xff, 0x81, + 0xf0, 0x3f, 0xff, 0xff, 0x0, 0x0, 0x7f, 0xff, + 0xfe, 0x0, 0x0, 0xff, 0xff, 0xfc, 0x0, 0x1, + 0xff, 0xff, 0xf8, 0x0, 0x3, 0xff, 0xff, 0xf0, + 0x0, 0x7, 0xff, 0xff, 0xe0, 0x0, 0xf, 0xff, + 0xff, 0xc0, 0x0, 0x1f, 0xff, 0xff, 0x80, 0x0, + 0x3f, 0xff, 0xff, 0x0, 0x0, 0x7f, 0xff, 0xfe, + 0x0, 0x0, 0xff, 0xff, 0xfe, 0x0, 0x1, 0xff, + 0xff, 0xfc, 0x0, 0x7, 0xff, 0xbf, 0xfc, 0x0, + 0x1f, 0xfe, 0x7f, 0xfc, 0x0, 0x7f, 0xfc, 0xff, + 0xfe, 0x3, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, + 0xe1, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, + 0xff, 0xff, 0x1, 0xff, 0xff, 0xff, 0xfc, 0x1, + 0xff, 0xff, 0xff, 0xf0, 0x1, 0xff, 0xff, 0xff, + 0xc0, 0x1, 0xff, 0xff, 0xff, 0x0, 0x0, 0xff, + 0xff, 0xf8, 0x0, 0x0, 0x7f, 0xff, 0xc0, 0x0, + 0x0, 0x1f, 0xfc, 0x0, 0x0, + + /* U+0031 "1" */ + 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x3f, 0xff, + 0x80, 0x0, 0x1, 0xff, 0xfe, 0x0, 0x0, 0x1f, + 0xff, 0xf8, 0x0, 0x0, 0xff, 0xff, 0xe0, 0x0, + 0x7, 0xff, 0xff, 0x80, 0x0, 0x7f, 0xff, 0xfe, + 0x0, 0x3, 0xff, 0xff, 0xf8, 0x0, 0x3f, 0xff, + 0xff, 0xe0, 0x1, 0xff, 0xff, 0xff, 0x80, 0xf, + 0xff, 0xff, 0xfe, 0x0, 0x3f, 0xff, 0xff, 0xf8, + 0x0, 0xff, 0xfd, 0xff, 0xe0, 0x3, 0xff, 0xc7, + 0xff, 0x80, 0xf, 0xfe, 0x1f, 0xfe, 0x0, 0x3f, + 0xe0, 0x7f, 0xf8, 0x0, 0xff, 0x1, 0xff, 0xe0, + 0x3, 0xf8, 0x7, 0xff, 0x80, 0xf, 0x80, 0x1f, + 0xfe, 0x0, 0x3c, 0x0, 0x7f, 0xf8, 0x0, 0xe0, + 0x1, 0xff, 0xe0, 0x2, 0x0, 0x7, 0xff, 0x80, + 0x0, 0x0, 0x1f, 0xfe, 0x0, 0x0, 0x0, 0x7f, + 0xf8, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, + 0x7, 0xff, 0x80, 0x0, 0x0, 0x1f, 0xfe, 0x0, + 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, 0x1, 0xff, + 0xe0, 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, + 0x1f, 0xfe, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, + 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x7, 0xff, + 0x80, 0x0, 0x0, 0x1f, 0xfe, 0x0, 0x0, 0x0, + 0x7f, 0xf8, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, 0x1f, 0xfe, + 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, 0x1, + 0xff, 0xe0, 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, + 0x0, 0x1f, 0xfe, 0x0, 0x0, 0x0, 0x7f, 0xf8, + 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x7, + 0xff, 0x80, 0x0, 0x0, 0x1f, 0xfe, 0x0, 0x0, + 0x0, 0x7f, 0xf8, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, + 0xc0, - /* U+32 "2" */ - 0x0, 0x1, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, - 0xfc, 0x0, 0x0, 0x1f, 0xff, 0xff, 0x80, 0x0, - 0x3f, 0xff, 0xff, 0xf0, 0x0, 0x3f, 0xff, 0xff, - 0xfc, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x0, 0x3f, - 0xff, 0xff, 0xff, 0xc0, 0x3f, 0xff, 0xff, 0xff, - 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, - 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xe0, 0x7f, 0xff, - 0x8f, 0xff, 0xc0, 0xf, 0xff, 0xc7, 0xff, 0xc0, - 0x3, 0xff, 0xe7, 0xff, 0xc0, 0x0, 0xff, 0xfb, - 0xff, 0xc0, 0x0, 0x7f, 0xfd, 0xff, 0xe0, 0x0, - 0x1f, 0xfe, 0xff, 0xf0, 0x0, 0xf, 0xff, 0x0, - 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, - 0xff, 0xc0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, - 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, - 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x0, 0x3f, 0xfe, - 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, - 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, - 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, - 0xff, 0x80, 0x0, 0x0, 0x7f, 0xff, 0x80, 0x0, - 0x0, 0x7f, 0xff, 0x80, 0x0, 0x0, 0x7f, 0xff, - 0x80, 0x0, 0x0, 0x7f, 0xff, 0x80, 0x0, 0x0, - 0xff, 0xff, 0x80, 0x0, 0x0, 0xff, 0xff, 0x80, - 0x0, 0x0, 0xff, 0xff, 0x80, 0x0, 0x0, 0xff, - 0xff, 0x80, 0x0, 0x1, 0xff, 0xff, 0x0, 0x0, - 0x1, 0xff, 0xff, 0x0, 0x0, 0x1, 0xff, 0xff, - 0x0, 0x0, 0x1, 0xff, 0xfe, 0x0, 0x0, 0x3, - 0xff, 0xfe, 0x0, 0x0, 0x3, 0xff, 0xfe, 0x0, - 0x0, 0x3, 0xff, 0xfc, 0x0, 0x0, 0x3, 0xff, - 0xfc, 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, - 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, - 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0xdf, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, - 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xfb, - 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, - 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, + /* U+0032 "2" */ + 0x0, 0x1, 0xff, 0x80, 0x0, 0x0, 0x3f, 0xff, + 0xe0, 0x0, 0x1, 0xff, 0xff, 0xf8, 0x0, 0xf, + 0xff, 0xff, 0xf8, 0x0, 0x3f, 0xff, 0xff, 0xf8, + 0x0, 0xff, 0xff, 0xff, 0xfc, 0x3, 0xff, 0xff, + 0xff, 0xf8, 0xf, 0xff, 0xff, 0xff, 0xf8, 0x1f, + 0xff, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xff, 0xff, + 0xf0, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xfc, + 0xf, 0xff, 0xe7, 0xff, 0xe0, 0xf, 0xff, 0xcf, + 0xff, 0x80, 0xf, 0xff, 0xff, 0xfe, 0x0, 0xf, + 0xff, 0xff, 0xfc, 0x0, 0x1f, 0xff, 0xff, 0xf0, + 0x0, 0x1f, 0xff, 0xff, 0xe0, 0x0, 0x3f, 0xff, + 0xff, 0xc0, 0x0, 0x7f, 0xf8, 0x0, 0x0, 0x0, + 0xff, 0xf0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0x0, 0x3, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, + 0x0, 0x0, 0x0, 0x1f, 0xfe, 0x0, 0x0, 0x0, + 0x7f, 0xfc, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, + 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0xf, 0xff, + 0xc0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, + 0xff, 0xfc, 0x0, 0x0, 0x3, 0xff, 0xf8, 0x0, + 0x0, 0xf, 0xff, 0xe0, 0x0, 0x0, 0x3f, 0xff, + 0x80, 0x0, 0x0, 0xff, 0xfe, 0x0, 0x0, 0x3, + 0xff, 0xfc, 0x0, 0x0, 0xf, 0xff, 0xf0, 0x0, + 0x0, 0x3f, 0xff, 0xc0, 0x0, 0x0, 0xff, 0xff, + 0x0, 0x0, 0x3, 0xff, 0xfc, 0x0, 0x0, 0xf, + 0xff, 0xf0, 0x0, 0x0, 0x3f, 0xff, 0xc0, 0x0, + 0x0, 0xff, 0xff, 0x0, 0x0, 0x3, 0xff, 0xf8, + 0x0, 0x0, 0xf, 0xff, 0xe0, 0x0, 0x0, 0x3f, + 0xff, 0x80, 0x0, 0x0, 0xff, 0xfe, 0x0, 0x0, + 0x3, 0xff, 0xf8, 0x0, 0x0, 0xf, 0xff, 0xe0, + 0x0, 0x0, 0x3f, 0xff, 0x80, 0x0, 0x0, 0xff, + 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, + 0xfb, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, - 0xff, 0xc0, + 0xff, 0x7f, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, + 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xfb, + 0xff, 0xff, 0xff, 0xff, 0xf0, - /* U+33 "3" */ - 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, 0xff, 0xff, - 0xff, 0xff, 0x7, 0xff, 0xff, 0xff, 0xff, 0x83, - 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, - 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x7f, + /* U+0033 "3" */ + 0x1f, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, + 0xff, 0xf0, 0x7f, 0xff, 0xff, 0xff, 0xe0, 0xff, + 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, 0xff, + 0x83, 0xff, 0xff, 0xff, 0xff, 0x7, 0xff, 0xff, + 0xff, 0xfe, 0xf, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xff, - 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, 0xff, - 0xff, 0x8f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, - 0x80, 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, 0x0, - 0x1f, 0xff, 0x80, 0x0, 0x0, 0x3f, 0xff, 0x80, - 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, - 0xff, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, - 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xfe, - 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, - 0x3f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfc, 0x0, - 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, 0x0, 0xf, - 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, 0xff, 0x0, - 0x0, 0x3, 0xff, 0xff, 0xe0, 0x0, 0x1, 0xff, - 0xff, 0xf8, 0x0, 0x0, 0xff, 0xff, 0xfe, 0x0, - 0x0, 0x7f, 0xff, 0xff, 0x80, 0x0, 0x3f, 0xff, - 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf0, 0x0, - 0xf, 0xff, 0xff, 0xfc, 0x0, 0x0, 0x0, 0xff, - 0xfe, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, - 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, 0x1, 0xff, - 0xe0, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, - 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, 0xfe, - 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, - 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, - 0x0, 0x0, 0x1, 0xff, 0xff, 0xfe, 0x0, 0x0, - 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xff, 0xff, - 0xc0, 0x0, 0x7f, 0xf9, 0xff, 0xf0, 0x0, 0x7f, - 0xfc, 0xff, 0xfc, 0x0, 0x7f, 0xfe, 0x7f, 0xff, - 0x80, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, - 0xf, 0xff, 0xff, 0xff, 0xff, 0x3, 0xff, 0xff, - 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0x80, - 0x3f, 0xff, 0xff, 0xff, 0x80, 0xf, 0xff, 0xff, - 0xff, 0x80, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, - 0x7f, 0xff, 0xff, 0x0, 0x0, 0xf, 0xff, 0xfc, - 0x0, 0x0, 0x0, 0x7f, 0xf0, 0x0, 0x0, + 0xf0, 0x0, 0x0, 0x3, 0xff, 0xc0, 0x0, 0x0, + 0xf, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xfc, 0x0, + 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x3, 0xff, + 0xc0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, + 0x7f, 0xf8, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, 0x1f, 0xfe, + 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, 0x1, + 0xff, 0xf8, 0x0, 0x0, 0x3, 0xff, 0xfe, 0x0, + 0x0, 0x7, 0xff, 0xff, 0x0, 0x0, 0xf, 0xff, + 0xff, 0x80, 0x0, 0x1f, 0xff, 0xff, 0x80, 0x0, + 0x3f, 0xff, 0xff, 0x80, 0x0, 0x7f, 0xff, 0xff, + 0x80, 0x0, 0xff, 0xff, 0xff, 0x80, 0x1, 0xff, + 0xff, 0xff, 0x0, 0x3, 0xff, 0xff, 0xff, 0x0, + 0x0, 0x0, 0xff, 0xfe, 0x0, 0x0, 0x0, 0x7f, + 0xfc, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, + 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, 0xf0, + 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x3, + 0xff, 0xc0, 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, + 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, 0x1f, 0xfe, + 0x0, 0x0, 0x0, 0x3f, 0xff, 0xff, 0xc0, 0x0, + 0x7f, 0xff, 0xff, 0x80, 0x0, 0xff, 0xff, 0xff, + 0x0, 0x1, 0xff, 0xff, 0xff, 0x0, 0x7, 0xff, + 0xff, 0xfe, 0x0, 0xf, 0xff, 0xbf, 0xfe, 0x0, + 0x3f, 0xfe, 0x7f, 0xff, 0x1, 0xff, 0xfc, 0xff, + 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, + 0xe0, 0xff, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, + 0xff, 0xff, 0x1, 0xff, 0xff, 0xff, 0xfc, 0x1, + 0xff, 0xff, 0xff, 0xf0, 0x0, 0xff, 0xff, 0xff, + 0x80, 0x0, 0xff, 0xff, 0xfe, 0x0, 0x0, 0x7f, + 0xff, 0xf0, 0x0, 0x0, 0xf, 0xfe, 0x0, 0x0, - /* U+34 "4" */ + /* U+0034 "4" */ 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x1f, 0xff, 0x80, - 0x0, 0x0, 0xff, 0xfc, 0x0, 0x0, 0x3, 0xff, - 0xe0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, - 0xff, 0xfc, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, + 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x3, 0xff, + 0xe0, 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, 0x0, + 0xff, 0xfc, 0x0, 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xff, 0xfc, - 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3f, - 0xff, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, - 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3f, 0xff, 0x0, + 0x0, 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x1f, + 0xff, 0x0, 0x0, 0x0, 0xff, 0xfc, 0x0, 0x0, + 0x7, 0xff, 0xe0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, - 0xc0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x1, - 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, - 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x1, 0xff, 0xf8, - 0x0, 0x0, 0xf, 0xff, 0xc0, 0x0, 0x0, 0x3f, - 0xfe, 0x0, 0xff, 0xf1, 0xff, 0xf0, 0x3, 0xff, - 0xcf, 0xff, 0xc0, 0xf, 0xff, 0x7f, 0xfe, 0x0, - 0x3f, 0xfd, 0xff, 0xf0, 0x0, 0xff, 0xff, 0xff, + 0xe0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, + 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, + 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0xff, 0xf8, + 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, 0x3f, + 0xff, 0x0, 0xff, 0xf0, 0xff, 0xf8, 0x3, 0xff, + 0xc7, 0xff, 0xc0, 0xf, 0xff, 0x3f, 0xff, 0x0, + 0x3f, 0xfd, 0xff, 0xf8, 0x0, 0xff, 0xf7, 0xff, 0xc0, 0x3, 0xff, 0xff, 0xfe, 0x0, 0xf, 0xff, - 0xff, 0xf0, 0x0, 0x3f, 0xff, 0xff, 0x80, 0x0, + 0xff, 0xf8, 0x0, 0x3f, 0xff, 0xff, 0xc0, 0x0, 0xff, 0xff, 0xfe, 0x0, 0x3, 0xff, 0xff, 0xf8, 0x0, 0xf, 0xff, 0xff, 0xe0, 0x0, 0x3f, 0xff, + 0xff, 0x80, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, - 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, 0x3f, + 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x3, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x3, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xfc, 0x0, - 0x0, 0x0, 0xff, 0xf0, + 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x3, 0xff, + 0xc0, - /* U+35 "5" */ - 0x3f, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, - 0xff, 0xff, 0xf, 0xff, 0xff, 0xff, 0xff, 0x87, - 0xff, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, - 0xff, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, - 0xff, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xff, 0xff, - 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, - 0xff, 0xff, 0xff, 0xf, 0xff, 0x0, 0x0, 0x0, - 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x0, - 0xff, 0xf0, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, - 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, - 0xfe, 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, - 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, - 0xc0, 0x7f, 0x80, 0x1, 0xff, 0xe1, 0xff, 0xf8, - 0x0, 0xff, 0xf1, 0xff, 0xff, 0x0, 0x7f, 0xf9, - 0xff, 0xff, 0xc0, 0x3f, 0xfd, 0xff, 0xff, 0xf0, - 0x1f, 0xff, 0xff, 0xff, 0xfc, 0xf, 0xff, 0xff, - 0xff, 0xff, 0x7, 0xff, 0xff, 0xff, 0xff, 0xc3, - 0xff, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xfc, 0x7, - 0xff, 0xf8, 0xff, 0xf8, 0x0, 0xff, 0xfc, 0x0, - 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0xf, - 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x0, 0xff, - 0xf0, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, - 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, 0xfe, - 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, - 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, - 0x0, 0x0, 0x1, 0xff, 0xff, 0xff, 0x0, 0x1, - 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xfb, 0xff, - 0xe0, 0x0, 0xff, 0xf9, 0xff, 0xf8, 0x0, 0xff, - 0xfc, 0xff, 0xff, 0x81, 0xff, 0xfe, 0x3f, 0xff, - 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, - 0x7, 0xff, 0xff, 0xff, 0xff, 0x1, 0xff, 0xff, - 0xff, 0xff, 0x0, 0x7f, 0xff, 0xff, 0xff, 0x0, - 0x1f, 0xff, 0xff, 0xff, 0x0, 0x7, 0xff, 0xff, - 0xff, 0x0, 0x0, 0xff, 0xff, 0xfe, 0x0, 0x0, - 0x1f, 0xff, 0xfc, 0x0, 0x0, 0x0, 0xff, 0xe0, - 0x0, 0x0, + /* U+0035 "5" */ + 0x7f, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, + 0xff, 0xc7, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xff, + 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0xff, 0xf1, + 0xff, 0xff, 0xff, 0xff, 0xc7, 0xff, 0xff, 0xff, + 0xff, 0x1f, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xff, + 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xc7, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfe, 0x0, 0x0, + 0x0, 0x7f, 0xf8, 0x0, 0x0, 0x1, 0xff, 0xe0, + 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, 0x1f, + 0xfe, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, + 0x1, 0xff, 0xe0, 0x0, 0x0, 0x7, 0xff, 0x80, + 0x0, 0x0, 0x1f, 0xfe, 0x0, 0x0, 0x0, 0x7f, + 0xf8, 0x1f, 0xf0, 0x1, 0xff, 0xe1, 0xff, 0xf0, + 0x7, 0xff, 0x9f, 0xff, 0xf0, 0x1f, 0xfe, 0xff, + 0xff, 0xe0, 0x7f, 0xfb, 0xff, 0xff, 0xc1, 0xff, + 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, + 0x1f, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, + 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xff, + 0xf0, 0x3f, 0xff, 0x9f, 0xff, 0x0, 0x3f, 0xfe, + 0x7f, 0xf8, 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x1, + 0xff, 0xf0, 0x0, 0x0, 0x3, 0xff, 0xc0, 0x0, + 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xfc, + 0x0, 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x3, + 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, + 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0xff, 0xf0, + 0x0, 0x0, 0x3, 0xff, 0xc0, 0x0, 0x0, 0xf, + 0xff, 0xff, 0xf0, 0x0, 0x3f, 0xff, 0xff, 0xc0, + 0x0, 0xff, 0xff, 0xff, 0x0, 0x7, 0xff, 0xff, + 0xfe, 0x0, 0x1f, 0xfe, 0xff, 0xfc, 0x0, 0xff, + 0xf9, 0xff, 0xfc, 0xf, 0xff, 0xe7, 0xff, 0xff, + 0xff, 0xff, 0xf, 0xff, 0xff, 0xff, 0xfc, 0x3f, + 0xff, 0xff, 0xff, 0xe0, 0x7f, 0xff, 0xff, 0xff, + 0x80, 0xff, 0xff, 0xff, 0xfc, 0x1, 0xff, 0xff, + 0xff, 0xe0, 0x3, 0xff, 0xff, 0xfe, 0x0, 0x3, + 0xff, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, 0x0, + 0x0, 0x1, 0xff, 0xc0, 0x0, - /* U+36 "6" */ - 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, - 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, - 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, - 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, - 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, - 0xc0, 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, + /* U+0036 "6" */ + 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0x1f, + 0xff, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, + 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, + 0x80, 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, + 0x7, 0xff, 0xc0, 0x0, 0x0, 0x7, 0xff, 0xc0, + 0x0, 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x3, + 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, + 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, + 0xf0, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, - 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, - 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, - 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, 0x1, - 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, - 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0xf, - 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, - 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x0, 0xff, - 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x3f, 0xc0, - 0x0, 0x1f, 0xfe, 0x3f, 0xfe, 0x0, 0xf, 0xff, - 0xbf, 0xff, 0xe0, 0x3, 0xff, 0xdf, 0xff, 0xfc, - 0x1, 0xff, 0xef, 0xff, 0xff, 0x80, 0x7f, 0xff, - 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xfe, - 0xf, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, - 0xff, 0xff, 0xf1, 0xff, 0xff, 0x3, 0xff, 0xfc, - 0x7f, 0xff, 0x0, 0x3f, 0xff, 0x9f, 0xff, 0x0, - 0x3, 0xff, 0xef, 0xff, 0xc0, 0x0, 0xff, 0xfb, - 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf8, 0x0, - 0x7, 0xff, 0xff, 0xfc, 0x0, 0x0, 0xff, 0xff, - 0xff, 0x0, 0x0, 0x3f, 0xff, 0xff, 0xc0, 0x0, - 0xf, 0xff, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, - 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, - 0x3f, 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0x7f, - 0xf8, 0x0, 0x7, 0xff, 0xdf, 0xfe, 0x0, 0x3, - 0xff, 0xe7, 0xff, 0xc0, 0x0, 0xff, 0xf9, 0xff, - 0xfc, 0x0, 0xff, 0xfe, 0x3f, 0xff, 0xc0, 0xff, - 0xff, 0xf, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, - 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, - 0xf0, 0x7, 0xff, 0xff, 0xff, 0xf8, 0x0, 0xff, - 0xff, 0xff, 0xfe, 0x0, 0x1f, 0xff, 0xff, 0xfe, - 0x0, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, 0x3f, - 0xff, 0xff, 0x0, 0x0, 0x3, 0xff, 0xff, 0x0, - 0x0, 0x0, 0xf, 0xfc, 0x0, 0x0, - - /* U+37 "7" */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x0, + 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, + 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0x1f, + 0xff, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, + 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, + 0x87, 0xf8, 0x0, 0x7, 0xff, 0x8f, 0xff, 0x0, + 0x7, 0xff, 0xcf, 0xff, 0xe0, 0x3, 0xff, 0xdf, + 0xff, 0xf8, 0x3, 0xff, 0xef, 0xff, 0xfe, 0x1, + 0xff, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, + 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x7f, + 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0x81, 0xff, + 0xff, 0x3f, 0xff, 0x0, 0x3f, 0xff, 0x9f, 0xff, + 0x0, 0x7, 0xff, 0xdf, 0xff, 0x80, 0x3, 0xff, + 0xef, 0xff, 0x80, 0x0, 0xff, 0xff, 0xff, 0xc0, + 0x0, 0x7f, 0xff, 0xff, 0xc0, 0x0, 0x1f, 0xff, + 0xff, 0xe0, 0x0, 0xf, 0xff, 0xff, 0xf0, 0x0, + 0x7, 0xff, 0xff, 0xf8, 0x0, 0x3, 0xff, 0xff, + 0xfc, 0x0, 0x1, 0xff, 0xff, 0xfe, 0x0, 0x0, + 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xfb, 0xff, + 0xc0, 0x0, 0x7f, 0xfd, 0xff, 0xf0, 0x0, 0x7f, + 0xfc, 0xff, 0xf8, 0x0, 0x3f, 0xfe, 0x3f, 0xfe, + 0x0, 0x3f, 0xff, 0x1f, 0xff, 0xc0, 0x7f, 0xff, + 0x7, 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0xff, + 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0x80, + 0x3f, 0xff, 0xff, 0xff, 0xc0, 0xf, 0xff, 0xff, + 0xff, 0xc0, 0x3, 0xff, 0xff, 0xff, 0x80, 0x0, + 0xff, 0xff, 0xff, 0x80, 0x0, 0x1f, 0xff, 0xff, + 0x0, 0x0, 0x3, 0xff, 0xfe, 0x0, 0x0, 0x0, + 0x3f, 0xf8, 0x0, 0x0, + + /* U+0037 "7" */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xe0, 0x0, 0xf, 0xff, 0xff, 0xe0, 0x0, 0x1f, - 0xfe, 0xff, 0xe0, 0x0, 0x1f, 0xfe, 0xff, 0xe0, - 0x0, 0x3f, 0xfc, 0xff, 0xe0, 0x0, 0x3f, 0xfc, - 0xff, 0xe0, 0x0, 0x7f, 0xf8, 0xff, 0xe0, 0x0, - 0x7f, 0xf8, 0xff, 0xe0, 0x0, 0xff, 0xf8, 0xff, - 0xe0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x1, 0xff, - 0xf0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, - 0x3, 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, 0xc0, - 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, 0x7, - 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, - 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0, 0x3, 0xff, + 0xff, 0xfe, 0x0, 0x1, 0xff, 0xef, 0xff, 0x0, + 0x1, 0xff, 0xf7, 0xff, 0x80, 0x0, 0xff, 0xf3, + 0xff, 0xc0, 0x0, 0xff, 0xf9, 0xff, 0xe0, 0x0, + 0x7f, 0xfc, 0xff, 0xf0, 0x0, 0x7f, 0xfc, 0x7f, + 0xf8, 0x0, 0x3f, 0xfe, 0x3f, 0xfc, 0x0, 0x3f, + 0xfe, 0x1f, 0xfe, 0x0, 0x1f, 0xff, 0x0, 0x0, + 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, + 0x80, 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, + 0x7, 0xff, 0xc0, 0x0, 0x0, 0x3, 0xff, 0xe0, + 0x0, 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x1, + 0xff, 0xf0, 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, + 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, + 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, + 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, - 0x1f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, - 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x7f, - 0xfc, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, - 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, 0xf8, - 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, 0x1, - 0xff, 0xf0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, 0x80, + 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, + 0xff, 0xc0, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, - 0xc0, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, - 0x7, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, 0x80, - 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x1f, - 0xff, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, - 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfe, + 0xe0, 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, + 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x0, - 0x7f, 0xfc, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, - 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, - 0xf8, 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, - 0x1, 0xff, 0xf0, 0x0, 0x0, 0x3, 0xff, 0xe0, + 0x7f, 0xfc, 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, + 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0x1f, + 0xff, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, + 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, + 0xc0, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, + 0x3, 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, 0xe0, + 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, 0x1, + 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, - /* U+38 "8" */ - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x7, 0xff, - 0xff, 0x80, 0x0, 0x7, 0xff, 0xff, 0xf8, 0x0, - 0x7, 0xff, 0xff, 0xff, 0x80, 0x3, 0xff, 0xff, - 0xff, 0xf0, 0x1, 0xff, 0xff, 0xff, 0xfe, 0x0, - 0xff, 0xff, 0xff, 0xff, 0xc0, 0x7f, 0xff, 0xff, - 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, - 0xff, 0xe0, 0x3f, 0xff, 0xc3, 0xff, 0xe0, 0x3, - 0xff, 0xf0, 0xff, 0xf0, 0x0, 0x7f, 0xfc, 0x7f, - 0xf8, 0x0, 0xf, 0xff, 0x9f, 0xfe, 0x0, 0x3, - 0xff, 0xe7, 0xff, 0x0, 0x0, 0x7f, 0xf9, 0xff, - 0xc0, 0x0, 0x1f, 0xfe, 0x7f, 0xf0, 0x0, 0x7, - 0xff, 0x9f, 0xfc, 0x0, 0x1, 0xff, 0xe7, 0xff, - 0x0, 0x0, 0x7f, 0xf9, 0xff, 0xc0, 0x0, 0x1f, - 0xfe, 0x3f, 0xf8, 0x0, 0xf, 0xff, 0xf, 0xfe, - 0x0, 0x3, 0xff, 0xc3, 0xff, 0xc0, 0x1, 0xff, - 0xe0, 0x7f, 0xf8, 0x0, 0xff, 0xf8, 0xf, 0xff, - 0x80, 0xff, 0xfc, 0x1, 0xff, 0xff, 0xff, 0xfe, - 0x0, 0x3f, 0xff, 0xff, 0xff, 0x0, 0x7, 0xff, - 0xff, 0xff, 0x0, 0x0, 0x7f, 0xff, 0xff, 0x0, - 0x0, 0x3, 0xff, 0xfe, 0x0, 0x0, 0x7, 0xff, - 0xff, 0xf0, 0x0, 0x7, 0xff, 0xff, 0xff, 0x80, - 0x7, 0xff, 0xff, 0xff, 0xf0, 0x3, 0xff, 0xff, - 0xff, 0xff, 0x1, 0xff, 0xf8, 0xf, 0xff, 0xe0, - 0xff, 0xf8, 0x0, 0x7f, 0xf8, 0x3f, 0xfc, 0x0, - 0xf, 0xff, 0x1f, 0xfe, 0x0, 0x1, 0xff, 0xe7, - 0xff, 0x80, 0x0, 0x7f, 0xfb, 0xff, 0xc0, 0x0, - 0xf, 0xfe, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, - 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, - 0x3f, 0xff, 0xff, 0xc0, 0x0, 0xf, 0xff, 0xff, - 0xf0, 0x0, 0x3, 0xff, 0xff, 0xfe, 0x0, 0x1, - 0xff, 0xff, 0xff, 0x80, 0x0, 0x7f, 0xff, 0xff, - 0xf0, 0x0, 0x3f, 0xff, 0x7f, 0xfe, 0x0, 0x1f, - 0xff, 0x9f, 0xff, 0xe0, 0x3f, 0xff, 0xe3, 0xff, - 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0x3, 0xff, - 0xff, 0xff, 0xff, 0x0, 0x7f, 0xff, 0xff, 0xff, - 0x80, 0xf, 0xff, 0xff, 0xff, 0xc0, 0x1, 0xff, - 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xe0, - 0x0, 0x1, 0xff, 0xff, 0xe0, 0x0, 0x0, 0x7, - 0xff, 0x80, 0x0, - - /* U+39 "9" */ - 0x0, 0x0, 0xff, 0xc0, 0x0, 0x0, 0x3, 0xff, - 0xff, 0x0, 0x0, 0x3, 0xff, 0xff, 0xf0, 0x0, - 0x3, 0xff, 0xff, 0xff, 0x0, 0x1, 0xff, 0xff, - 0xff, 0xe0, 0x1, 0xff, 0xff, 0xff, 0xfc, 0x0, - 0x7f, 0xff, 0xff, 0xff, 0x80, 0x3f, 0xff, 0xff, - 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, - 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0xfc, 0xf, - 0xff, 0xf1, 0xff, 0xf8, 0x0, 0xff, 0xfc, 0x7f, - 0xfc, 0x0, 0xf, 0xff, 0x9f, 0xff, 0x0, 0x3, - 0xff, 0xef, 0xff, 0x80, 0x0, 0x7f, 0xfb, 0xff, - 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf0, 0x0, 0x3, - 0xff, 0xff, 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, - 0x0, 0x0, 0x3f, 0xff, 0xff, 0xc0, 0x0, 0xf, - 0xff, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, 0xfc, - 0x0, 0x0, 0xff, 0xff, 0xff, 0x80, 0x0, 0x7f, - 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0x7f, 0xf8, - 0x0, 0xf, 0xff, 0xdf, 0xff, 0x0, 0x3, 0xff, - 0xe7, 0xff, 0xf0, 0x3, 0xff, 0xf8, 0xff, 0xff, - 0x3, 0xff, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, - 0x87, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, - 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xf8, - 0x7, 0xff, 0xff, 0xdf, 0xfe, 0x0, 0xff, 0xff, - 0xef, 0xff, 0x80, 0x1f, 0xff, 0xf7, 0xff, 0xc0, - 0x1, 0xff, 0xf1, 0xff, 0xf0, 0x0, 0xf, 0xf0, + /* U+0038 "8" */ + 0x0, 0x1, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, + 0xfc, 0x0, 0x0, 0x1f, 0xff, 0xff, 0x80, 0x0, + 0x1f, 0xff, 0xff, 0xf0, 0x0, 0x3f, 0xff, 0xff, + 0xfc, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x0, 0x3f, + 0xff, 0xff, 0xff, 0xc0, 0x3f, 0xff, 0xff, 0xff, + 0xf0, 0x1f, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xff, + 0xff, 0xff, 0xfe, 0xf, 0xff, 0xe0, 0x7f, 0xff, + 0x7, 0xff, 0xc0, 0xf, 0xff, 0x87, 0xff, 0xc0, + 0x3, 0xff, 0xe3, 0xff, 0xe0, 0x1, 0xff, 0xf1, + 0xff, 0xe0, 0x0, 0x7f, 0xf8, 0xff, 0xf0, 0x0, + 0x3f, 0xfc, 0x7f, 0xf8, 0x0, 0x1f, 0xfe, 0x3f, + 0xfc, 0x0, 0xf, 0xff, 0x1f, 0xfe, 0x0, 0x7, + 0xff, 0x8f, 0xff, 0x80, 0x7, 0xff, 0xc3, 0xff, + 0xc0, 0x3, 0xff, 0xc1, 0xff, 0xf0, 0x3, 0xff, + 0xe0, 0x7f, 0xfc, 0x3, 0xff, 0xe0, 0x3f, 0xff, + 0x3, 0xff, 0xf0, 0xf, 0xff, 0xe7, 0xff, 0xf0, + 0x3, 0xff, 0xff, 0xff, 0xf0, 0x0, 0xff, 0xff, + 0xff, 0xf0, 0x0, 0x1f, 0xff, 0xff, 0xf0, 0x0, + 0x7, 0xff, 0xff, 0xf0, 0x0, 0x1, 0xff, 0xff, + 0xf0, 0x0, 0x3, 0xff, 0xff, 0xfc, 0x0, 0x3, + 0xff, 0xff, 0xff, 0x80, 0x3, 0xff, 0xff, 0xff, + 0xe0, 0x3, 0xff, 0xff, 0xff, 0xf8, 0x3, 0xff, + 0xf0, 0xff, 0xfe, 0x3, 0xff, 0xf0, 0x1f, 0xff, + 0x83, 0xff, 0xe0, 0x7, 0xff, 0xe3, 0xff, 0xe0, + 0x1, 0xff, 0xf1, 0xff, 0xe0, 0x0, 0x7f, 0xfc, + 0xff, 0xf0, 0x0, 0x1f, 0xfe, 0xff, 0xf0, 0x0, + 0x7, 0xff, 0xff, 0xf8, 0x0, 0x3, 0xff, 0xff, + 0xfc, 0x0, 0x1, 0xff, 0xff, 0xfe, 0x0, 0x0, + 0xff, 0xff, 0xff, 0x0, 0x0, 0x7f, 0xff, 0xff, + 0xc0, 0x0, 0x7f, 0xff, 0xff, 0xe0, 0x0, 0x3f, + 0xff, 0xff, 0xf8, 0x0, 0x3f, 0xff, 0x7f, 0xfe, + 0x0, 0x3f, 0xff, 0x3f, 0xff, 0xc0, 0x7f, 0xff, + 0x9f, 0xff, 0xff, 0xff, 0xff, 0xc7, 0xff, 0xff, + 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, 0xff, 0xc0, + 0x7f, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, + 0xff, 0xe0, 0x7, 0xff, 0xff, 0xff, 0xe0, 0x1, + 0xff, 0xff, 0xff, 0xc0, 0x0, 0x3f, 0xff, 0xff, + 0x80, 0x0, 0x7, 0xff, 0xff, 0x0, 0x0, 0x0, + 0x3f, 0xf8, 0x0, 0x0, + + /* U+0039 "9" */ + 0x0, 0x1, 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, + 0xfc, 0x0, 0x0, 0xf, 0xff, 0xff, 0x80, 0x0, + 0x1f, 0xff, 0xff, 0xf0, 0x0, 0x1f, 0xff, 0xff, + 0xfc, 0x0, 0x1f, 0xff, 0xff, 0xff, 0x0, 0x1f, + 0xff, 0xff, 0xff, 0xc0, 0x1f, 0xff, 0xff, 0xff, + 0xf0, 0x1f, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, + 0xff, 0xff, 0xfe, 0xf, 0xff, 0xf0, 0x7f, 0xff, + 0x8f, 0xff, 0xe0, 0xf, 0xff, 0xc7, 0xff, 0xc0, + 0x1, 0xff, 0xf3, 0xff, 0xe0, 0x0, 0xff, 0xfb, + 0xff, 0xe0, 0x0, 0x3f, 0xfd, 0xff, 0xf0, 0x0, + 0x1f, 0xff, 0xff, 0xf0, 0x0, 0x7, 0xff, 0xff, + 0xf8, 0x0, 0x3, 0xff, 0xff, 0xfc, 0x0, 0x1, + 0xff, 0xff, 0xfe, 0x0, 0x0, 0xff, 0xff, 0xff, + 0x0, 0x0, 0x7f, 0xff, 0xff, 0x80, 0x0, 0x3f, + 0xff, 0xff, 0xe0, 0x0, 0x3f, 0xff, 0xff, 0xf0, + 0x0, 0x1f, 0xff, 0x7f, 0xfc, 0x0, 0x1f, 0xff, + 0x3f, 0xfe, 0x0, 0xf, 0xff, 0x9f, 0xff, 0xc0, + 0x1f, 0xff, 0xc7, 0xff, 0xf8, 0x3f, 0xff, 0xe3, + 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, + 0xff, 0xf0, 0x7f, 0xff, 0xff, 0xff, 0xf8, 0x1f, + 0xff, 0xff, 0xff, 0xf8, 0x7, 0xff, 0xff, 0xbf, + 0xfc, 0x1, 0xff, 0xff, 0xbf, 0xfc, 0x0, 0x7f, + 0xff, 0xbf, 0xfe, 0x0, 0xf, 0xff, 0x1f, 0xfe, + 0x0, 0x1, 0xfe, 0x1f, 0xff, 0x0, 0x0, 0x0, + 0xf, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, 0x80, + 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, 0x7, + 0xff, 0xc0, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, + 0x0, 0x3, 0xff, 0xc0, 0x0, 0x0, 0x3, 0xff, + 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, + 0x1, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, 0xf0, + 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, - 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, - 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, - 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, - 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, - 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, - 0x80, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, - 0x1, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, 0xf8, - 0x0, 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, 0x0, - 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, 0x80, - 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3, - 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, - 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, 0x0, 0x3f, - 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, - 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, + 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x0, 0x3f, + 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, + 0x0, 0x1f, 0xfe, 0x0, 0x0, 0x0, 0x1f, 0xff, + 0x0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, + 0xf, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, 0x80, + 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, 0x7, + 0xff, 0xc0, 0x0, 0x0, - /* U+3A ":" */ + /* U+003A ":" */ 0x7, 0xe0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, - 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, - 0x7f, 0xfe, 0x3f, 0xfc, 0x1f, 0xf8, 0x7, 0xe0, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0x3f, 0xfc, + 0x1f, 0xf8, 0x7, 0xe0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x7, 0xe0, 0x1f, 0xf8, - 0x3f, 0xfc, 0x7f, 0xfe, 0x7f, 0xfe, 0xff, 0xff, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x7, 0xe0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x7f, 0xfe, 0x7f, 0xfe, 0x3f, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0x3f, 0xfc, 0x1f, 0xf8, 0x7, 0xe0 }; @@ -439,17 +437,17 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, - {.bitmap_index = 0, .adv_w = 768, .box_w = 41, .box_h = 59, .ofs_x = 4, .ofs_y = -1}, - {.bitmap_index = 303, .adv_w = 768, .box_w = 40, .box_h = 58, .ofs_x = 6, .ofs_y = 0}, - {.bitmap_index = 593, .adv_w = 768, .box_w = 41, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 891, .adv_w = 768, .box_w = 41, .box_h = 59, .ofs_x = 3, .ofs_y = -1}, - {.bitmap_index = 1194, .adv_w = 768, .box_w = 38, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 1470, .adv_w = 768, .box_w = 41, .box_h = 58, .ofs_x = 4, .ofs_y = -1}, - {.bitmap_index = 1768, .adv_w = 768, .box_w = 42, .box_h = 59, .ofs_x = 3, .ofs_y = -1}, - {.bitmap_index = 2078, .adv_w = 768, .box_w = 40, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 2368, .adv_w = 768, .box_w = 42, .box_h = 60, .ofs_x = 3, .ofs_y = -1}, - {.bitmap_index = 2683, .adv_w = 768, .box_w = 42, .box_h = 59, .ofs_x = 3, .ofs_y = 0}, - {.bitmap_index = 2993, .adv_w = 768, .box_w = 16, .box_h = 46, .ofs_x = 16, .ofs_y = -1} + {.bitmap_index = 0, .adv_w = 768, .box_w = 39, .box_h = 60, .ofs_x = 5, .ofs_y = -1}, + {.bitmap_index = 293, .adv_w = 768, .box_w = 38, .box_h = 59, .ofs_x = 6, .ofs_y = 0}, + {.bitmap_index = 574, .adv_w = 768, .box_w = 39, .box_h = 60, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 867, .adv_w = 768, .box_w = 39, .box_h = 59, .ofs_x = 4, .ofs_y = -1}, + {.bitmap_index = 1155, .adv_w = 768, .box_w = 38, .box_h = 59, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 1436, .adv_w = 768, .box_w = 38, .box_h = 60, .ofs_x = 5, .ofs_y = -1}, + {.bitmap_index = 1721, .adv_w = 768, .box_w = 41, .box_h = 60, .ofs_x = 4, .ofs_y = -1}, + {.bitmap_index = 2029, .adv_w = 768, .box_w = 41, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 2327, .adv_w = 768, .box_w = 41, .box_h = 60, .ofs_x = 4, .ofs_y = -1}, + {.bitmap_index = 2635, .adv_w = 768, .box_w = 41, .box_h = 60, .ofs_x = 4, .ofs_y = -1}, + {.bitmap_index = 2943, .adv_w = 768, .box_w = 16, .box_h = 46, .ofs_x = 16, .ofs_y = -1} }; /*--------------------- @@ -473,9 +471,14 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * ALL CUSTOM DATA *--------------------*/ +#if LV_VERSION_CHECK(8, 0, 0) /*Store all the custom data of the font*/ +static lv_font_fmt_txt_glyph_cache_t cache; +static const lv_font_fmt_txt_dsc_t font_dsc = { +#else static lv_font_fmt_txt_dsc_t font_dsc = { - .glyph_bitmap = gylph_bitmap, +#endif + .glyph_bitmap = glyph_bitmap, .glyph_dsc = glyph_dsc, .cmaps = cmaps, .kern_dsc = NULL, @@ -483,7 +486,10 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .cmap_num = 1, .bpp = 1, .kern_classes = 0, - .bitmap_format = 0 + .bitmap_format = 0, +#if LV_VERSION_CHECK(8, 0, 0) + .cache = &cache +#endif }; @@ -492,16 +498,26 @@ static lv_font_fmt_txt_dsc_t font_dsc = { *----------------*/ /*Initialize a public general font descriptor*/ +#if LV_VERSION_CHECK(8, 0, 0) +const lv_font_t jetbrains_mono_extrabold_compressed = { +#else lv_font_t jetbrains_mono_extrabold_compressed = { +#endif .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ - .line_height = 60, /*The maximum line height required by the font*/ + .line_height = 61, /*The maximum line height required by the font*/ .base_line = 1, /*Baseline measured from the bottom of the line*/ #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, +#endif +#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8 + .underline_position = -12, + .underline_thickness = 4, #endif .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ }; + + #endif /*#if JETBRAINS_MONO_EXTRABOLD_COMPRESSED*/ diff --git a/src/displayapp/fonts/lv_font_sys_48.c b/src/displayapp/fonts/lv_font_sys_48.c index 19f3ec2d..ca007e30 100644 --- a/src/displayapp/fonts/lv_font_sys_48.c +++ b/src/displayapp/fonts/lv_font_sys_48.c @@ -311,7 +311,7 @@ lv_font_t lv_font_sys_48 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8 .underline_position = 0, .underline_thickness = 0, #endif -- cgit v1.2.3-70-g09d2 From 04d21dcd932c7e75b2d45314b2f68d9ba91c5d68 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sun, 27 Feb 2022 15:02:02 +0200 Subject: Add ExtraBold font ttf --- src/displayapp/fonts/JetBrainsMono-ExtraBold.ttf | Bin 0 -> 210688 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/displayapp/fonts/JetBrainsMono-ExtraBold.ttf (limited to 'src') diff --git a/src/displayapp/fonts/JetBrainsMono-ExtraBold.ttf b/src/displayapp/fonts/JetBrainsMono-ExtraBold.ttf new file mode 100644 index 00000000..f85a85b5 Binary files /dev/null and b/src/displayapp/fonts/JetBrainsMono-ExtraBold.ttf differ -- cgit v1.2.3-70-g09d2 From 61a9a97e267799f76c64279887a9845d4760a77c Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Tue, 1 Mar 2022 01:09:48 +0200 Subject: Update navigation font readme section --- src/displayapp/fonts/README.md | 16 ++++++---------- src/displayapp/fonts/lv_font_navi_80.c | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md index 2e900d12..7e6203ff 100644 --- a/src/displayapp/fonts/README.md +++ b/src/displayapp/fonts/README.md @@ -59,6 +59,7 @@ with * Load the file `JetBrainsMono-Regular.tff` (use the file in this repo to ensure the version matches) and specify the following range: `0x25, 0x30-0x3a` ### Large font + * Name: jetbrains_mono_76 * Size: 76 * Bpp: 1 bit-per-pixel @@ -87,17 +88,12 @@ with * Size: 48 * Bpp: 1 bit-per-pixel * Do not enable font compression or horizontal subpixel rendering -* Load the file `icons_sys_48.tff` (use the file in this repo to ensure the version matches) and specify the following range: `0xe902, 0xe904-0xe907, 0xe90b-0xe90c` - -#### Navigation font +* Load the file `icons_sys_48.tff` and specify the following range: `0xe902, 0xe904-0xe907, 0xe90b-0xe90c` -To create the navigtion.ttf I use the web app [icomoon](https://icomoon.io/app) -this app can import the svg files from the folder *src/displayapp/icons/navigation/unique* and create a ttf file the -project for the site is *lv_font_navi_80.json* you can import it to add or remove icons +### Navigation font -You can also use the online LVGL tool to create the .c +`navigtion.ttf` is created with the web app [icomoon](https://icomoon.io/app) by importing the svg files from `src/displayapp/icons/navigation/unique` and generating the font. `lv_font_navi_80.json` is a project file for the site, which you can import to add or remove icons. -ttf file : navigation.ttf name : lv_font_navi_80 size : 80px Bpp : 2 bit-per-pixel range : 0xe900-0xe929 +This font must be generated with the `lv_font_conv` tool, which has additional options not available in the online converter. -$lv_font_conv --font navigation.ttf -r '0xe900-0xe929' --size 80 --format lvgl --bpp 2 --no-prefilter -o -lv_font_navi_80.c +`lv_font_conv --font navigation.ttf -r '0xe900-0xe929' --size 80 --format lvgl --bpp 2 -o lv_font_navi_80.c` diff --git a/src/displayapp/fonts/lv_font_navi_80.c b/src/displayapp/fonts/lv_font_navi_80.c index d5a8400e..8fd3979f 100644 --- a/src/displayapp/fonts/lv_font_navi_80.c +++ b/src/displayapp/fonts/lv_font_navi_80.c @@ -2623,7 +2623,7 @@ lv_font_t lv_font_navi_80 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8 .underline_position = 0, .underline_thickness = 0, #endif -- cgit v1.2.3-70-g09d2 From f47b04ffd0ee401381f18cfedd716d492b4c7db8 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Tue, 8 Mar 2022 23:10:06 +0100 Subject: Fix SettingChimes cbOption array size There are 3 options, but the array-size is set to 2. This leads to memory corruption in the initialization of the SettingChimes screen when assigning the third option object pointer. Found in https://github.com/InfiniTimeOrg/InfiniSim/issues/11 --- src/displayapp/screens/settings/SettingChimes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/displayapp/screens/settings/SettingChimes.h b/src/displayapp/screens/settings/SettingChimes.h index 653f87f7..a251e95b 100644 --- a/src/displayapp/screens/settings/SettingChimes.h +++ b/src/displayapp/screens/settings/SettingChimes.h @@ -20,7 +20,7 @@ namespace Pinetime { private: Controllers::Settings& settingsController; uint8_t optionsTotal; - lv_obj_t* cbOption[2]; + lv_obj_t* cbOption[3]; }; } } -- cgit v1.2.3-70-g09d2 From ea14c580ca6296cb93facf526d65a2db0e3ff1b0 Mon Sep 17 00:00:00 2001 From: mabuch Date: Sat, 12 Mar 2022 17:55:54 +0100 Subject: Rename PineTimeStyle to WatchFacePineTimeStyle --- src/CMakeLists.txt | 2 +- src/displayapp/screens/Clock.cpp | 8 +- src/displayapp/screens/Clock.h | 2 +- src/displayapp/screens/PineTimeStyle.cpp | 601 ---------------------- src/displayapp/screens/PineTimeStyle.h | 111 ---- src/displayapp/screens/WatchFacePineTimeStyle.cpp | 601 ++++++++++++++++++++++ src/displayapp/screens/WatchFacePineTimeStyle.h | 111 ++++ 7 files changed, 718 insertions(+), 718 deletions(-) delete mode 100644 src/displayapp/screens/PineTimeStyle.cpp delete mode 100644 src/displayapp/screens/PineTimeStyle.h create mode 100644 src/displayapp/screens/WatchFacePineTimeStyle.cpp create mode 100644 src/displayapp/screens/WatchFacePineTimeStyle.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ff0c9b0c..2f7df3a1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -456,7 +456,7 @@ list(APPEND SOURCE_FILES displayapp/screens/WatchFaceAnalog.cpp displayapp/screens/WatchFaceDigital.cpp displayapp/screens/WatchFaceTerminal.cpp - displayapp/screens/PineTimeStyle.cpp + displayapp/screens/WatchFacePineTimeStyle.cpp ## diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index fd74683a..693e42a9 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -11,7 +11,7 @@ #include "displayapp/screens/WatchFaceDigital.h" #include "displayapp/screens/WatchFaceTerminal.h" #include "displayapp/screens/WatchFaceAnalog.h" -#include "displayapp/screens/PineTimeStyle.h" +#include "displayapp/screens/WatchFacePineTimeStyle.h" using namespace Pinetime::Applications::Screens; @@ -40,7 +40,7 @@ Clock::Clock(DisplayApp* app, return WatchFaceAnalogScreen(); break; case 2: - return PineTimeStyleScreen(); + return WatchFacePineTimeStyleScreen(); break; case 3: return WatchFaceTerminalScreen(); @@ -79,8 +79,8 @@ std::unique_ptr Clock::WatchFaceAnalogScreen() { app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); } -std::unique_ptr Clock::PineTimeStyleScreen() { - return std::make_unique( +std::unique_ptr Clock::WatchFacePineTimeStyleScreen() { + return std::make_unique( app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, motionController); } diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h index 50996a73..1ba752c7 100644 --- a/src/displayapp/screens/Clock.h +++ b/src/displayapp/screens/Clock.h @@ -46,7 +46,7 @@ namespace Pinetime { std::unique_ptr screen; std::unique_ptr WatchFaceDigitalScreen(); std::unique_ptr WatchFaceAnalogScreen(); - std::unique_ptr PineTimeStyleScreen(); + std::unique_ptr WatchFacePineTimeStyleScreen(); std::unique_ptr WatchFaceTerminalScreen(); }; } diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp deleted file mode 100644 index 44bf47a4..00000000 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ /dev/null @@ -1,601 +0,0 @@ -/* - * This file is part of the Infinitime distribution (https://github.com/InfiniTimeOrg/Infinitime). - * Copyright (c) 2021 Kieran Cawthray. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * PineTimeStyle watchface for Infinitime created by Kieran Cawthray - * Based on WatchFaceDigital - * Style/layout copied from TimeStyle for Pebble by Dan Tilden (github.com/tilden) - */ - -#include "displayapp/screens/PineTimeStyle.h" -#include -#include -#include -#include -#include "displayapp/screens/BatteryIcon.h" -#include "displayapp/screens/BleIcon.h" -#include "displayapp/screens/NotificationIcon.h" -#include "displayapp/screens/Symbols.h" -#include "components/battery/BatteryController.h" -#include "components/ble/BleController.h" -#include "components/ble/NotificationManager.h" -#include "components/motion/MotionController.h" -#include "components/settings/Settings.h" -#include "displayapp/DisplayApp.h" - -using namespace Pinetime::Applications::Screens; - -namespace { - void event_handler(lv_obj_t* obj, lv_event_t event) { - auto* screen = static_cast(obj->user_data); - screen->UpdateSelected(obj, event); - } - - bool IsBleIconVisible(bool isRadioEnabled, bool isConnected) { - if(!isRadioEnabled) { - return true; - } - return isConnected; - } -} - -PineTimeStyle::PineTimeStyle(DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController, - Controllers::NotificationManager& notificatioManager, - Controllers::Settings& settingsController, - Controllers::MotionController& motionController) - : Screen(app), - currentDateTime {{}}, - dateTimeController {dateTimeController}, - batteryController {batteryController}, - bleController {bleController}, - notificatioManager {notificatioManager}, - settingsController {settingsController}, - motionController {motionController} { - - // Create a 200px wide background rectangle - timebar = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorBG())); - lv_obj_set_style_local_radius(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); - lv_obj_set_size(timebar, 200, 240); - lv_obj_align(timebar, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 0); - - // 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_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_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); - - timeAMPM = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); - lv_obj_set_style_local_text_line_space(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -3); - lv_label_set_text_static(timeAMPM, ""); - lv_obj_align(timeAMPM, timebar, LV_ALIGN_IN_BOTTOM_LEFT, 2, -20); - - // Create a 40px wide bar down the right side of the screen - sidebar = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorBar())); - lv_obj_set_style_local_radius(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); - lv_obj_set_size(sidebar, 40, 240); - lv_obj_align(sidebar, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0); - - // Display icons - batteryIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_label_set_text_static(batteryIcon, Symbols::batteryFull); - lv_obj_align(batteryIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 2); - lv_obj_set_auto_realign(batteryIcon, true); - - 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(0x000000)); - lv_label_set_text_static(bleIcon, ""); - - notificationIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); - lv_label_set_text_static(notificationIcon, ""); - - // Calendar icon - calendarOuter = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(calendarOuter, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_radius(calendarOuter, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); - lv_obj_set_size(calendarOuter, 34, 34); - lv_obj_align(calendarOuter, sidebar, LV_ALIGN_CENTER, 0, 0); - - calendarInner = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(calendarInner, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_obj_set_style_local_radius(calendarInner, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); - lv_obj_set_size(calendarInner, 27, 27); - lv_obj_align(calendarInner, calendarOuter, LV_ALIGN_CENTER, 0, 0); - - calendarBar1 = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(calendarBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_radius(calendarBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); - lv_obj_set_size(calendarBar1, 3, 12); - lv_obj_align(calendarBar1, calendarOuter, LV_ALIGN_IN_TOP_MID, -6, -3); - - calendarBar2 = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(calendarBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_radius(calendarBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); - lv_obj_set_size(calendarBar2, 3, 12); - lv_obj_align(calendarBar2, calendarOuter, LV_ALIGN_IN_TOP_MID, 6, -3); - - calendarCrossBar1 = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(calendarCrossBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_radius(calendarCrossBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); - lv_obj_set_size(calendarCrossBar1, 8, 3); - lv_obj_align(calendarCrossBar1, calendarBar1, LV_ALIGN_IN_BOTTOM_MID, 0, 0); - - calendarCrossBar2 = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(calendarCrossBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_radius(calendarCrossBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); - lv_obj_set_size(calendarCrossBar2, 8, 3); - lv_obj_align(calendarCrossBar2, calendarBar2, LV_ALIGN_IN_BOTTOM_MID, 0, 0); - - // Display date - dateDayOfWeek = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(dateDayOfWeek, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_label_set_text_static(dateDayOfWeek, "THU"); - lv_obj_align(dateDayOfWeek, sidebar, LV_ALIGN_CENTER, 0, -34); - - dateDay = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(dateDay, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_label_set_text_static(dateDay, "25"); - lv_obj_align(dateDay, sidebar, LV_ALIGN_CENTER, 0, 3); - - dateMonth = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(dateMonth, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_label_set_text_static(dateMonth, "MAR"); - lv_obj_align(dateMonth, sidebar, LV_ALIGN_CENTER, 0, 32); - - // Step count gauge - if (settingsController.GetPTSColorBar() == Pinetime::Controllers::Settings::Colors::White) { - needle_colors[0] = LV_COLOR_BLACK; - } else { - needle_colors[0] = LV_COLOR_WHITE; - } - stepGauge = lv_gauge_create(lv_scr_act(), nullptr); - lv_gauge_set_needle_count(stepGauge, 1, needle_colors); - lv_obj_set_size(stepGauge, 40, 40); - lv_obj_align(stepGauge, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0); - lv_gauge_set_scale(stepGauge, 360, 11, 0); - lv_gauge_set_angle_offset(stepGauge, 180); - lv_gauge_set_critical_value(stepGauge, 100); - lv_gauge_set_range(stepGauge, 0, 100); - lv_gauge_set_value(stepGauge, 0, 0); - - lv_obj_set_style_local_pad_right(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3); - lv_obj_set_style_local_pad_left(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3); - lv_obj_set_style_local_pad_bottom(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3); - lv_obj_set_style_local_line_opa(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_obj_set_style_local_scale_width(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 4); - lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 4); - lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_line_opa(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 3); - lv_obj_set_style_local_pad_inner(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4); - - backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_click(backgroundLabel, true); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, 240, 240); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); - - btnNextTime = lv_btn_create(lv_scr_act(), nullptr); - btnNextTime->user_data = this; - lv_obj_set_size(btnNextTime, 60, 60); - lv_obj_align(btnNextTime, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -15, -80); - lv_obj_set_style_local_bg_opa(btnNextTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); - lv_obj_set_style_local_value_str(btnNextTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">"); - lv_obj_set_event_cb(btnNextTime, event_handler); - lv_obj_set_hidden(btnNextTime, true); - - btnPrevTime = lv_btn_create(lv_scr_act(), nullptr); - btnPrevTime->user_data = this; - lv_obj_set_size(btnPrevTime, 60, 60); - lv_obj_align(btnPrevTime, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 15, -80); - lv_obj_set_style_local_bg_opa(btnPrevTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); - lv_obj_set_style_local_value_str(btnPrevTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<"); - lv_obj_set_event_cb(btnPrevTime, event_handler); - lv_obj_set_hidden(btnPrevTime, true); - - btnNextBar = lv_btn_create(lv_scr_act(), nullptr); - btnNextBar->user_data = this; - lv_obj_set_size(btnNextBar, 60, 60); - lv_obj_align(btnNextBar, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -15, 0); - lv_obj_set_style_local_bg_opa(btnNextBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); - lv_obj_set_style_local_value_str(btnNextBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">"); - lv_obj_set_event_cb(btnNextBar, event_handler); - lv_obj_set_hidden(btnNextBar, true); - - btnPrevBar = lv_btn_create(lv_scr_act(), nullptr); - btnPrevBar->user_data = this; - lv_obj_set_size(btnPrevBar, 60, 60); - lv_obj_align(btnPrevBar, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 15, 0); - lv_obj_set_style_local_bg_opa(btnPrevBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); - lv_obj_set_style_local_value_str(btnPrevBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<"); - lv_obj_set_event_cb(btnPrevBar, event_handler); - lv_obj_set_hidden(btnPrevBar, true); - - btnNextBG = lv_btn_create(lv_scr_act(), nullptr); - btnNextBG->user_data = this; - lv_obj_set_size(btnNextBG, 60, 60); - lv_obj_align(btnNextBG, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -15, 80); - lv_obj_set_style_local_bg_opa(btnNextBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); - lv_obj_set_style_local_value_str(btnNextBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">"); - lv_obj_set_event_cb(btnNextBG, event_handler); - lv_obj_set_hidden(btnNextBG, true); - - btnPrevBG = lv_btn_create(lv_scr_act(), nullptr); - btnPrevBG->user_data = this; - lv_obj_set_size(btnPrevBG, 60, 60); - lv_obj_align(btnPrevBG, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 15, 80); - lv_obj_set_style_local_bg_opa(btnPrevBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); - lv_obj_set_style_local_value_str(btnPrevBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<"); - lv_obj_set_event_cb(btnPrevBG, event_handler); - lv_obj_set_hidden(btnPrevBG, true); - - btnReset = lv_btn_create(lv_scr_act(), nullptr); - btnReset->user_data = this; - lv_obj_set_size(btnReset, 60, 60); - lv_obj_align(btnReset, lv_scr_act(), LV_ALIGN_CENTER, 0, 80); - lv_obj_set_style_local_bg_opa(btnReset, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); - lv_obj_set_style_local_value_str(btnReset, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Rst"); - lv_obj_set_event_cb(btnReset, event_handler); - lv_obj_set_hidden(btnReset, true); - - btnRandom = lv_btn_create(lv_scr_act(), nullptr); - btnRandom->user_data = this; - lv_obj_set_size(btnRandom, 60, 60); - lv_obj_align(btnRandom, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); - lv_obj_set_style_local_bg_opa(btnRandom, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); - lv_obj_set_style_local_value_str(btnRandom, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Rnd"); - lv_obj_set_event_cb(btnRandom, event_handler); - lv_obj_set_hidden(btnRandom, true); - - btnClose = lv_btn_create(lv_scr_act(), nullptr); - btnClose->user_data = this; - lv_obj_set_size(btnClose, 60, 60); - lv_obj_align(btnClose, lv_scr_act(), LV_ALIGN_CENTER, 0, -80); - lv_obj_set_style_local_bg_opa(btnClose, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); - lv_obj_set_style_local_value_str(btnClose, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "X"); - lv_obj_set_event_cb(btnClose, event_handler); - lv_obj_set_hidden(btnClose, true); - - btnSet = lv_btn_create(lv_scr_act(), nullptr); - btnSet->user_data = this; - lv_obj_set_height(btnSet, 150); - lv_obj_set_width(btnSet, 150); - lv_obj_align(btnSet, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); - lv_obj_set_style_local_radius(btnSet, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 30); - 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_label_set_text_static(lbl_btnSet, Symbols::settings); - lv_obj_set_hidden(btnSet, true); - - taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); - Refresh(); -} - -PineTimeStyle::~PineTimeStyle() { - lv_task_del(taskRefresh); - lv_obj_clean(lv_scr_act()); -} - -bool PineTimeStyle::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnRandom)) { - lv_obj_set_hidden(btnSet, false); - savedTick = lv_tick_get(); - return true; - } - if ((event == Pinetime::Applications::TouchEvents::DoubleTap) && (lv_obj_get_hidden(btnRandom) == false)) { - return true; - } - return false; -} - -void PineTimeStyle::CloseMenu() { - settingsController.SaveSettings(); - lv_obj_set_hidden(btnNextTime, true); - lv_obj_set_hidden(btnPrevTime, true); - lv_obj_set_hidden(btnNextBar, true); - lv_obj_set_hidden(btnPrevBar, true); - lv_obj_set_hidden(btnNextBG, true); - lv_obj_set_hidden(btnPrevBG, true); - lv_obj_set_hidden(btnReset, true); - lv_obj_set_hidden(btnRandom, true); - lv_obj_set_hidden(btnClose, true); -} - -bool PineTimeStyle::OnButtonPushed() { - if (!lv_obj_get_hidden(btnClose)) { - CloseMenu(); - return true; - } - return false; -} - -void PineTimeStyle::SetBatteryIcon() { - auto batteryPercent = batteryPercentRemaining.Get(); - lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); -} - - -void PineTimeStyle::AlignIcons() { - bool isBleIconVisible = IsBleIconVisible(bleRadioEnabled.Get(), bleState.Get()); - if (notificationState.Get() && isBleIconVisible) { - lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 8, 25); - lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25); - } else if (notificationState.Get() && !isBleIconVisible) { - lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); - } else { - lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); - } -} - -void PineTimeStyle::Refresh() { - isCharging = batteryController.IsCharging(); - if (isCharging.IsUpdated()) { - if (isCharging.Get()) { - lv_label_set_text_static(batteryIcon, Symbols::plug); - } else { - SetBatteryIcon(); - } - } - if (!isCharging.Get()) { - batteryPercentRemaining = batteryController.PercentRemaining(); - if (batteryPercentRemaining.IsUpdated()) { - SetBatteryIcon(); - } - } - - bleState = bleController.IsConnected(); - bleRadioEnabled = bleController.IsRadioEnabled(); - if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) { - lv_label_set_text(bleIcon, BleIcon::GetIcon(bleRadioEnabled.Get(), bleState.Get())); - AlignIcons(); - } - - notificationState = notificatioManager.AreNewNotificationsAvailable(); - if (notificationState.IsUpdated()) { - lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get())); - AlignIcons(); - } - - currentDateTime = dateTimeController.CurrentDateTime(); - if (currentDateTime.IsUpdated()) { - auto newDateTime = currentDateTime.Get(); - - auto dp = date::floor(newDateTime); - auto time = date::make_time(newDateTime - dp); - auto yearMonthDay = date::year_month_day(dp); - - auto year = static_cast(yearMonthDay.year()); - auto month = static_cast(static_cast(yearMonthDay.month())); - auto day = static_cast(yearMonthDay.day()); - auto dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); - - uint8_t hour = time.hours().count(); - uint8_t minute = time.minutes().count(); - - if (displayedHour != hour || displayedMinute != minute) { - displayedHour = hour; - displayedMinute = minute; - - if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { - char ampmChar[4] = "A\nM"; - if (hour == 0) { - hour = 12; - } else if (hour == 12) { - ampmChar[0] = 'P'; - } else if (hour > 12) { - hour = hour - 12; - ampmChar[0] = 'P'; - } - lv_label_set_text(timeAMPM, ampmChar); - // Should be padded with blank spaces, but the space character doesn't exist in the font - lv_label_set_text_fmt(timeDD1, "%02d", hour); - lv_label_set_text_fmt(timeDD2, "%02d", minute); - } else { - lv_label_set_text_fmt(timeDD1, "%02d", hour); - lv_label_set_text_fmt(timeDD2, "%02d", minute); - } - } - - if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) { - lv_label_set_text_fmt(dateDayOfWeek, "%s", dateTimeController.DayOfWeekShortToString()); - lv_label_set_text_fmt(dateDay, "%d", day); - lv_obj_realign(dateDay); - lv_label_set_text_fmt(dateMonth, "%s", dateTimeController.MonthShortToString()); - - currentYear = year; - currentMonth = month; - currentDayOfWeek = dayOfWeek; - currentDay = day; - } - } - - stepCount = motionController.NbSteps(); - motionSensorOk = motionController.IsSensorOk(); - if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) { - lv_gauge_set_value(stepGauge, 0, (stepCount.Get() / (settingsController.GetStepsGoal() / 100))); - lv_obj_realign(stepGauge); - if (stepCount.Get() > settingsController.GetStepsGoal()) { - lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_obj_set_style_local_scale_grad_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); - } - } - if (!lv_obj_get_hidden(btnSet)) { - if ((savedTick > 0) && (lv_tick_get() - savedTick > 3000)) { - lv_obj_set_hidden(btnSet, true); - savedTick = 0; - } - } -} - -void PineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) { - auto valueTime = settingsController.GetPTSColorTime(); - auto valueBar = settingsController.GetPTSColorBar(); - auto valueBG = settingsController.GetPTSColorBG(); - - if (event == LV_EVENT_CLICKED) { - if (object == btnNextTime) { - valueTime = GetNext(valueTime); - if (valueTime == valueBG) { - valueTime = GetNext(valueTime); - } - settingsController.SetPTSColorTime(valueTime); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - } - if (object == btnPrevTime) { - valueTime = GetPrevious(valueTime); - if (valueTime == valueBG) { - valueTime = GetPrevious(valueTime); - } - settingsController.SetPTSColorTime(valueTime); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - } - if (object == btnNextBar) { - valueBar = GetNext(valueBar); - if (valueBar == Controllers::Settings::Colors::Black) { - valueBar = GetNext(valueBar); - } - if (valueBar == Controllers::Settings::Colors::White) { - needle_colors[0] = LV_COLOR_BLACK; - } else { - needle_colors[0] = LV_COLOR_WHITE; - } - settingsController.SetPTSColorBar(valueBar); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar)); - } - if (object == btnPrevBar) { - valueBar = GetPrevious(valueBar); - if (valueBar == Controllers::Settings::Colors::Black) { - valueBar = GetPrevious(valueBar); - } - if (valueBar == Controllers::Settings::Colors::White) { - needle_colors[0] = LV_COLOR_BLACK; - } else { - needle_colors[0] = LV_COLOR_WHITE; - } - settingsController.SetPTSColorBar(valueBar); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar)); - } - if (object == btnNextBG) { - valueBG = GetNext(valueBG); - if (valueBG == valueTime) { - valueBG = GetNext(valueBG); - } - settingsController.SetPTSColorBG(valueBG); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG)); - } - if (object == btnPrevBG) { - valueBG = GetPrevious(valueBG); - if (valueBG == valueTime) { - valueBG = GetPrevious(valueBG); - } - settingsController.SetPTSColorBG(valueBG); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG)); - } - if (object == btnReset) { - needle_colors[0] = LV_COLOR_WHITE; - settingsController.SetPTSColorTime(Controllers::Settings::Colors::Teal); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal)); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal)); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal)); - settingsController.SetPTSColorBar(Controllers::Settings::Colors::Teal); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal)); - settingsController.SetPTSColorBG(Controllers::Settings::Colors::Black); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Black)); - } - if (object == btnRandom) { - valueTime = static_cast(rand() % 17); - valueBar = static_cast(rand() % 17); - valueBG = static_cast(rand() % 17); - if (valueTime == valueBG) { - valueBG = GetNext(valueBG); - } - if (valueBar == Controllers::Settings::Colors::Black) { - valueBar = GetPrevious(valueBar); - } - if (valueBar == Controllers::Settings::Colors::White) { - needle_colors[0] = LV_COLOR_BLACK; - } else { - needle_colors[0] = LV_COLOR_WHITE; - } - settingsController.SetPTSColorTime(static_cast(valueTime)); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - settingsController.SetPTSColorBar(static_cast(valueBar)); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar)); - settingsController.SetPTSColorBG(static_cast(valueBG)); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG)); - } - if (object == btnClose) { - CloseMenu(); - } - if (object == btnSet) { - lv_obj_set_hidden(btnSet, true); - lv_obj_set_hidden(btnNextTime, false); - lv_obj_set_hidden(btnPrevTime, false); - lv_obj_set_hidden(btnNextBar, false); - lv_obj_set_hidden(btnPrevBar, false); - lv_obj_set_hidden(btnNextBG, false); - lv_obj_set_hidden(btnPrevBG, false); - lv_obj_set_hidden(btnReset, false); - lv_obj_set_hidden(btnRandom, false); - lv_obj_set_hidden(btnClose, false); - } - } -} - -Pinetime::Controllers::Settings::Colors PineTimeStyle::GetNext(Pinetime::Controllers::Settings::Colors color) { - auto colorAsInt = static_cast(color); - Pinetime::Controllers::Settings::Colors nextColor; - if (colorAsInt < 16) { - nextColor = static_cast(colorAsInt + 1); - } else { - nextColor = static_cast(0); - } - return nextColor; -} - -Pinetime::Controllers::Settings::Colors PineTimeStyle::GetPrevious(Pinetime::Controllers::Settings::Colors color) { - auto colorAsInt = static_cast(color); - Pinetime::Controllers::Settings::Colors prevColor; - - if (colorAsInt > 0) { - prevColor = static_cast(colorAsInt - 1); - } else { - prevColor = static_cast(16); - } - return prevColor; -} diff --git a/src/displayapp/screens/PineTimeStyle.h b/src/displayapp/screens/PineTimeStyle.h deleted file mode 100644 index 5de9a5fa..00000000 --- a/src/displayapp/screens/PineTimeStyle.h +++ /dev/null @@ -1,111 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include "displayapp/screens/Screen.h" -#include "displayapp/Colors.h" -#include "components/datetime/DateTimeController.h" -#include "components/ble/BleController.h" - -namespace Pinetime { - namespace Controllers { - class Settings; - class Battery; - class Ble; - class NotificationManager; - class HeartRateController; - class MotionController; - } - - namespace Applications { - namespace Screens { - class PineTimeStyle : public Screen { - public: - PineTimeStyle(DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController, - Controllers::NotificationManager& notificatioManager, - Controllers::Settings& settingsController, - Controllers::MotionController& motionController); - ~PineTimeStyle() override; - - bool OnTouchEvent(TouchEvents event) override; - bool OnButtonPushed() override; - - void Refresh() override; - - void UpdateSelected(lv_obj_t *object, lv_event_t event); - - private: - uint8_t displayedHour = -1; - uint8_t displayedMinute = -1; - - uint16_t currentYear = 1970; - Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown; - Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown; - uint8_t currentDay = 0; - uint32_t savedTick = 0; - - DirtyValue batteryPercentRemaining {}; - DirtyValue isCharging {}; - DirtyValue bleState {}; - DirtyValue bleRadioEnabled {}; - DirtyValue> currentDateTime {}; - DirtyValue motionSensorOk {}; - DirtyValue stepCount {}; - DirtyValue notificationState {}; - - static Pinetime::Controllers::Settings::Colors GetNext(Controllers::Settings::Colors color); - static Pinetime::Controllers::Settings::Colors GetPrevious(Controllers::Settings::Colors color); - - lv_obj_t* btnNextTime; - lv_obj_t* btnPrevTime; - lv_obj_t* btnNextBar; - lv_obj_t* btnPrevBar; - lv_obj_t* btnNextBG; - lv_obj_t* btnPrevBG; - lv_obj_t* btnReset; - lv_obj_t* btnRandom; - lv_obj_t* btnClose; - lv_obj_t* timebar; - lv_obj_t* sidebar; - lv_obj_t* timeDD1; - lv_obj_t* timeDD2; - lv_obj_t* timeAMPM; - lv_obj_t* dateDayOfWeek; - lv_obj_t* dateDay; - lv_obj_t* dateMonth; - lv_obj_t* backgroundLabel; - lv_obj_t* batteryIcon; - lv_obj_t* bleIcon; - lv_obj_t* calendarOuter; - lv_obj_t* calendarInner; - lv_obj_t* calendarBar1; - lv_obj_t* calendarBar2; - lv_obj_t* calendarCrossBar1; - lv_obj_t* calendarCrossBar2; - lv_obj_t* notificationIcon; - lv_obj_t* stepGauge; - lv_obj_t* btnSet; - lv_obj_t* lbl_btnSet; - lv_color_t needle_colors[1]; - - Controllers::DateTime& dateTimeController; - Controllers::Battery& batteryController; - Controllers::Ble& bleController; - Controllers::NotificationManager& notificatioManager; - Controllers::Settings& settingsController; - Controllers::MotionController& motionController; - - void SetBatteryIcon(); - void CloseMenu(); - void AlignIcons(); - - lv_task_t* taskRefresh; - }; - } - } -} diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp new file mode 100644 index 00000000..e032ac2e --- /dev/null +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -0,0 +1,601 @@ +/* + * This file is part of the Infinitime distribution (https://github.com/InfiniTimeOrg/Infinitime). + * Copyright (c) 2021 Kieran Cawthray. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * PineTimeStyle watchface for Infinitime created by Kieran Cawthray + * Based on WatchFaceDigital + * Style/layout copied from TimeStyle for Pebble by Dan Tilden (github.com/tilden) + */ + +#include "displayapp/screens/WatchFacePineTimeStyle.h" +#include +#include +#include +#include +#include "displayapp/screens/BatteryIcon.h" +#include "displayapp/screens/BleIcon.h" +#include "displayapp/screens/NotificationIcon.h" +#include "displayapp/screens/Symbols.h" +#include "components/battery/BatteryController.h" +#include "components/ble/BleController.h" +#include "components/ble/NotificationManager.h" +#include "components/motion/MotionController.h" +#include "components/settings/Settings.h" +#include "displayapp/DisplayApp.h" + +using namespace Pinetime::Applications::Screens; + +namespace { + void event_handler(lv_obj_t* obj, lv_event_t event) { + auto* screen = static_cast(obj->user_data); + screen->UpdateSelected(obj, event); + } + + bool IsBleIconVisible(bool isRadioEnabled, bool isConnected) { + if(!isRadioEnabled) { + return true; + } + return isConnected; + } +} + +WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app, + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::NotificationManager& notificatioManager, + Controllers::Settings& settingsController, + Controllers::MotionController& motionController) + : Screen(app), + currentDateTime {{}}, + dateTimeController {dateTimeController}, + batteryController {batteryController}, + bleController {bleController}, + notificatioManager {notificatioManager}, + settingsController {settingsController}, + motionController {motionController} { + + // Create a 200px wide background rectangle + timebar = lv_obj_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorBG())); + lv_obj_set_style_local_radius(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); + lv_obj_set_size(timebar, 200, 240); + lv_obj_align(timebar, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 0); + + // 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_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_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); + + timeAMPM = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); + lv_obj_set_style_local_text_line_space(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -3); + lv_label_set_text_static(timeAMPM, ""); + lv_obj_align(timeAMPM, timebar, LV_ALIGN_IN_BOTTOM_LEFT, 2, -20); + + // Create a 40px wide bar down the right side of the screen + sidebar = lv_obj_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorBar())); + lv_obj_set_style_local_radius(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); + lv_obj_set_size(sidebar, 40, 240); + lv_obj_align(sidebar, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0); + + // Display icons + batteryIcon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_label_set_text_static(batteryIcon, Symbols::batteryFull); + lv_obj_align(batteryIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 2); + lv_obj_set_auto_realign(batteryIcon, true); + + 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(0x000000)); + lv_label_set_text_static(bleIcon, ""); + + notificationIcon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); + lv_label_set_text_static(notificationIcon, ""); + + // Calendar icon + calendarOuter = lv_obj_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_bg_color(calendarOuter, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_radius(calendarOuter, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); + lv_obj_set_size(calendarOuter, 34, 34); + lv_obj_align(calendarOuter, sidebar, LV_ALIGN_CENTER, 0, 0); + + calendarInner = lv_obj_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_bg_color(calendarInner, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_radius(calendarInner, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); + lv_obj_set_size(calendarInner, 27, 27); + lv_obj_align(calendarInner, calendarOuter, LV_ALIGN_CENTER, 0, 0); + + calendarBar1 = lv_obj_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_bg_color(calendarBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_radius(calendarBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); + lv_obj_set_size(calendarBar1, 3, 12); + lv_obj_align(calendarBar1, calendarOuter, LV_ALIGN_IN_TOP_MID, -6, -3); + + calendarBar2 = lv_obj_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_bg_color(calendarBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_radius(calendarBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); + lv_obj_set_size(calendarBar2, 3, 12); + lv_obj_align(calendarBar2, calendarOuter, LV_ALIGN_IN_TOP_MID, 6, -3); + + calendarCrossBar1 = lv_obj_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_bg_color(calendarCrossBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_radius(calendarCrossBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); + lv_obj_set_size(calendarCrossBar1, 8, 3); + lv_obj_align(calendarCrossBar1, calendarBar1, LV_ALIGN_IN_BOTTOM_MID, 0, 0); + + calendarCrossBar2 = lv_obj_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_bg_color(calendarCrossBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_radius(calendarCrossBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); + lv_obj_set_size(calendarCrossBar2, 8, 3); + lv_obj_align(calendarCrossBar2, calendarBar2, LV_ALIGN_IN_BOTTOM_MID, 0, 0); + + // Display date + dateDayOfWeek = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(dateDayOfWeek, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_label_set_text_static(dateDayOfWeek, "THU"); + lv_obj_align(dateDayOfWeek, sidebar, LV_ALIGN_CENTER, 0, -34); + + dateDay = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(dateDay, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_label_set_text_static(dateDay, "25"); + lv_obj_align(dateDay, sidebar, LV_ALIGN_CENTER, 0, 3); + + dateMonth = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(dateMonth, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_label_set_text_static(dateMonth, "MAR"); + lv_obj_align(dateMonth, sidebar, LV_ALIGN_CENTER, 0, 32); + + // Step count gauge + if (settingsController.GetPTSColorBar() == Pinetime::Controllers::Settings::Colors::White) { + needle_colors[0] = LV_COLOR_BLACK; + } else { + needle_colors[0] = LV_COLOR_WHITE; + } + stepGauge = lv_gauge_create(lv_scr_act(), nullptr); + lv_gauge_set_needle_count(stepGauge, 1, needle_colors); + lv_obj_set_size(stepGauge, 40, 40); + lv_obj_align(stepGauge, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0); + lv_gauge_set_scale(stepGauge, 360, 11, 0); + lv_gauge_set_angle_offset(stepGauge, 180); + lv_gauge_set_critical_value(stepGauge, 100); + lv_gauge_set_range(stepGauge, 0, 100); + lv_gauge_set_value(stepGauge, 0, 0); + + lv_obj_set_style_local_pad_right(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3); + lv_obj_set_style_local_pad_left(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3); + lv_obj_set_style_local_pad_bottom(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3); + lv_obj_set_style_local_line_opa(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_obj_set_style_local_scale_width(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 4); + lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 4); + lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_line_opa(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 3); + lv_obj_set_style_local_pad_inner(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4); + + backgroundLabel = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_click(backgroundLabel, true); + lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); + lv_obj_set_size(backgroundLabel, 240, 240); + lv_obj_set_pos(backgroundLabel, 0, 0); + lv_label_set_text_static(backgroundLabel, ""); + + btnNextTime = lv_btn_create(lv_scr_act(), nullptr); + btnNextTime->user_data = this; + lv_obj_set_size(btnNextTime, 60, 60); + lv_obj_align(btnNextTime, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -15, -80); + lv_obj_set_style_local_bg_opa(btnNextTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_style_local_value_str(btnNextTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">"); + lv_obj_set_event_cb(btnNextTime, event_handler); + lv_obj_set_hidden(btnNextTime, true); + + btnPrevTime = lv_btn_create(lv_scr_act(), nullptr); + btnPrevTime->user_data = this; + lv_obj_set_size(btnPrevTime, 60, 60); + lv_obj_align(btnPrevTime, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 15, -80); + lv_obj_set_style_local_bg_opa(btnPrevTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_style_local_value_str(btnPrevTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<"); + lv_obj_set_event_cb(btnPrevTime, event_handler); + lv_obj_set_hidden(btnPrevTime, true); + + btnNextBar = lv_btn_create(lv_scr_act(), nullptr); + btnNextBar->user_data = this; + lv_obj_set_size(btnNextBar, 60, 60); + lv_obj_align(btnNextBar, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -15, 0); + lv_obj_set_style_local_bg_opa(btnNextBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_style_local_value_str(btnNextBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">"); + lv_obj_set_event_cb(btnNextBar, event_handler); + lv_obj_set_hidden(btnNextBar, true); + + btnPrevBar = lv_btn_create(lv_scr_act(), nullptr); + btnPrevBar->user_data = this; + lv_obj_set_size(btnPrevBar, 60, 60); + lv_obj_align(btnPrevBar, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 15, 0); + lv_obj_set_style_local_bg_opa(btnPrevBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_style_local_value_str(btnPrevBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<"); + lv_obj_set_event_cb(btnPrevBar, event_handler); + lv_obj_set_hidden(btnPrevBar, true); + + btnNextBG = lv_btn_create(lv_scr_act(), nullptr); + btnNextBG->user_data = this; + lv_obj_set_size(btnNextBG, 60, 60); + lv_obj_align(btnNextBG, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -15, 80); + lv_obj_set_style_local_bg_opa(btnNextBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_style_local_value_str(btnNextBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">"); + lv_obj_set_event_cb(btnNextBG, event_handler); + lv_obj_set_hidden(btnNextBG, true); + + btnPrevBG = lv_btn_create(lv_scr_act(), nullptr); + btnPrevBG->user_data = this; + lv_obj_set_size(btnPrevBG, 60, 60); + lv_obj_align(btnPrevBG, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 15, 80); + lv_obj_set_style_local_bg_opa(btnPrevBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_style_local_value_str(btnPrevBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<"); + lv_obj_set_event_cb(btnPrevBG, event_handler); + lv_obj_set_hidden(btnPrevBG, true); + + btnReset = lv_btn_create(lv_scr_act(), nullptr); + btnReset->user_data = this; + lv_obj_set_size(btnReset, 60, 60); + lv_obj_align(btnReset, lv_scr_act(), LV_ALIGN_CENTER, 0, 80); + lv_obj_set_style_local_bg_opa(btnReset, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_style_local_value_str(btnReset, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Rst"); + lv_obj_set_event_cb(btnReset, event_handler); + lv_obj_set_hidden(btnReset, true); + + btnRandom = lv_btn_create(lv_scr_act(), nullptr); + btnRandom->user_data = this; + lv_obj_set_size(btnRandom, 60, 60); + lv_obj_align(btnRandom, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style_local_bg_opa(btnRandom, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_style_local_value_str(btnRandom, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Rnd"); + lv_obj_set_event_cb(btnRandom, event_handler); + lv_obj_set_hidden(btnRandom, true); + + btnClose = lv_btn_create(lv_scr_act(), nullptr); + btnClose->user_data = this; + lv_obj_set_size(btnClose, 60, 60); + lv_obj_align(btnClose, lv_scr_act(), LV_ALIGN_CENTER, 0, -80); + lv_obj_set_style_local_bg_opa(btnClose, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_style_local_value_str(btnClose, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "X"); + lv_obj_set_event_cb(btnClose, event_handler); + lv_obj_set_hidden(btnClose, true); + + btnSet = lv_btn_create(lv_scr_act(), nullptr); + btnSet->user_data = this; + lv_obj_set_height(btnSet, 150); + lv_obj_set_width(btnSet, 150); + lv_obj_align(btnSet, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style_local_radius(btnSet, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 30); + 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_label_set_text_static(lbl_btnSet, Symbols::settings); + lv_obj_set_hidden(btnSet, true); + + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); + Refresh(); +} + +WatchFacePineTimeStyle::~WatchFacePineTimeStyle() { + lv_task_del(taskRefresh); + lv_obj_clean(lv_scr_act()); +} + +bool WatchFacePineTimeStyle::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnRandom)) { + lv_obj_set_hidden(btnSet, false); + savedTick = lv_tick_get(); + return true; + } + if ((event == Pinetime::Applications::TouchEvents::DoubleTap) && (lv_obj_get_hidden(btnRandom) == false)) { + return true; + } + return false; +} + +void WatchFacePineTimeStyle::CloseMenu() { + settingsController.SaveSettings(); + lv_obj_set_hidden(btnNextTime, true); + lv_obj_set_hidden(btnPrevTime, true); + lv_obj_set_hidden(btnNextBar, true); + lv_obj_set_hidden(btnPrevBar, true); + lv_obj_set_hidden(btnNextBG, true); + lv_obj_set_hidden(btnPrevBG, true); + lv_obj_set_hidden(btnReset, true); + lv_obj_set_hidden(btnRandom, true); + lv_obj_set_hidden(btnClose, true); +} + +bool WatchFacePineTimeStyle::OnButtonPushed() { + if (!lv_obj_get_hidden(btnClose)) { + CloseMenu(); + return true; + } + return false; +} + +void WatchFacePineTimeStyle::SetBatteryIcon() { + auto batteryPercent = batteryPercentRemaining.Get(); + lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); +} + + +void WatchFacePineTimeStyle::AlignIcons() { + bool isBleIconVisible = IsBleIconVisible(bleRadioEnabled.Get(), bleState.Get()); + if (notificationState.Get() && isBleIconVisible) { + lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 8, 25); + lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25); + } else if (notificationState.Get() && !isBleIconVisible) { + lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); + } else { + lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); + } +} + +void WatchFacePineTimeStyle::Refresh() { + isCharging = batteryController.IsCharging(); + if (isCharging.IsUpdated()) { + if (isCharging.Get()) { + lv_label_set_text_static(batteryIcon, Symbols::plug); + } else { + SetBatteryIcon(); + } + } + if (!isCharging.Get()) { + batteryPercentRemaining = batteryController.PercentRemaining(); + if (batteryPercentRemaining.IsUpdated()) { + SetBatteryIcon(); + } + } + + bleState = bleController.IsConnected(); + bleRadioEnabled = bleController.IsRadioEnabled(); + if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) { + lv_label_set_text(bleIcon, BleIcon::GetIcon(bleRadioEnabled.Get(), bleState.Get())); + AlignIcons(); + } + + notificationState = notificatioManager.AreNewNotificationsAvailable(); + if (notificationState.IsUpdated()) { + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get())); + AlignIcons(); + } + + currentDateTime = dateTimeController.CurrentDateTime(); + if (currentDateTime.IsUpdated()) { + auto newDateTime = currentDateTime.Get(); + + auto dp = date::floor(newDateTime); + auto time = date::make_time(newDateTime - dp); + auto yearMonthDay = date::year_month_day(dp); + + auto year = static_cast(yearMonthDay.year()); + auto month = static_cast(static_cast(yearMonthDay.month())); + auto day = static_cast(yearMonthDay.day()); + auto dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); + + uint8_t hour = time.hours().count(); + uint8_t minute = time.minutes().count(); + + if (displayedHour != hour || displayedMinute != minute) { + displayedHour = hour; + displayedMinute = minute; + + if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { + char ampmChar[4] = "A\nM"; + if (hour == 0) { + hour = 12; + } else if (hour == 12) { + ampmChar[0] = 'P'; + } else if (hour > 12) { + hour = hour - 12; + ampmChar[0] = 'P'; + } + lv_label_set_text(timeAMPM, ampmChar); + // Should be padded with blank spaces, but the space character doesn't exist in the font + lv_label_set_text_fmt(timeDD1, "%02d", hour); + lv_label_set_text_fmt(timeDD2, "%02d", minute); + } else { + lv_label_set_text_fmt(timeDD1, "%02d", hour); + lv_label_set_text_fmt(timeDD2, "%02d", minute); + } + } + + if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) { + lv_label_set_text_fmt(dateDayOfWeek, "%s", dateTimeController.DayOfWeekShortToString()); + lv_label_set_text_fmt(dateDay, "%d", day); + lv_obj_realign(dateDay); + lv_label_set_text_fmt(dateMonth, "%s", dateTimeController.MonthShortToString()); + + currentYear = year; + currentMonth = month; + currentDayOfWeek = dayOfWeek; + currentDay = day; + } + } + + stepCount = motionController.NbSteps(); + motionSensorOk = motionController.IsSensorOk(); + if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) { + lv_gauge_set_value(stepGauge, 0, (stepCount.Get() / (settingsController.GetStepsGoal() / 100))); + lv_obj_realign(stepGauge); + if (stepCount.Get() > settingsController.GetStepsGoal()) { + lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_scale_grad_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + } + } + if (!lv_obj_get_hidden(btnSet)) { + if ((savedTick > 0) && (lv_tick_get() - savedTick > 3000)) { + lv_obj_set_hidden(btnSet, true); + savedTick = 0; + } + } +} + +void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) { + auto valueTime = settingsController.GetPTSColorTime(); + auto valueBar = settingsController.GetPTSColorBar(); + auto valueBG = settingsController.GetPTSColorBG(); + + if (event == LV_EVENT_CLICKED) { + if (object == btnNextTime) { + valueTime = GetNext(valueTime); + if (valueTime == valueBG) { + valueTime = GetNext(valueTime); + } + settingsController.SetPTSColorTime(valueTime); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); + } + if (object == btnPrevTime) { + valueTime = GetPrevious(valueTime); + if (valueTime == valueBG) { + valueTime = GetPrevious(valueTime); + } + settingsController.SetPTSColorTime(valueTime); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); + } + if (object == btnNextBar) { + valueBar = GetNext(valueBar); + if (valueBar == Controllers::Settings::Colors::Black) { + valueBar = GetNext(valueBar); + } + if (valueBar == Controllers::Settings::Colors::White) { + needle_colors[0] = LV_COLOR_BLACK; + } else { + needle_colors[0] = LV_COLOR_WHITE; + } + settingsController.SetPTSColorBar(valueBar); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar)); + } + if (object == btnPrevBar) { + valueBar = GetPrevious(valueBar); + if (valueBar == Controllers::Settings::Colors::Black) { + valueBar = GetPrevious(valueBar); + } + if (valueBar == Controllers::Settings::Colors::White) { + needle_colors[0] = LV_COLOR_BLACK; + } else { + needle_colors[0] = LV_COLOR_WHITE; + } + settingsController.SetPTSColorBar(valueBar); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar)); + } + if (object == btnNextBG) { + valueBG = GetNext(valueBG); + if (valueBG == valueTime) { + valueBG = GetNext(valueBG); + } + settingsController.SetPTSColorBG(valueBG); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG)); + } + if (object == btnPrevBG) { + valueBG = GetPrevious(valueBG); + if (valueBG == valueTime) { + valueBG = GetPrevious(valueBG); + } + settingsController.SetPTSColorBG(valueBG); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG)); + } + if (object == btnReset) { + needle_colors[0] = LV_COLOR_WHITE; + settingsController.SetPTSColorTime(Controllers::Settings::Colors::Teal); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal)); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal)); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal)); + settingsController.SetPTSColorBar(Controllers::Settings::Colors::Teal); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal)); + settingsController.SetPTSColorBG(Controllers::Settings::Colors::Black); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Black)); + } + if (object == btnRandom) { + valueTime = static_cast(rand() % 17); + valueBar = static_cast(rand() % 17); + valueBG = static_cast(rand() % 17); + if (valueTime == valueBG) { + valueBG = GetNext(valueBG); + } + if (valueBar == Controllers::Settings::Colors::Black) { + valueBar = GetPrevious(valueBar); + } + if (valueBar == Controllers::Settings::Colors::White) { + needle_colors[0] = LV_COLOR_BLACK; + } else { + needle_colors[0] = LV_COLOR_WHITE; + } + settingsController.SetPTSColorTime(static_cast(valueTime)); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); + settingsController.SetPTSColorBar(static_cast(valueBar)); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar)); + settingsController.SetPTSColorBG(static_cast(valueBG)); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG)); + } + if (object == btnClose) { + CloseMenu(); + } + if (object == btnSet) { + lv_obj_set_hidden(btnSet, true); + lv_obj_set_hidden(btnNextTime, false); + lv_obj_set_hidden(btnPrevTime, false); + lv_obj_set_hidden(btnNextBar, false); + lv_obj_set_hidden(btnPrevBar, false); + lv_obj_set_hidden(btnNextBG, false); + lv_obj_set_hidden(btnPrevBG, false); + lv_obj_set_hidden(btnReset, false); + lv_obj_set_hidden(btnRandom, false); + lv_obj_set_hidden(btnClose, false); + } + } +} + +Pinetime::Controllers::Settings::Colors WatchFacePineTimeStyle::GetNext(Pinetime::Controllers::Settings::Colors color) { + auto colorAsInt = static_cast(color); + Pinetime::Controllers::Settings::Colors nextColor; + if (colorAsInt < 16) { + nextColor = static_cast(colorAsInt + 1); + } else { + nextColor = static_cast(0); + } + return nextColor; +} + +Pinetime::Controllers::Settings::Colors WatchFacePineTimeStyle::GetPrevious(Pinetime::Controllers::Settings::Colors color) { + auto colorAsInt = static_cast(color); + Pinetime::Controllers::Settings::Colors prevColor; + + if (colorAsInt > 0) { + prevColor = static_cast(colorAsInt - 1); + } else { + prevColor = static_cast(16); + } + return prevColor; +} diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.h b/src/displayapp/screens/WatchFacePineTimeStyle.h new file mode 100644 index 00000000..465aa705 --- /dev/null +++ b/src/displayapp/screens/WatchFacePineTimeStyle.h @@ -0,0 +1,111 @@ +#pragma once + +#include +#include +#include +#include +#include "displayapp/screens/Screen.h" +#include "displayapp/Colors.h" +#include "components/datetime/DateTimeController.h" +#include "components/ble/BleController.h" + +namespace Pinetime { + namespace Controllers { + class Settings; + class Battery; + class Ble; + class NotificationManager; + class HeartRateController; + class MotionController; + } + + namespace Applications { + namespace Screens { + class WatchFacePineTimeStyle : public Screen { + public: + WatchFacePineTimeStyle(DisplayApp* app, + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::NotificationManager& notificatioManager, + Controllers::Settings& settingsController, + Controllers::MotionController& motionController); + ~WatchFacePineTimeStyle() override; + + bool OnTouchEvent(TouchEvents event) override; + bool OnButtonPushed() override; + + void Refresh() override; + + void UpdateSelected(lv_obj_t *object, lv_event_t event); + + private: + uint8_t displayedHour = -1; + uint8_t displayedMinute = -1; + + uint16_t currentYear = 1970; + Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown; + Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown; + uint8_t currentDay = 0; + uint32_t savedTick = 0; + + DirtyValue batteryPercentRemaining {}; + DirtyValue isCharging {}; + DirtyValue bleState {}; + DirtyValue bleRadioEnabled {}; + DirtyValue> currentDateTime {}; + DirtyValue motionSensorOk {}; + DirtyValue stepCount {}; + DirtyValue notificationState {}; + + static Pinetime::Controllers::Settings::Colors GetNext(Controllers::Settings::Colors color); + static Pinetime::Controllers::Settings::Colors GetPrevious(Controllers::Settings::Colors color); + + lv_obj_t* btnNextTime; + lv_obj_t* btnPrevTime; + lv_obj_t* btnNextBar; + lv_obj_t* btnPrevBar; + lv_obj_t* btnNextBG; + lv_obj_t* btnPrevBG; + lv_obj_t* btnReset; + lv_obj_t* btnRandom; + lv_obj_t* btnClose; + lv_obj_t* timebar; + lv_obj_t* sidebar; + lv_obj_t* timeDD1; + lv_obj_t* timeDD2; + lv_obj_t* timeAMPM; + lv_obj_t* dateDayOfWeek; + lv_obj_t* dateDay; + lv_obj_t* dateMonth; + lv_obj_t* backgroundLabel; + lv_obj_t* batteryIcon; + lv_obj_t* bleIcon; + lv_obj_t* calendarOuter; + lv_obj_t* calendarInner; + lv_obj_t* calendarBar1; + lv_obj_t* calendarBar2; + lv_obj_t* calendarCrossBar1; + lv_obj_t* calendarCrossBar2; + lv_obj_t* notificationIcon; + lv_obj_t* stepGauge; + lv_obj_t* btnSet; + lv_obj_t* lbl_btnSet; + lv_color_t needle_colors[1]; + + Controllers::DateTime& dateTimeController; + Controllers::Battery& batteryController; + Controllers::Ble& bleController; + Controllers::NotificationManager& notificatioManager; + Controllers::Settings& settingsController; + Controllers::MotionController& motionController; + + void SetBatteryIcon(); + void CloseMenu(); + void AlignIcons(); + + lv_task_t* taskRefresh; + }; + } + } +} -- cgit v1.2.3-70-g09d2 From 0933d60b1627df18c5615c610b8e26a685901b44 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Sun, 13 Mar 2022 21:58:53 +0100 Subject: Music: fix warning about overridden function Clang warns on `OnTouchEvent()` function, which is overridden, but is missing the `override` keyword ``` In file included from InfiniTime/src/displayapp/screens/Music.cpp:18: InfiniTime/src/displayapp/screens/Music.h:43:14: warning: 'OnTouchEvent' overrides a member function but is not marked 'override' [-Winconsistent-missing-override] bool OnTouchEvent(TouchEvents event); ^ ``` --- src/displayapp/screens/Music.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h index 35f7bab5..27b2d3d2 100644 --- a/src/displayapp/screens/Music.h +++ b/src/displayapp/screens/Music.h @@ -40,7 +40,7 @@ namespace Pinetime { void OnObjectEvent(lv_obj_t* obj, lv_event_t event); private: - bool OnTouchEvent(TouchEvents event); + bool OnTouchEvent(TouchEvents event) override; void UpdateLength(); -- cgit v1.2.3-70-g09d2 From 51716898aa00ea2d38dfe38d28a33b4ffbdf22ff Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Sun, 13 Mar 2022 22:03:29 +0100 Subject: Twos: fix warning about extra paranthesis We have a comparison like `if (( a == b ))`, which is a parenthesis too much, which generates the following warning ``` InfiniTime/src/displayapp/screens/Twos.cpp:133:35: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] if ((grid[newRow][newCol].value == grid[oldRow][oldCol].value)) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ InfiniTime/src/displayapp/screens/Twos.cpp:133:35: note: remove extraneous parentheses around the comparison to silence this warning if ((grid[newRow][newCol].value == grid[oldRow][oldCol].value)) { ~ ^ ~ ``` --- src/displayapp/screens/Twos.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/displayapp/screens/Twos.cpp b/src/displayapp/screens/Twos.cpp index b15332f1..6d675859 100644 --- a/src/displayapp/screens/Twos.cpp +++ b/src/displayapp/screens/Twos.cpp @@ -130,7 +130,7 @@ bool Twos::placeNewTile() { } bool Twos::tryMerge(TwosTile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol) { - if ((grid[newRow][newCol].value == grid[oldRow][oldCol].value)) { + if (grid[newRow][newCol].value == grid[oldRow][oldCol].value) { if ((newCol != oldCol) || (newRow != oldRow)) { if (!grid[newRow][newCol].merged) { unsigned int newVal = grid[oldRow][oldCol].value *= 2; -- cgit v1.2.3-70-g09d2 From db41d9081a61b2370a4633568a9cb01bc948a5ab Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Mon, 14 Mar 2022 20:28:51 +0100 Subject: DateTimeController: make possible functions const MonthShortToString and DayOfWeekShortToString don't change the underlying object. Those are just getters and can be declared `const`. --- src/components/datetime/DateTimeController.cpp | 4 ++-- src/components/datetime/DateTimeController.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/components/datetime/DateTimeController.cpp b/src/components/datetime/DateTimeController.cpp index e0d12431..3bfbdc7e 100644 --- a/src/components/datetime/DateTimeController.cpp +++ b/src/components/datetime/DateTimeController.cpp @@ -108,11 +108,11 @@ void DateTime::UpdateTime(uint32_t systickCounter) { } } -const char* DateTime::MonthShortToString() { +const char* DateTime::MonthShortToString() const { return MonthsString[static_cast(month)]; } -const char* DateTime::DayOfWeekShortToString() { +const char* DateTime::DayOfWeekShortToString() const { return DaysStringShort[static_cast(dayOfWeek)]; } diff --git a/src/components/datetime/DateTimeController.h b/src/components/datetime/DateTimeController.h index 6e5ee3ca..00bbc2ee 100644 --- a/src/components/datetime/DateTimeController.h +++ b/src/components/datetime/DateTimeController.h @@ -61,8 +61,8 @@ namespace Pinetime { return second; } - const char* MonthShortToString(); - const char* DayOfWeekShortToString(); + const char* MonthShortToString() const; + const char* DayOfWeekShortToString() const; static const char* MonthShortToStringLow(Months month); std::chrono::time_point CurrentDateTime() const { -- cgit v1.2.3-70-g09d2 From bebc072e78145af69aacb1c2c9549da8653b7b0c Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Mon, 14 Mar 2022 20:55:20 +0100 Subject: WatchFaceAnalog: const ref to dateTimeController The clock app only reads from the dateTimeController, never modifies it. --- src/displayapp/screens/WatchFaceAnalog.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/displayapp/screens/WatchFaceAnalog.h b/src/displayapp/screens/WatchFaceAnalog.h index a18eb299..3377d39e 100644 --- a/src/displayapp/screens/WatchFaceAnalog.h +++ b/src/displayapp/screens/WatchFaceAnalog.h @@ -74,7 +74,7 @@ namespace Pinetime { lv_obj_t* batteryIcon; lv_obj_t* notificationIcon; - Controllers::DateTime& dateTimeController; + const Controllers::DateTime& dateTimeController; Controllers::Battery& batteryController; Controllers::Ble& bleController; Controllers::NotificationManager& notificationManager; -- cgit v1.2.3-70-g09d2 From 1379b7902fca8628614af358bac7d546cc94efdc Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Mon, 14 Mar 2022 20:33:14 +0100 Subject: WatchFaceAnalog: local date/time variables Use local date and time variables. No need to store them in the object. --- src/displayapp/screens/WatchFaceAnalog.cpp | 12 ++++++------ src/displayapp/screens/WatchFaceAnalog.h | 7 ------- 2 files changed, 6 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index f1b91444..61042816 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -137,9 +137,9 @@ WatchFaceAnalog::~WatchFaceAnalog() { } void WatchFaceAnalog::UpdateClock() { - hour = dateTimeController.Hours(); - minute = dateTimeController.Minutes(); - second = dateTimeController.Seconds(); + uint8_t hour = dateTimeController.Hours(); + uint8_t minute = dateTimeController.Minutes(); + uint8_t second = dateTimeController.Seconds(); if (sMinute != minute) { auto const angle = minute * 6; @@ -214,9 +214,9 @@ void WatchFaceAnalog::Refresh() { currentDateTime = dateTimeController.CurrentDateTime(); if (currentDateTime.IsUpdated()) { - month = dateTimeController.Month(); - day = dateTimeController.Day(); - dayOfWeek = dateTimeController.DayOfWeek(); + Pinetime::Controllers::DateTime::Months month = dateTimeController.Month(); + uint8_t day = dateTimeController.Day(); + Pinetime::Controllers::DateTime::Days dayOfWeek = dateTimeController.DayOfWeek(); UpdateClock(); diff --git a/src/displayapp/screens/WatchFaceAnalog.h b/src/displayapp/screens/WatchFaceAnalog.h index a18eb299..9412d739 100644 --- a/src/displayapp/screens/WatchFaceAnalog.h +++ b/src/displayapp/screens/WatchFaceAnalog.h @@ -35,13 +35,6 @@ namespace Pinetime { private: uint8_t sHour, sMinute, sSecond; - uint8_t hour; - uint8_t minute; - uint8_t second; - - Pinetime::Controllers::DateTime::Months month; - uint8_t day; - Pinetime::Controllers::DateTime::Days dayOfWeek; Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown; Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown; -- cgit v1.2.3-70-g09d2 From df61907073fab7d4c2f9595c7771e894a3841b65 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Mon, 14 Mar 2022 20:44:19 +0100 Subject: Limit the size of the track and album name received by MusicService. This should work around this bug : https://github.com/InfiniTimeOrg/InfiniTime/issues/825 and prevent heap over-allocation. --- src/components/ble/MusicService.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/components/ble/MusicService.cpp b/src/components/ble/MusicService.cpp index 3457ce4c..7b74ac2e 100644 --- a/src/components/ble/MusicService.cpp +++ b/src/components/ble/MusicService.cpp @@ -47,6 +47,8 @@ namespace { constexpr ble_uuid128_t msRepeatCharUuid {CharUuid(0x0b, 0x00)}; constexpr ble_uuid128_t msShuffleCharUuid {CharUuid(0x0c, 0x00)}; + constexpr uint8_t MaxStringSize {40}; + int MusicCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) { return static_cast(arg)->OnCommand(conn_handle, attr_handle, ctxt); } @@ -125,6 +127,11 @@ void Pinetime::Controllers::MusicService::Init() { int Pinetime::Controllers::MusicService::OnCommand(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) { if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { size_t notifSize = OS_MBUF_PKTLEN(ctxt->om); + + if(notifSize > MaxStringSize) { + notifSize = MaxStringSize; + } + char data[notifSize + 1]; data[notifSize] = '\0'; os_mbuf_copydata(ctxt->om, 0, notifSize, data); -- cgit v1.2.3-70-g09d2 From f973f1c12c5f82ddacfdaca29fbe1043d94313ee Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Mon, 14 Mar 2022 21:03:08 +0100 Subject: Add missing space in if expression. --- src/components/ble/MusicService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/ble/MusicService.cpp b/src/components/ble/MusicService.cpp index 7b74ac2e..0e53b9cb 100644 --- a/src/components/ble/MusicService.cpp +++ b/src/components/ble/MusicService.cpp @@ -128,7 +128,7 @@ int Pinetime::Controllers::MusicService::OnCommand(uint16_t conn_handle, uint16_ if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { size_t notifSize = OS_MBUF_PKTLEN(ctxt->om); - if(notifSize > MaxStringSize) { + if (notifSize > MaxStringSize) { notifSize = MaxStringSize; } -- cgit v1.2.3-70-g09d2 From 88197b66328ab8cbecc199c91d1ce1e1688ade83 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Thu, 17 Mar 2022 21:15:05 +0100 Subject: Music app : when title/track name are truncated, add an ellipsis at the end of the strings. --- src/components/ble/MusicService.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/components/ble/MusicService.cpp b/src/components/ble/MusicService.cpp index 0e53b9cb..c99aa1e3 100644 --- a/src/components/ble/MusicService.cpp +++ b/src/components/ble/MusicService.cpp @@ -17,6 +17,7 @@ */ #include "components/ble/MusicService.h" #include "systemtask/SystemTask.h" +#include namespace { // 0000yyxx-78fc-48fe-8e23-433b3a1942d0 @@ -127,14 +128,21 @@ void Pinetime::Controllers::MusicService::Init() { int Pinetime::Controllers::MusicService::OnCommand(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) { if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { size_t notifSize = OS_MBUF_PKTLEN(ctxt->om); - + size_t bufferSize = notifSize; if (notifSize > MaxStringSize) { - notifSize = MaxStringSize; + bufferSize = MaxStringSize; + } + + char data[bufferSize + 1]; + os_mbuf_copydata(ctxt->om, 0, bufferSize, data); + + if (notifSize > bufferSize) { + data[bufferSize-1] = '.'; + data[bufferSize-2] = '.'; + data[bufferSize-3] = '.'; } + data[bufferSize] = '\0'; - char data[notifSize + 1]; - data[notifSize] = '\0'; - os_mbuf_copydata(ctxt->om, 0, notifSize, data); char* s = &data[0]; if (ble_uuid_cmp(ctxt->chr->uuid, &msArtistCharUuid.u) == 0) { artistName = s; -- cgit v1.2.3-70-g09d2 From f1194a5f74fa7e02805940a39489210783b94878 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Mon, 14 Mar 2022 20:54:04 +0100 Subject: In current configuration, the timer task (the one from FreeRTOS) has the lowest priority (0). Both display and system tasks are also set on priority 0. In cases where any other task takes too much time to execute (it can happen in Display Task, see https://github.com/InfiniTimeOrg/InfiniTime/issues/825), the timer task does not have the opportunity to run fast enough to detect and debounce presses on the button. This commit sets the following priorities: - [0] : Display Task - [1] : Timer and System tasks - [2] : BLE Host - [3] : BLE LL This way, we ensure that button presses will always be detected, even if the rendering of the display takes a huge amount of time. --- src/FreeRTOSConfig.h | 4 ++-- src/systemtask/SystemTask.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/FreeRTOSConfig.h b/src/FreeRTOSConfig.h index adbbc8f0..5462b93c 100644 --- a/src/FreeRTOSConfig.h +++ b/src/FreeRTOSConfig.h @@ -60,7 +60,7 @@ #define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG 0 /* See into vPortSuppressTicksAndSleep source code for explanation */ #define configCPU_CLOCK_HZ (SystemCoreClock) #define configTICK_RATE_HZ 1024 -#define configMAX_PRIORITIES (3) +#define configMAX_PRIORITIES (4) #define configMINIMAL_STACK_SIZE (120) #define configTOTAL_HEAP_SIZE (1024 * 17) #define configMAX_TASK_NAME_LEN (4) @@ -93,7 +93,7 @@ /* Software timer definitions. */ #define configUSE_TIMERS 1 -#define configTIMER_TASK_PRIORITY (0) +#define configTIMER_TASK_PRIORITY (1) #define configTIMER_QUEUE_LENGTH 32 #define configTIMER_TASK_STACK_DEPTH (300) diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 1e45fac1..77cf411b 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -107,7 +107,7 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi, void SystemTask::Start() { systemTasksMsgQueue = xQueueCreate(10, 1); - if (pdPASS != xTaskCreate(SystemTask::Process, "MAIN", 350, this, 0, &taskHandle)) { + if (pdPASS != xTaskCreate(SystemTask::Process, "MAIN", 350, this, 1, &taskHandle)) { APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); } } -- cgit v1.2.3-70-g09d2 From cd1f218dd8710f61238307a9fa5b0d11e229bffa Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Mon, 14 Mar 2022 21:54:13 +0100 Subject: Fix priorities of BLE tasks --- .../mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c b/src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c index b9902781..205831a9 100644 --- a/src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c +++ b/src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c @@ -38,7 +38,7 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn) * since it has compatible prototype. */ xTaskCreate(nimble_port_ll_task_func, "ll", configMINIMAL_STACK_SIZE + 200, - NULL, configMAX_PRIORITIES - 1, &ll_task_h); + NULL, 3, &ll_task_h); #endif /* @@ -47,5 +47,5 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn) * default queue it is just easier to make separate task which does this. */ xTaskCreate(host_task_fn, "ble", configMINIMAL_STACK_SIZE + 600, - NULL, tskIDLE_PRIORITY + 1, &host_task_h); + NULL, 2, &host_task_h); } -- cgit v1.2.3-70-g09d2 From a8b7fbe48b4a86238f38ed0f084b277b44c428fb Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Thu, 17 Mar 2022 21:22:59 +0100 Subject: New changes according to the review : Priority 0 for display, 1 for system, timer and ble host, and 2 for ble LL --- src/FreeRTOSConfig.h | 2 +- src/components/ble/NimbleController.cpp | 1 + .../mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/FreeRTOSConfig.h b/src/FreeRTOSConfig.h index 5462b93c..263d8031 100644 --- a/src/FreeRTOSConfig.h +++ b/src/FreeRTOSConfig.h @@ -60,7 +60,7 @@ #define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG 0 /* See into vPortSuppressTicksAndSleep source code for explanation */ #define configCPU_CLOCK_HZ (SystemCoreClock) #define configTICK_RATE_HZ 1024 -#define configMAX_PRIORITIES (4) +#define configMAX_PRIORITIES (3) #define configMINIMAL_STACK_SIZE (120) #define configTOTAL_HEAP_SIZE (1024 * 17) #define configMAX_TASK_NAME_LEN (4) diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index 0be7c0f7..10eb429a 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -77,6 +77,7 @@ int GAPEventCallback(struct ble_gap_event* event, void* arg) { void NimbleController::Init() { while (!ble_hs_synced()) { + vTaskDelay(10); } nptr = this; diff --git a/src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c b/src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c index 205831a9..49834db1 100644 --- a/src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c +++ b/src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c @@ -38,7 +38,7 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn) * since it has compatible prototype. */ xTaskCreate(nimble_port_ll_task_func, "ll", configMINIMAL_STACK_SIZE + 200, - NULL, 3, &ll_task_h); + NULL, 2, &ll_task_h); #endif /* @@ -47,5 +47,5 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn) * default queue it is just easier to make separate task which does this. */ xTaskCreate(host_task_fn, "ble", configMINIMAL_STACK_SIZE + 600, - NULL, 2, &host_task_h); + NULL, 1, &host_task_h); } -- cgit v1.2.3-70-g09d2 From 4761fcb63a55749c5e46c5fe6bb53ae25b4716c8 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 27 Mar 2022 20:29:52 +0200 Subject: DisplayApp : Call the event handler of the current app before loading the new one. This way, we ensure that lv_task_handler() is called before sending event to the newly loaded app. --- src/displayapp/DisplayApp.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index fdc6376c..c8429563 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -306,14 +306,14 @@ void DisplayApp::Refresh() { } } + if (touchHandler.IsTouching()) { + currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY()); + } + if (nextApp != Apps::None) { LoadApp(nextApp, nextDirection); nextApp = Apps::None; } - - if (touchHandler.IsTouching()) { - currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY()); - } } void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction) { -- cgit v1.2.3-70-g09d2 From 8f436e1d74ffdd497c68dc2f34f6a67e430a1932 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 27 Mar 2022 20:21:44 +0200 Subject: Timer App : add background label to ensure that the app will be displayed correctly after a full refresh (HW scrolling transition). Code cleaning and rename methods. --- src/displayapp/DisplayApp.cpp | 2 +- src/displayapp/screens/Timer.cpp | 19 ++++++++++++------- src/displayapp/screens/Timer.h | 27 +++++++++++++++------------ 3 files changed, 28 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index c8429563..f6d27477 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -207,7 +207,7 @@ void DisplayApp::Refresh() { case Messages::TimerDone: if (currentApp == Apps::Timer) { auto* timer = static_cast(currentScreen.get()); - timer->setDone(); + timer->SetDone(); } else { LoadApp(Apps::Timer, DisplayApp::FullRefreshDirections::Down); } diff --git a/src/displayapp/screens/Timer.cpp b/src/displayapp/screens/Timer.cpp index a5e40195..5cd496c7 100644 --- a/src/displayapp/screens/Timer.cpp +++ b/src/displayapp/screens/Timer.cpp @@ -1,5 +1,4 @@ #include "displayapp/screens/Timer.h" - #include "displayapp/screens/Screen.h" #include "displayapp/screens/Symbols.h" #include @@ -7,11 +6,11 @@ using namespace Pinetime::Applications::Screens; static void btnEventHandler(lv_obj_t* obj, lv_event_t event) { - Timer* screen = static_cast(obj->user_data); + auto* screen = static_cast(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); @@ -51,6 +50,12 @@ void Timer::createButtons() { Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController) : Screen(app), running {true}, timerController {timerController} { + backgroundLabel = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_click(backgroundLabel, true); + lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); + lv_obj_set_size(backgroundLabel, 240, 240); + lv_obj_set_pos(backgroundLabel, 0, 0); + 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); @@ -71,7 +76,7 @@ Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController) lv_label_set_text(txtPlayPause, 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); @@ -98,7 +103,7 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { minutesToSet = seconds / 60; secondsToSet = seconds % 60; timerController.StopTimer(); - createButtons(); + CreateButtons(); } else if (secondsToSet + minutesToSet > 0) { lv_label_set_text(txtPlayPause, Symbols::pause); @@ -152,10 +157,10 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { } } -void Timer::setDone() { +void Timer::SetDone() { lv_label_set_text(time, "00:00"); lv_label_set_text(txtPlayPause, Symbols::play); secondsToSet = 0; minutesToSet = 0; - createButtons(); + CreateButtons(); } diff --git a/src/displayapp/screens/Timer.h b/src/displayapp/screens/Timer.h index 23c87345..93e84c82 100644 --- a/src/displayapp/screens/Timer.h +++ b/src/displayapp/screens/Timer.h @@ -8,32 +8,35 @@ #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 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(); - - lv_obj_t *time, *msecTime, *btnPlayPause, *txtPlayPause, *btnMinutesUp, *btnMinutesDown, *btnSecondsUp, *btnSecondsDown, *txtMUp, - *txtMDown, *txtSUp, *txtSDown; - + 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; }; } -- cgit v1.2.3-70-g09d2 From 78cab3604d307d48db5d2b38b54a00bbaaaf67ec Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Mon, 21 Feb 2022 23:45:59 +0100 Subject: AlarmController: allow loss of precision for alarmTime cast Allow a loss of precision if the system clock has a lower resolution than nanoseconds. This is the case for web assembly. --- src/components/alarm/AlarmController.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/alarm/AlarmController.cpp b/src/components/alarm/AlarmController.cpp index 28b328d5..11d96e7a 100644 --- a/src/components/alarm/AlarmController.cpp +++ b/src/components/alarm/AlarmController.cpp @@ -54,7 +54,8 @@ void AlarmController::ScheduleAlarm() { auto now = dateTimeController.CurrentDateTime(); alarmTime = now; - time_t ttAlarmTime = std::chrono::system_clock::to_time_t(alarmTime); + time_t ttAlarmTime = std::chrono::system_clock::to_time_t( + std::chrono::time_point_cast(alarmTime)); tm* tmAlarmTime = std::localtime(&ttAlarmTime); // If the time being set has already passed today,the alarm should be set for tomorrow -- cgit v1.2.3-70-g09d2 From 78365548f70d9a6ef9a040d8e0039e640e386dc3 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sat, 2 Apr 2022 16:03:20 +0300 Subject: Replace airplane mode with a bluetooth toggle --- src/CMakeLists.txt | 2 +- src/components/settings/Settings.h | 2 +- src/displayapp/Apps.h | 2 +- src/displayapp/DisplayApp.cpp | 6 +- src/displayapp/fonts/README.md | 2 +- src/displayapp/fonts/jetbrains_mono_bold_20.c | 72 +++++++---------- src/displayapp/screens/BleIcon.cpp | 6 +- src/displayapp/screens/BleIcon.h | 2 +- src/displayapp/screens/PineTimeStyle.cpp | 7 +- src/displayapp/screens/Symbols.h | 1 - src/displayapp/screens/WatchFaceDigital.cpp | 2 +- .../screens/settings/SettingAirplaneMode.cpp | 93 ---------------------- .../screens/settings/SettingAirplaneMode.h | 31 -------- .../screens/settings/SettingBluetooth.cpp | 93 ++++++++++++++++++++++ src/displayapp/screens/settings/SettingBluetooth.h | 31 ++++++++ src/displayapp/screens/settings/Settings.cpp | 2 +- 16 files changed, 168 insertions(+), 186 deletions(-) delete mode 100644 src/displayapp/screens/settings/SettingAirplaneMode.cpp delete mode 100644 src/displayapp/screens/settings/SettingAirplaneMode.h create mode 100644 src/displayapp/screens/settings/SettingBluetooth.cpp create mode 100644 src/displayapp/screens/settings/SettingBluetooth.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ff0c9b0c..077546a0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -449,7 +449,7 @@ list(APPEND SOURCE_FILES displayapp/screens/settings/SettingSetTime.cpp displayapp/screens/settings/SettingChimes.cpp displayapp/screens/settings/SettingShakeThreshold.cpp - displayapp/screens/settings/SettingAirplaneMode.cpp + displayapp/screens/settings/SettingBluetooth.cpp ## Watch faces displayapp/icons/bg_clock.c diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 24a82607..44a1a85c 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -237,7 +237,7 @@ namespace Pinetime { uint8_t appMenu = 0; uint8_t settingsMenu = 0; - /* airplaneMode is intentionally not saved with the other watch settings and initialized + /* ble state is intentionally not saved with the other watch settings and initialized * to off (false) on every boot because we always want ble to be enabled on startup */ bool bleRadioEnabled = true; diff --git a/src/displayapp/Apps.h b/src/displayapp/Apps.h index dc9e6253..8aad9535 100644 --- a/src/displayapp/Apps.h +++ b/src/displayapp/Apps.h @@ -38,7 +38,7 @@ namespace Pinetime { SettingSetTime, SettingChimes, SettingShakeThreshold, - SettingAirplaneMode, + SettingBluetooth, Error }; } diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index f6d27477..9ce29da6 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -49,7 +49,7 @@ #include "displayapp/screens/settings/SettingSetTime.h" #include "displayapp/screens/settings/SettingChimes.h" #include "displayapp/screens/settings/SettingShakeThreshold.h" -#include "displayapp/screens/settings/SettingAirplaneMode.h" +#include "displayapp/screens/settings/SettingBluetooth.h" #include "libs/lv_conf.h" @@ -434,8 +434,8 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) currentScreen = std::make_unique(this, settingsController, motionController, *systemTask); ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; - case Apps::SettingAirplaneMode: - currentScreen = std::make_unique(this, settingsController); + case Apps::SettingBluetooth: + currentScreen = std::make_unique(this, settingsController); ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::BatteryInfo: diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md index 7e6203ff..c7a8e2bf 100644 --- a/src/displayapp/fonts/README.md +++ b/src/displayapp/fonts/README.md @@ -31,7 +31,7 @@ static constexpr const char* newSymbol = "\xEF\x86\x85"; * Do not enable font compression or horizontal subpixel rendering * Load the file `JetBrainsMono-Bold.tff` (use the file in this repo to ensure the version matches) and specify the following range: `0x20-0x7e, 0x410-0x44f` * Add a 2nd font, load the file `FontAwesome5-Solid+Brands+Regular.woff` and specify the following - range: `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf201, 0xf06e, 0xf015, 0xf072` + range: `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf201, 0xf06e, 0xf015` * Fix an error in the font conversion. Replace the following: diff --git a/src/displayapp/fonts/jetbrains_mono_bold_20.c b/src/displayapp/fonts/jetbrains_mono_bold_20.c index cc67532a..5c40d494 100644 --- a/src/displayapp/fonts/jetbrains_mono_bold_20.c +++ b/src/displayapp/fonts/jetbrains_mono_bold_20.c @@ -840,16 +840,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xf8, 0xf, 0x80, 0xf8, 0x3e, 0x0, 0xff, 0xf0, 0x0, 0x3f, 0x80, 0x0, - /* U+F072 "" */ - 0x1, 0xc0, 0x0, 0x7, 0xc0, 0x0, 0x7, 0x80, - 0x0, 0xf, 0x80, 0x0, 0x1f, 0x0, 0x0, 0x1f, - 0x0, 0x38, 0x3e, 0x0, 0x78, 0x7e, 0x0, 0x7f, - 0xff, 0xe0, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xf3, - 0xff, 0xff, 0xe7, 0xff, 0xff, 0xdf, 0xff, 0xfc, - 0x3c, 0x3f, 0x0, 0x70, 0x7c, 0x0, 0x1, 0xf0, - 0x0, 0x3, 0xe0, 0x0, 0x7, 0x80, 0x0, 0xf, - 0x0, 0x0, 0x1c, 0x0, 0x0, - /* U+F095 "" */ 0x0, 0x0, 0x0, 0x0, 0x3e, 0x0, 0x7, 0xf0, 0x0, 0x7f, 0x0, 0x7, 0xf0, 0x0, 0xff, 0x0, @@ -1230,32 +1220,31 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 3027, .adv_w = 280, .box_w = 13, .box_h = 17, .ofs_x = 2, .ofs_y = -1}, {.bitmap_index = 3055, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 3103, .adv_w = 360, .box_w = 23, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3147, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3208, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3261, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3280, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3330, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3366, .adv_w = 320, .box_w = 20, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3414, .adv_w = 320, .box_w = 21, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3454, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 3497, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3535, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3573, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3611, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3649, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 3687, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3723, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 3761, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3790, .adv_w = 280, .box_w = 16, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 3828, .adv_w = 400, .box_w = 25, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 3894, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 3943, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3993, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 4053, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 4106, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 4167, .adv_w = 360, .box_w = 22, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 4222, .adv_w = 360, .box_w = 22, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 4275, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 3147, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3200, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3219, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3269, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3305, .adv_w = 320, .box_w = 20, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3353, .adv_w = 320, .box_w = 21, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3393, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 3436, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3474, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3512, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3550, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3588, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 3626, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3662, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 3700, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3729, .adv_w = 280, .box_w = 16, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 3767, .adv_w = 400, .box_w = 25, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3833, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 3882, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3932, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3992, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 4045, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 4106, .adv_w = 360, .box_w = 22, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 4161, .adv_w = 360, .box_w = 22, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 4214, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- @@ -1264,11 +1253,10 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { static const uint16_t unicode_list_2[] = { 0x0, 0x14, 0x16, 0x23, 0x26, 0x27, 0x28, 0x39, - 0x47, 0x4a, 0x4b, 0x4c, 0x50, 0x68, 0x6d, 0x71, - 0x94, 0x128, 0x184, 0x1e5, 0x1fb, 0x200, 0x21d, 0x23f, - 0x240, 0x241, 0x242, 0x243, 0x251, 0x292, 0x293, 0x2f1, - 0x3dc, 0x3fc, 0x45c, 0x54a, 0x55f, 0x568, 0x59e, 0x59f, - 0x6a8 + 0x47, 0x4a, 0x4b, 0x4c, 0x50, 0x68, 0x6d, 0x94, + 0x128, 0x184, 0x1e5, 0x1fb, 0x200, 0x21d, 0x23f, 0x240, + 0x241, 0x242, 0x243, 0x251, 0x292, 0x293, 0x2f1, 0x3dc, + 0x3fc, 0x45c, 0x54a, 0x55f, 0x568, 0x59e, 0x59f, 0x6a8 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -1284,7 +1272,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 61441, .range_length = 1705, .glyph_id_start = 160, - .unicode_list = unicode_list_2, .glyph_id_ofs_list = NULL, .list_length = 41, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_2, .glyph_id_ofs_list = NULL, .list_length = 40, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; diff --git a/src/displayapp/screens/BleIcon.cpp b/src/displayapp/screens/BleIcon.cpp index 019f8039..780a14cf 100644 --- a/src/displayapp/screens/BleIcon.cpp +++ b/src/displayapp/screens/BleIcon.cpp @@ -2,11 +2,7 @@ #include "displayapp/screens/Symbols.h" using namespace Pinetime::Applications::Screens; -const char* BleIcon::GetIcon(bool isRadioEnabled, bool isConnected) { - if(!isRadioEnabled) { - return Symbols::airplane; - } - +const char* BleIcon::GetIcon(bool isConnected) { if (isConnected) { return Symbols::bluetooth; } diff --git a/src/displayapp/screens/BleIcon.h b/src/displayapp/screens/BleIcon.h index d32dfad7..d9a46541 100644 --- a/src/displayapp/screens/BleIcon.h +++ b/src/displayapp/screens/BleIcon.h @@ -7,7 +7,7 @@ namespace Pinetime { namespace Screens { class BleIcon { public: - static const char* GetIcon(bool isRadioEnabled, bool isConnected); + static const char* GetIcon(bool isConnected); }; } } diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index 44bf47a4..e807289c 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -345,11 +345,10 @@ void PineTimeStyle::SetBatteryIcon() { void PineTimeStyle::AlignIcons() { - bool isBleIconVisible = IsBleIconVisible(bleRadioEnabled.Get(), bleState.Get()); - if (notificationState.Get() && isBleIconVisible) { + if (notificationState.Get() && bleState.Get()) { lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 8, 25); lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25); - } else if (notificationState.Get() && !isBleIconVisible) { + } else if (notificationState.Get() && !bleState.Get()) { lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); } else { lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); @@ -375,7 +374,7 @@ void PineTimeStyle::Refresh() { bleState = bleController.IsConnected(); bleRadioEnabled = bleController.IsRadioEnabled(); if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) { - lv_label_set_text(bleIcon, BleIcon::GetIcon(bleRadioEnabled.Get(), bleState.Get())); + lv_label_set_text(bleIcon, BleIcon::GetIcon(bleState.Get())); AlignIcons(); } diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h index 5ba8f953..e68a7af6 100644 --- a/src/displayapp/screens/Symbols.h +++ b/src/displayapp/screens/Symbols.h @@ -44,7 +44,6 @@ namespace Pinetime { static constexpr const char* chartLine = "\xEF\x88\x81"; static constexpr const char* eye = "\xEF\x81\xAE"; static constexpr const char* home = "\xEF\x80\x95"; - static constexpr const char* airplane = "\xEF\x81\xB2"; // lv_font_sys_48.c static constexpr const char* settings = "\xEE\xA4\x82"; // e902 diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 59bde839..6a914884 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -121,7 +121,7 @@ void WatchFaceDigital::Refresh() { bleState = bleController.IsConnected(); bleRadioEnabled = bleController.IsRadioEnabled(); if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) { - lv_label_set_text(bleIcon, BleIcon::GetIcon(bleRadioEnabled.Get(), bleState.Get())); + lv_label_set_text(bleIcon, BleIcon::GetIcon(bleState.Get())); } lv_obj_realign(batteryIcon); lv_obj_realign(batteryPlug); diff --git a/src/displayapp/screens/settings/SettingAirplaneMode.cpp b/src/displayapp/screens/settings/SettingAirplaneMode.cpp deleted file mode 100644 index 85172787..00000000 --- a/src/displayapp/screens/settings/SettingAirplaneMode.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "displayapp/screens/settings/SettingAirplaneMode.h" -#include -#include "displayapp/DisplayApp.h" -#include "displayapp/Messages.h" -#include "displayapp/screens/Styles.h" -#include "displayapp/screens/Screen.h" -#include "displayapp/screens/Symbols.h" - -using namespace Pinetime::Applications::Screens; - -namespace { - static void OnAirplaneModeEnabledEvent(lv_obj_t* obj, lv_event_t event) { - auto* screen = static_cast(obj->user_data); - screen->OnAirplaneModeEnabled(obj, event); - } - - static void OnAirplaneModeDisabledEvent(lv_obj_t* obj, lv_event_t event) { - auto* screen = static_cast(obj->user_data); - screen->OnAirplaneModeDisabled(obj, event); - } -} - -SettingAirplaneMode::SettingAirplaneMode(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) - : Screen(app), settingsController {settingsController} { - - lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr); - - lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); - lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10); - 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_width(container1, LV_HOR_RES - 20); - lv_obj_set_height(container1, LV_VER_RES - 50); - lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT); - - lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(title, "Airplane mode"); - lv_label_set_align(title, LV_LABEL_ALIGN_CENTER); - lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15); - - lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); - lv_label_set_text_static(icon, Symbols::airplane); - lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); - lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); - - cbEnabled = lv_checkbox_create(container1, nullptr); - lv_checkbox_set_text(cbEnabled, " Enable"); - cbEnabled->user_data = this; - lv_obj_set_event_cb(cbEnabled, OnAirplaneModeEnabledEvent); - SetRadioButtonStyle(cbEnabled); - - cbDisabled = lv_checkbox_create(container1, nullptr); - lv_checkbox_set_text(cbDisabled, " Disable"); - cbDisabled->user_data = this; - lv_obj_set_event_cb(cbDisabled, OnAirplaneModeDisabledEvent); - SetRadioButtonStyle(cbDisabled); - - if (settingsController.GetBleRadioEnabled()) { - lv_checkbox_set_checked(cbDisabled, true); - priorMode = true; - } else { - lv_checkbox_set_checked(cbEnabled, true); - priorMode = false; - } -} - -SettingAirplaneMode::~SettingAirplaneMode() { - lv_obj_clean(lv_scr_act()); - // Do not call SaveSettings - see src/components/settings/Settings.h - if (priorMode != settingsController.GetBleRadioEnabled()) { - app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle); - } -} - -void SettingAirplaneMode::OnAirplaneModeEnabled(lv_obj_t* object, lv_event_t event) { - if (event == LV_EVENT_VALUE_CHANGED) { - lv_checkbox_set_checked(cbEnabled, true); - lv_checkbox_set_checked(cbDisabled, false); - settingsController.SetBleRadioEnabled(false); - } -} - -void SettingAirplaneMode::OnAirplaneModeDisabled(lv_obj_t* object, lv_event_t event) { - if (event == LV_EVENT_VALUE_CHANGED) { - lv_checkbox_set_checked(cbEnabled, false); - lv_checkbox_set_checked(cbDisabled, true); - settingsController.SetBleRadioEnabled(true); - } -} - diff --git a/src/displayapp/screens/settings/SettingAirplaneMode.h b/src/displayapp/screens/settings/SettingAirplaneMode.h deleted file mode 100644 index b3478c64..00000000 --- a/src/displayapp/screens/settings/SettingAirplaneMode.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "components/settings/Settings.h" -#include "displayapp/screens/Screen.h" - -namespace Pinetime { - - namespace Applications { - namespace Screens { - - class SettingAirplaneMode : public Screen { - public: - SettingAirplaneMode(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); - ~SettingAirplaneMode() override; - - void OnAirplaneModeEnabled(lv_obj_t* object, lv_event_t event); - void OnAirplaneModeDisabled(lv_obj_t* object, lv_event_t event); - - private: - Controllers::Settings& settingsController; - lv_obj_t* cbEnabled; - lv_obj_t* cbDisabled; - bool priorMode; - }; - } - } -} diff --git a/src/displayapp/screens/settings/SettingBluetooth.cpp b/src/displayapp/screens/settings/SettingBluetooth.cpp new file mode 100644 index 00000000..ab1af223 --- /dev/null +++ b/src/displayapp/screens/settings/SettingBluetooth.cpp @@ -0,0 +1,93 @@ +#include "displayapp/screens/settings/SettingBluetooth.h" +#include +#include "displayapp/DisplayApp.h" +#include "displayapp/Messages.h" +#include "displayapp/screens/Styles.h" +#include "displayapp/screens/Screen.h" +#include "displayapp/screens/Symbols.h" + +using namespace Pinetime::Applications::Screens; + +namespace { + static void OnBluetoothDisabledEvent(lv_obj_t* obj, lv_event_t event) { + auto* screen = static_cast(obj->user_data); + screen->OnBluetoothDisabled(obj, event); + } + + static void OnBluetoothEnabledEvent(lv_obj_t* obj, lv_event_t event) { + auto* screen = static_cast(obj->user_data); + screen->OnBluetoothEnabled(obj, event); + } +} + +SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) + : Screen(app), settingsController {settingsController} { + + lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr); + + lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); + lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10); + 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_width(container1, LV_HOR_RES - 20); + lv_obj_set_height(container1, LV_VER_RES - 50); + lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT); + + lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_static(title, "Bluetooth"); + lv_label_set_align(title, LV_LABEL_ALIGN_CENTER); + lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15); + + lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_label_set_text_static(icon, Symbols::bluetooth); + lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); + lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); + + cbEnabled = lv_checkbox_create(container1, nullptr); + lv_checkbox_set_text(cbEnabled, " Enabled"); + cbEnabled->user_data = this; + lv_obj_set_event_cb(cbEnabled, OnBluetoothEnabledEvent); + SetRadioButtonStyle(cbEnabled); + + cbDisabled = lv_checkbox_create(container1, nullptr); + lv_checkbox_set_text(cbDisabled, " Disabled"); + cbDisabled->user_data = this; + lv_obj_set_event_cb(cbDisabled, OnBluetoothDisabledEvent); + SetRadioButtonStyle(cbDisabled); + + if (settingsController.GetBleRadioEnabled()) { + lv_checkbox_set_checked(cbEnabled, true); + priorMode = true; + } else { + lv_checkbox_set_checked(cbDisabled, true); + priorMode = false; + } +} + +SettingBluetooth::~SettingBluetooth() { + lv_obj_clean(lv_scr_act()); + // Do not call SaveSettings - see src/components/settings/Settings.h + if (priorMode != settingsController.GetBleRadioEnabled()) { + app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle); + } +} + +void SettingBluetooth::OnBluetoothDisabled(lv_obj_t* object, lv_event_t event) { + if (event == LV_EVENT_VALUE_CHANGED) { + lv_checkbox_set_checked(cbEnabled, false); + lv_checkbox_set_checked(cbDisabled, true); + settingsController.SetBleRadioEnabled(false); + } +} + +void SettingBluetooth::OnBluetoothEnabled(lv_obj_t* object, lv_event_t event) { + if (event == LV_EVENT_VALUE_CHANGED) { + lv_checkbox_set_checked(cbEnabled, true); + lv_checkbox_set_checked(cbDisabled, false); + settingsController.SetBleRadioEnabled(true); + } +} + diff --git a/src/displayapp/screens/settings/SettingBluetooth.h b/src/displayapp/screens/settings/SettingBluetooth.h new file mode 100644 index 00000000..12bb459a --- /dev/null +++ b/src/displayapp/screens/settings/SettingBluetooth.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include + +#include "components/settings/Settings.h" +#include "displayapp/screens/Screen.h" + +namespace Pinetime { + + namespace Applications { + namespace Screens { + + class SettingBluetooth : public Screen { + public: + SettingBluetooth(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); + ~SettingBluetooth() override; + + void OnBluetoothEnabled(lv_obj_t* object, lv_event_t event); + void OnBluetoothDisabled(lv_obj_t* object, lv_event_t event); + + private: + Controllers::Settings& settingsController; + lv_obj_t* cbEnabled; + lv_obj_t* cbDisabled; + bool priorMode; + }; + } + } +} diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index dce0c071..bc7efcc2 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -64,7 +64,7 @@ std::unique_ptr Settings::CreateScreen3() { {Symbols::clock, "Chimes", Apps::SettingChimes}, {Symbols::tachometer, "Shake Calib.", Apps::SettingShakeThreshold}, {Symbols::check, "Firmware", Apps::FirmwareValidation}, - {Symbols::airplane, "Airplane mode", Apps::SettingAirplaneMode} + {Symbols::bluetooth, "Bluetooth", Apps::SettingBluetooth} }}; return std::make_unique(2, 4, app, settingsController, applications); -- cgit v1.2.3-70-g09d2 From 2607c3d79947e900ce4c5ded296f649677511a34 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Sun, 16 Jan 2022 23:37:15 +0100 Subject: Let TouchHandler return TouchEvents instead of driver specific enum Let the TouchHandler::GestureGet() function return a TouchEvent instead of the touchpanel-driver specific enum. This helps to move the driver specific helper function `ConvertGesture` from `DisplayApp` into `TouchHandler`. --- src/displayapp/DisplayApp.cpp | 24 +----------------------- src/systemtask/SystemTask.cpp | 7 ++++--- src/touchhandler/TouchHandler.cpp | 38 ++++++++++++++++++++++++++++++++++---- src/touchhandler/TouchHandler.h | 6 +++--- 4 files changed, 42 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 9ce29da6..32280615 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -60,28 +60,6 @@ namespace { static inline bool in_isr(void) { return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0; } - - TouchEvents ConvertGesture(Pinetime::Drivers::Cst816S::Gestures gesture) { - switch (gesture) { - case Pinetime::Drivers::Cst816S::Gestures::SingleTap: - return TouchEvents::Tap; - case Pinetime::Drivers::Cst816S::Gestures::LongPress: - return TouchEvents::LongTap; - case Pinetime::Drivers::Cst816S::Gestures::DoubleTap: - return TouchEvents::DoubleTap; - case Pinetime::Drivers::Cst816S::Gestures::SlideRight: - return TouchEvents::SwipeRight; - case Pinetime::Drivers::Cst816S::Gestures::SlideLeft: - return TouchEvents::SwipeLeft; - case Pinetime::Drivers::Cst816S::Gestures::SlideDown: - return TouchEvents::SwipeDown; - case Pinetime::Drivers::Cst816S::Gestures::SlideUp: - return TouchEvents::SwipeUp; - case Pinetime::Drivers::Cst816S::Gestures::None: - default: - return TouchEvents::None; - } - } } DisplayApp::DisplayApp(Drivers::St7789& lcd, @@ -227,7 +205,7 @@ void DisplayApp::Refresh() { if (state != States::Running) { break; } - auto gesture = ConvertGesture(touchHandler.GestureGet()); + auto gesture = touchHandler.GestureGet(); if (gesture == TouchEvents::None) { break; } diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 77cf411b..38c728f8 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -6,6 +6,7 @@ #include "BootloaderVersion.h" #include "components/battery/BatteryController.h" #include "components/ble/BleController.h" +#include "displayapp/TouchEvents.h" #include "drivers/Cst816s.h" #include "drivers/St7789.h" #include "drivers/InternalFlash.h" @@ -265,10 +266,10 @@ void SystemTask::Work() { case Messages::TouchWakeUp: { if (touchHandler.GetNewTouchInfo()) { auto gesture = touchHandler.GestureGet(); - if (gesture != Pinetime::Drivers::Cst816S::Gestures::None and - ((gesture == Pinetime::Drivers::Cst816S::Gestures::DoubleTap and + if (gesture != Pinetime::Applications::TouchEvents::None and + ((gesture == Pinetime::Applications::TouchEvents::DoubleTap and settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) or - (gesture == Pinetime::Drivers::Cst816S::Gestures::SingleTap and + (gesture == Pinetime::Applications::TouchEvents::Tap and settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::SingleTap)))) { GoToRunning(); } diff --git a/src/touchhandler/TouchHandler.cpp b/src/touchhandler/TouchHandler.cpp index 0be33476..0e4fb541 100644 --- a/src/touchhandler/TouchHandler.cpp +++ b/src/touchhandler/TouchHandler.cpp @@ -1,6 +1,36 @@ #include "touchhandler/TouchHandler.h" +#ifdef PINETIME_IS_RECOVERY + #include "displayapp/DummyLittleVgl.h" +#else + #include "displayapp/LittleVgl.h" +#endif using namespace Pinetime::Controllers; +using namespace Pinetime::Applications; + +namespace { + TouchEvents ConvertGesture(Pinetime::Drivers::Cst816S::Gestures gesture) { + switch (gesture) { + case Pinetime::Drivers::Cst816S::Gestures::SingleTap: + return TouchEvents::Tap; + case Pinetime::Drivers::Cst816S::Gestures::LongPress: + return TouchEvents::LongTap; + case Pinetime::Drivers::Cst816S::Gestures::DoubleTap: + return TouchEvents::DoubleTap; + case Pinetime::Drivers::Cst816S::Gestures::SlideRight: + return TouchEvents::SwipeRight; + case Pinetime::Drivers::Cst816S::Gestures::SlideLeft: + return TouchEvents::SwipeLeft; + case Pinetime::Drivers::Cst816S::Gestures::SlideDown: + return TouchEvents::SwipeDown; + case Pinetime::Drivers::Cst816S::Gestures::SlideUp: + return TouchEvents::SwipeUp; + case Pinetime::Drivers::Cst816S::Gestures::None: + default: + return TouchEvents::None; + } + } +} TouchHandler::TouchHandler(Drivers::Cst816S& touchPanel, Components::LittleVgl& lvgl) : touchPanel {touchPanel}, lvgl {lvgl} { } @@ -12,9 +42,9 @@ void TouchHandler::CancelTap() { } } -Pinetime::Drivers::Cst816S::Gestures TouchHandler::GestureGet() { +Pinetime::Applications::TouchEvents TouchHandler::GestureGet() { auto returnGesture = gesture; - gesture = Drivers::Cst816S::Gestures::None; + gesture = Pinetime::Applications::TouchEvents::None; return returnGesture; } @@ -33,11 +63,11 @@ bool TouchHandler::GetNewTouchInfo() { info.gesture == Pinetime::Drivers::Cst816S::Gestures::SlideRight || info.gesture == Pinetime::Drivers::Cst816S::Gestures::LongPress) { if (info.touching) { - gesture = info.gesture; + gesture = ConvertGesture(info.gesture); gestureReleased = false; } } else { - gesture = info.gesture; + gesture = ConvertGesture(info.gesture); } } } diff --git a/src/touchhandler/TouchHandler.h b/src/touchhandler/TouchHandler.h index ed452b3a..fb3d2654 100644 --- a/src/touchhandler/TouchHandler.h +++ b/src/touchhandler/TouchHandler.h @@ -1,6 +1,6 @@ #pragma once #include "drivers/Cst816s.h" -#include "systemtask/SystemTask.h" +#include "displayapp/TouchEvents.h" namespace Pinetime { namespace Components { @@ -26,13 +26,13 @@ namespace Pinetime { uint8_t GetY() const { return info.y; } - Drivers::Cst816S::Gestures GestureGet(); + Pinetime::Applications::TouchEvents GestureGet(); private: Pinetime::Drivers::Cst816S::TouchInfos info; Pinetime::Drivers::Cst816S& touchPanel; Pinetime::Components::LittleVgl& lvgl; - Pinetime::Drivers::Cst816S::Gestures gesture; + Pinetime::Applications::TouchEvents gesture; bool isCancelled = false; bool gestureReleased = true; }; -- cgit v1.2.3-70-g09d2 From 68a7016080115dd7a7eae1041eb2a75457aae0cd Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sun, 20 Mar 2022 16:47:25 +0200 Subject: Replace lv_label_set_text where possible --- src/displayapp/screens/Alarm.cpp | 8 ++-- src/displayapp/screens/FirmwareUpdate.cpp | 11 +++-- src/displayapp/screens/FirmwareUpdate.h | 1 - src/displayapp/screens/FirmwareValidation.cpp | 4 +- src/displayapp/screens/FlashLight.cpp | 2 +- src/displayapp/screens/HeartRate.cpp | 14 +++--- src/displayapp/screens/Motion.cpp | 2 +- src/displayapp/screens/Music.cpp | 50 ++++++++++------------ src/displayapp/screens/Navigation.cpp | 8 ++-- src/displayapp/screens/Notifications.cpp | 10 ++--- src/displayapp/screens/Paddle.cpp | 2 +- src/displayapp/screens/PassKey.cpp | 2 +- src/displayapp/screens/Steps.cpp | 2 +- src/displayapp/screens/StopWatch.cpp | 28 ++++++------ src/displayapp/screens/Tile.cpp | 4 +- src/displayapp/screens/Timer.cpp | 22 +++++----- src/displayapp/screens/Twos.cpp | 2 +- src/displayapp/screens/WatchFaceAnalog.cpp | 10 ++--- src/displayapp/screens/WatchFaceDigital.cpp | 2 +- src/displayapp/screens/WatchFacePineTimeStyle.cpp | 6 +-- src/displayapp/screens/settings/QuickSettings.cpp | 4 +- .../screens/settings/SettingShakeThreshold.cpp | 8 ++-- 22 files changed, 98 insertions(+), 104 deletions(-) (limited to 'src') diff --git a/src/displayapp/screens/Alarm.cpp b/src/displayapp/screens/Alarm.cpp index 879e50d8..d5fc2c04 100644 --- a/src/displayapp/screens/Alarm.cpp +++ b/src/displayapp/screens/Alarm.cpp @@ -303,7 +303,7 @@ void Alarm::ShowInfo() { lv_label_set_text_fmt( txtMessage, "Time to\nalarm:\n%2lu Days\n%2lu Hours\n%2lu Minutes\n%2lu Seconds", daysToAlarm, hrsToAlarm, minToAlarm, secToAlarm); } else { - lv_label_set_text(txtMessage, "Alarm\nis not\nset."); + lv_label_set_text_static(txtMessage, "Alarm\nis not\nset."); } } @@ -317,13 +317,13 @@ void Alarm::SetRecurButtonState() { using Pinetime::Controllers::AlarmController; switch (alarmController.Recurrence()) { case AlarmController::RecurType::None: - lv_label_set_text(txtRecur, "ONCE"); + lv_label_set_text_static(txtRecur, "ONCE"); break; case AlarmController::RecurType::Daily: - lv_label_set_text(txtRecur, "DAILY"); + lv_label_set_text_static(txtRecur, "DAILY"); break; case AlarmController::RecurType::Weekdays: - lv_label_set_text(txtRecur, "MON-FRI"); + lv_label_set_text_static(txtRecur, "MON-FRI"); } } diff --git a/src/displayapp/screens/FirmwareUpdate.cpp b/src/displayapp/screens/FirmwareUpdate.cpp index 373fcae4..0a8544b3 100644 --- a/src/displayapp/screens/FirmwareUpdate.cpp +++ b/src/displayapp/screens/FirmwareUpdate.cpp @@ -15,7 +15,7 @@ FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp* app, Pinetime lv_label_set_text_static(backgroundLabel, ""); titleLabel = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(titleLabel, "Firmware update"); + lv_label_set_text_static(titleLabel, "Firmware update"); lv_obj_set_auto_realign(titleLabel, true); lv_obj_align(titleLabel, nullptr, LV_ALIGN_IN_TOP_MID, 0, 50); @@ -27,7 +27,7 @@ FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp* app, Pinetime lv_bar_set_value(bar1, 0, LV_ANIM_OFF); percentLabel = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(percentLabel, "Waiting..."); + lv_label_set_text_static(percentLabel, "Waiting..."); lv_obj_set_auto_realign(percentLabel, true); lv_obj_align(percentLabel, bar1, LV_ALIGN_OUT_TOP_MID, 0, 60); taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); @@ -81,20 +81,19 @@ void FirmwareUpdate::DisplayProgression() const { float current = bleController.FirmwareUpdateCurrentBytes() / 1024.0f; float total = bleController.FirmwareUpdateTotalBytes() / 1024.0f; int16_t pc = (current / total) * 100.0f; - sprintf(percentStr, "%d %%", pc); - lv_label_set_text(percentLabel, percentStr); + lv_label_set_text_fmt(percentLabel, "%d %%", pc); lv_bar_set_value(bar1, pc, LV_ANIM_OFF); } void FirmwareUpdate::UpdateValidated() { lv_label_set_recolor(percentLabel, true); - lv_label_set_text(percentLabel, "#00ff00 Image Ok!#"); + lv_label_set_text_static(percentLabel, "#00ff00 Image Ok!#"); } void FirmwareUpdate::UpdateError() { lv_label_set_recolor(percentLabel, true); - lv_label_set_text(percentLabel, "#ff0000 Error!#"); + lv_label_set_text_static(percentLabel, "#ff0000 Error!#"); startTime = xTaskGetTickCount(); } diff --git a/src/displayapp/screens/FirmwareUpdate.h b/src/displayapp/screens/FirmwareUpdate.h index a61178ce..5156b7ea 100644 --- a/src/displayapp/screens/FirmwareUpdate.h +++ b/src/displayapp/screens/FirmwareUpdate.h @@ -24,7 +24,6 @@ namespace Pinetime { lv_obj_t* bar1; lv_obj_t* percentLabel; lv_obj_t* titleLabel; - mutable char percentStr[10]; States state = States::Idle; diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp index c7a5b27e..16244ad5 100644 --- a/src/displayapp/screens/FirmwareValidation.cpp +++ b/src/displayapp/screens/FirmwareValidation.cpp @@ -33,9 +33,9 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp* app, lv_obj_set_width(labelIsValidated, 240); if (validator.IsValidated()) - lv_label_set_text(labelIsValidated, "You have already\n#00ff00 validated# this firmware#"); + lv_label_set_text_static(labelIsValidated, "You have already\n#00ff00 validated# this firmware#"); else { - lv_label_set_text(labelIsValidated, "Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version."); + lv_label_set_text_static(labelIsValidated, "Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version."); buttonValidate = lv_btn_create(lv_scr_act(), nullptr); buttonValidate->user_data = this; diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp index c4d02643..0634187d 100644 --- a/src/displayapp/screens/FlashLight.cpp +++ b/src/displayapp/screens/FlashLight.cpp @@ -45,7 +45,7 @@ FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app, lv_label_set_long_mode(backgroundAction, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundAction, 240, 240); lv_obj_set_pos(backgroundAction, 0, 0); - lv_label_set_text(backgroundAction, ""); + lv_label_set_text_static(backgroundAction, ""); lv_obj_set_click(backgroundAction, true); backgroundAction->user_data = this; lv_obj_set_event_cb(backgroundAction, event_handler); diff --git a/src/displayapp/screens/HeartRate.cpp b/src/displayapp/screens/HeartRate.cpp index 513c40bf..89b43bb5 100644 --- a/src/displayapp/screens/HeartRate.cpp +++ b/src/displayapp/screens/HeartRate.cpp @@ -41,16 +41,16 @@ HeartRate::HeartRate(Pinetime::Applications::DisplayApp* app, else lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); - lv_label_set_text(label_hr, "000"); + lv_label_set_text_static(label_hr, "000"); lv_obj_align(label_hr, nullptr, LV_ALIGN_CENTER, 0, -40); label_bpm = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(label_bpm, "Heart rate BPM"); + lv_label_set_text_static(label_bpm, "Heart rate BPM"); lv_obj_align(label_bpm, label_hr, LV_ALIGN_OUT_TOP_MID, 0, -20); label_status = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(label_status, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222)); - lv_label_set_text(label_status, ToString(Pinetime::Controllers::HeartRateController::States::NotEnoughData)); + lv_label_set_text_static(label_status, ToString(Pinetime::Controllers::HeartRateController::States::NotEnoughData)); lv_obj_align(label_status, label_hr, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); @@ -81,13 +81,13 @@ void HeartRate::Refresh() { case Controllers::HeartRateController::States::NoTouch: case Controllers::HeartRateController::States::NotEnoughData: // case Controllers::HeartRateController::States::Stopped: - lv_label_set_text(label_hr, "000"); + lv_label_set_text_static(label_hr, "000"); break; default: lv_label_set_text_fmt(label_hr, "%03d", heartRateController.HeartRate()); } - lv_label_set_text(label_status, ToString(state)); + lv_label_set_text_static(label_status, ToString(state)); lv_obj_align(label_status, label_hr, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); } @@ -109,7 +109,7 @@ void HeartRate::OnStartStopEvent(lv_event_t event) { void HeartRate::UpdateStartStopButton(bool isRunning) { if (isRunning) - lv_label_set_text(label_startStop, "Stop"); + lv_label_set_text_static(label_startStop, "Stop"); else - lv_label_set_text(label_startStop, "Start"); + lv_label_set_text_static(label_startStop, "Start"); } diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp index 23eb2765..799dcb3b 100644 --- a/src/displayapp/screens/Motion.cpp +++ b/src/displayapp/screens/Motion.cpp @@ -35,7 +35,7 @@ Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionContr labelStep = lv_label_create(lv_scr_act(), NULL); lv_obj_align(labelStep, chart, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); - lv_label_set_text(labelStep, "Steps ---"); + lv_label_set_text_static(labelStep, "Steps ---"); taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp index 9f17b956..dd4609cf 100644 --- a/src/displayapp/screens/Music.cpp +++ b/src/displayapp/screens/Music.cpp @@ -62,7 +62,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus lv_obj_align(btnVolDown, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); lv_obj_add_style(btnVolDown, LV_STATE_DEFAULT, &btn_style); label = lv_label_create(btnVolDown, nullptr); - lv_label_set_text(label, Symbols::volumDown); + lv_label_set_text_static(label, Symbols::volumDown); lv_obj_set_hidden(btnVolDown, true); btnVolUp = lv_btn_create(lv_scr_act(), nullptr); @@ -72,7 +72,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus lv_obj_align(btnVolUp, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); lv_obj_add_style(btnVolUp, LV_STATE_DEFAULT, &btn_style); label = lv_label_create(btnVolUp, nullptr); - lv_label_set_text(label, Symbols::volumUp); + lv_label_set_text_static(label, Symbols::volumUp); lv_obj_set_hidden(btnVolUp, true); btnPrev = lv_btn_create(lv_scr_act(), nullptr); @@ -82,7 +82,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus lv_obj_align(btnPrev, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); lv_obj_add_style(btnPrev, LV_STATE_DEFAULT, &btn_style); label = lv_label_create(btnPrev, nullptr); - lv_label_set_text(label, Symbols::stepBackward); + lv_label_set_text_static(label, Symbols::stepBackward); btnNext = lv_btn_create(lv_scr_act(), nullptr); btnNext->user_data = this; @@ -91,7 +91,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus lv_obj_align(btnNext, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); lv_obj_add_style(btnNext, LV_STATE_DEFAULT, &btn_style); label = lv_label_create(btnNext, nullptr); - lv_label_set_text(label, Symbols::stepForward); + lv_label_set_text_static(label, Symbols::stepForward); btnPlayPause = lv_btn_create(lv_scr_act(), nullptr); btnPlayPause->user_data = this; @@ -100,12 +100,12 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus lv_obj_align(btnPlayPause, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, 0); lv_obj_add_style(btnPlayPause, LV_STATE_DEFAULT, &btn_style); txtPlayPause = lv_label_create(btnPlayPause, nullptr); - lv_label_set_text(txtPlayPause, Symbols::play); + lv_label_set_text_static(txtPlayPause, Symbols::play); txtTrackDuration = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(txtTrackDuration, LV_LABEL_LONG_SROLL); lv_obj_align(txtTrackDuration, nullptr, LV_ALIGN_IN_TOP_LEFT, 12, 20); - lv_label_set_text(txtTrackDuration, "--:--/--:--"); + lv_label_set_text_static(txtTrackDuration, "--:--/--:--"); lv_label_set_align(txtTrackDuration, LV_ALIGN_IN_LEFT_MID); lv_obj_set_width(txtTrackDuration, LV_HOR_RES); @@ -117,7 +117,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus lv_obj_align(txtArtist, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 1 * FONT_HEIGHT); lv_label_set_align(txtArtist, LV_ALIGN_IN_LEFT_MID); lv_obj_set_width(txtArtist, LV_HOR_RES - 12); - lv_label_set_text(txtArtist, "Artist Name"); + lv_label_set_text_static(txtArtist, "Artist Name"); txtTrack = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_SROLL_CIRC); @@ -125,7 +125,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus lv_label_set_align(txtTrack, LV_ALIGN_IN_LEFT_MID); lv_obj_set_width(txtTrack, LV_HOR_RES - 12); - lv_label_set_text(txtTrack, "This is a very long getTrack name"); + lv_label_set_text_static(txtTrack, "This is a very long getTrack name"); /** Init animation */ imgDisc = lv_img_create(lv_scr_act(), nullptr); @@ -187,7 +187,7 @@ void Music::Refresh() { } if (playing == Pinetime::Controllers::MusicService::MusicStatus::Playing) { - lv_label_set_text(txtPlayPause, Symbols::pause); + lv_label_set_text_static(txtPlayPause, Symbols::pause); if (xTaskGetTickCount() - 1024 >= lastIncrement) { if (frameB) { @@ -211,31 +211,27 @@ void Music::Refresh() { UpdateLength(); } } else { - lv_label_set_text(txtPlayPause, Symbols::play); + lv_label_set_text_static(txtPlayPause, Symbols::play); } } void Music::UpdateLength() { if (totalLength > (99 * 60 * 60)) { - lv_label_set_text(txtTrackDuration, "Inf/Inf"); + lv_label_set_text_static(txtTrackDuration, "Inf/Inf"); } else if (totalLength > (99 * 60)) { - char timer[12]; - sprintf(timer, - "%02d:%02d/%02d:%02d", - (currentLength / (60 * 60)) % 100, - ((currentLength % (60 * 60)) / 60) % 100, - (totalLength / (60 * 60)) % 100, - ((totalLength % (60 * 60)) / 60) % 100); - lv_label_set_text(txtTrackDuration, timer); + lv_label_set_text_fmt(txtTrackDuration, + "%02d:%02d/%02d:%02d", + (currentLength / (60 * 60)) % 100, + ((currentLength % (60 * 60)) / 60) % 100, + (totalLength / (60 * 60)) % 100, + ((totalLength % (60 * 60)) / 60) % 100); } else { - char timer[12]; - sprintf(timer, - "%02d:%02d/%02d:%02d", - (currentLength / 60) % 100, - (currentLength % 60) % 100, - (totalLength / 60) % 100, - (totalLength % 60) % 100); - lv_label_set_text(txtTrackDuration, timer); + lv_label_set_text_fmt(txtTrackDuration, + "%02d:%02d/%02d:%02d", + (currentLength / 60) % 100, + (currentLength % 60) % 100, + (totalLength / 60) % 100, + (totalLength % 60) % 100); } } diff --git a/src/displayapp/screens/Navigation.cpp b/src/displayapp/screens/Navigation.cpp index 674362a6..0dd0d303 100644 --- a/src/displayapp/screens/Navigation.cpp +++ b/src/displayapp/screens/Navigation.cpp @@ -134,13 +134,13 @@ Navigation::Navigation(Pinetime::Applications::DisplayApp* app, Pinetime::Contro imgFlag = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(imgFlag, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_navi_80); lv_obj_set_style_local_text_color(imgFlag, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN); - lv_label_set_text(imgFlag, iconForName("flag")); + lv_label_set_text_static(imgFlag, iconForName("flag")); lv_obj_align(imgFlag, nullptr, LV_ALIGN_CENTER, 0, -60); txtNarrative = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(txtNarrative, LV_LABEL_LONG_BREAK); lv_obj_set_width(txtNarrative, LV_HOR_RES); - lv_label_set_text(txtNarrative, "Navigation"); + lv_label_set_text_static(txtNarrative, "Navigation"); lv_label_set_align(txtNarrative, LV_LABEL_ALIGN_CENTER); lv_obj_align(txtNarrative, nullptr, LV_ALIGN_CENTER, 0, 10); @@ -148,7 +148,7 @@ Navigation::Navigation(Pinetime::Applications::DisplayApp* app, Pinetime::Contro lv_label_set_long_mode(txtManDist, LV_LABEL_LONG_BREAK); lv_obj_set_style_local_text_color(txtManDist, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); lv_obj_set_width(txtManDist, LV_HOR_RES); - lv_label_set_text(txtManDist, "--M"); + lv_label_set_text_static(txtManDist, "--M"); lv_label_set_align(txtManDist, LV_LABEL_ALIGN_CENTER); lv_obj_align(txtManDist, nullptr, LV_ALIGN_CENTER, 0, 60); @@ -173,7 +173,7 @@ Navigation::~Navigation() { void Navigation::Refresh() { if (flag != navService.getFlag()) { flag = navService.getFlag(); - lv_label_set_text(imgFlag, iconForName(flag)); + lv_label_set_text_static(imgFlag, iconForName(flag)); } if (narrative != navService.getNarrative()) { diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index f9afd8c7..600f7488 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -229,7 +229,7 @@ Notifications::NotificationItem::NotificationItem(const char* title, lv_obj_set_style_local_text_color(alert_subject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); lv_label_set_long_mode(alert_subject, LV_LABEL_LONG_BREAK); lv_obj_set_width(alert_subject, LV_HOR_RES - 20); - lv_label_set_text(alert_subject, "Incoming call from"); + lv_label_set_text_static(alert_subject, "Incoming call from"); lv_obj_t* alert_caller = lv_label_create(container1, nullptr); lv_obj_align(alert_caller, alert_subject, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0); @@ -243,7 +243,7 @@ Notifications::NotificationItem::NotificationItem(const char* title, lv_obj_set_size(bt_accept, 76, 76); lv_obj_align(bt_accept, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); label_accept = lv_label_create(bt_accept, nullptr); - lv_label_set_text(label_accept, Symbols::phone); + lv_label_set_text_static(label_accept, Symbols::phone); lv_obj_set_style_local_bg_color(bt_accept, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); bt_reject = lv_btn_create(lv_scr_act(), nullptr); @@ -252,7 +252,7 @@ Notifications::NotificationItem::NotificationItem(const char* title, lv_obj_set_size(bt_reject, 76, 76); lv_obj_align(bt_reject, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0); label_reject = lv_label_create(bt_reject, nullptr); - lv_label_set_text(label_reject, Symbols::phoneSlash); + lv_label_set_text_static(label_reject, Symbols::phoneSlash); lv_obj_set_style_local_bg_color(bt_reject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); bt_mute = lv_btn_create(lv_scr_act(), nullptr); @@ -261,7 +261,7 @@ Notifications::NotificationItem::NotificationItem(const char* title, lv_obj_set_size(bt_mute, 76, 76); lv_obj_align(bt_mute, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); label_mute = lv_label_create(bt_mute, nullptr); - lv_label_set_text(label_mute, Symbols::volumMute); + lv_label_set_text_static(label_mute, Symbols::volumMute); lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); } break; } @@ -270,7 +270,7 @@ Notifications::NotificationItem::NotificationItem(const char* title, lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text(backgroundLabel, ""); + lv_label_set_text_static(backgroundLabel, ""); } void Notifications::NotificationItem::OnCallButtonEvent(lv_obj_t* obj, lv_event_t event) { diff --git a/src/displayapp/screens/Paddle.cpp b/src/displayapp/screens/Paddle.cpp index 608eb644..79401ff9 100644 --- a/src/displayapp/screens/Paddle.cpp +++ b/src/displayapp/screens/Paddle.cpp @@ -17,7 +17,7 @@ Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::Li 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_label_set_text(points, "0000"); + lv_label_set_text_static(points, "0000"); lv_obj_align(points, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 10); paddle = lv_obj_create(lv_scr_act(), nullptr); diff --git a/src/displayapp/screens/PassKey.cpp b/src/displayapp/screens/PassKey.cpp index 9e43a541..e9715cd6 100644 --- a/src/displayapp/screens/PassKey.cpp +++ b/src/displayapp/screens/PassKey.cpp @@ -15,7 +15,7 @@ PassKey::PassKey(Pinetime::Applications::DisplayApp* app, uint32_t key) : Screen lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text(backgroundLabel, ""); + lv_label_set_text_static(backgroundLabel, ""); } PassKey::~PassKey() { diff --git a/src/displayapp/screens/Steps.cpp b/src/displayapp/screens/Steps.cpp index 3e7f8201..df137585 100644 --- a/src/displayapp/screens/Steps.cpp +++ b/src/displayapp/screens/Steps.cpp @@ -61,7 +61,7 @@ Steps::Steps(Pinetime::Applications::DisplayApp* app, lv_obj_set_width(resetBtn, 115); lv_obj_align(resetBtn, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0); resetButtonLabel = lv_label_create(resetBtn, nullptr); - lv_label_set_text(resetButtonLabel, "Reset"); + lv_label_set_text_static(resetButtonLabel, "Reset"); currentTripSteps = motionController.GetTripSteps(); diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index 8749839f..fcff5f12 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -55,13 +55,13 @@ StopWatch::StopWatch(DisplayApp* app, System::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_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); - lv_label_set_text(time, "00:00"); + lv_label_set_text_static(time, "00:00"); lv_obj_align(time, lv_scr_act(), LV_ALIGN_CENTER, 0, -45); msecTime = lv_label_create(lv_scr_act(), nullptr); // lv_obj_set_style_local_text_font(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20); lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); - lv_label_set_text(msecTime, "00"); + lv_label_set_text_static(msecTime, "00"); lv_obj_align(msecTime, lv_scr_act(), LV_ALIGN_CENTER, 0, 3); btnPlayPause = lv_btn_create(lv_scr_act(), nullptr); @@ -71,7 +71,7 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask) lv_obj_set_width(btnPlayPause, 115); lv_obj_align(btnPlayPause, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); txtPlayPause = lv_label_create(btnPlayPause, nullptr); - lv_label_set_text(txtPlayPause, Symbols::play); + lv_label_set_text_static(txtPlayPause, Symbols::play); btnStopLap = lv_btn_create(lv_scr_act(), nullptr); btnStopLap->user_data = this; @@ -82,7 +82,7 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask) lv_obj_set_style_local_bg_color(btnStopLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex(0x080808)); txtStopLap = lv_label_create(btnStopLap, nullptr); lv_obj_set_style_local_text_color(txtStopLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex(0x888888)); - lv_label_set_text(txtStopLap, Symbols::stop); + lv_label_set_text_static(txtStopLap, Symbols::stop); lv_obj_set_state(btnStopLap, LV_STATE_DISABLED); lv_obj_set_state(txtStopLap, LV_STATE_DISABLED); @@ -90,13 +90,13 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask) // lv_obj_set_style_local_text_font(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20); lv_obj_set_style_local_text_color(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW); lv_obj_align(lapOneText, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 50, 30); - lv_label_set_text(lapOneText, ""); + lv_label_set_text_static(lapOneText, ""); lapTwoText = lv_label_create(lv_scr_act(), nullptr); // lv_obj_set_style_local_text_font(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20); lv_obj_set_style_local_text_color(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW); lv_obj_align(lapTwoText, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 50, 55); - lv_label_set_text(lapTwoText, ""); + lv_label_set_text_static(lapTwoText, ""); taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } @@ -113,11 +113,11 @@ void StopWatch::reset() { lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); - lv_label_set_text(time, "00:00"); - lv_label_set_text(msecTime, "00"); + lv_label_set_text_static(time, "00:00"); + lv_label_set_text_static(msecTime, "00"); - lv_label_set_text(lapOneText, ""); - lv_label_set_text(lapTwoText, ""); + lv_label_set_text_static(lapOneText, ""); + lv_label_set_text_static(lapTwoText, ""); lapBuffer.clearBuffer(); lapNr = 0; lv_obj_set_state(btnStopLap, LV_STATE_DISABLED); @@ -129,8 +129,8 @@ void StopWatch::start() { lv_obj_set_state(txtStopLap, LV_STATE_DEFAULT); lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); - lv_label_set_text(txtPlayPause, Symbols::pause); - lv_label_set_text(txtStopLap, Symbols::lapsFlag); + lv_label_set_text_static(txtPlayPause, Symbols::pause); + lv_label_set_text_static(txtStopLap, Symbols::lapsFlag); startTime = xTaskGetTickCount(); currentState = States::Running; systemTask.PushMessage(Pinetime::System::Messages::DisableSleeping); @@ -141,8 +141,8 @@ void StopWatch::pause() { // Store the current time elapsed in cache oldTimeElapsed += timeElapsed; currentState = States::Halted; - lv_label_set_text(txtPlayPause, Symbols::play); - lv_label_set_text(txtStopLap, Symbols::stop); + lv_label_set_text_static(txtPlayPause, Symbols::play); + lv_label_set_text_static(txtStopLap, Symbols::stop); lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW); lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW); systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping); diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp index 23d9bca7..4df69fed 100644 --- a/src/displayapp/screens/Tile.cpp +++ b/src/displayapp/screens/Tile.cpp @@ -39,7 +39,7 @@ Tile::Tile(uint8_t screenID, // Battery batteryIcon = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); + lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, -8, 0); if (numScreens > 1) { @@ -120,7 +120,7 @@ Tile::~Tile() { void Tile::UpdateScreen() { lv_label_set_text(label_time, dateTimeController.FormattedTime().c_str()); - lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); + lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); } void Tile::OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId) { diff --git a/src/displayapp/screens/Timer.cpp b/src/displayapp/screens/Timer.cpp index 5cd496c7..167b7b1e 100644 --- a/src/displayapp/screens/Timer.cpp +++ b/src/displayapp/screens/Timer.cpp @@ -18,7 +18,7 @@ void Timer::CreateButtons() { lv_obj_set_height(btnMinutesUp, 40); lv_obj_set_width(btnMinutesUp, 60); txtMUp = lv_label_create(btnMinutesUp, nullptr); - lv_label_set_text(txtMUp, "+"); + lv_label_set_text_static(txtMUp, "+"); btnMinutesDown = lv_btn_create(lv_scr_act(), nullptr); btnMinutesDown->user_data = this; @@ -27,7 +27,7 @@ void Timer::CreateButtons() { lv_obj_set_height(btnMinutesDown, 40); lv_obj_set_width(btnMinutesDown, 60); txtMDown = lv_label_create(btnMinutesDown, nullptr); - lv_label_set_text(txtMDown, "-"); + lv_label_set_text_static(txtMDown, "-"); btnSecondsUp = lv_btn_create(lv_scr_act(), nullptr); btnSecondsUp->user_data = this; @@ -36,7 +36,7 @@ void Timer::CreateButtons() { lv_obj_set_height(btnSecondsUp, 40); lv_obj_set_width(btnSecondsUp, 60); txtSUp = lv_label_create(btnSecondsUp, nullptr); - lv_label_set_text(txtSUp, "+"); + lv_label_set_text_static(txtSUp, "+"); btnSecondsDown = lv_btn_create(lv_scr_act(), nullptr); btnSecondsDown->user_data = this; @@ -45,7 +45,7 @@ void Timer::CreateButtons() { lv_obj_set_height(btnSecondsDown, 40); lv_obj_set_width(btnSecondsDown, 60); txtSDown = lv_label_create(btnSecondsDown, nullptr); - lv_label_set_text(txtSDown, "-"); + lv_label_set_text_static(txtSDown, "-"); } Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController) @@ -55,7 +55,7 @@ Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController) lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text(backgroundLabel, ""); + lv_label_set_text_static(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); @@ -73,9 +73,9 @@ Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController) lv_obj_set_height(btnPlayPause, 40); txtPlayPause = lv_label_create(btnPlayPause, nullptr); if (timerController.IsRunning()) { - lv_label_set_text(txtPlayPause, Symbols::pause); + lv_label_set_text_static(txtPlayPause, Symbols::pause); } else { - lv_label_set_text(txtPlayPause, Symbols::play); + lv_label_set_text_static(txtPlayPause, Symbols::play); CreateButtons(); } @@ -98,7 +98,7 @@ 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); + lv_label_set_text_static(txtPlayPause, Symbols::play); uint32_t seconds = timerController.GetTimeRemaining() / 1000; minutesToSet = seconds / 60; secondsToSet = seconds % 60; @@ -106,7 +106,7 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { CreateButtons(); } else if (secondsToSet + minutesToSet > 0) { - lv_label_set_text(txtPlayPause, Symbols::pause); + lv_label_set_text_static(txtPlayPause, Symbols::pause); timerController.StartTimer((secondsToSet + minutesToSet * 60) * 1000); lv_obj_del(btnSecondsDown); @@ -158,8 +158,8 @@ 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); + lv_label_set_text_static(time, "00:00"); + lv_label_set_text_static(txtPlayPause, Symbols::play); secondsToSet = 0; minutesToSet = 0; CreateButtons(); diff --git a/src/displayapp/screens/Twos.cpp b/src/displayapp/screens/Twos.cpp index 6d675859..ca9295d5 100644 --- a/src/displayapp/screens/Twos.cpp +++ b/src/displayapp/screens/Twos.cpp @@ -90,7 +90,7 @@ Twos::Twos(Pinetime::Applications::DisplayApp* app) : Screen(app) { lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text(backgroundLabel, ""); + lv_label_set_text_static(backgroundLabel, ""); } Twos::~Twos() { diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index 61042816..4cfc9692 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -67,13 +67,13 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app, lv_obj_align(bg_clock_img, NULL, LV_ALIGN_CENTER, 0, 0); batteryIcon = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(batteryIcon, Symbols::batteryHalf); + lv_label_set_text_static(batteryIcon, Symbols::batteryHalf); lv_obj_align(batteryIcon, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 0); lv_obj_set_auto_realign(batteryIcon, true); notificationIcon = lv_label_create(lv_scr_act(), NULL); lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); - lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); lv_obj_align(notificationIcon, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0); // Date - Day / Week day @@ -185,7 +185,7 @@ void WatchFaceAnalog::SetBatteryIcon() { } else { lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); } - lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); + lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); } void WatchFaceAnalog::Refresh() { @@ -193,7 +193,7 @@ void WatchFaceAnalog::Refresh() { if (isCharging.IsUpdated()) { if (isCharging.Get()) { lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); - lv_label_set_text(batteryIcon, Symbols::plug); + lv_label_set_text_static(batteryIcon, Symbols::plug); } else { SetBatteryIcon(); } @@ -208,7 +208,7 @@ void WatchFaceAnalog::Refresh() { notificationState = notificationManager.AreNewNotificationsAvailable(); if (notificationState.IsUpdated()) { - lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(notificationState.Get())); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get())); } currentDateTime = dateTimeController.CurrentDateTime(); diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 6a914884..ad328e1a 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -121,7 +121,7 @@ void WatchFaceDigital::Refresh() { bleState = bleController.IsConnected(); bleRadioEnabled = bleController.IsRadioEnabled(); if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) { - lv_label_set_text(bleIcon, BleIcon::GetIcon(bleState.Get())); + lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get())); } lv_obj_realign(batteryIcon); lv_obj_realign(batteryPlug); diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index d0fbf059..28e7a6a3 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -373,7 +373,7 @@ void WatchFacePineTimeStyle::Refresh() { bleState = bleController.IsConnected(); bleRadioEnabled = bleController.IsRadioEnabled(); if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) { - lv_label_set_text(bleIcon, BleIcon::GetIcon(bleState.Get())); + lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get())); AlignIcons(); } @@ -424,10 +424,10 @@ void WatchFacePineTimeStyle::Refresh() { } if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) { - lv_label_set_text_fmt(dateDayOfWeek, "%s", dateTimeController.DayOfWeekShortToString()); + lv_label_set_text_static(dateDayOfWeek, dateTimeController.DayOfWeekShortToString()); lv_label_set_text_fmt(dateDay, "%d", day); lv_obj_realign(dateDay); - lv_label_set_text_fmt(dateMonth, "%s", dateTimeController.MonthShortToString()); + lv_label_set_text_static(dateMonth, dateTimeController.MonthShortToString()); currentYear = year; currentMonth = month; diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index cd56c145..97faaa79 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -40,7 +40,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 0); batteryIcon = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); + lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0); static constexpr uint8_t barHeight = 20 + innerDistance; @@ -124,7 +124,7 @@ QuickSettings::~QuickSettings() { void QuickSettings::UpdateScreen() { lv_label_set_text(label_time, dateTimeController.FormattedTime().c_str()); - lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); + lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); } void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) { diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.cpp b/src/displayapp/screens/settings/SettingShakeThreshold.cpp index 9d40fcf9..c354bdc4 100644 --- a/src/displayapp/screens/settings/SettingShakeThreshold.cpp +++ b/src/displayapp/screens/settings/SettingShakeThreshold.cpp @@ -57,7 +57,7 @@ SettingShakeThreshold::SettingShakeThreshold(DisplayApp* app, lv_obj_align(calButton, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0); lv_btn_set_checkable(calButton, true); calLabel = lv_label_create(calButton, NULL); - lv_label_set_text(calLabel, "Calibrate"); + lv_label_set_text_static(calLabel, "Calibrate"); lv_arc_set_value(positionArc, settingsController.GetShakeThreshold()); @@ -91,7 +91,7 @@ void SettingShakeThreshold::Refresh() { calibrating = 2; lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_RED); lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_RED); - lv_label_set_text(calLabel, "Shake!!"); + lv_label_set_text_static(calLabel, "Shake!"); } } if (calibrating == 2) { @@ -121,14 +121,14 @@ void SettingShakeThreshold::UpdateSelected(lv_obj_t* object, lv_event_t event) { lv_arc_set_value(positionArc, 0); calibrating = 1; vCalTime = xTaskGetTickCount(); - lv_label_set_text(calLabel, "Ready!"); + lv_label_set_text_static(calLabel, "Ready!"); lv_obj_set_click(positionArc, false); lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_GREEN); lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_GREEN); } else if (lv_btn_get_state(calButton) == LV_BTN_STATE_RELEASED) { calibrating = 0; lv_obj_set_click(positionArc, true); - lv_label_set_text(calLabel, "Calibrate"); + lv_label_set_text_static(calLabel, "Calibrate"); } break; } -- cgit v1.2.3-70-g09d2