From 378fa6b4016b65e2d7b128fdc3ce89c4ca779a4d Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Tue, 18 May 2021 15:23:26 +0200 Subject: Reset diff --git a/.clang-tidy b/.clang-tidy index 8a7d38f..d603680 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -22,9 +22,5 @@ Checks: '*, -hicpp-no-assembler, -hicpp-avoid-c-arrays, -hicpp-uppercase-literal-suffix, - -hicpp-no-array-decay, -cert-err58-cpp, - -cert-err60-cpp' -CheckOptions: - - key: readability-function-cognitive-complexity.Threshold - value: 100 \ No newline at end of file + -cert-err60-cpp' \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c529f3..f777013 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,22 +55,10 @@ if(BUILD_DFU) set(BUILD_DFU true) endif() -set(PROJECT_GIT_COMMIT_HASH "") - -execute_process(COMMAND git rev-parse --short HEAD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - OUTPUT_VARIABLE PROJECT_GIT_COMMIT_HASH - RESULT_VARIABLE PROJECT_GIT_COMMIT_HASH_SUCCESS) - -string(STRIP ${PROJECT_GIT_COMMIT_HASH} PROJECT_GIT_COMMIT_HASH) - -message("PROJECT_GIT_COMMIT_HASH_SUCCESS? " ${PROJECT_GIT_COMMIT_HASH_SUCCESS}) - message("BUILD CONFIGURATION") message("-------------------") message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH}) -message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH}) message(" * NRF52 SDK : " ${NRF5_SDK_PATH}) set(PROGRAMMER "???") if(USE_JLINK) diff --git a/README.md b/README.md index 396d746..34f6e84 100644 --- a/README.md +++ b/README.md @@ -72,8 +72,7 @@ As of now, here is the list of achievements of this project: ## Documentation ### Getting started - - [Getting started with InfiniTime 1.0 (quick user guide, update bootloader and InfiniTime,...)](doc/gettingStarted/gettingStarted-1.0.md) - - [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/ota-gadgetbridge-nrfconnect.md) + - [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/gettingStarted.md) ### Develop - [Generate the fonts and symbols](src/displayapp/fonts/README.md) diff --git a/doc/buildAndProgram.md b/doc/buildAndProgram.md index afd526e..b70bdfc 100644 --- a/doc/buildAndProgram.md +++ b/doc/buildAndProgram.md @@ -3,7 +3,6 @@ To build this project, you'll need: - A cross-compiler : [ARM-GCC (9-2020-q2-update)](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads/9-2020-q2-update) - The NRF52 SDK 15.3.0 : [nRF-SDK v15.3.0](https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip) - - The `cbor` and `intelhex` modules for Python 3 - A reasonably recent version of CMake (I use 3.16.5) ## Build steps @@ -222,4 +221,4 @@ Loading section .sec6, size 0x10000 lma 0x30000 Loading section .sec7, size 0xdf08 lma 0x40000 Start address 0x0, load size 314200 Transfer rate: 45 KB/sec, 969 bytes/write. -``` +``` \ No newline at end of file diff --git a/doc/contribute.md b/doc/contribute.md index 09d2077..7958eea 100644 --- a/doc/contribute.md +++ b/doc/contribute.md @@ -2,13 +2,13 @@ ## Report bugs You use your Pinetime and find a bug in the firmware? [Create an issue on Github](https://github.com/JF002/InfiniTime/issues) explaining the bug, how to reproduce it, the version of the firmware you use... ## Write and improve documentation -Documentation might be incomplete, or not clear enough, and it is always possible to improve it with better wording, pictures, photo, video,... +Documentation might be incomplete, or not clear enough, and it is always possible to improve it with better wording, pictures, photo, video,... As the documentation is part of the source code, you can submit your improvements to the documentation by submitting a pull request (see below). ## Fix bugs, add functionalities and improve the code You want to fix a bug, add a cool new functionality or improve the code? See *How to submit a pull request below*. ## Spread the word -The Pinetime is a cool open source project that deserves to be known. Talk about it around you, on social networks, on your blog,... and let people know that we are working on an open-source firmware for a smartwatch! +Pinetime is a cool open source project that deserves to be know. Talk about it around you, on social networks, on your blog,... and let people know that we are working on an open-source firmware for a smartwatch! # How to submit a pull request ? @@ -21,28 +21,28 @@ The Pinetime is a cool open source project that deserves to be known. Talk about - Write documentation related to your new feature is applicable; - Create the pull-request and write a great description about it : what does your PR do, why, how,... Add pictures and video if possible; - Wait for someone to review your PR and take part in the review process; - - Your PR will eventually be merged :) + - You PR will eventually be merged :) -Your contribution is more than welcome! +Your contribution is more than welcome! If you want to fix a bug, add a functionality or improve the code, you'll first need to create a branch from the **develop** branch (see [this page about the branching model](./branches.md)). This branch is called a feature branch, and you should choose a name that explains what you are working on (ex: "add-doc-about-contributions"). In this branch, **focus on only one topic, bug or feature**. For example, if you created this branch to work on the UI of a specific application, do not commit modifications about the SPI driver. If you want to work on multiple topics, create one branch per topic. When your feature branch is ready, **make sure it actually works** and **do not forget to write documentation** about it if it's relevant. -I **strongly discourage to create a PR containing modifications that haven't been tested**. If, for any reason, you cannot test your modifications but want to publish them anyway, **please mention it in the description**. This way, other contributors might be willing to test it and provide feedback about your code. +I **strongly discourage to create a PR containing modifications that haven't been tested**. If, for any reason, you cannot test your modifications but want to publish them anyway, **please mention it in the description**. This way, other contributors might be willing to test it and provide feedbacks about your code. Also, before submitting your PR, check the coding style of your code against the **coding conventions** detailed below. This project also provides [clang-format](../.clang-format) and [clang-tidy](../.clang-tidy) configuration files. You can use them to ensure correct formatting of your code. Do not forget to check the files you are going to commit and remove those who are not necessary (config files from your IDE, for example). Remove old comments, commented code,... -Then, you can submit a pull-request for review. Try to **describe your pull request as much as possible**: what did you do in this branch, how does it work, how is it designed, are there any limitations,... This will help the contributors to understand and review your code easily. You can add pictures and video to the description so that contributors will have a quick overview of your work. +Then, you can submit a pull-request for review. Try to **describe your pull request as much as possible**: what did you do in this branch, how does it work, how is it designed, are there any limitations,... This will help the contributors to understand and review your code easily. You can add pictures and video to the description so that contributors will have a quick overview of you work. -Other contributors can post comments about the pull request, maybe ask for more info or adjustments in the code. +Other contributors can post comments about the pull request, maybe ask for more info or adjustements in the code. -Once the pull request is reviewed and accepted, it'll be merge in **develop** and will be released in the next release version of the firmware. +Once the pull request is reviewed an accepted, it'll be merge in **develop** and will be released in the next release version of the firmware. ## Why all these rules? -Reviewing pull-requests is a **very time consuming task** for the creator of this project ([JF002](https://github.com/JF002)) and for other contributors who take the time to review them. Every little thing you do to make their lives easier will **increase the chances your PR will be merge quickly**. +Reviewing pull-requests is a **very time consuming task** for the creator of this project ([JF002](https://github.com/JF002)) and for other contributors who take the time to review them. Every little thing you do to make their lifes easier will **increase the chances your PR will be merge quickly**. When reviewing PR, the author and contributors will first look at the **description**. If it's easy to understand what the PR does, why the modification is needed or interesting and how it's done, a good part of the work is already done : we understand the PR and its context. @@ -58,12 +58,12 @@ It's totally normal for a PR to need some more work even after it was created, t ## Language The language of this project is **C++**, and all new code must be written in C++. (Modern) C++ provides a lot of useful tools and functionalities that are beneficial for embedded software development like `constexpr`, `template` and anything that provides zero-cost abstraction. -It's OK to include C code if this code comes from another library like FreeRTOS, NimBLE, LVGL or the NRF-SDK. +It's OK to include C code if this code comes from another library like FreeRTOS, NimBLE, LVGL or the NRF-SDK. ## Coding style -The most important rule to follow is to try to keep the code as easy to read and maintain as possible. +The most important rule to follow is to try to keep the code as easy to read and maintain as possible. - - **Indentation** : 2 spaces, no tabulation + - **Identation** : 2 spaces, no tabulation - **Opening brace** at the end of the line - **Naming** : Choose self-describing variable name - **class** : PascalCase diff --git a/doc/gettingStarted/appmenu-071.jpg b/doc/gettingStarted/appmenu-071.jpg deleted file mode 100644 index dee7c8f..0000000 Binary files a/doc/gettingStarted/appmenu-071.jpg and /dev/null differ diff --git a/doc/gettingStarted/appmenu.jpg b/doc/gettingStarted/appmenu.jpg deleted file mode 100644 index 1e52fe7..0000000 Binary files a/doc/gettingStarted/appmenu.jpg and /dev/null differ diff --git a/doc/gettingStarted/bootloader-1.0.jpg b/doc/gettingStarted/bootloader-1.0.jpg deleted file mode 100644 index 7b63918..0000000 Binary files a/doc/gettingStarted/bootloader-1.0.jpg and /dev/null differ diff --git a/doc/gettingStarted/gettingStarted-1.0.md b/doc/gettingStarted/gettingStarted-1.0.md deleted file mode 100644 index 2ac22b9..0000000 --- a/doc/gettingStarted/gettingStarted-1.0.md +++ /dev/null @@ -1,112 +0,0 @@ -# Getting started with InfiniTime 1.0 -On April 22 2021, InfiniTime and Pine64 [announced the release of InfiniTime 1.0](https://www.pine64.org/2021/04/22/its-time-infinitime-1-0/) and the availability of PineTime smartwatches as *enthusiast grade end-user product*. This page aims to guide you with your first step with your new PineTime. - -## Firmware, InfiniTime, Bootloader, Recovery firmware, OTA, DFU... What is it? -You might have already seen these words by reading the announcement, release notes, or [the wiki guide](https://wiki.pine64.org/wiki/Upgrade_PineTime_to_InfiniTime_1.0.0) and, you may find them misleading if you're not familiar with the project. - -Basically, a **firmware** is just a software running on the embedded hardware of a device, the PineTime in this case. -**InfiniTime** is based on 3 distinct **firmwares**: - - **[InfiniTime](https://github.com/JF002/InfiniTime)** itself, this is the *application firmware* running on the PineTime. This is the main firmware which provides most of the functionalities you'll use on a daily basis : bluetooth low-energy (BLE) connectivity, applications, watchfaces,... - - **[The bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader)** is responsible for safely applying **updates** of the *application firmware*, reverting them in case of issues and load the recovery firmware when requested. - - **The recovery firmware** is a specific *application firmware* than can be loaded by the bootloader on user request. This firmware can be useful in case of serious issue, when the main application firmware cannot perform an OTA update correctly. Currently, this recovery firmware is based on [InfiniTime 0.14.1](https://github.com/JF002/InfiniTime/releases/tag/0.14.1). - -**OTA** and **DFU** refer to the update of the firmware over BLE (**B**luetooth **L**ow **E**nergy). **OTA** means **O**ver **T**he **A**ir, this is a functionality that allows the user to update the firmware how their device using a wireless communication like BLE. When we talk about **DFU** (**D**igital **F**irmware **U**pdate), we refer to the file format and protocol used to send the update of the firmware to the watch over-the-air. InfiniTime implement the (legacy) DFU protocol from Nordic Semiconductor (NRF). - -## How to check the version of InfiniTime and the bootloader? -Since September 2020, all PineTimes (devkits or sealed) are flashed using the **[first iteration of the bootloader](https://github.com/lupyuen/pinetime-rust-mynewt/releases/tag/v4.1.7)** and **[InfiniTime 0.7.1](https://github.com/JF002/InfiniTime/releases/tag/0.7.1)**. There was no recovery firmware at that time. - -The bootloader only runs when the watch starts (from an empty battery, for example) or after a reset (after a succesful OTA or a manual reset - long push on the button). - -You can recognize this first iteration of the bootloader with it greenish **PINETIME** logo. - -![Old bootloader logo](oldbootloaderlogo.jpg) - -You can check the version of InfiniTime by opening the app *SystemInfo*. For version < 1.0: - -![InfiniTime 0.7.1 Application menu](appmenu-071.jpg) -![InfiniTime 0.7.1 version](version-071.jpg) - -And for version >= 1.0 : - -![InfiniTime 1.0 version](version-1.0.jpg) - - -PineTime shipped from June 2020 (to be confirmed) will be flashed with the [new version of the bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader/releases/tag/1.0.0), the [recovery firmware](https://github.com/JF002/InfiniTime/releases/tag/0.14.1) and [InfiniTime 1.0](https://github.com/JF002/InfiniTime/releases/tag/1.0.0). - -The bootloader is easily recognizable with it white pine cone that is progressively drawn in green. It also displays its own version on the bottom (1.0.0 as of now). - -![Bootloader 1.0](bootloader-1.0.jpg) - -## How to update your PineTime? -To update your PineTime, you can use one of the compatible companion applications. Here are the main ones: - - - **[Amazfish](https://github.com/piggz/harbour-amazfish)** (Desktop Linux, mobile Linux, SailfishOS, runs on the PinebookPro and the Pinephone) - - **[Gadgetbridge](https://www.gadgetbridge.org/)** (Android) - - **[Siglo](https://github.com/alexr4535/siglo)** (Linux, GTK based) - - **NRFConnect** (closed source, Android & iOS). - -See [this page](ota-gadgetbridge-nrfconnect.md) for more info about the OTA procedure using Gadgetbrige and NRFCOnnect. - -### From InfiniTime 0.7.1 / old bootloader -If your PineTime is currently running InfiniTime 0.7.1 and the old bootloader, we strongly recommend you update them to more recent version (Bootloader 1.0.0 and InfiniTime 1.0.0 as of now). We also recommend you install the recovery firmware once the bootloader is up-do-date. - -Using the companion app of your choice, you'll need to apply the OTA procedure for these 3 firmwares in this sequence (failing to follow this specific order might temporarily or permanently brick your device): - - 1. Flash the latest version of InfiniTime. The file to upload is named **pinetime-mcuboot-app-dfu-x.y.z.zip**. Here is the link to [InfiniTime 1.0](https://github.com/JF002/InfiniTime/releases/download/1.0.0/pinetime-mcuboot-app-dfu-1.0.0.zip). - 2. Update the bootloader by applying the OTA procedure with the file named [**reloader-mcuboot.zip** from the repo of the bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader/releases/download/1.0.0/reloader-mcuboot.zip). - 3. Install the recovery firmware by applying the OTA procedure with the file named [**pinetime-mcuboot-recovery-loader-dfu-0.14.1.zip** from the version 0.14.1 of InfiniTime](https://github.com/JF002/InfiniTime/releases/download/0.14.1/pinetime-mcuboot-recovery-loader-dfu-0.14.1.zip). - -You'll find more info about this process in [this wiki page](https://wiki.pine64.org/wiki/Upgrade_PineTime_to_InfiniTime_1.0.0). You can also see the procedure in video [here](https://video.codingfield.com/videos/watch/831077c5-16f3-47b4-9b2b-c4bbfecc6529) and [here (from Amazfish)](https://video.codingfield.com/videos/watch/f7bffb3d-a6a1-43c4-8f01-f4aeff4adf9e) - -### From version > 1.0 -If you are already running the new "1.0.0" bootloader, all you have to do is update your version of InfiniTime when it'll be available. We'll write specific instructions when (if) we release a new version of the bootloader. - -### Firmware validation -The bootloader requires a (manual) validation of the firmware. If the watch reset with an updated firmware that was not validated, the bootloader will consider it as non-functionning and will revert to the previous version of the firmware. This is a safety feature to prevent bricking your device with a faulty firmware. - -You can validate your updated firmware on InfiniTime >= 1.0 by following this simple procedure: - - - From the watchface, swipe **right** to display the *Quick Actions menu* - - Open the **Settings** app by tapping the *gear* icon on the bottom right - - Swipe down and tap on the entry named **Firmware** - - This app shows the version that is currently running. If it's not validated yet, it displays 2 buttons: - - **Validate** to validate your firmware - - **Reset** to reset the watch and revert to the previously running version of the firmware - -## InfiniTime 1.0 quick user guide -### Setting the time -By default, InfiniTime starts on the digital watchface. It'll probably display the epoch time (1 Jan 1970, 00:00). The time will be automatically synchronized once you connect on of the companion app to your PineTime using BLE connectivity. InfiniTime does not provide any way to manually set the time for now. - -### Navigation in the menu - -![Quick actions](quickactions.jpg) -![Settings](settings.jpg) -![Application menu](appmenu.jpg) - - - Swipe **down** to display the notification panel. Notification sent by your companion app will be displayed in this panel. - - Swipe **up** to display the application menus. Apps (stopwatch, music, step, games,...) can be started from this menu. - - Swipe **right** to display the Quick Actions menu. This menu allows you to - - Set the brightness of the display - - Start the **flashlight** app - - Enable/disable vibrations on notifications (Do Not Disturb mode) - - Enter the **settings** menu - - Settings - - Display timeout - - Wake up event (Tap, wrist rotation) - - Time format (12/24H) - - Default watchface (digital / analog) - - Battery info - - Firmware validation - - About (system info, firmware version,...) - -### Bootloader - -Most of the time, the bootloader just runs without your intervention (update and load the firmware). - -However, you can enable 2 functionalities using the push button: - - - Push the button until the pine cone is drawn in **blue** to force the rollback of the previous version of the firmware, even if you've already validated the updated one - - Push the button until the pine cone is drawn in **red** to load the recovery firmware. This recovery firmware only provides BLE connectivity and OTA functionality. - -More info about the bootloader in [its project page](https://github.com/JF002/pinetime-mcuboot-bootloader/blob/master/README.md). - diff --git a/doc/gettingStarted/oldbootloaderlogo.jpg b/doc/gettingStarted/oldbootloaderlogo.jpg deleted file mode 100644 index b4d0cdf..0000000 Binary files a/doc/gettingStarted/oldbootloaderlogo.jpg and /dev/null differ diff --git a/doc/gettingStarted/ota-gadgetbridge-nrfconnect.md b/doc/gettingStarted/ota-gadgetbridge-nrfconnect.md deleted file mode 100644 index 1187a9b..0000000 --- a/doc/gettingStarted/ota-gadgetbridge-nrfconnect.md +++ /dev/null @@ -1,101 +0,0 @@ -# Flash and upgrade InfiniTime -If you just want to flash or upgrade InfiniTime on your PineTime, this page is for you! - -- [InfiniTime releases and versions](#infinitime-releases-and-versions) -- [How to upgrade Over-The-Air (OTA)](#how-to-upgrade-over-the-air-ota) - - [Using Gadgetbridge](#using-gadgetbridge) - - [Using NRFConnect](#Using-nrfconnect) -- [How to flash InfiniTime using the SWD interface](#how-to-flash-infinitime-using-the-swd-interface) - -## InfiniTime releases and versions -All releases of InfiniTime are available on the [release page of the GitHub repo](https://github.com/JF002/InfiniTime/releases). - -Versions that are tagged as **RELEASE CANDIDATE** are pre-release versions, that are available for testing before actually releasing a new stable version. If you want to help us debug the project and provide stable versions to other user, you can use them. If you want stable and tested version, you should not flash these release candidate version. - -Release files are available under the *Assets* button. - -## How to upgrade Over-The-Air (OTA) -OTA is the easiest method to upgrade InfiniTime. Note that it's only possible is your PineTime is already running InfiniTime (>= 0.7.1). - -2 companion apps provide support for OTA : - - [Gadgetbridge](https://gadgetbridge.org/) (open source, runs on Android, [available on F-Droid](https://f-droid.org/packages/nodomain.freeyourgadget.gadgetbridge/)). - - [NRFConnect](https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Connect-for-mobile) (close source, runs on Android and iOS). - -Both applications need you to download the **DFU file** of InfiniTime. This file contains the new version of InfiniTime that will be flashed into your device. It's called **dfu-x.y.z.zip** (ex: dfu-0.9.0.zip) in the release note. -![Dfu file](dfuFile.png ) - -### Using Gadgetbridge -Launch Gadgetbridge and tap on the **"+"** button on the bottom right to add a new device: - -![Gadgetbridge 0](gadgetbridge0.jpg) - -Wait for the scan to complete, your PineTime should be detected: - -![Gadgetbridge 1](gadgetbridge1.jpg) - -Tap on it. Gadgdetbridge will pair and connect to your device: - -![Gadgetbridge 2](gadgetbridge2.jpg) - -Now that Gadgetbridge is connected to your PineTime, use a file browser application (I'm using Seafile to browse my NAS) and browse to the DFU file (image-xxx.zip) you downloaded previously. Tap on it and open it using the Gadgetbridge application/firmware installer: - -![Gadgetbridge 3](gadgetbridge3.jpg) - -Read carefully the warning and tap **Install**: - -![Gadgetbridge 4](gadgetbridge4.jpg) - -Wait for the transfer to finish. Your PineTime should reset and reboot with the new version of InfiniTime! - -![Gadgetbridge 5](gadgetbridge5.jpg) - -### Using NRFConnect -Open NRFConnect. Swipe down in the *Scanner* tab and wait for your device to appear: - -![NRFConnect 0](nrfconnect0.jpg) - -Tap on the *Connect* button on the right of your device. NRFConnect will connect to your PineTime and discover its characteristics. Tap on the **DFU** button on the top right: - -![NRFConnect 1](nrfconnect1.jpg) - -Select **Distribution packet (ZIP)**: - -![NRFConnect 2](nrfconnect2.jpg) - -Browse to the DFU file you downloaded previously, the DFU transfer will start automatically. When the transfer is finished, your PineTime will reset and restart on the new version of InfiniTime! - -![NRFConnect 3](nrfconnect3.jpg) - -## How to flash InfiniTime using the SWD interface -Download the files **bootloader.bin**, **image-x.y.z.bin** and **pinetime-graphics-x.y.z.bin** from the release page: - -![Image file](imageFile.png ) - -The bootloader reads a boot logo from the external SPI flash memory. The first step consists in flashing a tool in the MCU that will flash the boot logo into this SPI flash memory. This first step is optional but recommanded (the bootloader will display garbage on screen for a few second if you don't do it). -Using your SWD tool, flash **pinetime-graphics-x.y.z.bin** at offset **0x0000**. Reset the MCU and wait for a few second, until the logo is completely drawn on the display. - -Then, using your SWD tool, flash those file at specific offset: - - - bootloader.bin : **0x0000** - - image-x.y.z.bin : **0x8000** - -Reset and voilĂ , you're running InfiniTime on your PineTime! - -If you are using OpenOCD with a STLinkV2, you can find more info [on this page](../openOCD.md). - -## How to synchronize the time - -### Using Gadgetbridge -Good news! Gadgetbridge **automatically** synchronizes the time when connecting to your PineTime! - -### Using NRFConnect -You must enable the **CTS** *GATT server* into NRFConnect so that InfiniTime can synchronize the time with your smartphone. - -Launch NRFConnect, tap the sandwich button on the top left and select *Configure GATT server*: - -![NRFConnect CTS 0](nrfconnectcts0.jpg) - - -Tap *Add service* and select the server configuration *Current Time service*. Tap OK and connect to your PineTime, it should automcatically sync the time once the connection is established! - -![NRFConnect CTS 1](nrfconnectcts1.jpg) diff --git a/doc/gettingStarted/quickactions.jpg b/doc/gettingStarted/quickactions.jpg deleted file mode 100644 index 0d92b13..0000000 Binary files a/doc/gettingStarted/quickactions.jpg and /dev/null differ diff --git a/doc/gettingStarted/settings.jpg b/doc/gettingStarted/settings.jpg deleted file mode 100644 index 510b29e..0000000 Binary files a/doc/gettingStarted/settings.jpg and /dev/null differ diff --git a/doc/gettingStarted/version-071.jpg b/doc/gettingStarted/version-071.jpg deleted file mode 100644 index bc9bc5b..0000000 Binary files a/doc/gettingStarted/version-071.jpg and /dev/null differ diff --git a/doc/gettingStarted/version-1.0.jpg b/doc/gettingStarted/version-1.0.jpg deleted file mode 100644 index bcfc8c6..0000000 Binary files a/doc/gettingStarted/version-1.0.jpg and /dev/null differ diff --git a/docker/.gitpod.Dockerfile b/docker/.gitpod.Dockerfile index 4fbc7be..2f7099a 100644 --- a/docker/.gitpod.Dockerfile +++ b/docker/.gitpod.Dockerfile @@ -19,11 +19,8 @@ RUN apt-get update -qq \ libffi-dev \ libssl-dev \ python3-dev \ - git \ && rm -rf /var/cache/apt/* /var/lib/apt/lists/*; -# Git needed for PROJECT_GIT_COMMIT_HASH variable setting - # Needs to be installed as root RUN pip3 install adafruit-nrfutil RUN pip3 install -Iv cryptography==3.3 diff --git a/docker/Dockerfile b/docker/Dockerfile index 0a4f69f..a6caa24 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -19,11 +19,8 @@ RUN apt-get update -qq \ libssl-dev \ python3-dev \ python \ - git \ && rm -rf /var/cache/apt/* /var/lib/apt/lists/*; -# Git needed for PROJECT_GIT_COMMIT_HASH variable setting - RUN pip3 install adafruit-nrfutil RUN pip3 install -Iv cryptography==3.3 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index acbfba1..5c6af93 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -406,7 +406,6 @@ list(APPEND SOURCE_FILES displayapp/screens/FlashLight.cpp displayapp/screens/List.cpp displayapp/screens/BatteryInfo.cpp - displayapp/screens/Steps.cpp ## Settings displayapp/screens/settings/QuickSettings.cpp @@ -415,12 +414,12 @@ list(APPEND SOURCE_FILES displayapp/screens/settings/SettingTimeFormat.cpp displayapp/screens/settings/SettingWakeUp.cpp displayapp/screens/settings/SettingDisplay.cpp - displayapp/screens/settings/SettingSteps.cpp ## Watch faces displayapp/icons/bg_clock.c displayapp/screens/WatchFaceAnalog.cpp displayapp/screens/WatchFaceDigital.cpp + displayapp/screens/PineTimeStyle.cpp ## @@ -468,7 +467,7 @@ list(APPEND SOURCE_FILES displayapp/fonts/jetbrains_mono_extrabold_compressed.c displayapp/fonts/jetbrains_mono_bold_20.c displayapp/fonts/jetbrains_mono_76.c - displayapp/fonts/jetbrains_mono_42.c + displayapp/fonts/open_sans_light.c displayapp/fonts/lv_font_sys_48.c displayapp/lv_pinetime_theme.c diff --git a/src/Version.h.in b/src/Version.h.in index 8cd39c9..6ff5938 100644 --- a/src/Version.h.in +++ b/src/Version.h.in @@ -8,13 +8,11 @@ namespace Pinetime { static constexpr uint32_t Major() {return major;} static constexpr uint32_t Minor() {return minor;} static constexpr uint32_t Patch() {return patch;} - static constexpr const char* GitCommitHash() {return commitHash;} static constexpr const char* VersionString() {return versionString;} private: static constexpr uint32_t major = @PROJECT_VERSION_MAJOR@; static constexpr uint32_t minor = @PROJECT_VERSION_MINOR@; static constexpr uint32_t patch = @PROJECT_VERSION_PATCH@; - static constexpr const char* commitHash = "@PROJECT_GIT_COMMIT_HASH@"; static constexpr const char* versionString = "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@"; }; } \ No newline at end of file diff --git a/src/components/motion/MotionController.h b/src/components/motion/MotionController.h index 3a23826..bf64481 100644 --- a/src/components/motion/MotionController.h +++ b/src/components/motion/MotionController.h @@ -8,13 +8,13 @@ namespace Pinetime { public: void Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps); - int16_t X() const { + uint16_t X() const { return x; } - int16_t Y() const { + uint16_t Y() const { return y; } - int16_t Z() const { + uint16_t Z() const { return z; } uint32_t NbSteps() const { diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 4409425..18c87fd 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -86,14 +86,6 @@ namespace Pinetime { return settings.brightLevel; }; - void SetStepsGoal( uint32_t goal ) { - if ( goal != settings.stepsGoal ) - settingsChanged = true; - settings.stepsGoal = goal; - }; - - uint32_t GetStepsGoal() const { return settings.stepsGoal; }; - private: Pinetime::Drivers::SpiNorFlash& spiNorFlash; struct SettingsData { @@ -103,7 +95,7 @@ namespace Pinetime { uint8_t clockFace = 0; - uint32_t stepsGoal = 10000; + uint32_t stepsGoal = 1000; uint32_t screenTimeOut = 15000; WakeUpMode wakeUpMode = WakeUpMode::None; diff --git a/src/displayapp/Apps.h b/src/displayapp/Apps.h index 09a2018..936a3ae 100644 --- a/src/displayapp/Apps.h +++ b/src/displayapp/Apps.h @@ -21,14 +21,12 @@ namespace Pinetime { Navigation, StopWatch, Motion, - Steps, QuickSettings, Settings, SettingWatchFace, SettingTimeFormat, SettingDisplay, - SettingWakeUp, - SettingSteps + SettingWakeUp }; } } diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index a6c4a3e..3a20c76 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -25,7 +25,6 @@ #include "displayapp/screens/Twos.h" #include "displayapp/screens/FlashLight.h" #include "displayapp/screens/BatteryInfo.h" -#include "displayapp/screens/Steps.h" #include "drivers/Cst816s.h" #include "drivers/St7789.h" @@ -38,7 +37,6 @@ #include "displayapp/screens/settings/SettingTimeFormat.h" #include "displayapp/screens/settings/SettingWakeUp.h" #include "displayapp/screens/settings/SettingDisplay.h" -#include "displayapp/screens/settings/SettingSteps.h" using namespace Pinetime::Applications; using namespace Pinetime::Applications::Display; @@ -67,7 +65,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, notificationManager {notificationManager}, heartRateController {heartRateController}, settingsController {settingsController}, - motorController {motorController}, + motorController{motorController}, motionController {motionController} { msgQueue = xQueueCreate(queueSize, itemSize); // Start clock when smartwatch boots @@ -75,9 +73,8 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, } void DisplayApp::Start() { - if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 800, this, 0, &taskHandle)) { + if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 800, this, 0, &taskHandle)) APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); - } } void DisplayApp::Process(void* instance) { @@ -88,7 +85,7 @@ void DisplayApp::Process(void* instance) { // Send a dummy notification to unlock the lvgl display driver for the first iteration xTaskNotifyGive(xTaskGetCurrentTaskHandle()); - while (true) { + while (1) { app->Refresh(); } } @@ -216,7 +213,7 @@ void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction) LoadApp(app, direction); } -void DisplayApp::ReturnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent) { +void DisplayApp::returnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent) { returnToApp = app; returnDirection = direction; returnTouchEvent = touchEvent; @@ -227,12 +224,12 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) SetFullRefresh(direction); // default return to launcher - ReturnApp(Apps::Launcher, FullRefreshDirections::Down, TouchEvents::SwipeDown); + returnApp(Apps::Launcher, FullRefreshDirections::Down, TouchEvents::SwipeDown); switch (app) { case Apps::Launcher: currentScreen = std::make_unique(this, settingsController, batteryController, dateTimeController); - ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown); + returnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::None: case Apps::Clock: @@ -248,7 +245,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) case Apps::FirmwareValidation: currentScreen = std::make_unique(this, validator); - ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::FirmwareUpdate: currentScreen = std::make_unique(this, bleController); @@ -257,58 +254,54 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) case Apps::Notifications: currentScreen = std::make_unique( this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Normal); - ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); + returnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); break; case Apps::NotificationsPreview: currentScreen = std::make_unique( this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Preview); - ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); + returnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); break; // Settings case Apps::QuickSettings: - currentScreen = std::make_unique( - this, batteryController, dateTimeController, brightnessController, motorController, settingsController); - ReturnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft); + currentScreen = + std::make_unique(this, batteryController, dateTimeController, brightnessController, motorController, settingsController); + returnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft); break; case Apps::Settings: currentScreen = std::make_unique(this, settingsController); - ReturnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + returnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SettingWatchFace: currentScreen = std::make_unique(this, settingsController); - ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SettingTimeFormat: currentScreen = std::make_unique(this, settingsController); - ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SettingWakeUp: currentScreen = std::make_unique(this, settingsController); - ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SettingDisplay: currentScreen = std::make_unique(this, settingsController); - ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); - break; - case Apps::SettingSteps: - currentScreen = std::make_unique(this, settingsController); - ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::BatteryInfo: currentScreen = std::make_unique(this, batteryController); - ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SysInfo: currentScreen = std::make_unique(this, dateTimeController, batteryController, brightnessController, bleController, watchdog); - ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; // case Apps::FlashLight: currentScreen = std::make_unique(this, systemTask, brightnessController); - ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None); + returnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None); break; case Apps::StopWatch: currentScreen = std::make_unique(this); @@ -334,9 +327,6 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) case Apps::Motion: currentScreen = std::make_unique(this, motionController); break; - case Apps::Steps: - currentScreen = std::make_unique(this, motionController, settingsController); - break; } currentApp = app; } @@ -359,9 +349,8 @@ TouchEvents DisplayApp::OnTouchEvent() { if (info.isTouch) { switch (info.gesture) { case Pinetime::Drivers::Cst816S::Gestures::SingleTap: - if (touchMode == TouchModes::Gestures) { + if (touchMode == TouchModes::Gestures) lvgl.SetNewTapEvent(info.x, info.y); - } return TouchEvents::Tap; case Pinetime::Drivers::Cst816S::Gestures::LongPress: return TouchEvents::LongTap; diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index ffe27cf..75e5275 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -103,7 +103,7 @@ namespace Pinetime { static void Process(void* instance); void InitHw(); void Refresh(); - void ReturnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent); + void returnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent); void LoadApp(Apps app, DisplayApp::FullRefreshDirections direction); }; } diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp index a132a47..6db987f 100644 --- a/src/displayapp/DisplayAppRecovery.cpp +++ b/src/displayapp/DisplayAppRecovery.cpp @@ -37,7 +37,7 @@ void DisplayApp::Process(void* instance) { xTaskNotifyGive(xTaskGetCurrentTaskHandle()); app->InitHw(); - while (true) { + while (1) { app->Refresh(); } } @@ -51,11 +51,10 @@ void DisplayApp::Refresh() { if (xQueueReceive(msgQueue, &msg, 200)) { switch (msg) { case Display::Messages::UpdateBleConnection: - if (bleController.IsConnected()) { + if (bleController.IsConnected()) DisplayLogo(colorBlue); - } else { + else DisplayLogo(colorWhite); - } break; case Display::Messages::BleFirmwareUpdateStarted: DisplayLogo(colorGreen); diff --git a/src/displayapp/fonts/jetbrains_mono_42.c b/src/displayapp/fonts/jetbrains_mono_42.c deleted file mode 100644 index 6f25f5a..0000000 --- a/src/displayapp/fonts/jetbrains_mono_42.c +++ /dev/null @@ -1,258 +0,0 @@ -/******************************************************************************* - * Size: 42 px - * Bpp: 1 - * Opts: - ******************************************************************************/ - -#ifdef LV_LVGL_H_INCLUDE_SIMPLE -#include "lvgl.h" -#else -#include "lvgl/lvgl.h" -#endif - -#ifndef JETBRAINS_MONO_42 -#define JETBRAINS_MONO_42 1 -#endif - -#if JETBRAINS_MONO_42 - -/*----------------- - * BITMAPS - *----------------*/ - -/*Store the image of the glyphs*/ -static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { - /* U+0025 "%" */ - 0x1f, 0x80, 0x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, 0xfc, 0x0, 0x7f, 0xe0, - 0xf, 0xff, 0x3, 0xe0, 0x7c, 0x3c, 0x3, 0xc7, - 0x80, 0x1e, 0xf0, 0x0, 0xff, 0x0, 0xf, 0xf0, - 0x0, 0xff, 0x0, 0xf, 0xf0, 0x0, 0xff, 0x80, - 0x1f, 0x7c, 0x3, 0xe7, 0xe0, 0x7e, 0x3f, 0xff, - 0xc0, 0xff, 0xf0, 0x3, 0xfc, 0x0, - - /* U+0039 "9" */ - 0x3, 0xf8, 0x0, 0xff, 0xf0, 0x1f, 0xff, 0x83, - 0xe0, 0xfc, 0x7c, 0x3, 0xe7, 0x80, 0x1e, 0xf8, - 0x1, 0xff, 0x0, 0xf, 0xf0, 0x0, 0xff, 0x0, - 0xf, 0xf0, 0x0, 0xff, 0x0, 0xf, 0xf8, 0x1, - 0xf7, 0x80, 0x1e, 0x7c, 0x3, 0xe3, 0xe0, 0x7e, - 0x3f, 0xff, 0xc1, 0xff, 0xfc, 0x7, 0xe7, 0x80, - 0x0, 0xf8, 0x0, 0xf, 0x0, 0x1, 0xe0, 0x0, - 0x1e, 0x0, 0x3, 0xc0, 0x0, 0x3c, 0x0, 0x7, - 0x80, 0x0, 0xf8, 0x0, 0xf, 0x0, 0x1, 0xe0, - 0x0, 0x1e, 0x0, 0x3, 0xc0, 0x0, - - /* U+003A ":" */ - 0x7d, 0xff, 0xff, 0xff, 0xef, 0x80, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, - 0xf7, 0xff, 0xff, 0xff, 0xbe -}; - - -/*--------------------- - * GLYPH DESCRIPTION - *--------------------*/ - -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 = 403, .box_w = 24, .box_h = 31, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 93, .adv_w = 403, .box_w = 19, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, - {.bitmap_index = 167, .adv_w = 403, .box_w = 19, .box_h = 31, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 241, .adv_w = 403, .box_w = 19, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, - {.bitmap_index = 315, .adv_w = 403, .box_w = 19, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, - {.bitmap_index = 389, .adv_w = 403, .box_w = 18, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, - {.bitmap_index = 459, .adv_w = 403, .box_w = 18, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, - {.bitmap_index = 529, .adv_w = 403, .box_w = 20, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, - {.bitmap_index = 607, .adv_w = 403, .box_w = 20, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, - {.bitmap_index = 685, .adv_w = 403, .box_w = 20, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, - {.bitmap_index = 763, .adv_w = 403, .box_w = 20, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, - {.bitmap_index = 841, .adv_w = 403, .box_w = 7, .box_h = 24, .ofs_x = 9, .ofs_y = 0} -}; - -/*--------------------- - * CHARACTER MAPPING - *--------------------*/ - - - -/*Collect the unicode lists and glyph_id offsets*/ -static const lv_font_fmt_txt_cmap_t cmaps[] = -{ - { - .range_start = 37, .range_length = 1, .glyph_id_start = 1, - .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY - }, - { - .range_start = 48, .range_length = 11, .glyph_id_start = 2, - .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY - } -}; - - - -/*-------------------- - * 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 = { -#endif - .glyph_bitmap = glyph_bitmap, - .glyph_dsc = glyph_dsc, - .cmaps = cmaps, - .kern_dsc = NULL, - .kern_scale = 0, - .cmap_num = 2, - .bpp = 1, - .kern_classes = 0, - .bitmap_format = 0, -#if LV_VERSION_CHECK(8, 0, 0) - .cache = &cache -#endif -}; - - -/*----------------- - * PUBLIC FONT - *----------------*/ - -/*Initialize a public general font descriptor*/ -#if LV_VERSION_CHECK(8, 0, 0) -const lv_font_t jetbrains_mono_42 = { -#else -lv_font_t jetbrains_mono_42 = { -#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 = 31, /*The maximum line height required by the font*/ - .base_line = 0, /*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) - .underline_position = -7, - .underline_thickness = 2, -#endif - .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ -}; - - - -#endif /*#if JETBRAINS_MONO_42*/ - diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp index 1eb3699..7e38b3f 100644 --- a/src/displayapp/screens/ApplicationList.cpp +++ b/src/displayapp/screens/ApplicationList.cpp @@ -49,7 +49,7 @@ std::unique_ptr ApplicationList::CreateScreen1() { {Symbols::stopWatch, Apps::StopWatch}, {Symbols::music, Apps::Music}, {Symbols::map, Apps::Navigation}, - {Symbols::shoe, Apps::Steps}, + {Symbols::shoe, Apps::Motion}, {Symbols::heartBeat, Apps::HeartRate}, {"", Apps::None}, }}; @@ -62,7 +62,7 @@ std::unique_ptr ApplicationList::CreateScreen2() { {Symbols::paintbrush, Apps::Paint}, {Symbols::paddle, Apps::Paddle}, {"2", Apps::Twos}, - {"M", Apps::Motion}, + {"", Apps::None}, {"", Apps::None}, {"", Apps::None}, }}; diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index 1429984..e0c1f62 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -14,6 +14,7 @@ #include "../DisplayApp.h" #include "WatchFaceDigital.h" #include "WatchFaceAnalog.h" +#include "PineTimeStyle.h" using namespace Pinetime::Applications::Screens; @@ -42,6 +43,9 @@ Clock::Clock(DisplayApp* app, [this]() -> std::unique_ptr { return WatchFaceAnalogScreen(); }, + [this]() -> std::unique_ptr { + return PineTimeStyleScreen(); + }, // Examples for more watch faces //[this]() -> std::unique_ptr { return WatchFaceMinimalScreen(); }, //[this]() -> std::unique_ptr { return WatchFaceCustomScreen(); } @@ -80,6 +84,16 @@ std::unique_ptr Clock::WatchFaceAnalogScreen() { app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); } +std::unique_ptr Clock::PineTimeStyleScreen() { + return std::make_unique(app, + dateTimeController, + batteryController, + bleController, + notificatioManager, + settingsController, + heartRateController); +} + /* // Examples for more watch faces std::unique_ptr Clock::WatchFaceMinimalScreen() { @@ -91,4 +105,4 @@ std::unique_ptr Clock::WatchFaceCustomScreen() { return std::make_unique(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); } -*/ \ No newline at end of file +*/ diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h index 9879985..920d58b 100644 --- a/src/displayapp/screens/Clock.h +++ b/src/displayapp/screens/Clock.h @@ -47,9 +47,10 @@ namespace Pinetime { Controllers::HeartRateController& heartRateController; Controllers::MotionController& motionController; - ScreenList<2> screens; + ScreenList<3> screens; std::unique_ptr WatchFaceDigitalScreen(); std::unique_ptr WatchFaceAnalogScreen(); + std::unique_ptr PineTimeStyleScreen(); // Examples for more watch faces // std::unique_ptr WatchFaceMinimalScreen(); diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp index ad37a3d..873a22f 100644 --- a/src/displayapp/screens/FirmwareValidation.cpp +++ b/src/displayapp/screens/FirmwareValidation.cpp @@ -27,17 +27,6 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp* app, sprintf(version, "%ld.%ld.%ld", Version::Major(), Version::Minor(), Version::Patch()); lv_label_set_text(labelVersionValue, version); - labelShortRefInfo = lv_label_create(lv_scr_act(), nullptr); - lv_obj_align(labelShortRefInfo, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 25); - lv_label_set_text(labelShortRefInfo, "ShortRef : "); - lv_label_set_align(labelShortRefInfo, LV_LABEL_ALIGN_LEFT); - - labelShortRefValue = lv_label_create(lv_scr_act(), nullptr); - lv_obj_align(labelShortRefValue, labelShortRefInfo, LV_ALIGN_OUT_RIGHT_MID, 0, 0); - lv_label_set_recolor(labelShortRefValue, true); - sprintf(shortref, "%s", Version::GitCommitHash()); - lv_label_set_text(labelShortRefValue, shortref); - labelIsValidated = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(labelIsValidated, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 50); lv_label_set_recolor(labelIsValidated, true); diff --git a/src/displayapp/screens/FirmwareValidation.h b/src/displayapp/screens/FirmwareValidation.h index 303c215..67662fd 100644 --- a/src/displayapp/screens/FirmwareValidation.h +++ b/src/displayapp/screens/FirmwareValidation.h @@ -25,10 +25,7 @@ namespace Pinetime { lv_obj_t* labelVersionInfo; lv_obj_t* labelVersionValue; - lv_obj_t* labelShortRefInfo; - lv_obj_t* labelShortRefValue; char version[9]; - char shortref[9]; lv_obj_t* labelIsValidated; lv_obj_t* buttonValidate; lv_obj_t* labelButtonValidate; diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp index a8bb3c1..e719626 100644 --- a/src/displayapp/screens/Motion.cpp +++ b/src/displayapp/screens/Motion.cpp @@ -3,6 +3,8 @@ #include "../DisplayApp.h" using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionController& motionController) : Screen(app), motionController {motionController} { @@ -27,16 +29,13 @@ Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionContr lv_chart_init_points(chart, ser3, 0); lv_chart_refresh(chart); /*Required after direct set*/ - label = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text_fmt(label, "X #FF0000 %d# Y #008000 %d# Z #FFFF00 %d#", 0, 0, 0); - lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); - lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10); - lv_label_set_recolor(label, true); - 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(labelStep, "Steps: "); + labelStepValue = lv_label_create(lv_scr_act(), NULL); + lv_obj_align(labelStepValue, labelStep, LV_ALIGN_OUT_RIGHT_MID, 0, 0); + lv_label_set_text(labelStepValue, "-"); } Motion::~Motion() { @@ -48,10 +47,8 @@ bool Motion::Refresh() { lv_chart_set_next(chart, ser2, motionController.Y()); lv_chart_set_next(chart, ser3, motionController.Z()); - lv_label_set_text_fmt(labelStep, "Steps %lu", motionController.NbSteps()); - - lv_label_set_text_fmt(label, "X #FF0000 %d# Y #008000 %d# Z #FFFF00 %d#", motionController.X() / 0x10, motionController.Y() / 0x10, motionController.Z() / 0x10); - lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10); + snprintf(nbStepsBuffer, nbStepsBufferSize, "%lu", motionController.NbSteps()); + lv_label_set_text(labelStepValue, nbStepsBuffer); return running; } diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h index 132b20e..1100786 100644 --- a/src/displayapp/screens/Motion.h +++ b/src/displayapp/screens/Motion.h @@ -26,9 +26,9 @@ namespace Pinetime { lv_chart_series_t* ser1; lv_chart_series_t* ser2; lv_chart_series_t* ser3; - lv_obj_t* label; lv_obj_t* labelStep; + lv_obj_t* labelStepValue; static constexpr uint8_t nbStepsBufferSize = 9; char nbStepsBuffer[nbStepsBufferSize + 1]; bool running = true; diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 1f11375..f0fd2f6 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -176,17 +176,7 @@ Notifications::NotificationItem::NotificationItem(const char* title, 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 = - pchar = strchr(pchar + 1, '\n'); - } lv_label_set_text(alert_type, title); - lv_label_set_long_mode(alert_type, LV_LABEL_LONG_SROLL_CIRC); - lv_label_set_anim_speed(alert_type, 3); - 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/Steps.cpp b/src/displayapp/screens/Steps.cpp deleted file mode 100644 index b485c97..0000000 --- a/src/displayapp/screens/Steps.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include "Steps.h" -#include -#include "../DisplayApp.h" -#include "Symbols.h" - -using namespace Pinetime::Applications::Screens; - -Steps::Steps( - Pinetime::Applications::DisplayApp *app, - Controllers::MotionController& motionController, - Controllers::Settings &settingsController) - : Screen(app), - motionController{motionController}, - settingsController{settingsController} { - - stepsArc = lv_arc_create(lv_scr_act(), nullptr); - - lv_obj_set_style_local_bg_opa(stepsArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, LV_OPA_0); - lv_obj_set_style_local_border_width(stepsArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, 2); - lv_obj_set_style_local_radius(stepsArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, 0); - lv_obj_set_style_local_line_color(stepsArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, lv_color_hex(0x0000FF)); - lv_arc_set_end_angle(stepsArc, 200); - lv_obj_set_size(stepsArc, 220, 220); - lv_arc_set_range(stepsArc, 0, 500); - lv_obj_align(stepsArc, nullptr, LV_ALIGN_CENTER, 0, 0); - - stepsCount = motionController.NbSteps(); - - lv_arc_set_value(stepsArc, int16_t(500 * stepsCount / settingsController.GetStepsGoal())); - - lSteps = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); - lv_obj_set_style_local_text_font(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); - lv_label_set_text_fmt(lSteps, "%li", stepsCount); - lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -20); - - lv_obj_t * lstepsL = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(lstepsL, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); - lv_label_set_text_static(lstepsL, "Steps"); - lv_obj_align(lstepsL, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); - - lv_obj_t * lstepsGoal = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(lstepsGoal, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN); - lv_label_set_text_fmt(lstepsGoal,"Goal\n%i", settingsController.GetStepsGoal()); - lv_label_set_align(lstepsGoal, LV_LABEL_ALIGN_CENTER); - lv_obj_align(lstepsGoal, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 60); - - lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - 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, ""); - -} - -Steps::~Steps() { - lv_obj_clean(lv_scr_act()); -} - -bool Steps::Refresh() { - - stepsCount = motionController.NbSteps(); - - lv_label_set_text_fmt(lSteps,"%li", stepsCount); - lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -20); - - lv_arc_set_value(stepsArc, int16_t(500 * stepsCount / settingsController.GetStepsGoal())); - - return running; -} - - diff --git a/src/displayapp/screens/Steps.h b/src/displayapp/screens/Steps.h deleted file mode 100644 index 9c135e2..0000000 --- a/src/displayapp/screens/Steps.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" -#include - -namespace Pinetime { - - namespace Controllers { - class Settings; - } - - namespace Applications { - namespace Screens { - - class Steps : public Screen { - public: - Steps(DisplayApp* app, Controllers::MotionController& motionController, Controllers::Settings &settingsController); - ~Steps() override; - - bool Refresh() override; - - - private: - - Controllers::MotionController& motionController; - Controllers::Settings& settingsController; - - lv_obj_t * lSteps; - lv_obj_t * lStepsIcon; - lv_obj_t * stepsArc; - - uint32_t stepsCount; - - }; - } - } -} diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index d7cd20c..e06981a 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -115,9 +115,8 @@ bool StopWatch::Refresh() { // Init state when an user first opens the app // and when a stop/reset button is pressed case States::Init: { - if (btnStopLap != nullptr) { + if (btnStopLap) { lv_obj_del(btnStopLap); - btnStopLap = nullptr; } // The initial default value lv_label_set_text(time, "00:00"); diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index e4ef691..f6e8d61 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -69,14 +69,12 @@ std::unique_ptr SystemInfo::CreateScreen1() { lv_label_set_text_fmt(label, "#FFFF00 InfiniTime#\n\n" "#444444 Version# %ld.%ld.%ld\n\n" - "#444444 Short Ref# %s\n\n" "#444444 Build date#\n" - "%s\n" - "%s\n", + "\t%s\n" + "\t%s\n", Version::Major(), Version::Minor(), Version::Patch(), - Version::GitCommitHash(), __DATE__, __TIME__); lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); @@ -244,4 +242,4 @@ std::unique_ptr SystemInfo::CreateScreen5() { lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); return std::unique_ptr(new Screens::Label(4, 5, app, label)); -} +} \ No newline at end of file diff --git a/src/displayapp/screens/settings/SettingSteps.cpp b/src/displayapp/screens/settings/SettingSteps.cpp deleted file mode 100644 index b7c024f..0000000 --- a/src/displayapp/screens/settings/SettingSteps.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include "SettingSteps.h" -#include -#include "displayapp/DisplayApp.h" -#include "displayapp/screens/Symbols.h" - -using namespace Pinetime::Applications::Screens; - -namespace { - static void event_handler(lv_obj_t * obj, lv_event_t event) { - SettingSteps* screen = static_cast(obj->user_data); - screen->UpdateSelected(obj, event); - } -} - -SettingSteps::SettingSteps( - 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_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); - 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, 30, 60); - lv_obj_set_width(container1, LV_HOR_RES - 50); - lv_obj_set_height(container1, LV_VER_RES - 60); - lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT); - - lv_obj_t * title = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text_static(title,"Daily steps goal"); - 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(), NULL); - 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::shoe); - lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); - lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); - - - stepValue = lv_label_create(lv_scr_act(), NULL); - lv_obj_set_style_local_text_font(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); - lv_label_set_text_fmt(stepValue,"%i", settingsController.GetStepsGoal()); - lv_label_set_align(stepValue, LV_LABEL_ALIGN_CENTER); - lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); - - btnPlus = lv_btn_create(lv_scr_act(), NULL); - btnPlus->user_data = this; - lv_obj_set_size(btnPlus, 80, 50); - lv_obj_align(btnPlus, lv_scr_act(), LV_ALIGN_CENTER, 55, 80); - lv_obj_set_style_local_value_str(btnPlus, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "+"); - lv_obj_set_event_cb(btnPlus, event_handler); - - btnMinus = lv_btn_create(lv_scr_act(), NULL); - btnMinus->user_data = this; - lv_obj_set_size(btnMinus, 80, 50); - lv_obj_set_event_cb(btnMinus, event_handler); - lv_obj_align(btnMinus, lv_scr_act(), LV_ALIGN_CENTER, -55, 80); - lv_obj_set_style_local_value_str(btnMinus, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "-"); - -} - -SettingSteps::~SettingSteps() { - lv_obj_clean(lv_scr_act()); - settingsController.SaveSettings(); -} - -bool SettingSteps::Refresh() { - return running; -} - - -void SettingSteps::UpdateSelected(lv_obj_t *object, lv_event_t event) { - uint32_t value = settingsController.GetStepsGoal(); - if(object == btnPlus && (event == LV_EVENT_PRESSED)) { - value += 1000; - if ( value <= 500000 ) { - settingsController.SetStepsGoal(value); - lv_label_set_text_fmt(stepValue,"%i", settingsController.GetStepsGoal()); - lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); - } - } - - if(object == btnMinus && (event == LV_EVENT_PRESSED)) { - value -= 1000; - if ( value >= 1000 ) { - settingsController.SetStepsGoal(value); - lv_label_set_text_fmt(stepValue,"%i", settingsController.GetStepsGoal()); - lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); - } - } - -} \ No newline at end of file diff --git a/src/displayapp/screens/settings/SettingSteps.h b/src/displayapp/screens/settings/SettingSteps.h deleted file mode 100644 index 0a4c205..0000000 --- a/src/displayapp/screens/settings/SettingSteps.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include -#include "components/settings/Settings.h" -#include "displayapp/screens/Screen.h" - -namespace Pinetime { - - namespace Applications { - namespace Screens { - - class SettingSteps : public Screen{ - public: - SettingSteps(DisplayApp* app, Pinetime::Controllers::Settings &settingsController); - ~SettingSteps() override; - - bool Refresh() override; - void UpdateSelected(lv_obj_t *object, lv_event_t event); - - private: - - Controllers::Settings& settingsController; - - lv_obj_t * stepValue; - lv_obj_t * btnPlus; - lv_obj_t * btnMinus; - - }; - } - } -} diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp index 457cebf..3914a04 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.cpp +++ b/src/displayapp/screens/settings/SettingWatchFace.cpp @@ -59,6 +59,15 @@ SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pine } optionsTotal++; + cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); + lv_checkbox_set_text_static(cbOption[optionsTotal], " PineTimeStyle"); + cbOption[optionsTotal]->user_data = this; + lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); + if (settingsController.GetClockFace() == 2) { + lv_checkbox_set_checked(cbOption[optionsTotal], true); + } + + optionsTotal++; } SettingWatchFace::~SettingWatchFace() { @@ -81,4 +90,4 @@ void SettingWatchFace::UpdateSelected(lv_obj_t* object, lv_event_t event) { } } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/settings/SettingWatchFace.h b/src/displayapp/screens/settings/SettingWatchFace.h index 1930a22..6f65d69 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.h +++ b/src/displayapp/screens/settings/SettingWatchFace.h @@ -21,7 +21,7 @@ namespace Pinetime { private: Controllers::Settings& settingsController; uint8_t optionsTotal; - lv_obj_t* cbOption[2]; + lv_obj_t* cbOption[3]; }; } } diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index 2c72c83..e24be3d 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -44,7 +44,9 @@ std::unique_ptr Settings::CreateScreen1() { {Symbols::clock, "Wake Up", Apps::SettingWakeUp}, {Symbols::clock, "Time format", Apps::SettingTimeFormat}, {Symbols::clock, "Watch face", Apps::SettingWatchFace}, - }}; + } + + }; return std::unique_ptr(new Screens::List(0, 2, app, settingsController, applications)); } @@ -52,11 +54,13 @@ std::unique_ptr Settings::CreateScreen1() { std::unique_ptr Settings::CreateScreen2() { std::array applications {{ - {Symbols::shoe, "Steps", Apps::SettingSteps}, {Symbols::batteryHalf, "Battery", Apps::BatteryInfo}, {Symbols::check, "Firmware", Apps::FirmwareValidation}, {Symbols::list, "About", Apps::SysInfo}, - }}; + {"", "", Apps::None}, + } + + }; return std::unique_ptr(new Screens::List(1, 2, app, settingsController, applications)); } diff --git a/src/libs/lv_conf.h b/src/libs/lv_conf.h index 761baba..e774091 100644 --- a/src/libs/lv_conf.h +++ b/src/libs/lv_conf.h @@ -415,8 +415,8 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(jetbrains_mono_bold_20) \ LV_FONT_DECLARE(jetbrains_mono_extrabold_compressed) \ - LV_FONT_DECLARE(jetbrains_mono_42) \ LV_FONT_DECLARE(jetbrains_mono_76) \ + LV_FONT_DECLARE(open_sans_light) \ LV_FONT_DECLARE(lv_font_sys_48) /* Enable it if you have fonts with a lot of characters. @@ -758,4 +758,4 @@ typedef void* lv_obj_user_data_t; /*--END OF LV_CONF_H--*/ -#endif /*LV_CONF_H*/ \ No newline at end of file +#endif /*LV_CONF_H*/ diff --git a/src/logging/NrfLogger.cpp b/src/logging/NrfLogger.cpp index 1c048f2..70a00e6 100644 --- a/src/logging/NrfLogger.cpp +++ b/src/logging/NrfLogger.cpp @@ -12,9 +12,8 @@ void NrfLogger::Init() { NRF_LOG_DEFAULT_BACKENDS_INIT(); - if (pdPASS != xTaskCreate(NrfLogger::Process, "LOGGER", 200, this, 0, &m_logger_thread)) { + if (pdPASS != xTaskCreate(NrfLogger::Process, "LOGGER", 200, this, 0, &m_logger_thread)) APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); - } } void NrfLogger::Process(void*) { @@ -22,7 +21,7 @@ void NrfLogger::Process(void*) { // Suppress endless loop diagnostic #pragma clang diagnostic push #pragma ide diagnostic ignored "EndlessLoop" - while (true) { + while (1) { NRF_LOG_FLUSH(); vTaskDelay(100); // Not good for power consumption, it will wake up every 100ms... } -- cgit v0.10.2 From a4968b502990f4a9e848c5240be2ee73348dd38e Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Tue, 18 May 2021 15:25:38 +0200 Subject: PineTimeStyle diff --git a/src/displayapp/fonts/open_sans_light.c b/src/displayapp/fonts/open_sans_light.c new file mode 100644 index 0000000..15f0ddf --- /dev/null +++ b/src/displayapp/fonts/open_sans_light.c @@ -0,0 +1,1261 @@ +/******************************************************************************* + * Size: 150 px + * Bpp: 1 + * Opts: + ******************************************************************************/ + +#ifdef LV_LVGL_H_INCLUDE_SIMPLE +#include "lvgl.h" +#else +#include "lvgl/lvgl.h" +#endif + +#ifndef OPEN_SANS_LIGHT +#define OPEN_SANS_LIGHT 1 +#endif + +#if OPEN_SANS_LIGHT + +/*----------------- + * BITMAPS + *----------------*/ + +/*Store the image of the glyphs*/ +static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { + /* U+0030 "0" */ + 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x7, 0xff, 0xff, 0xc0, 0x0, + 0x0, 0x0, 0x0, 0x1, 0xff, 0xff, 0xff, 0x80, + 0x0, 0x0, 0x0, 0x0, 0x3f, 0xff, 0xff, 0xff, + 0x0, 0x0, 0x0, 0x0, 0x7, 0xff, 0xff, 0xff, + 0xfe, 0x0, 0x0, 0x0, 0x0, 0x7f, 0xff, 0xff, + 0xff, 0xf8, 0x0, 0x0, 0x0, 0xf, 0xff, 0xe0, + 0x3, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, 0xf8, + 0x0, 0x3, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xfe, + 0x0, 0x0, 0x7, 0xff, 0x0, 0x0, 0x0, 0xff, + 0xe0, 0x0, 0x0, 0xf, 0xfc, 0x0, 0x0, 0x7, + 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xf0, 0x0, 0x0, + 0x7f, 0xc0, 0x0, 0x0, 0x0, 0xff, 0x80, 0x0, + 0x7, 0xfc, 0x0, 0x0, 0x0, 0x1, 0xfe, 0x0, + 0x0, 0x7f, 0xc0, 0x0, 0x0, 0x0, 0xf, 0xf8, + 0x0, 0x3, 0xfe, 0x0, 0x0, 0x0, 0x0, 0x3f, + 0xc0, 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 0x0, 0x0, 0x3f, 0xe0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xf8, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0xfe, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x80, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3f, 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, + 0xf0, + + /* U+0033 "3" */ + 0x0, 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x7f, 0xff, 0xff, 0xc0, 0x0, + 0x0, 0x0, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x80, + 0x0, 0x0, 0x0, 0x1f, 0xff, 0xff, 0xff, 0xff, + 0x0, 0x0, 0x0, 0xf, 0xff, 0xff, 0xff, 0xff, + 0xf8, 0x0, 0x0, 0x3, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xe0, 0x0, 0x0, 0xff, 0xff, 0xe0, 0x0, + 0xff, 0xff, 0x0, 0x0, 0x3f, 0xff, 0xc0, 0x0, + 0x0, 0xff, 0xf8, 0x0, 0x7, 0xff, 0xe0, 0x0, + 0x0, 0x3, 0xff, 0xc0, 0x1, 0xff, 0xf0, 0x0, + 0x0, 0x0, 0xf, 0xfe, 0x0, 0x3f, 0xfc, 0x0, + 0x0, 0x0, 0x0, 0x7f, 0xf0, 0x7, 0xff, 0x0, + 0x0, 0x0, 0x0, 0x1, 0xff, 0x80, 0x3f, 0xc0, + 0x0, 0x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 0x0, 0x0, 0x0, 0x3f, 0xf0, 0x0, 0x0, + 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, 0x0, 0x0, + 0x3, 0xff, 0xc0, 0x0, 0x0, 0x7f, 0xf0, 0x0, + 0x0, 0xf, 0xff, 0x80, 0x0, 0x1f, 0xff, 0x0, + 0x0, 0x0, 0x1f, 0xff, 0xc0, 0xf, 0xff, 0xf0, + 0x0, 0x0, 0x0, 0x7f, 0xff, 0xff, 0xff, 0xfe, + 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xff, + 0xe0, 0x0, 0x0, 0x0, 0x3, 0xff, 0xff, 0xff, + 0xfc, 0x0, 0x0, 0x0, 0x0, 0x7, 0xff, 0xff, + 0xff, 0x80, 0x0, 0x0, 0x0, 0x0, 0x7, 0xff, + 0xff, 0xe0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, + 0xff, 0xe0, 0x0, 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, + 0xff, 0xff, 0xff, 0xfc, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x3f, 0xc0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x1, 0xfe, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x1f, 0xe0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xf0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x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0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x1f, 0xf0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x3, 0xfe, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x3f, 0xc0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x7, 0xfc, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0xff, 0x80, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x1f, 0xf0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x3, 0xff, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f, 0xe0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xfc, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xff, 0x80, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f, 0xf0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xfe, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0xff, + 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xff, + 0xf8, 0x0, 0x0, 0x1, 0x80, 0x0, 0x0, 0xff, + 0xff, 0x0, 0x0, 0x0, 0x1f, 0xe0, 0x0, 0xff, + 0xff, 0xc0, 0x0, 0x0, 0x1, 0xff, 0xff, 0xff, + 0xff, 0xf0, 0x0, 0x0, 0x0, 0x1f, 0xff, 0xff, + 0xff, 0xfc, 0x0, 0x0, 0x0, 0x1, 0xff, 0xff, + 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x1f, 0xff, + 0xff, 0xff, 0xc0, 0x0, 0x0, 0x0, 0x0, 0xff, + 0xff, 0xff, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x7f, 0xff, 0x80, 0x0, 0x0, 0x0, 0x0 +}; + + +/*--------------------- + * GLYPH DESCRIPTION + *--------------------*/ + +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 = 1370, .box_w = 69, .box_h = 110, .ofs_x = 8, .ofs_y = -1}, + {.bitmap_index = 949, .adv_w = 1370, .box_w = 35, .box_h = 107, .ofs_x = 15, .ofs_y = 0}, + {.bitmap_index = 1418, .adv_w = 1370, .box_w = 67, .box_h = 108, .ofs_x = 8, .ofs_y = 0}, + {.bitmap_index = 2323, .adv_w = 1370, .box_w = 68, .box_h = 110, .ofs_x = 7, .ofs_y = -1}, + {.bitmap_index = 3258, .adv_w = 1370, .box_w = 81, .box_h = 108, .ofs_x = 3, .ofs_y = -1}, + {.bitmap_index = 4352, .adv_w = 1370, .box_w = 66, .box_h = 108, .ofs_x = 10, .ofs_y = -1}, + {.bitmap_index = 5243, .adv_w = 1370, .box_w = 69, .box_h = 110, .ofs_x = 9, .ofs_y = -1}, + {.bitmap_index = 6192, .adv_w = 1370, .box_w = 69, .box_h = 106, .ofs_x = 8, .ofs_y = 0}, + {.bitmap_index = 7107, .adv_w = 1370, .box_w = 68, .box_h = 110, .ofs_x = 9, .ofs_y = -1}, + {.bitmap_index = 8042, .adv_w = 1370, .box_w = 68, .box_h = 110, .ofs_x = 8, .ofs_y = -1} +}; + +/*--------------------- + * CHARACTER MAPPING + *--------------------*/ + + + +/*Collect the unicode lists and glyph_id offsets*/ +static const lv_font_fmt_txt_cmap_t cmaps[] = +{ + { + .range_start = 48, .range_length = 10, .glyph_id_start = 1, + .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY + } +}; + + + +/*-------------------- + * 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 = { +#endif + .glyph_bitmap = glyph_bitmap, + .glyph_dsc = glyph_dsc, + .cmaps = cmaps, + .kern_dsc = NULL, + .kern_scale = 0, + .cmap_num = 1, + .bpp = 1, + .kern_classes = 0, + .bitmap_format = 0, +#if LV_VERSION_CHECK(8, 0, 0) + .cache = &cache +#endif +}; + + +/*----------------- + * PUBLIC FONT + *----------------*/ + +/*Initialize a public general font descriptor*/ +#if LV_VERSION_CHECK(8, 0, 0) +const lv_font_t open_sans_light = { +#else +lv_font_t open_sans_light = { +#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 = 110, /*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) + .underline_position = -11, + .underline_thickness = 7, +#endif + .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ +}; + + + +#endif /*#if OPEN_SANS_LIGHT*/ + diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp new file mode 100644 index 0000000..b249416 --- /dev/null +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -0,0 +1,294 @@ +#include "PineTimeStyle.h" + +#include +#include +#include +#include "BatteryIcon.h" +#include "BleIcon.h" +#include "NotificationIcon.h" +#include "Symbols.h" +#include "components/battery/BatteryController.h" +#include "components/ble/BleController.h" +#include "components/ble/NotificationManager.h" +#include "components/heartrate/HeartRateController.h" +#include "components/settings/Settings.h" +#include "../DisplayApp.h" + +/* + * PineTimeStyle watchface for Infinitime created by Kieran Cawthray + * Based on WatchFaceDigital + * Style/layout copied from TimeStyle for Pebble by Dan Tilden (github.com/tilden) + */ + +using namespace Pinetime::Applications::Screens; + +PineTimeStyle::PineTimeStyle(DisplayApp* app, + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::NotificationManager& notificatioManager, + Controllers::Settings& settingsController, + Controllers::HeartRateController& heartRateController) + : Screen(app), + currentDateTime {{}}, + dateTimeController {dateTimeController}, + batteryController {batteryController}, + bleController {bleController}, + notificatioManager {notificatioManager}, + settingsController {settingsController}, + heartRateController {heartRateController} { + + /* This sets the watchface number to return to after leaving the menu*/ + settingsController.SetClockFace(2); + + displayedChar[0] = 0; + displayedChar[1] = 0; + displayedChar[2] = 0; + displayedChar[3] = 0; + displayedChar[4] = 0; + + /*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, lv_color_hex(0x000000)); + 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, 5, 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, lv_color_hex(0x008080)); + lv_label_set_text(timeDD1, "12"); + 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, lv_color_hex(0x008080)); + lv_label_set_text(timeDD2, "34"); + lv_obj_align(timeDD2, timebar, LV_ALIGN_IN_BOTTOM_MID, 5, -5); + + /*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, lv_color_hex(0x008080)); + 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_hex(0x000000)); + lv_label_set_text(batteryIcon, Symbols::batteryFull); + lv_obj_align(batteryIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 2); + + batteryPlug = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(batteryPlug, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); + //lv_label_set_text(batteryPlug, Symbols::plug); + lv_obj_align(batteryPlug, sidebar, LV_ALIGN_IN_TOP_MID, 0, 2); + + 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(bleIcon, BleIcon::GetIcon(false)); + lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); + + 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(notificationIcon, NotificationIcon::GetIcon(false)); + lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 40); + + /* 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_hex(0x000000)); + 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_hex(0xffffff)); + 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_hex(0x000000)); + 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_hex(0x000000)); + 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_hex(0x000000)); + 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_hex(0x000000)); + 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_hex(0x000000)); + lv_label_set_text(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_hex(0x000000)); + lv_label_set_text(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_hex(0x000000)); + lv_label_set_text(dateMonth, "MAR"); + lv_obj_align(dateMonth, sidebar, LV_ALIGN_CENTER, 0, 32); + + /*Display heartrate info*/ + + heartbeatIcon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); + lv_label_set_text(heartbeatIcon, Symbols::heartBeat); + lv_obj_align(heartbeatIcon, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, -30); + + heartbeatValue = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); + lv_label_set_text(heartbeatValue, "---"); + lv_obj_align(heartbeatValue, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, -10); + + 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, ""); +} + +PineTimeStyle::~PineTimeStyle() { + lv_obj_clean(lv_scr_act()); +} + +bool PineTimeStyle::Refresh() { + batteryPercentRemaining = batteryController.PercentRemaining(); + if (batteryPercentRemaining.IsUpdated()) { + auto batteryPercent = batteryPercentRemaining.Get(); + if (batteryController.IsCharging()) { + auto isCharging = batteryController.IsCharging() || batteryController.IsPowerPresent(); + lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(isCharging)); + lv_obj_realign(batteryPlug); + lv_label_set_text(batteryIcon, ""); + } else { + lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); + lv_label_set_text(batteryPlug, ""); + } + } + + bleState = bleController.IsConnected(); + if (bleState.IsUpdated()) { + if (bleState.Get() == true) { + lv_label_set_text(bleIcon, BleIcon::GetIcon(true)); + lv_obj_realign(bleIcon); + } else { + lv_label_set_text(bleIcon, BleIcon::GetIcon(false)); + } + } + + notificationState = notificatioManager.AreNewNotificationsAvailable(); + if (notificationState.IsUpdated()) { + if (notificationState.Get() == true) { + lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true)); + lv_obj_realign(notificationIcon); + //lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25); + } else { + lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); + //lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); + } + } + + 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 = (int) yearMonthDay.year(); + auto month = static_cast((unsigned) yearMonthDay.month()); + auto day = (unsigned) yearMonthDay.day(); + auto dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); + + int hour = time.hours().count(); + auto minute = time.minutes().count(); + + char minutesChar[3]; + sprintf(minutesChar, "%02d", static_cast(minute)); + + char hoursChar[3]; + sprintf(hoursChar, "%02d", hour); + + if (hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] || + minutesChar[1] != displayedChar[3]) { + displayedChar[0] = hoursChar[0]; + displayedChar[1] = hoursChar[1]; + displayedChar[2] = minutesChar[0]; + displayedChar[3] = minutesChar[1]; + + char hourStr[3]; + char minStr[3]; + + /*Display the time as 2 pairs of digits*/ + sprintf(hourStr, "%c%c", hoursChar[0], hoursChar[1]); + lv_label_set_text(timeDD1, hourStr); + + sprintf(minStr, "%c%c", minutesChar[0], minutesChar[1]); + lv_label_set_text(timeDD2, minStr); + } + + if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) { + char dayOfWeekStr[4]; + char dayStr[3]; + char monthStr[4]; + + sprintf(dayOfWeekStr, "%s", dateTimeController.DayOfWeekShortToString()); + sprintf(dayStr, "%d", day); + sprintf(monthStr, "%s", dateTimeController.MonthShortToString()); + + lv_label_set_text(dateDayOfWeek, dayOfWeekStr); + lv_label_set_text(dateDay, dayStr); + lv_obj_realign(dateDay); + lv_label_set_text(dateMonth, monthStr); + + currentYear = year; + currentMonth = month; + currentDayOfWeek = dayOfWeek; + currentDay = day; + } + } + + heartbeat = heartRateController.HeartRate(); + heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped; + if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) { + char heartbeatBuffer[4]; + if (heartbeatRunning.Get()) + sprintf(heartbeatBuffer, "%d", heartbeat.Get()); + else + sprintf(heartbeatBuffer, "---"); + + lv_label_set_text(heartbeatValue, heartbeatBuffer); + lv_obj_realign(heartbeatValue); + } + + return running; +} diff --git a/src/displayapp/screens/PineTimeStyle.h b/src/displayapp/screens/PineTimeStyle.h new file mode 100644 index 0000000..5575241 --- /dev/null +++ b/src/displayapp/screens/PineTimeStyle.h @@ -0,0 +1,83 @@ +#pragma once + +#include +#include +#include +#include +#include "Screen.h" +#include "ScreenList.h" +#include "components/datetime/DateTimeController.h" + +namespace Pinetime { + namespace Controllers { + class Settings; + class Battery; + class Ble; + class NotificationManager; + class HeartRateController; + } + + 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::HeartRateController& heartRateController); + ~PineTimeStyle() override; + + bool Refresh() override; + + void OnObjectEvent(lv_obj_t* pObj, lv_event_t i); + + private: + 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; + uint8_t currentDay = 0; + + DirtyValue batteryPercentRemaining {}; + DirtyValue bleState {}; + DirtyValue> currentDateTime {}; + DirtyValue heartbeat {}; + DirtyValue heartbeatRunning {}; + DirtyValue notificationState {}; + + lv_obj_t* timebar; + lv_obj_t* sidebar; + lv_obj_t* timeDD1; + lv_obj_t* timeDD2; + 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* batteryPlug; + 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* heartbeatIcon; + lv_obj_t* heartbeatValue; + lv_obj_t* heartbeatBpm; + lv_obj_t* notificationIcon; + + Controllers::DateTime& dateTimeController; + Controllers::Battery& batteryController; + Controllers::Ble& bleController; + Controllers::NotificationManager& notificatioManager; + Controllers::Settings& settingsController; + Controllers::HeartRateController& heartRateController; + }; + } + } +} -- cgit v0.10.2 From 6a925292722be365f4efc288c64b023639f0c201 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Tue, 18 May 2021 17:45:16 +0200 Subject: Revert "Reset" This reverts commit 378fa6b4016b65e2d7b128fdc3ce89c4ca779a4d. diff --git a/.clang-tidy b/.clang-tidy index d603680..8a7d38f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -22,5 +22,9 @@ Checks: '*, -hicpp-no-assembler, -hicpp-avoid-c-arrays, -hicpp-uppercase-literal-suffix, + -hicpp-no-array-decay, -cert-err58-cpp, - -cert-err60-cpp' \ No newline at end of file + -cert-err60-cpp' +CheckOptions: + - key: readability-function-cognitive-complexity.Threshold + value: 100 \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index f777013..6c529f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,10 +55,22 @@ if(BUILD_DFU) set(BUILD_DFU true) endif() +set(PROJECT_GIT_COMMIT_HASH "") + +execute_process(COMMAND git rev-parse --short HEAD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE PROJECT_GIT_COMMIT_HASH + RESULT_VARIABLE PROJECT_GIT_COMMIT_HASH_SUCCESS) + +string(STRIP ${PROJECT_GIT_COMMIT_HASH} PROJECT_GIT_COMMIT_HASH) + +message("PROJECT_GIT_COMMIT_HASH_SUCCESS? " ${PROJECT_GIT_COMMIT_HASH_SUCCESS}) + message("BUILD CONFIGURATION") message("-------------------") message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH}) +message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH}) message(" * NRF52 SDK : " ${NRF5_SDK_PATH}) set(PROGRAMMER "???") if(USE_JLINK) diff --git a/README.md b/README.md index 34f6e84..396d746 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,8 @@ As of now, here is the list of achievements of this project: ## Documentation ### Getting started - - [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/gettingStarted.md) + - [Getting started with InfiniTime 1.0 (quick user guide, update bootloader and InfiniTime,...)](doc/gettingStarted/gettingStarted-1.0.md) + - [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/ota-gadgetbridge-nrfconnect.md) ### Develop - [Generate the fonts and symbols](src/displayapp/fonts/README.md) diff --git a/doc/buildAndProgram.md b/doc/buildAndProgram.md index b70bdfc..afd526e 100644 --- a/doc/buildAndProgram.md +++ b/doc/buildAndProgram.md @@ -3,6 +3,7 @@ To build this project, you'll need: - A cross-compiler : [ARM-GCC (9-2020-q2-update)](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads/9-2020-q2-update) - The NRF52 SDK 15.3.0 : [nRF-SDK v15.3.0](https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip) + - The `cbor` and `intelhex` modules for Python 3 - A reasonably recent version of CMake (I use 3.16.5) ## Build steps @@ -221,4 +222,4 @@ Loading section .sec6, size 0x10000 lma 0x30000 Loading section .sec7, size 0xdf08 lma 0x40000 Start address 0x0, load size 314200 Transfer rate: 45 KB/sec, 969 bytes/write. -``` \ No newline at end of file +``` diff --git a/doc/contribute.md b/doc/contribute.md index 7958eea..09d2077 100644 --- a/doc/contribute.md +++ b/doc/contribute.md @@ -2,13 +2,13 @@ ## Report bugs You use your Pinetime and find a bug in the firmware? [Create an issue on Github](https://github.com/JF002/InfiniTime/issues) explaining the bug, how to reproduce it, the version of the firmware you use... ## Write and improve documentation -Documentation might be incomplete, or not clear enough, and it is always possible to improve it with better wording, pictures, photo, video,... +Documentation might be incomplete, or not clear enough, and it is always possible to improve it with better wording, pictures, photo, video,... As the documentation is part of the source code, you can submit your improvements to the documentation by submitting a pull request (see below). ## Fix bugs, add functionalities and improve the code You want to fix a bug, add a cool new functionality or improve the code? See *How to submit a pull request below*. ## Spread the word -Pinetime is a cool open source project that deserves to be know. Talk about it around you, on social networks, on your blog,... and let people know that we are working on an open-source firmware for a smartwatch! +The Pinetime is a cool open source project that deserves to be known. Talk about it around you, on social networks, on your blog,... and let people know that we are working on an open-source firmware for a smartwatch! # How to submit a pull request ? @@ -21,28 +21,28 @@ Pinetime is a cool open source project that deserves to be know. Talk about it a - Write documentation related to your new feature is applicable; - Create the pull-request and write a great description about it : what does your PR do, why, how,... Add pictures and video if possible; - Wait for someone to review your PR and take part in the review process; - - You PR will eventually be merged :) + - Your PR will eventually be merged :) -Your contribution is more than welcome! +Your contribution is more than welcome! If you want to fix a bug, add a functionality or improve the code, you'll first need to create a branch from the **develop** branch (see [this page about the branching model](./branches.md)). This branch is called a feature branch, and you should choose a name that explains what you are working on (ex: "add-doc-about-contributions"). In this branch, **focus on only one topic, bug or feature**. For example, if you created this branch to work on the UI of a specific application, do not commit modifications about the SPI driver. If you want to work on multiple topics, create one branch per topic. When your feature branch is ready, **make sure it actually works** and **do not forget to write documentation** about it if it's relevant. -I **strongly discourage to create a PR containing modifications that haven't been tested**. If, for any reason, you cannot test your modifications but want to publish them anyway, **please mention it in the description**. This way, other contributors might be willing to test it and provide feedbacks about your code. +I **strongly discourage to create a PR containing modifications that haven't been tested**. If, for any reason, you cannot test your modifications but want to publish them anyway, **please mention it in the description**. This way, other contributors might be willing to test it and provide feedback about your code. Also, before submitting your PR, check the coding style of your code against the **coding conventions** detailed below. This project also provides [clang-format](../.clang-format) and [clang-tidy](../.clang-tidy) configuration files. You can use them to ensure correct formatting of your code. Do not forget to check the files you are going to commit and remove those who are not necessary (config files from your IDE, for example). Remove old comments, commented code,... -Then, you can submit a pull-request for review. Try to **describe your pull request as much as possible**: what did you do in this branch, how does it work, how is it designed, are there any limitations,... This will help the contributors to understand and review your code easily. You can add pictures and video to the description so that contributors will have a quick overview of you work. +Then, you can submit a pull-request for review. Try to **describe your pull request as much as possible**: what did you do in this branch, how does it work, how is it designed, are there any limitations,... This will help the contributors to understand and review your code easily. You can add pictures and video to the description so that contributors will have a quick overview of your work. -Other contributors can post comments about the pull request, maybe ask for more info or adjustements in the code. +Other contributors can post comments about the pull request, maybe ask for more info or adjustments in the code. -Once the pull request is reviewed an accepted, it'll be merge in **develop** and will be released in the next release version of the firmware. +Once the pull request is reviewed and accepted, it'll be merge in **develop** and will be released in the next release version of the firmware. ## Why all these rules? -Reviewing pull-requests is a **very time consuming task** for the creator of this project ([JF002](https://github.com/JF002)) and for other contributors who take the time to review them. Every little thing you do to make their lifes easier will **increase the chances your PR will be merge quickly**. +Reviewing pull-requests is a **very time consuming task** for the creator of this project ([JF002](https://github.com/JF002)) and for other contributors who take the time to review them. Every little thing you do to make their lives easier will **increase the chances your PR will be merge quickly**. When reviewing PR, the author and contributors will first look at the **description**. If it's easy to understand what the PR does, why the modification is needed or interesting and how it's done, a good part of the work is already done : we understand the PR and its context. @@ -58,12 +58,12 @@ It's totally normal for a PR to need some more work even after it was created, t ## Language The language of this project is **C++**, and all new code must be written in C++. (Modern) C++ provides a lot of useful tools and functionalities that are beneficial for embedded software development like `constexpr`, `template` and anything that provides zero-cost abstraction. -It's OK to include C code if this code comes from another library like FreeRTOS, NimBLE, LVGL or the NRF-SDK. +It's OK to include C code if this code comes from another library like FreeRTOS, NimBLE, LVGL or the NRF-SDK. ## Coding style -The most important rule to follow is to try to keep the code as easy to read and maintain as possible. +The most important rule to follow is to try to keep the code as easy to read and maintain as possible. - - **Identation** : 2 spaces, no tabulation + - **Indentation** : 2 spaces, no tabulation - **Opening brace** at the end of the line - **Naming** : Choose self-describing variable name - **class** : PascalCase diff --git a/doc/gettingStarted/appmenu-071.jpg b/doc/gettingStarted/appmenu-071.jpg new file mode 100644 index 0000000..dee7c8f Binary files /dev/null and b/doc/gettingStarted/appmenu-071.jpg differ diff --git a/doc/gettingStarted/appmenu.jpg b/doc/gettingStarted/appmenu.jpg new file mode 100644 index 0000000..1e52fe7 Binary files /dev/null and b/doc/gettingStarted/appmenu.jpg differ diff --git a/doc/gettingStarted/bootloader-1.0.jpg b/doc/gettingStarted/bootloader-1.0.jpg new file mode 100644 index 0000000..7b63918 Binary files /dev/null and b/doc/gettingStarted/bootloader-1.0.jpg differ diff --git a/doc/gettingStarted/gettingStarted-1.0.md b/doc/gettingStarted/gettingStarted-1.0.md new file mode 100644 index 0000000..2ac22b9 --- /dev/null +++ b/doc/gettingStarted/gettingStarted-1.0.md @@ -0,0 +1,112 @@ +# Getting started with InfiniTime 1.0 +On April 22 2021, InfiniTime and Pine64 [announced the release of InfiniTime 1.0](https://www.pine64.org/2021/04/22/its-time-infinitime-1-0/) and the availability of PineTime smartwatches as *enthusiast grade end-user product*. This page aims to guide you with your first step with your new PineTime. + +## Firmware, InfiniTime, Bootloader, Recovery firmware, OTA, DFU... What is it? +You might have already seen these words by reading the announcement, release notes, or [the wiki guide](https://wiki.pine64.org/wiki/Upgrade_PineTime_to_InfiniTime_1.0.0) and, you may find them misleading if you're not familiar with the project. + +Basically, a **firmware** is just a software running on the embedded hardware of a device, the PineTime in this case. +**InfiniTime** is based on 3 distinct **firmwares**: + - **[InfiniTime](https://github.com/JF002/InfiniTime)** itself, this is the *application firmware* running on the PineTime. This is the main firmware which provides most of the functionalities you'll use on a daily basis : bluetooth low-energy (BLE) connectivity, applications, watchfaces,... + - **[The bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader)** is responsible for safely applying **updates** of the *application firmware*, reverting them in case of issues and load the recovery firmware when requested. + - **The recovery firmware** is a specific *application firmware* than can be loaded by the bootloader on user request. This firmware can be useful in case of serious issue, when the main application firmware cannot perform an OTA update correctly. Currently, this recovery firmware is based on [InfiniTime 0.14.1](https://github.com/JF002/InfiniTime/releases/tag/0.14.1). + +**OTA** and **DFU** refer to the update of the firmware over BLE (**B**luetooth **L**ow **E**nergy). **OTA** means **O**ver **T**he **A**ir, this is a functionality that allows the user to update the firmware how their device using a wireless communication like BLE. When we talk about **DFU** (**D**igital **F**irmware **U**pdate), we refer to the file format and protocol used to send the update of the firmware to the watch over-the-air. InfiniTime implement the (legacy) DFU protocol from Nordic Semiconductor (NRF). + +## How to check the version of InfiniTime and the bootloader? +Since September 2020, all PineTimes (devkits or sealed) are flashed using the **[first iteration of the bootloader](https://github.com/lupyuen/pinetime-rust-mynewt/releases/tag/v4.1.7)** and **[InfiniTime 0.7.1](https://github.com/JF002/InfiniTime/releases/tag/0.7.1)**. There was no recovery firmware at that time. + +The bootloader only runs when the watch starts (from an empty battery, for example) or after a reset (after a succesful OTA or a manual reset - long push on the button). + +You can recognize this first iteration of the bootloader with it greenish **PINETIME** logo. + +![Old bootloader logo](oldbootloaderlogo.jpg) + +You can check the version of InfiniTime by opening the app *SystemInfo*. For version < 1.0: + +![InfiniTime 0.7.1 Application menu](appmenu-071.jpg) +![InfiniTime 0.7.1 version](version-071.jpg) + +And for version >= 1.0 : + +![InfiniTime 1.0 version](version-1.0.jpg) + + +PineTime shipped from June 2020 (to be confirmed) will be flashed with the [new version of the bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader/releases/tag/1.0.0), the [recovery firmware](https://github.com/JF002/InfiniTime/releases/tag/0.14.1) and [InfiniTime 1.0](https://github.com/JF002/InfiniTime/releases/tag/1.0.0). + +The bootloader is easily recognizable with it white pine cone that is progressively drawn in green. It also displays its own version on the bottom (1.0.0 as of now). + +![Bootloader 1.0](bootloader-1.0.jpg) + +## How to update your PineTime? +To update your PineTime, you can use one of the compatible companion applications. Here are the main ones: + + - **[Amazfish](https://github.com/piggz/harbour-amazfish)** (Desktop Linux, mobile Linux, SailfishOS, runs on the PinebookPro and the Pinephone) + - **[Gadgetbridge](https://www.gadgetbridge.org/)** (Android) + - **[Siglo](https://github.com/alexr4535/siglo)** (Linux, GTK based) + - **NRFConnect** (closed source, Android & iOS). + +See [this page](ota-gadgetbridge-nrfconnect.md) for more info about the OTA procedure using Gadgetbrige and NRFCOnnect. + +### From InfiniTime 0.7.1 / old bootloader +If your PineTime is currently running InfiniTime 0.7.1 and the old bootloader, we strongly recommend you update them to more recent version (Bootloader 1.0.0 and InfiniTime 1.0.0 as of now). We also recommend you install the recovery firmware once the bootloader is up-do-date. + +Using the companion app of your choice, you'll need to apply the OTA procedure for these 3 firmwares in this sequence (failing to follow this specific order might temporarily or permanently brick your device): + + 1. Flash the latest version of InfiniTime. The file to upload is named **pinetime-mcuboot-app-dfu-x.y.z.zip**. Here is the link to [InfiniTime 1.0](https://github.com/JF002/InfiniTime/releases/download/1.0.0/pinetime-mcuboot-app-dfu-1.0.0.zip). + 2. Update the bootloader by applying the OTA procedure with the file named [**reloader-mcuboot.zip** from the repo of the bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader/releases/download/1.0.0/reloader-mcuboot.zip). + 3. Install the recovery firmware by applying the OTA procedure with the file named [**pinetime-mcuboot-recovery-loader-dfu-0.14.1.zip** from the version 0.14.1 of InfiniTime](https://github.com/JF002/InfiniTime/releases/download/0.14.1/pinetime-mcuboot-recovery-loader-dfu-0.14.1.zip). + +You'll find more info about this process in [this wiki page](https://wiki.pine64.org/wiki/Upgrade_PineTime_to_InfiniTime_1.0.0). You can also see the procedure in video [here](https://video.codingfield.com/videos/watch/831077c5-16f3-47b4-9b2b-c4bbfecc6529) and [here (from Amazfish)](https://video.codingfield.com/videos/watch/f7bffb3d-a6a1-43c4-8f01-f4aeff4adf9e) + +### From version > 1.0 +If you are already running the new "1.0.0" bootloader, all you have to do is update your version of InfiniTime when it'll be available. We'll write specific instructions when (if) we release a new version of the bootloader. + +### Firmware validation +The bootloader requires a (manual) validation of the firmware. If the watch reset with an updated firmware that was not validated, the bootloader will consider it as non-functionning and will revert to the previous version of the firmware. This is a safety feature to prevent bricking your device with a faulty firmware. + +You can validate your updated firmware on InfiniTime >= 1.0 by following this simple procedure: + + - From the watchface, swipe **right** to display the *Quick Actions menu* + - Open the **Settings** app by tapping the *gear* icon on the bottom right + - Swipe down and tap on the entry named **Firmware** + - This app shows the version that is currently running. If it's not validated yet, it displays 2 buttons: + - **Validate** to validate your firmware + - **Reset** to reset the watch and revert to the previously running version of the firmware + +## InfiniTime 1.0 quick user guide +### Setting the time +By default, InfiniTime starts on the digital watchface. It'll probably display the epoch time (1 Jan 1970, 00:00). The time will be automatically synchronized once you connect on of the companion app to your PineTime using BLE connectivity. InfiniTime does not provide any way to manually set the time for now. + +### Navigation in the menu + +![Quick actions](quickactions.jpg) +![Settings](settings.jpg) +![Application menu](appmenu.jpg) + + - Swipe **down** to display the notification panel. Notification sent by your companion app will be displayed in this panel. + - Swipe **up** to display the application menus. Apps (stopwatch, music, step, games,...) can be started from this menu. + - Swipe **right** to display the Quick Actions menu. This menu allows you to + - Set the brightness of the display + - Start the **flashlight** app + - Enable/disable vibrations on notifications (Do Not Disturb mode) + - Enter the **settings** menu + - Settings + - Display timeout + - Wake up event (Tap, wrist rotation) + - Time format (12/24H) + - Default watchface (digital / analog) + - Battery info + - Firmware validation + - About (system info, firmware version,...) + +### Bootloader + +Most of the time, the bootloader just runs without your intervention (update and load the firmware). + +However, you can enable 2 functionalities using the push button: + + - Push the button until the pine cone is drawn in **blue** to force the rollback of the previous version of the firmware, even if you've already validated the updated one + - Push the button until the pine cone is drawn in **red** to load the recovery firmware. This recovery firmware only provides BLE connectivity and OTA functionality. + +More info about the bootloader in [its project page](https://github.com/JF002/pinetime-mcuboot-bootloader/blob/master/README.md). + diff --git a/doc/gettingStarted/oldbootloaderlogo.jpg b/doc/gettingStarted/oldbootloaderlogo.jpg new file mode 100644 index 0000000..b4d0cdf Binary files /dev/null and b/doc/gettingStarted/oldbootloaderlogo.jpg differ diff --git a/doc/gettingStarted/ota-gadgetbridge-nrfconnect.md b/doc/gettingStarted/ota-gadgetbridge-nrfconnect.md new file mode 100644 index 0000000..1187a9b --- /dev/null +++ b/doc/gettingStarted/ota-gadgetbridge-nrfconnect.md @@ -0,0 +1,101 @@ +# Flash and upgrade InfiniTime +If you just want to flash or upgrade InfiniTime on your PineTime, this page is for you! + +- [InfiniTime releases and versions](#infinitime-releases-and-versions) +- [How to upgrade Over-The-Air (OTA)](#how-to-upgrade-over-the-air-ota) + - [Using Gadgetbridge](#using-gadgetbridge) + - [Using NRFConnect](#Using-nrfconnect) +- [How to flash InfiniTime using the SWD interface](#how-to-flash-infinitime-using-the-swd-interface) + +## InfiniTime releases and versions +All releases of InfiniTime are available on the [release page of the GitHub repo](https://github.com/JF002/InfiniTime/releases). + +Versions that are tagged as **RELEASE CANDIDATE** are pre-release versions, that are available for testing before actually releasing a new stable version. If you want to help us debug the project and provide stable versions to other user, you can use them. If you want stable and tested version, you should not flash these release candidate version. + +Release files are available under the *Assets* button. + +## How to upgrade Over-The-Air (OTA) +OTA is the easiest method to upgrade InfiniTime. Note that it's only possible is your PineTime is already running InfiniTime (>= 0.7.1). + +2 companion apps provide support for OTA : + - [Gadgetbridge](https://gadgetbridge.org/) (open source, runs on Android, [available on F-Droid](https://f-droid.org/packages/nodomain.freeyourgadget.gadgetbridge/)). + - [NRFConnect](https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Connect-for-mobile) (close source, runs on Android and iOS). + +Both applications need you to download the **DFU file** of InfiniTime. This file contains the new version of InfiniTime that will be flashed into your device. It's called **dfu-x.y.z.zip** (ex: dfu-0.9.0.zip) in the release note. +![Dfu file](dfuFile.png ) + +### Using Gadgetbridge +Launch Gadgetbridge and tap on the **"+"** button on the bottom right to add a new device: + +![Gadgetbridge 0](gadgetbridge0.jpg) + +Wait for the scan to complete, your PineTime should be detected: + +![Gadgetbridge 1](gadgetbridge1.jpg) + +Tap on it. Gadgdetbridge will pair and connect to your device: + +![Gadgetbridge 2](gadgetbridge2.jpg) + +Now that Gadgetbridge is connected to your PineTime, use a file browser application (I'm using Seafile to browse my NAS) and browse to the DFU file (image-xxx.zip) you downloaded previously. Tap on it and open it using the Gadgetbridge application/firmware installer: + +![Gadgetbridge 3](gadgetbridge3.jpg) + +Read carefully the warning and tap **Install**: + +![Gadgetbridge 4](gadgetbridge4.jpg) + +Wait for the transfer to finish. Your PineTime should reset and reboot with the new version of InfiniTime! + +![Gadgetbridge 5](gadgetbridge5.jpg) + +### Using NRFConnect +Open NRFConnect. Swipe down in the *Scanner* tab and wait for your device to appear: + +![NRFConnect 0](nrfconnect0.jpg) + +Tap on the *Connect* button on the right of your device. NRFConnect will connect to your PineTime and discover its characteristics. Tap on the **DFU** button on the top right: + +![NRFConnect 1](nrfconnect1.jpg) + +Select **Distribution packet (ZIP)**: + +![NRFConnect 2](nrfconnect2.jpg) + +Browse to the DFU file you downloaded previously, the DFU transfer will start automatically. When the transfer is finished, your PineTime will reset and restart on the new version of InfiniTime! + +![NRFConnect 3](nrfconnect3.jpg) + +## How to flash InfiniTime using the SWD interface +Download the files **bootloader.bin**, **image-x.y.z.bin** and **pinetime-graphics-x.y.z.bin** from the release page: + +![Image file](imageFile.png ) + +The bootloader reads a boot logo from the external SPI flash memory. The first step consists in flashing a tool in the MCU that will flash the boot logo into this SPI flash memory. This first step is optional but recommanded (the bootloader will display garbage on screen for a few second if you don't do it). +Using your SWD tool, flash **pinetime-graphics-x.y.z.bin** at offset **0x0000**. Reset the MCU and wait for a few second, until the logo is completely drawn on the display. + +Then, using your SWD tool, flash those file at specific offset: + + - bootloader.bin : **0x0000** + - image-x.y.z.bin : **0x8000** + +Reset and voilĂ , you're running InfiniTime on your PineTime! + +If you are using OpenOCD with a STLinkV2, you can find more info [on this page](../openOCD.md). + +## How to synchronize the time + +### Using Gadgetbridge +Good news! Gadgetbridge **automatically** synchronizes the time when connecting to your PineTime! + +### Using NRFConnect +You must enable the **CTS** *GATT server* into NRFConnect so that InfiniTime can synchronize the time with your smartphone. + +Launch NRFConnect, tap the sandwich button on the top left and select *Configure GATT server*: + +![NRFConnect CTS 0](nrfconnectcts0.jpg) + + +Tap *Add service* and select the server configuration *Current Time service*. Tap OK and connect to your PineTime, it should automcatically sync the time once the connection is established! + +![NRFConnect CTS 1](nrfconnectcts1.jpg) diff --git a/doc/gettingStarted/quickactions.jpg b/doc/gettingStarted/quickactions.jpg new file mode 100644 index 0000000..0d92b13 Binary files /dev/null and b/doc/gettingStarted/quickactions.jpg differ diff --git a/doc/gettingStarted/settings.jpg b/doc/gettingStarted/settings.jpg new file mode 100644 index 0000000..510b29e Binary files /dev/null and b/doc/gettingStarted/settings.jpg differ diff --git a/doc/gettingStarted/version-071.jpg b/doc/gettingStarted/version-071.jpg new file mode 100644 index 0000000..bc9bc5b Binary files /dev/null and b/doc/gettingStarted/version-071.jpg differ diff --git a/doc/gettingStarted/version-1.0.jpg b/doc/gettingStarted/version-1.0.jpg new file mode 100644 index 0000000..bcfc8c6 Binary files /dev/null and b/doc/gettingStarted/version-1.0.jpg differ diff --git a/docker/.gitpod.Dockerfile b/docker/.gitpod.Dockerfile index 2f7099a..4fbc7be 100644 --- a/docker/.gitpod.Dockerfile +++ b/docker/.gitpod.Dockerfile @@ -19,8 +19,11 @@ RUN apt-get update -qq \ libffi-dev \ libssl-dev \ python3-dev \ + git \ && rm -rf /var/cache/apt/* /var/lib/apt/lists/*; +# Git needed for PROJECT_GIT_COMMIT_HASH variable setting + # Needs to be installed as root RUN pip3 install adafruit-nrfutil RUN pip3 install -Iv cryptography==3.3 diff --git a/docker/Dockerfile b/docker/Dockerfile index a6caa24..0a4f69f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -19,8 +19,11 @@ RUN apt-get update -qq \ libssl-dev \ python3-dev \ python \ + git \ && rm -rf /var/cache/apt/* /var/lib/apt/lists/*; +# Git needed for PROJECT_GIT_COMMIT_HASH variable setting + RUN pip3 install adafruit-nrfutil RUN pip3 install -Iv cryptography==3.3 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5c6af93..acbfba1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -406,6 +406,7 @@ list(APPEND SOURCE_FILES displayapp/screens/FlashLight.cpp displayapp/screens/List.cpp displayapp/screens/BatteryInfo.cpp + displayapp/screens/Steps.cpp ## Settings displayapp/screens/settings/QuickSettings.cpp @@ -414,12 +415,12 @@ list(APPEND SOURCE_FILES displayapp/screens/settings/SettingTimeFormat.cpp displayapp/screens/settings/SettingWakeUp.cpp displayapp/screens/settings/SettingDisplay.cpp + displayapp/screens/settings/SettingSteps.cpp ## Watch faces displayapp/icons/bg_clock.c displayapp/screens/WatchFaceAnalog.cpp displayapp/screens/WatchFaceDigital.cpp - displayapp/screens/PineTimeStyle.cpp ## @@ -467,7 +468,7 @@ list(APPEND SOURCE_FILES displayapp/fonts/jetbrains_mono_extrabold_compressed.c displayapp/fonts/jetbrains_mono_bold_20.c displayapp/fonts/jetbrains_mono_76.c - displayapp/fonts/open_sans_light.c + displayapp/fonts/jetbrains_mono_42.c displayapp/fonts/lv_font_sys_48.c displayapp/lv_pinetime_theme.c diff --git a/src/Version.h.in b/src/Version.h.in index 6ff5938..8cd39c9 100644 --- a/src/Version.h.in +++ b/src/Version.h.in @@ -8,11 +8,13 @@ namespace Pinetime { static constexpr uint32_t Major() {return major;} static constexpr uint32_t Minor() {return minor;} static constexpr uint32_t Patch() {return patch;} + static constexpr const char* GitCommitHash() {return commitHash;} static constexpr const char* VersionString() {return versionString;} private: static constexpr uint32_t major = @PROJECT_VERSION_MAJOR@; static constexpr uint32_t minor = @PROJECT_VERSION_MINOR@; static constexpr uint32_t patch = @PROJECT_VERSION_PATCH@; + static constexpr const char* commitHash = "@PROJECT_GIT_COMMIT_HASH@"; static constexpr const char* versionString = "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@"; }; } \ No newline at end of file diff --git a/src/components/motion/MotionController.h b/src/components/motion/MotionController.h index bf64481..3a23826 100644 --- a/src/components/motion/MotionController.h +++ b/src/components/motion/MotionController.h @@ -8,13 +8,13 @@ namespace Pinetime { public: void Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps); - uint16_t X() const { + int16_t X() const { return x; } - uint16_t Y() const { + int16_t Y() const { return y; } - uint16_t Z() const { + int16_t Z() const { return z; } uint32_t NbSteps() const { diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 18c87fd..4409425 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -86,6 +86,14 @@ namespace Pinetime { return settings.brightLevel; }; + void SetStepsGoal( uint32_t goal ) { + if ( goal != settings.stepsGoal ) + settingsChanged = true; + settings.stepsGoal = goal; + }; + + uint32_t GetStepsGoal() const { return settings.stepsGoal; }; + private: Pinetime::Drivers::SpiNorFlash& spiNorFlash; struct SettingsData { @@ -95,7 +103,7 @@ namespace Pinetime { uint8_t clockFace = 0; - uint32_t stepsGoal = 1000; + uint32_t stepsGoal = 10000; uint32_t screenTimeOut = 15000; WakeUpMode wakeUpMode = WakeUpMode::None; diff --git a/src/displayapp/Apps.h b/src/displayapp/Apps.h index 936a3ae..09a2018 100644 --- a/src/displayapp/Apps.h +++ b/src/displayapp/Apps.h @@ -21,12 +21,14 @@ namespace Pinetime { Navigation, StopWatch, Motion, + Steps, QuickSettings, Settings, SettingWatchFace, SettingTimeFormat, SettingDisplay, - SettingWakeUp + SettingWakeUp, + SettingSteps }; } } diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 3a20c76..a6c4a3e 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -25,6 +25,7 @@ #include "displayapp/screens/Twos.h" #include "displayapp/screens/FlashLight.h" #include "displayapp/screens/BatteryInfo.h" +#include "displayapp/screens/Steps.h" #include "drivers/Cst816s.h" #include "drivers/St7789.h" @@ -37,6 +38,7 @@ #include "displayapp/screens/settings/SettingTimeFormat.h" #include "displayapp/screens/settings/SettingWakeUp.h" #include "displayapp/screens/settings/SettingDisplay.h" +#include "displayapp/screens/settings/SettingSteps.h" using namespace Pinetime::Applications; using namespace Pinetime::Applications::Display; @@ -65,7 +67,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, notificationManager {notificationManager}, heartRateController {heartRateController}, settingsController {settingsController}, - motorController{motorController}, + motorController {motorController}, motionController {motionController} { msgQueue = xQueueCreate(queueSize, itemSize); // Start clock when smartwatch boots @@ -73,8 +75,9 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, } void DisplayApp::Start() { - if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 800, this, 0, &taskHandle)) + if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 800, this, 0, &taskHandle)) { APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); + } } void DisplayApp::Process(void* instance) { @@ -85,7 +88,7 @@ void DisplayApp::Process(void* instance) { // Send a dummy notification to unlock the lvgl display driver for the first iteration xTaskNotifyGive(xTaskGetCurrentTaskHandle()); - while (1) { + while (true) { app->Refresh(); } } @@ -213,7 +216,7 @@ void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction) LoadApp(app, direction); } -void DisplayApp::returnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent) { +void DisplayApp::ReturnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent) { returnToApp = app; returnDirection = direction; returnTouchEvent = touchEvent; @@ -224,12 +227,12 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) SetFullRefresh(direction); // default return to launcher - returnApp(Apps::Launcher, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Launcher, FullRefreshDirections::Down, TouchEvents::SwipeDown); switch (app) { case Apps::Launcher: currentScreen = std::make_unique(this, settingsController, batteryController, dateTimeController); - returnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::None: case Apps::Clock: @@ -245,7 +248,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) case Apps::FirmwareValidation: currentScreen = std::make_unique(this, validator); - returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::FirmwareUpdate: currentScreen = std::make_unique(this, bleController); @@ -254,54 +257,58 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) case Apps::Notifications: currentScreen = std::make_unique( this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Normal); - returnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); + ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); break; case Apps::NotificationsPreview: currentScreen = std::make_unique( this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Preview); - returnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); + ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); break; // Settings case Apps::QuickSettings: - currentScreen = - std::make_unique(this, batteryController, dateTimeController, brightnessController, motorController, settingsController); - returnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft); + currentScreen = std::make_unique( + this, batteryController, dateTimeController, brightnessController, motorController, settingsController); + ReturnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft); break; case Apps::Settings: currentScreen = std::make_unique(this, settingsController); - returnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SettingWatchFace: currentScreen = std::make_unique(this, settingsController); - returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SettingTimeFormat: currentScreen = std::make_unique(this, settingsController); - returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SettingWakeUp: currentScreen = std::make_unique(this, settingsController); - returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SettingDisplay: currentScreen = std::make_unique(this, settingsController); - returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + break; + case Apps::SettingSteps: + 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); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SysInfo: currentScreen = std::make_unique(this, dateTimeController, batteryController, brightnessController, bleController, watchdog); - returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); + ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; // case Apps::FlashLight: currentScreen = std::make_unique(this, systemTask, brightnessController); - returnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None); + ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None); break; case Apps::StopWatch: currentScreen = std::make_unique(this); @@ -327,6 +334,9 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) case Apps::Motion: currentScreen = std::make_unique(this, motionController); break; + case Apps::Steps: + currentScreen = std::make_unique(this, motionController, settingsController); + break; } currentApp = app; } @@ -349,8 +359,9 @@ TouchEvents DisplayApp::OnTouchEvent() { if (info.isTouch) { switch (info.gesture) { case Pinetime::Drivers::Cst816S::Gestures::SingleTap: - if (touchMode == TouchModes::Gestures) + if (touchMode == TouchModes::Gestures) { lvgl.SetNewTapEvent(info.x, info.y); + } return TouchEvents::Tap; case Pinetime::Drivers::Cst816S::Gestures::LongPress: return TouchEvents::LongTap; diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index 75e5275..ffe27cf 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -103,7 +103,7 @@ namespace Pinetime { static void Process(void* instance); void InitHw(); void Refresh(); - void returnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent); + void ReturnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent); void LoadApp(Apps app, DisplayApp::FullRefreshDirections direction); }; } diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp index 6db987f..a132a47 100644 --- a/src/displayapp/DisplayAppRecovery.cpp +++ b/src/displayapp/DisplayAppRecovery.cpp @@ -37,7 +37,7 @@ void DisplayApp::Process(void* instance) { xTaskNotifyGive(xTaskGetCurrentTaskHandle()); app->InitHw(); - while (1) { + while (true) { app->Refresh(); } } @@ -51,10 +51,11 @@ void DisplayApp::Refresh() { if (xQueueReceive(msgQueue, &msg, 200)) { switch (msg) { case Display::Messages::UpdateBleConnection: - if (bleController.IsConnected()) + if (bleController.IsConnected()) { DisplayLogo(colorBlue); - else + } else { DisplayLogo(colorWhite); + } break; case Display::Messages::BleFirmwareUpdateStarted: DisplayLogo(colorGreen); diff --git a/src/displayapp/fonts/jetbrains_mono_42.c b/src/displayapp/fonts/jetbrains_mono_42.c new file mode 100644 index 0000000..6f25f5a --- /dev/null +++ b/src/displayapp/fonts/jetbrains_mono_42.c @@ -0,0 +1,258 @@ +/******************************************************************************* + * Size: 42 px + * Bpp: 1 + * Opts: + ******************************************************************************/ + +#ifdef LV_LVGL_H_INCLUDE_SIMPLE +#include "lvgl.h" +#else +#include "lvgl/lvgl.h" +#endif + +#ifndef JETBRAINS_MONO_42 +#define JETBRAINS_MONO_42 1 +#endif + +#if JETBRAINS_MONO_42 + +/*----------------- + * BITMAPS + *----------------*/ + +/*Store the image of the glyphs*/ +static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { + /* U+0025 "%" */ + 0x1f, 0x80, 0x7, 0x3f, 0xc0, 0xe, 0x7f, 0xe0, + 0x1c, 0xf0, 0xf0, 0x1c, 0xe0, 0x70, 0x38, 0xe0, + 0x70, 0x70, 0xe0, 0x70, 0x70, 0xe0, 0x70, 0xe0, + 0xe0, 0x71, 0xc0, 0xe0, 0x71, 0xc0, 0xf0, 0xf3, + 0x80, 0x7f, 0xe7, 0x0, 0x3f, 0xc7, 0x0, 0x1f, + 0x8e, 0x0, 0x0, 0x1c, 0x0, 0x0, 0x3c, 0x0, + 0x0, 0x38, 0x0, 0x0, 0x71, 0xf8, 0x0, 0xe3, + 0xfc, 0x0, 0xe7, 0xfe, 0x1, 0xcf, 0xf, 0x3, + 0x8e, 0x7, 0x3, 0x8e, 0x7, 0x7, 0xe, 0x7, + 0xe, 0xe, 0x7, 0xe, 0xe, 0x7, 0x1c, 0xe, + 0x7, 0x38, 0xf, 0xf, 0x38, 0x7, 0xfe, 0x70, + 0x3, 0xfc, 0xe0, 0x1, 0xf8, + + /* U+0030 "0" */ + 0x3, 0xf8, 0x1, 0xff, 0xc0, 0xff, 0xfe, 0x1f, + 0x7, 0xc7, 0xc0, 0x7c, 0xf0, 0x7, 0xbc, 0x0, + 0x7f, 0x80, 0xf, 0xf0, 0x1, 0xfe, 0x0, 0x3f, + 0xc0, 0x7, 0xf8, 0x0, 0xff, 0xe, 0x1f, 0xe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0x7d, 0xff, 0xff, 0xff, 0xef, 0x80, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, + 0xf7, 0xff, 0xff, 0xff, 0xbe +}; + + +/*--------------------- + * GLYPH DESCRIPTION + *--------------------*/ + +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 = 403, .box_w = 24, .box_h = 31, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 93, .adv_w = 403, .box_w = 19, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 167, .adv_w = 403, .box_w = 19, .box_h = 31, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 241, .adv_w = 403, .box_w = 19, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 315, .adv_w = 403, .box_w = 19, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 389, .adv_w = 403, .box_w = 18, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 459, .adv_w = 403, .box_w = 18, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 529, .adv_w = 403, .box_w = 20, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 607, .adv_w = 403, .box_w = 20, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 685, .adv_w = 403, .box_w = 20, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 763, .adv_w = 403, .box_w = 20, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 841, .adv_w = 403, .box_w = 7, .box_h = 24, .ofs_x = 9, .ofs_y = 0} +}; + +/*--------------------- + * CHARACTER MAPPING + *--------------------*/ + + + +/*Collect the unicode lists and glyph_id offsets*/ +static const lv_font_fmt_txt_cmap_t cmaps[] = +{ + { + .range_start = 37, .range_length = 1, .glyph_id_start = 1, + .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY + }, + { + .range_start = 48, .range_length = 11, .glyph_id_start = 2, + .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY + } +}; + + + +/*-------------------- + * 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 = { +#endif + .glyph_bitmap = glyph_bitmap, + .glyph_dsc = glyph_dsc, + .cmaps = cmaps, + .kern_dsc = NULL, + .kern_scale = 0, + .cmap_num = 2, + .bpp = 1, + .kern_classes = 0, + .bitmap_format = 0, +#if LV_VERSION_CHECK(8, 0, 0) + .cache = &cache +#endif +}; + + +/*----------------- + * PUBLIC FONT + *----------------*/ + +/*Initialize a public general font descriptor*/ +#if LV_VERSION_CHECK(8, 0, 0) +const lv_font_t jetbrains_mono_42 = { +#else +lv_font_t jetbrains_mono_42 = { +#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 = 31, /*The maximum line height required by the font*/ + .base_line = 0, /*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) + .underline_position = -7, + .underline_thickness = 2, +#endif + .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ +}; + + + +#endif /*#if JETBRAINS_MONO_42*/ + diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp index 7e38b3f..1eb3699 100644 --- a/src/displayapp/screens/ApplicationList.cpp +++ b/src/displayapp/screens/ApplicationList.cpp @@ -49,7 +49,7 @@ std::unique_ptr ApplicationList::CreateScreen1() { {Symbols::stopWatch, Apps::StopWatch}, {Symbols::music, Apps::Music}, {Symbols::map, Apps::Navigation}, - {Symbols::shoe, Apps::Motion}, + {Symbols::shoe, Apps::Steps}, {Symbols::heartBeat, Apps::HeartRate}, {"", Apps::None}, }}; @@ -62,7 +62,7 @@ std::unique_ptr ApplicationList::CreateScreen2() { {Symbols::paintbrush, Apps::Paint}, {Symbols::paddle, Apps::Paddle}, {"2", Apps::Twos}, - {"", Apps::None}, + {"M", Apps::Motion}, {"", Apps::None}, {"", Apps::None}, }}; diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index e0c1f62..1429984 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -14,7 +14,6 @@ #include "../DisplayApp.h" #include "WatchFaceDigital.h" #include "WatchFaceAnalog.h" -#include "PineTimeStyle.h" using namespace Pinetime::Applications::Screens; @@ -43,9 +42,6 @@ Clock::Clock(DisplayApp* app, [this]() -> std::unique_ptr { return WatchFaceAnalogScreen(); }, - [this]() -> std::unique_ptr { - return PineTimeStyleScreen(); - }, // Examples for more watch faces //[this]() -> std::unique_ptr { return WatchFaceMinimalScreen(); }, //[this]() -> std::unique_ptr { return WatchFaceCustomScreen(); } @@ -84,16 +80,6 @@ std::unique_ptr Clock::WatchFaceAnalogScreen() { app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); } -std::unique_ptr Clock::PineTimeStyleScreen() { - return std::make_unique(app, - dateTimeController, - batteryController, - bleController, - notificatioManager, - settingsController, - heartRateController); -} - /* // Examples for more watch faces std::unique_ptr Clock::WatchFaceMinimalScreen() { @@ -105,4 +91,4 @@ std::unique_ptr Clock::WatchFaceCustomScreen() { return std::make_unique(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); } -*/ +*/ \ No newline at end of file diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h index 920d58b..9879985 100644 --- a/src/displayapp/screens/Clock.h +++ b/src/displayapp/screens/Clock.h @@ -47,10 +47,9 @@ namespace Pinetime { Controllers::HeartRateController& heartRateController; Controllers::MotionController& motionController; - ScreenList<3> screens; + ScreenList<2> screens; std::unique_ptr WatchFaceDigitalScreen(); std::unique_ptr WatchFaceAnalogScreen(); - std::unique_ptr PineTimeStyleScreen(); // Examples for more watch faces // std::unique_ptr WatchFaceMinimalScreen(); diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp index 873a22f..ad37a3d 100644 --- a/src/displayapp/screens/FirmwareValidation.cpp +++ b/src/displayapp/screens/FirmwareValidation.cpp @@ -27,6 +27,17 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp* app, sprintf(version, "%ld.%ld.%ld", Version::Major(), Version::Minor(), Version::Patch()); lv_label_set_text(labelVersionValue, version); + labelShortRefInfo = lv_label_create(lv_scr_act(), nullptr); + lv_obj_align(labelShortRefInfo, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 25); + lv_label_set_text(labelShortRefInfo, "ShortRef : "); + lv_label_set_align(labelShortRefInfo, LV_LABEL_ALIGN_LEFT); + + labelShortRefValue = lv_label_create(lv_scr_act(), nullptr); + lv_obj_align(labelShortRefValue, labelShortRefInfo, LV_ALIGN_OUT_RIGHT_MID, 0, 0); + lv_label_set_recolor(labelShortRefValue, true); + sprintf(shortref, "%s", Version::GitCommitHash()); + lv_label_set_text(labelShortRefValue, shortref); + labelIsValidated = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(labelIsValidated, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 50); lv_label_set_recolor(labelIsValidated, true); diff --git a/src/displayapp/screens/FirmwareValidation.h b/src/displayapp/screens/FirmwareValidation.h index 67662fd..303c215 100644 --- a/src/displayapp/screens/FirmwareValidation.h +++ b/src/displayapp/screens/FirmwareValidation.h @@ -25,7 +25,10 @@ namespace Pinetime { lv_obj_t* labelVersionInfo; lv_obj_t* labelVersionValue; + lv_obj_t* labelShortRefInfo; + lv_obj_t* labelShortRefValue; char version[9]; + char shortref[9]; lv_obj_t* labelIsValidated; lv_obj_t* buttonValidate; lv_obj_t* labelButtonValidate; diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp index e719626..a8bb3c1 100644 --- a/src/displayapp/screens/Motion.cpp +++ b/src/displayapp/screens/Motion.cpp @@ -3,8 +3,6 @@ #include "../DisplayApp.h" using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionController& motionController) : Screen(app), motionController {motionController} { @@ -29,13 +27,16 @@ Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionContr lv_chart_init_points(chart, ser3, 0); lv_chart_refresh(chart); /*Required after direct set*/ + label = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text_fmt(label, "X #FF0000 %d# Y #008000 %d# Z #FFFF00 %d#", 0, 0, 0); + lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); + lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10); + lv_label_set_recolor(label, true); + 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(labelStep, "Steps ---"); - labelStepValue = lv_label_create(lv_scr_act(), NULL); - lv_obj_align(labelStepValue, labelStep, LV_ALIGN_OUT_RIGHT_MID, 0, 0); - lv_label_set_text(labelStepValue, "-"); } Motion::~Motion() { @@ -47,8 +48,10 @@ bool Motion::Refresh() { lv_chart_set_next(chart, ser2, motionController.Y()); lv_chart_set_next(chart, ser3, motionController.Z()); - snprintf(nbStepsBuffer, nbStepsBufferSize, "%lu", motionController.NbSteps()); - lv_label_set_text(labelStepValue, nbStepsBuffer); + lv_label_set_text_fmt(labelStep, "Steps %lu", motionController.NbSteps()); + + lv_label_set_text_fmt(label, "X #FF0000 %d# Y #008000 %d# Z #FFFF00 %d#", motionController.X() / 0x10, motionController.Y() / 0x10, motionController.Z() / 0x10); + lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10); return running; } diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h index 1100786..132b20e 100644 --- a/src/displayapp/screens/Motion.h +++ b/src/displayapp/screens/Motion.h @@ -26,9 +26,9 @@ namespace Pinetime { lv_chart_series_t* ser1; lv_chart_series_t* ser2; lv_chart_series_t* ser3; + lv_obj_t* label; lv_obj_t* labelStep; - lv_obj_t* labelStepValue; static constexpr uint8_t nbStepsBufferSize = 9; char nbStepsBuffer[nbStepsBufferSize + 1]; bool running = true; diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index f0fd2f6..1f11375 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -176,7 +176,17 @@ Notifications::NotificationItem::NotificationItem(const char* title, 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 = + pchar = strchr(pchar + 1, '\n'); + } lv_label_set_text(alert_type, title); + lv_label_set_long_mode(alert_type, LV_LABEL_LONG_SROLL_CIRC); + lv_label_set_anim_speed(alert_type, 3); + 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/Steps.cpp b/src/displayapp/screens/Steps.cpp new file mode 100644 index 0000000..b485c97 --- /dev/null +++ b/src/displayapp/screens/Steps.cpp @@ -0,0 +1,72 @@ +#include "Steps.h" +#include +#include "../DisplayApp.h" +#include "Symbols.h" + +using namespace Pinetime::Applications::Screens; + +Steps::Steps( + Pinetime::Applications::DisplayApp *app, + Controllers::MotionController& motionController, + Controllers::Settings &settingsController) + : Screen(app), + motionController{motionController}, + settingsController{settingsController} { + + stepsArc = lv_arc_create(lv_scr_act(), nullptr); + + lv_obj_set_style_local_bg_opa(stepsArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, LV_OPA_0); + lv_obj_set_style_local_border_width(stepsArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, 2); + lv_obj_set_style_local_radius(stepsArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, 0); + lv_obj_set_style_local_line_color(stepsArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, lv_color_hex(0x0000FF)); + lv_arc_set_end_angle(stepsArc, 200); + lv_obj_set_size(stepsArc, 220, 220); + lv_arc_set_range(stepsArc, 0, 500); + lv_obj_align(stepsArc, nullptr, LV_ALIGN_CENTER, 0, 0); + + stepsCount = motionController.NbSteps(); + + lv_arc_set_value(stepsArc, int16_t(500 * stepsCount / settingsController.GetStepsGoal())); + + lSteps = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); + lv_obj_set_style_local_text_font(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); + lv_label_set_text_fmt(lSteps, "%li", stepsCount); + lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -20); + + lv_obj_t * lstepsL = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(lstepsL, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); + lv_label_set_text_static(lstepsL, "Steps"); + lv_obj_align(lstepsL, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); + + lv_obj_t * lstepsGoal = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(lstepsGoal, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN); + lv_label_set_text_fmt(lstepsGoal,"Goal\n%i", settingsController.GetStepsGoal()); + lv_label_set_align(lstepsGoal, LV_LABEL_ALIGN_CENTER); + lv_obj_align(lstepsGoal, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 60); + + lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr); + 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, ""); + +} + +Steps::~Steps() { + lv_obj_clean(lv_scr_act()); +} + +bool Steps::Refresh() { + + stepsCount = motionController.NbSteps(); + + lv_label_set_text_fmt(lSteps,"%li", stepsCount); + lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -20); + + lv_arc_set_value(stepsArc, int16_t(500 * stepsCount / settingsController.GetStepsGoal())); + + return running; +} + + diff --git a/src/displayapp/screens/Steps.h b/src/displayapp/screens/Steps.h new file mode 100644 index 0000000..9c135e2 --- /dev/null +++ b/src/displayapp/screens/Steps.h @@ -0,0 +1,39 @@ +#pragma once + +#include +#include +#include "Screen.h" +#include + +namespace Pinetime { + + namespace Controllers { + class Settings; + } + + namespace Applications { + namespace Screens { + + class Steps : public Screen { + public: + Steps(DisplayApp* app, Controllers::MotionController& motionController, Controllers::Settings &settingsController); + ~Steps() override; + + bool Refresh() override; + + + private: + + Controllers::MotionController& motionController; + Controllers::Settings& settingsController; + + lv_obj_t * lSteps; + lv_obj_t * lStepsIcon; + lv_obj_t * stepsArc; + + uint32_t stepsCount; + + }; + } + } +} diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index e06981a..d7cd20c 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -115,8 +115,9 @@ bool StopWatch::Refresh() { // Init state when an user first opens the app // and when a stop/reset button is pressed case States::Init: { - if (btnStopLap) { + if (btnStopLap != nullptr) { lv_obj_del(btnStopLap); + btnStopLap = nullptr; } // The initial default value lv_label_set_text(time, "00:00"); diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index f6e8d61..e4ef691 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -69,12 +69,14 @@ std::unique_ptr SystemInfo::CreateScreen1() { lv_label_set_text_fmt(label, "#FFFF00 InfiniTime#\n\n" "#444444 Version# %ld.%ld.%ld\n\n" + "#444444 Short Ref# %s\n\n" "#444444 Build date#\n" - "\t%s\n" - "\t%s\n", + "%s\n" + "%s\n", Version::Major(), Version::Minor(), Version::Patch(), + Version::GitCommitHash(), __DATE__, __TIME__); lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); @@ -242,4 +244,4 @@ std::unique_ptr SystemInfo::CreateScreen5() { lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); return std::unique_ptr(new Screens::Label(4, 5, app, label)); -} \ No newline at end of file +} diff --git a/src/displayapp/screens/settings/SettingSteps.cpp b/src/displayapp/screens/settings/SettingSteps.cpp new file mode 100644 index 0000000..b7c024f --- /dev/null +++ b/src/displayapp/screens/settings/SettingSteps.cpp @@ -0,0 +1,98 @@ +#include "SettingSteps.h" +#include +#include "displayapp/DisplayApp.h" +#include "displayapp/screens/Symbols.h" + +using namespace Pinetime::Applications::Screens; + +namespace { + static void event_handler(lv_obj_t * obj, lv_event_t event) { + SettingSteps* screen = static_cast(obj->user_data); + screen->UpdateSelected(obj, event); + } +} + +SettingSteps::SettingSteps( + 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_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); + 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, 30, 60); + lv_obj_set_width(container1, LV_HOR_RES - 50); + lv_obj_set_height(container1, LV_VER_RES - 60); + lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT); + + lv_obj_t * title = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text_static(title,"Daily steps goal"); + 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(), NULL); + 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::shoe); + lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); + lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); + + + stepValue = lv_label_create(lv_scr_act(), NULL); + lv_obj_set_style_local_text_font(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); + lv_label_set_text_fmt(stepValue,"%i", settingsController.GetStepsGoal()); + lv_label_set_align(stepValue, LV_LABEL_ALIGN_CENTER); + lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); + + btnPlus = lv_btn_create(lv_scr_act(), NULL); + btnPlus->user_data = this; + lv_obj_set_size(btnPlus, 80, 50); + lv_obj_align(btnPlus, lv_scr_act(), LV_ALIGN_CENTER, 55, 80); + lv_obj_set_style_local_value_str(btnPlus, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "+"); + lv_obj_set_event_cb(btnPlus, event_handler); + + btnMinus = lv_btn_create(lv_scr_act(), NULL); + btnMinus->user_data = this; + lv_obj_set_size(btnMinus, 80, 50); + lv_obj_set_event_cb(btnMinus, event_handler); + lv_obj_align(btnMinus, lv_scr_act(), LV_ALIGN_CENTER, -55, 80); + lv_obj_set_style_local_value_str(btnMinus, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "-"); + +} + +SettingSteps::~SettingSteps() { + lv_obj_clean(lv_scr_act()); + settingsController.SaveSettings(); +} + +bool SettingSteps::Refresh() { + return running; +} + + +void SettingSteps::UpdateSelected(lv_obj_t *object, lv_event_t event) { + uint32_t value = settingsController.GetStepsGoal(); + if(object == btnPlus && (event == LV_EVENT_PRESSED)) { + value += 1000; + if ( value <= 500000 ) { + settingsController.SetStepsGoal(value); + lv_label_set_text_fmt(stepValue,"%i", settingsController.GetStepsGoal()); + lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); + } + } + + if(object == btnMinus && (event == LV_EVENT_PRESSED)) { + value -= 1000; + if ( value >= 1000 ) { + settingsController.SetStepsGoal(value); + lv_label_set_text_fmt(stepValue,"%i", settingsController.GetStepsGoal()); + lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); + } + } + +} \ No newline at end of file diff --git a/src/displayapp/screens/settings/SettingSteps.h b/src/displayapp/screens/settings/SettingSteps.h new file mode 100644 index 0000000..0a4c205 --- /dev/null +++ b/src/displayapp/screens/settings/SettingSteps.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include "components/settings/Settings.h" +#include "displayapp/screens/Screen.h" + +namespace Pinetime { + + namespace Applications { + namespace Screens { + + class SettingSteps : public Screen{ + public: + SettingSteps(DisplayApp* app, Pinetime::Controllers::Settings &settingsController); + ~SettingSteps() override; + + bool Refresh() override; + void UpdateSelected(lv_obj_t *object, lv_event_t event); + + private: + + Controllers::Settings& settingsController; + + lv_obj_t * stepValue; + lv_obj_t * btnPlus; + lv_obj_t * btnMinus; + + }; + } + } +} diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp index 3914a04..457cebf 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.cpp +++ b/src/displayapp/screens/settings/SettingWatchFace.cpp @@ -59,15 +59,6 @@ SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pine } optionsTotal++; - cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); - lv_checkbox_set_text_static(cbOption[optionsTotal], " PineTimeStyle"); - cbOption[optionsTotal]->user_data = this; - lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); - if (settingsController.GetClockFace() == 2) { - lv_checkbox_set_checked(cbOption[optionsTotal], true); - } - - optionsTotal++; } SettingWatchFace::~SettingWatchFace() { @@ -90,4 +81,4 @@ void SettingWatchFace::UpdateSelected(lv_obj_t* object, lv_event_t event) { } } } -} +} \ No newline at end of file diff --git a/src/displayapp/screens/settings/SettingWatchFace.h b/src/displayapp/screens/settings/SettingWatchFace.h index 6f65d69..1930a22 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.h +++ b/src/displayapp/screens/settings/SettingWatchFace.h @@ -21,7 +21,7 @@ namespace Pinetime { private: Controllers::Settings& settingsController; uint8_t optionsTotal; - lv_obj_t* cbOption[3]; + lv_obj_t* cbOption[2]; }; } } diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index e24be3d..2c72c83 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -44,9 +44,7 @@ std::unique_ptr Settings::CreateScreen1() { {Symbols::clock, "Wake Up", Apps::SettingWakeUp}, {Symbols::clock, "Time format", Apps::SettingTimeFormat}, {Symbols::clock, "Watch face", Apps::SettingWatchFace}, - } - - }; + }}; return std::unique_ptr(new Screens::List(0, 2, app, settingsController, applications)); } @@ -54,13 +52,11 @@ std::unique_ptr Settings::CreateScreen1() { std::unique_ptr Settings::CreateScreen2() { std::array applications {{ + {Symbols::shoe, "Steps", Apps::SettingSteps}, {Symbols::batteryHalf, "Battery", Apps::BatteryInfo}, {Symbols::check, "Firmware", Apps::FirmwareValidation}, {Symbols::list, "About", Apps::SysInfo}, - {"", "", Apps::None}, - } - - }; + }}; return std::unique_ptr(new Screens::List(1, 2, app, settingsController, applications)); } diff --git a/src/libs/lv_conf.h b/src/libs/lv_conf.h index e774091..761baba 100644 --- a/src/libs/lv_conf.h +++ b/src/libs/lv_conf.h @@ -415,8 +415,8 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(jetbrains_mono_bold_20) \ LV_FONT_DECLARE(jetbrains_mono_extrabold_compressed) \ + LV_FONT_DECLARE(jetbrains_mono_42) \ LV_FONT_DECLARE(jetbrains_mono_76) \ - LV_FONT_DECLARE(open_sans_light) \ LV_FONT_DECLARE(lv_font_sys_48) /* Enable it if you have fonts with a lot of characters. @@ -758,4 +758,4 @@ typedef void* lv_obj_user_data_t; /*--END OF LV_CONF_H--*/ -#endif /*LV_CONF_H*/ +#endif /*LV_CONF_H*/ \ No newline at end of file diff --git a/src/logging/NrfLogger.cpp b/src/logging/NrfLogger.cpp index 70a00e6..1c048f2 100644 --- a/src/logging/NrfLogger.cpp +++ b/src/logging/NrfLogger.cpp @@ -12,8 +12,9 @@ void NrfLogger::Init() { NRF_LOG_DEFAULT_BACKENDS_INIT(); - if (pdPASS != xTaskCreate(NrfLogger::Process, "LOGGER", 200, this, 0, &m_logger_thread)) + if (pdPASS != xTaskCreate(NrfLogger::Process, "LOGGER", 200, this, 0, &m_logger_thread)) { APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); + } } void NrfLogger::Process(void*) { @@ -21,7 +22,7 @@ void NrfLogger::Process(void*) { // Suppress endless loop diagnostic #pragma clang diagnostic push #pragma ide diagnostic ignored "EndlessLoop" - while (1) { + while (true) { NRF_LOG_FLUSH(); vTaskDelay(100); // Not good for power consumption, it will wake up every 100ms... } -- cgit v0.10.2 From 108bbc3642f9e6ca614ab4b470eb8ae34e739ffe Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Tue, 18 May 2021 18:03:26 +0200 Subject: Fix it again.. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index acbfba1..5b83812 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -421,6 +421,7 @@ list(APPEND SOURCE_FILES displayapp/icons/bg_clock.c displayapp/screens/WatchFaceAnalog.cpp displayapp/screens/WatchFaceDigital.cpp + displayapp/screens/PineTimeStyle.cpp ## @@ -470,6 +471,7 @@ list(APPEND SOURCE_FILES displayapp/fonts/jetbrains_mono_76.c displayapp/fonts/jetbrains_mono_42.c displayapp/fonts/lv_font_sys_48.c + displayapp/fonts/open_sans_light.c displayapp/lv_pinetime_theme.c systemtask/SystemTask.cpp diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index 1429984..e0c1f62 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -14,6 +14,7 @@ #include "../DisplayApp.h" #include "WatchFaceDigital.h" #include "WatchFaceAnalog.h" +#include "PineTimeStyle.h" using namespace Pinetime::Applications::Screens; @@ -42,6 +43,9 @@ Clock::Clock(DisplayApp* app, [this]() -> std::unique_ptr { return WatchFaceAnalogScreen(); }, + [this]() -> std::unique_ptr { + return PineTimeStyleScreen(); + }, // Examples for more watch faces //[this]() -> std::unique_ptr { return WatchFaceMinimalScreen(); }, //[this]() -> std::unique_ptr { return WatchFaceCustomScreen(); } @@ -80,6 +84,16 @@ std::unique_ptr Clock::WatchFaceAnalogScreen() { app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); } +std::unique_ptr Clock::PineTimeStyleScreen() { + return std::make_unique(app, + dateTimeController, + batteryController, + bleController, + notificatioManager, + settingsController, + heartRateController); +} + /* // Examples for more watch faces std::unique_ptr Clock::WatchFaceMinimalScreen() { @@ -91,4 +105,4 @@ std::unique_ptr Clock::WatchFaceCustomScreen() { return std::make_unique(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); } -*/ \ No newline at end of file +*/ diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h index 9879985..920d58b 100644 --- a/src/displayapp/screens/Clock.h +++ b/src/displayapp/screens/Clock.h @@ -47,9 +47,10 @@ namespace Pinetime { Controllers::HeartRateController& heartRateController; Controllers::MotionController& motionController; - ScreenList<2> screens; + ScreenList<3> screens; std::unique_ptr WatchFaceDigitalScreen(); std::unique_ptr WatchFaceAnalogScreen(); + std::unique_ptr PineTimeStyleScreen(); // Examples for more watch faces // std::unique_ptr WatchFaceMinimalScreen(); diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp index 457cebf..33d4141 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.cpp +++ b/src/displayapp/screens/settings/SettingWatchFace.cpp @@ -59,6 +59,15 @@ SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pine } optionsTotal++; + cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); + lv_checkbox_set_text_static(cbOption[optionsTotal], " PineTimeStyle"); + cbOption[optionsTotal]->user_data = this; + lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); + if (settingsController.GetClockFace() == 2) { + lv_checkbox_set_checked(cbOption[optionsTotal], true); + } + + optionsTotal++; } SettingWatchFace::~SettingWatchFace() { @@ -81,4 +90,4 @@ void SettingWatchFace::UpdateSelected(lv_obj_t* object, lv_event_t event) { } } } -} \ No newline at end of file +} diff --git a/src/libs/lv_conf.h b/src/libs/lv_conf.h index 761baba..cabc185 100644 --- a/src/libs/lv_conf.h +++ b/src/libs/lv_conf.h @@ -417,6 +417,7 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in LV_FONT_DECLARE(jetbrains_mono_extrabold_compressed) \ LV_FONT_DECLARE(jetbrains_mono_42) \ LV_FONT_DECLARE(jetbrains_mono_76) \ + LV_FONT_DECLARE(open_sans_light) \ LV_FONT_DECLARE(lv_font_sys_48) /* Enable it if you have fonts with a lot of characters. @@ -758,4 +759,4 @@ typedef void* lv_obj_user_data_t; /*--END OF LV_CONF_H--*/ -#endif /*LV_CONF_H*/ \ No newline at end of file +#endif /*LV_CONF_H*/ -- cgit v0.10.2 From 5daaa5cf75b23e80776614af263c23e6433365e3 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Wed, 19 May 2021 11:03:33 +0200 Subject: Tidying/formatting fixes diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index b249416..10f2da6 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -15,6 +15,21 @@ #include "../DisplayApp.h" /* + * This file is part of the Infinitime distribution (https://github.com/JF002/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) @@ -38,7 +53,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, settingsController {settingsController}, heartRateController {heartRateController} { - /* This sets the watchface number to return to after leaving the menu*/ + /* This sets the watchface number to return to after leaving the menu */ settingsController.SetClockFace(2); displayedChar[0] = 0; @@ -47,7 +62,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, displayedChar[3] = 0; displayedChar[4] = 0; - /*Create a 200px wide background rectangle*/ + /* 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, lv_color_hex(0x000000)); @@ -55,7 +70,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, lv_obj_set_size(timebar, 200, 240); lv_obj_align(timebar, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 0); - /*Display the time*/ + /* 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); @@ -69,7 +84,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, lv_label_set_text(timeDD2, "34"); lv_obj_align(timeDD2, timebar, LV_ALIGN_IN_BOTTOM_MID, 5, -5); - /*Create a 40px wide bar down the right side of the screen*/ + /* 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, lv_color_hex(0x008080)); @@ -77,7 +92,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, lv_obj_set_size(sidebar, 40, 240); lv_obj_align(sidebar, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0); - /*Display icons*/ + /* 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_hex(0x000000)); @@ -86,17 +101,14 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, batteryPlug = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(batteryPlug, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); - //lv_label_set_text(batteryPlug, Symbols::plug); lv_obj_align(batteryPlug, sidebar, LV_ALIGN_IN_TOP_MID, 0, 2); 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(bleIcon, BleIcon::GetIcon(false)); lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); 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(notificationIcon, NotificationIcon::GetIcon(false)); lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 40); /* Calendar icon */ @@ -137,7 +149,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, lv_obj_set_size(calendarCrossBar2, 8, 3); lv_obj_align(calendarCrossBar2, calendarBar2, LV_ALIGN_IN_BOTTOM_MID, 0, 0); - /*Display date*/ + /* 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_hex(0x000000)); @@ -154,7 +166,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, lv_label_set_text(dateMonth, "MAR"); lv_obj_align(dateMonth, sidebar, LV_ALIGN_CENTER, 0, 32); - /*Display heartrate info*/ + /* Display heartrate info */ heartbeatIcon = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); @@ -208,10 +220,8 @@ bool PineTimeStyle::Refresh() { if (notificationState.Get() == true) { lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true)); lv_obj_realign(notificationIcon); - //lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25); } else { lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); - //lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); } } @@ -248,7 +258,7 @@ bool PineTimeStyle::Refresh() { char hourStr[3]; char minStr[3]; - /*Display the time as 2 pairs of digits*/ + /* Display the time as 2 pairs of digits */ sprintf(hourStr, "%c%c", hoursChar[0], hoursChar[1]); lv_label_set_text(timeDD1, hourStr); -- cgit v0.10.2 From 249b6db6f5a5a7ac6cfaf96b1d8e59306ffe1333 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Wed, 19 May 2021 17:05:33 +0200 Subject: Remove newline modifications diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index e0c1f62..4f0efd9 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -105,4 +105,4 @@ std::unique_ptr Clock::WatchFaceCustomScreen() { return std::make_unique(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); } -*/ +*/ \ No newline at end of file diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index 10f2da6..f6597ca 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -301,4 +301,4 @@ bool PineTimeStyle::Refresh() { } return running; -} +} \ No newline at end of file diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp index 33d4141..3e73489 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.cpp +++ b/src/displayapp/screens/settings/SettingWatchFace.cpp @@ -90,4 +90,4 @@ void SettingWatchFace::UpdateSelected(lv_obj_t* object, lv_event_t event) { } } } -} +} \ No newline at end of file diff --git a/src/libs/lv_conf.h b/src/libs/lv_conf.h index cabc185..a03a483 100644 --- a/src/libs/lv_conf.h +++ b/src/libs/lv_conf.h @@ -759,4 +759,4 @@ typedef void* lv_obj_user_data_t; /*--END OF LV_CONF_H--*/ -#endif /*LV_CONF_H*/ +#endif /*LV_CONF_H*/ \ No newline at end of file -- cgit v0.10.2 From 5c413016a7b9e78040fb8e5b48cd37b7963362df Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Wed, 19 May 2021 17:27:42 +0200 Subject: Move GPL license header diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index f6597ca..787bb40 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -1,19 +1,3 @@ -#include "PineTimeStyle.h" - -#include -#include -#include -#include "BatteryIcon.h" -#include "BleIcon.h" -#include "NotificationIcon.h" -#include "Symbols.h" -#include "components/battery/BatteryController.h" -#include "components/ble/BleController.h" -#include "components/ble/NotificationManager.h" -#include "components/heartrate/HeartRateController.h" -#include "components/settings/Settings.h" -#include "../DisplayApp.h" - /* * This file is part of the Infinitime distribution (https://github.com/JF002/Infinitime). * Copyright (c) 2021 Kieran Cawthray. @@ -35,6 +19,21 @@ * Style/layout copied from TimeStyle for Pebble by Dan Tilden (github.com/tilden) */ +#include "PineTimeStyle.h" +#include +#include +#include +#include "BatteryIcon.h" +#include "BleIcon.h" +#include "NotificationIcon.h" +#include "Symbols.h" +#include "components/battery/BatteryController.h" +#include "components/ble/BleController.h" +#include "components/ble/NotificationManager.h" +#include "components/heartrate/HeartRateController.h" +#include "components/settings/Settings.h" +#include "../DisplayApp.h" + using namespace Pinetime::Applications::Screens; PineTimeStyle::PineTimeStyle(DisplayApp* app, -- cgit v0.10.2 From 607af27ba8790f68d06d7cc855ef3058558defd7 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Sun, 20 Jun 2021 21:53:09 +0200 Subject: Add step count gauge - replaces heartrate in sidebar diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 83f2439..aca8654 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -235,6 +235,7 @@ set(LVGL_SRC libs/lvgl/src/lv_widgets/lv_cont.h libs/lvgl/src/lv_widgets/lv_cpicker.h libs/lvgl/src/lv_widgets/lv_dropdown.h + libs/lvgl/src/lv_widgets/lv_gauge.h libs/lvgl/src/lv_widgets/lv_img.h libs/lvgl/src/lv_widgets/lv_imgbtn.h libs/lvgl/src/lv_widgets/lv_keyboard.h @@ -321,6 +322,7 @@ set(LVGL_SRC libs/lvgl/src/lv_widgets/lv_cont.c libs/lvgl/src/lv_widgets/lv_cpicker.c libs/lvgl/src/lv_widgets/lv_dropdown.c + libs/lvgl/src/lv_widgets/lv_gauge.c libs/lvgl/src/lv_widgets/lv_img.c libs/lvgl/src/lv_widgets/lv_imgbtn.c libs/lvgl/src/lv_widgets/lv_keyboard.c diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index 3b288d9..e068497 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -87,7 +87,7 @@ std::unique_ptr Clock::PineTimeStyleScreen() { bleController, notificatioManager, settingsController, - heartRateController); + motionController); } /* diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index 787bb40..ab6e2a7 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -30,7 +30,7 @@ #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" #include "../DisplayApp.h" @@ -42,7 +42,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, Controllers::Ble& bleController, Controllers::NotificationManager& notificatioManager, Controllers::Settings& settingsController, - Controllers::HeartRateController& heartRateController) + Controllers::MotionController& motionController) : Screen(app), currentDateTime {{}}, dateTimeController {dateTimeController}, @@ -50,7 +50,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, bleController {bleController}, notificatioManager {notificatioManager}, settingsController {settingsController}, - heartRateController {heartRateController} { + motionController {motionController} { /* This sets the watchface number to return to after leaving the menu */ settingsController.SetClockFace(2); @@ -165,17 +165,29 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, lv_label_set_text(dateMonth, "MAR"); lv_obj_align(dateMonth, sidebar, LV_ALIGN_CENTER, 0, 32); - /* Display heartrate info */ - - heartbeatIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); - lv_label_set_text(heartbeatIcon, Symbols::heartBeat); - lv_obj_align(heartbeatIcon, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, -30); - - heartbeatValue = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); - lv_label_set_text(heartbeatValue, "---"); - lv_obj_align(heartbeatValue, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, -10); + // Step count gauge + static lv_color_t needle_colors[1]; + 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, (settingsController.GetStepsGoal() / 100)); + lv_gauge_set_range(stepGauge, 0, (settingsController.GetStepsGoal() / 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, 4); + 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); @@ -286,17 +298,11 @@ bool PineTimeStyle::Refresh() { } } - heartbeat = heartRateController.HeartRate(); - heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped; - if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) { - char heartbeatBuffer[4]; - if (heartbeatRunning.Get()) - sprintf(heartbeatBuffer, "%d", heartbeat.Get()); - else - sprintf(heartbeatBuffer, "---"); - - lv_label_set_text(heartbeatValue, heartbeatBuffer); - lv_obj_realign(heartbeatValue); + stepCount = motionController.NbSteps(); + motionSensorOk = motionController.IsSensorOk(); + if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) { + lv_gauge_set_value(stepGauge, 0, (stepCount.Get() / 100)); + lv_obj_realign(stepGauge); } return running; diff --git a/src/displayapp/screens/PineTimeStyle.h b/src/displayapp/screens/PineTimeStyle.h index 5575241..4530bb5f 100644 --- a/src/displayapp/screens/PineTimeStyle.h +++ b/src/displayapp/screens/PineTimeStyle.h @@ -27,7 +27,7 @@ namespace Pinetime { Controllers::Ble& bleController, Controllers::NotificationManager& notificatioManager, Controllers::Settings& settingsController, - Controllers::HeartRateController& heartRateController); + Controllers::MotionController& motionController); ~PineTimeStyle() override; bool Refresh() override; @@ -45,8 +45,8 @@ namespace Pinetime { DirtyValue batteryPercentRemaining {}; DirtyValue bleState {}; DirtyValue> currentDateTime {}; - DirtyValue heartbeat {}; - DirtyValue heartbeatRunning {}; + DirtyValue motionSensorOk {}; + DirtyValue stepCount {}; DirtyValue notificationState {}; lv_obj_t* timebar; @@ -70,13 +70,14 @@ namespace Pinetime { lv_obj_t* heartbeatValue; lv_obj_t* heartbeatBpm; lv_obj_t* notificationIcon; + lv_obj_t* stepGauge; Controllers::DateTime& dateTimeController; Controllers::Battery& batteryController; Controllers::Ble& bleController; Controllers::NotificationManager& notificatioManager; Controllers::Settings& settingsController; - Controllers::HeartRateController& heartRateController; + Controllers::MotionController& motionController; }; } } -- cgit v0.10.2 From 266573deff61b25e924738bc046c03edfeeb0ef8 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Sun, 20 Jun 2021 21:57:28 +0200 Subject: Enable 12/24h functionality diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index ab6e2a7..6f7ec3a 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -83,6 +83,12 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, lv_label_set_text(timeDD2, "34"); 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, lv_color_hex(0x008080)); + lv_obj_set_style_local_text_line_space(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -3); + lv_label_set_text(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); @@ -257,7 +263,25 @@ bool PineTimeStyle::Refresh() { sprintf(minutesChar, "%02d", static_cast(minute)); char hoursChar[3]; - sprintf(hoursChar, "%02d", hour); + char ampmChar[5]; + + if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) { + sprintf(hoursChar, "%02d", hour); + } else { + if (hour == 0 && hour != 12) { + hour = 12; + sprintf(ampmChar, "A\nM"); + } else if (hour == 12 && hour != 0) { + hour = 12; + sprintf(ampmChar, "P\nM"); + } else if (hour < 12 && hour != 0) { + sprintf(ampmChar, "A\nM"); + } else if (hour > 12 && hour != 0) { + hour = hour - 12; + sprintf(ampmChar, "P\nM"); + } + sprintf(hoursChar, "%02d", hour); + } if (hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] || minutesChar[1] != displayedChar[3]) { @@ -269,6 +293,10 @@ bool PineTimeStyle::Refresh() { char hourStr[3]; char minStr[3]; + if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { + lv_label_set_text(timeAMPM, ampmChar); + } + /* Display the time as 2 pairs of digits */ sprintf(hourStr, "%c%c", hoursChar[0], hoursChar[1]); lv_label_set_text(timeDD1, hourStr); diff --git a/src/displayapp/screens/PineTimeStyle.h b/src/displayapp/screens/PineTimeStyle.h index 4530bb5f..7c99c6a 100644 --- a/src/displayapp/screens/PineTimeStyle.h +++ b/src/displayapp/screens/PineTimeStyle.h @@ -53,6 +53,7 @@ namespace Pinetime { 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; -- cgit v0.10.2 From be505fc15fef5d87c311a442f291dd1cbd86fd40 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Mon, 21 Jun 2021 20:06:47 +0200 Subject: Set step gauge outer to be white when step goal is reached diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index 6f7ec3a..0dc4117 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -329,8 +329,12 @@ bool PineTimeStyle::Refresh() { stepCount = motionController.NbSteps(); motionSensorOk = motionController.IsSensorOk(); if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) { - lv_gauge_set_value(stepGauge, 0, (stepCount.Get() / 100)); - lv_obj_realign(stepGauge); + lv_gauge_set_value(stepGauge, 0, (stepCount.Get() / 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); + } } return running; -- cgit v0.10.2 From c3f854ba65967631282a719743f68943f4c6c86f Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Tue, 22 Jun 2021 21:32:27 +0200 Subject: Add font source file diff --git a/src/displayapp/fonts/open_sans_light.ttf b/src/displayapp/fonts/open_sans_light.ttf new file mode 100644 index 0000000..0d38189 Binary files /dev/null and b/src/displayapp/fonts/open_sans_light.ttf differ -- cgit v0.10.2 From 14721e8f1ef3fd8ebfe2bf870416c7f343f83936 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Wed, 23 Jun 2021 22:14:34 +0200 Subject: Move static needle_colors array to member variable diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index 0dc4117..678099c 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -172,7 +172,6 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, lv_obj_align(dateMonth, sidebar, LV_ALIGN_CENTER, 0, 32); // Step count gauge - static lv_color_t needle_colors[1]; needle_colors[0] = LV_COLOR_WHITE; stepGauge = lv_gauge_create(lv_scr_act(), nullptr); lv_gauge_set_needle_count(stepGauge, 1, needle_colors); diff --git a/src/displayapp/screens/PineTimeStyle.h b/src/displayapp/screens/PineTimeStyle.h index 7c99c6a..70794cc 100644 --- a/src/displayapp/screens/PineTimeStyle.h +++ b/src/displayapp/screens/PineTimeStyle.h @@ -72,6 +72,7 @@ namespace Pinetime { lv_obj_t* heartbeatBpm; lv_obj_t* notificationIcon; lv_obj_t* stepGauge; + lv_color_t needle_colors[1]; Controllers::DateTime& dateTimeController; Controllers::Battery& batteryController; -- cgit v0.10.2 From 38ab0add487183c2f7e0a1e545de49a8ad7b17e1 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Thu, 24 Jun 2021 19:15:23 +0200 Subject: PineTimeStyle color picker initial commit diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aca8654..caf015b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -420,6 +420,7 @@ list(APPEND SOURCE_FILES displayapp/screens/settings/SettingWakeUp.cpp displayapp/screens/settings/SettingDisplay.cpp displayapp/screens/settings/SettingSteps.cpp + displayapp/screens/settings/SettingPineTimeStyle.cpp ## Watch faces displayapp/icons/bg_clock.c diff --git a/src/displayapp/Apps.h b/src/displayapp/Apps.h index 684e3a4..dd51fdb 100644 --- a/src/displayapp/Apps.h +++ b/src/displayapp/Apps.h @@ -30,7 +30,8 @@ namespace Pinetime { SettingTimeFormat, SettingDisplay, SettingWakeUp, - SettingSteps + SettingSteps, + SettingPineTimeStyle }; } } diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index de93428..48a012a 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -42,6 +42,7 @@ #include "displayapp/screens/settings/SettingWakeUp.h" #include "displayapp/screens/settings/SettingDisplay.h" #include "displayapp/screens/settings/SettingSteps.h" +#include "displayapp/screens/settings/SettingPineTimeStyle.h" using namespace Pinetime::Applications; using namespace Pinetime::Applications::Display; @@ -323,6 +324,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::SettingPineTimeStyle: + 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/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp new file mode 100644 index 0000000..3aceeb7 --- /dev/null +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp @@ -0,0 +1,302 @@ +#include "SettingPineTimeStyle.h" +#include +#include "displayapp/DisplayApp.h" +#include "displayapp/screens/Symbols.h" + +using namespace Pinetime::Applications::Screens; + +namespace { + static void event_handler(lv_obj_t * obj, lv_event_t event) { + SettingPineTimeStyle* screen = static_cast(obj->user_data); + screen->UpdateSelected(obj, event); + } +} + +SettingPineTimeStyle::SettingPineTimeStyle( + Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) : + Screen(app), + settingsController{settingsController} +{ + + timebar = lv_obj_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); + 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, 5, 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, lv_color_hex(0x008080)); + lv_label_set_text(timeDD1, "12"); + 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, lv_color_hex(0x008080)); + lv_label_set_text(timeDD2, "34"); + 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, lv_color_hex(0x008080)); + lv_obj_set_style_local_text_line_space(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -3); + lv_label_set_text(timeAMPM, "A\nM"); + 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, lv_color_hex(0x008080)); + 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_hex(0x000000)); + lv_label_set_text(batteryIcon, Symbols::batteryFull); + lv_obj_align(batteryIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 2); + + 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(bleIcon, Symbols::bluetooth); + lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); + + /* 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_hex(0x000000)); + 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_hex(0xffffff)); + 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_hex(0x000000)); + 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_hex(0x000000)); + 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_hex(0x000000)); + 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_hex(0x000000)); + 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_hex(0x000000)); + lv_label_set_text(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_hex(0x000000)); + lv_label_set_text(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_hex(0x000000)); + lv_label_set_text(dateMonth, "MAR"); + lv_obj_align(dateMonth, sidebar, LV_ALIGN_CENTER, 0, 32); + + // Step count gauge + 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, 4); + lv_obj_set_style_local_pad_inner(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4); + +// lv_style_copy(&style_button, &lv_style_plain_color); +// style_button.body.opa = LV_OPA_50; + btnNextTime = lv_btn_create(lv_scr_act(), nullptr); + btnNextTime->user_data = this; + lv_obj_set_size(btnNextTime, 50, 50); + lv_obj_align(btnNextTime, lv_scr_act(), LV_ALIGN_CENTER, 55, -80); + lv_obj_set_style_local_value_str(btnNextTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">"); + lv_obj_set_event_cb(btnNextTime, event_handler); + + btnPrevTime = lv_btn_create(lv_scr_act(), nullptr); + btnPrevTime->user_data = this; + lv_obj_set_size(btnPrevTime, 50, 50); + lv_obj_align(btnPrevTime, lv_scr_act(), LV_ALIGN_CENTER, -55, -80); + lv_obj_set_style_local_value_str(btnPrevTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<"); + lv_obj_set_event_cb(btnPrevTime, event_handler); + + btnNextBar = lv_btn_create(lv_scr_act(), nullptr); + btnNextBar->user_data = this; + lv_obj_set_size(btnNextBar, 50, 50); + lv_obj_align(btnNextBar, lv_scr_act(), LV_ALIGN_CENTER, 55, 0); + lv_obj_set_style_local_value_str(btnNextBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">"); + lv_obj_set_event_cb(btnNextBar, event_handler); + + btnPrevBar = lv_btn_create(lv_scr_act(), nullptr); + btnPrevBar->user_data = this; + lv_obj_set_size(btnPrevBar, 50, 50); + lv_obj_align(btnPrevBar, lv_scr_act(), LV_ALIGN_CENTER, -55, 0); + lv_obj_set_style_local_value_str(btnPrevBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<"); + lv_obj_set_event_cb(btnPrevBar, event_handler); + + btnNextBG = lv_btn_create(lv_scr_act(), nullptr); + btnNextBG->user_data = this; + lv_obj_set_size(btnNextBG, 50, 50); + lv_obj_align(btnNextBG, lv_scr_act(), LV_ALIGN_CENTER, 55, 80); + lv_obj_set_style_local_value_str(btnNextBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">"); + lv_obj_set_event_cb(btnNextBG, event_handler); + + btnPrevBG = lv_btn_create(lv_scr_act(), nullptr); + btnPrevBG->user_data = this; + lv_obj_set_size(btnPrevBG, 50, 50); + lv_obj_align(btnPrevBG, lv_scr_act(), LV_ALIGN_CENTER, -55, 80); + lv_obj_set_style_local_value_str(btnPrevBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<"); + lv_obj_set_event_cb(btnPrevBG, event_handler); + + 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, ""); + + +/* + + stepValue = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_font(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); + lv_label_set_text_fmt(stepValue,"%i", settingsController.GetStepsGoal()); + lv_label_set_align(stepValue, LV_LABEL_ALIGN_CENTER); + lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); + + btnPlus = lv_btn_create(lv_scr_act(), nullptr); + btnPlus->user_data = this; + lv_obj_set_size(btnPlus, 80, 50); + lv_obj_align(btnPlus, lv_scr_act(), LV_ALIGN_CENTER, 55, 80); + lv_obj_set_style_local_value_str(btnPlus, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "+"); + lv_obj_set_event_cb(btnPlus, event_handler); + + btnMinus = lv_btn_create(lv_scr_act(), nullptr); + btnMinus->user_data = this; + lv_obj_set_size(btnMinus, 80, 50); + lv_obj_set_event_cb(btnMinus, event_handler); + lv_obj_align(btnMinus, lv_scr_act(), LV_ALIGN_CENTER, -55, 80); + lv_obj_set_style_local_value_str(btnMinus, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "-"); +*/ +} + +SettingPineTimeStyle::~SettingPineTimeStyle() { + lv_obj_clean(lv_scr_act()); + settingsController.SaveSettings(); +} + +bool SettingPineTimeStyle::Refresh() { + return running; +} + +void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { + uint8_t value = 0; + lv_color_t pts_colors[17] = {LV_COLOR_WHITE, LV_COLOR_SILVER, LV_COLOR_GRAY, LV_COLOR_BLACK, + LV_COLOR_RED, LV_COLOR_MAROON, LV_COLOR_YELLOW, LV_COLOR_OLIVE, + LV_COLOR_LIME, LV_COLOR_GREEN, LV_COLOR_CYAN, LV_COLOR_TEAL, + LV_COLOR_BLUE, LV_COLOR_NAVY, LV_COLOR_MAGENTA, LV_COLOR_PURPLE, + LV_COLOR_ORANGE}; + + if((object == btnNextBar) && (event == LV_EVENT_PRESSED)) { + if ( value < 16 ) { + value += 1; + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + } + } + if((object == btnPrevBar) && (event == LV_EVENT_PRESSED)) { + if ( value > 0 ) { + value -= 1; + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + } + } + if((object == btnNextTime) && (event == LV_EVENT_PRESSED)) { + if ( value < 16 ) { + value += 1; + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + } + } + if((object == btnPrevTime) && (event == LV_EVENT_PRESSED)) { + if ( value > 0 ) { + value -= 1; + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + } + } + if((object == btnNextBG) && (event == LV_EVENT_PRESSED)) { + if ( value < 16 ) { + value += 1; + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + } + } + + if((object == btnPrevBG) && (event == LV_EVENT_PRESSED)) { + if ( value > 0 ) { + value -= 1; + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + } + } + + + +/* + uint32_t value = settingsController.GetStepsGoal(); + if(object == btnPlus && (event == LV_EVENT_PRESSED)) { + value += 1000; + if ( value <= 500000 ) { + settingsController.SetStepsGoal(value); + lv_label_set_text_fmt(stepValue,"%i", settingsController.GetStepsGoal()); + lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); + } + } + + if(object == btnMinus && (event == LV_EVENT_PRESSED)) { + value -= 1000; + if ( value >= 1000 ) { + settingsController.SetStepsGoal(value); + lv_label_set_text_fmt(stepValue,"%i", settingsController.GetStepsGoal()); + lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); + } + } +*/ +} \ No newline at end of file diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.h b/src/displayapp/screens/settings/SettingPineTimeStyle.h new file mode 100644 index 0000000..5b5e61b --- /dev/null +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.h @@ -0,0 +1,58 @@ +#pragma once + +#include +#include +#include "components/settings/Settings.h" +#include "displayapp/screens/Screen.h" + +namespace Pinetime { + + namespace Applications { + namespace Screens { + + class SettingPineTimeStyle : public Screen{ + public: + SettingPineTimeStyle(DisplayApp* app, Pinetime::Controllers::Settings &settingsController); + ~SettingPineTimeStyle() override; + + bool Refresh() override; + void UpdateSelected(lv_obj_t *object, lv_event_t event); + + private: + + Controllers::Settings& settingsController; + + 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 * timeColor; + lv_obj_t * barColor; + lv_obj_t * bgColor; + 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 * stepGauge; + lv_color_t needle_colors[1]; + lv_color_t pts_colors[17]; + + }; + } + } +} diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index e63a358..7334780 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -18,6 +18,9 @@ Settings::Settings(Pinetime::Applications::DisplayApp* app, Pinetime::Controller }, [this]() -> std::unique_ptr { return CreateScreen2(); + }, + [this]() -> std::unique_ptr { + return CreateScreen3(); }}, Screens::ScreenListModes::UpDown} { } @@ -60,3 +63,15 @@ std::unique_ptr Settings::CreateScreen2() { return std::make_unique(1, 2, app, settingsController, applications); } + +std::unique_ptr Settings::CreateScreen3() { + + std::array applications {{ + {Symbols::paintbrush, "PTS Colors", Apps::SettingPineTimeStyle}, + {Symbols::none, "None", Apps::None}, + {Symbols::none, "None", Apps::None}, + {Symbols::none, "None", Apps::None}, + }}; + + return std::make_unique(2, 2, app, settingsController, applications); +} diff --git a/src/displayapp/screens/settings/Settings.h b/src/displayapp/screens/settings/Settings.h index 711a6be..12dd051 100644 --- a/src/displayapp/screens/settings/Settings.h +++ b/src/displayapp/screens/settings/Settings.h @@ -21,10 +21,11 @@ namespace Pinetime { private: Controllers::Settings& settingsController; - ScreenList<2> screens; + ScreenList<3> screens; std::unique_ptr CreateScreen1(); std::unique_ptr CreateScreen2(); + std::unique_ptr CreateScreen3(); }; } } -- cgit v0.10.2 From 7edfc534819ba7b9a14523d84df62952852a0fe3 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Thu, 24 Jun 2021 21:49:04 +0200 Subject: PineTimeStyle color picker add settings integration diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 4409425..69e28e5 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -27,6 +27,33 @@ namespace Pinetime { return settings.clockFace; }; + void SetPTSColorTime(uint8_t colorTime) { + if (colorTime != settings.PTSColorTime) + settingsChanged = true; + settings.PTSColorTime = colorTime; + }; + uint8_t GetPTSColorTime() const { + return settings.PTSColorTime; + }; + + void SetPTSColorBar(uint8_t colorBar) { + if (colorBar != settings.PTSColorBar) + settingsChanged = true; + settings.PTSColorBar = colorBar; + }; + uint8_t GetPTSColorBar() const { + return settings.PTSColorBar; + }; + + void SetPTSColorBG(uint8_t colorBG) { + if (colorBG != settings.PTSColorBG) + settingsChanged = true; + settings.PTSColorBG = colorBG; + }; + uint8_t GetPTSColorBG() const { + return settings.PTSColorBG; + }; + void SetAppMenu(uint8_t menu) { appMenu = menu; }; @@ -103,6 +130,10 @@ namespace Pinetime { uint8_t clockFace = 0; + uint8_t PTSColorTime = 11; + uint8_t PTSColorBar = 11; + uint8_t PTSColorBG = 3; + uint32_t stepsGoal = 10000; uint32_t screenTimeOut = 15000; diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp index 3aceeb7..3673e79 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp @@ -12,6 +12,12 @@ namespace { } } +lv_color_t pts_colors[17] = {LV_COLOR_WHITE, LV_COLOR_SILVER, LV_COLOR_GRAY, LV_COLOR_BLACK, + LV_COLOR_RED, LV_COLOR_MAROON, LV_COLOR_YELLOW, LV_COLOR_OLIVE, + LV_COLOR_LIME, LV_COLOR_GREEN, LV_COLOR_CYAN, LV_COLOR_TEAL, + LV_COLOR_BLUE, LV_COLOR_NAVY, LV_COLOR_MAGENTA, LV_COLOR_PURPLE, + LV_COLOR_ORANGE}; + SettingPineTimeStyle::SettingPineTimeStyle( Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) : Screen(app), @@ -19,7 +25,7 @@ SettingPineTimeStyle::SettingPineTimeStyle( { timebar = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); 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, 5, 0); @@ -28,18 +34,18 @@ SettingPineTimeStyle::SettingPineTimeStyle( 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, lv_color_hex(0x008080)); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_TEAL); lv_label_set_text(timeDD1, "12"); 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, lv_color_hex(0x008080)); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_TEAL); lv_label_set_text(timeDD2, "34"); 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, lv_color_hex(0x008080)); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_TEAL); lv_obj_set_style_local_text_line_space(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -3); lv_label_set_text(timeAMPM, "A\nM"); lv_obj_align(timeAMPM, timebar, LV_ALIGN_IN_BOTTOM_LEFT, 2, -20); @@ -47,7 +53,7 @@ SettingPineTimeStyle::SettingPineTimeStyle( /* 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, lv_color_hex(0x008080)); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_TEAL); 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); @@ -142,6 +148,13 @@ SettingPineTimeStyle::SettingPineTimeStyle( lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4); 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(backgroundLabel, ""); + // lv_style_copy(&style_button, &lv_style_plain_color); // style_button.body.opa = LV_OPA_50; btnNextTime = lv_btn_create(lv_scr_act(), nullptr); @@ -186,14 +199,6 @@ SettingPineTimeStyle::SettingPineTimeStyle( lv_obj_set_style_local_value_str(btnPrevBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<"); lv_obj_set_event_cb(btnPrevBG, event_handler); - 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, ""); - - /* stepValue = lv_label_create(lv_scr_act(), nullptr); @@ -228,52 +233,55 @@ bool SettingPineTimeStyle::Refresh() { } void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { - uint8_t value = 0; - lv_color_t pts_colors[17] = {LV_COLOR_WHITE, LV_COLOR_SILVER, LV_COLOR_GRAY, LV_COLOR_BLACK, - LV_COLOR_RED, LV_COLOR_MAROON, LV_COLOR_YELLOW, LV_COLOR_OLIVE, - LV_COLOR_LIME, LV_COLOR_GREEN, LV_COLOR_CYAN, LV_COLOR_TEAL, - LV_COLOR_BLUE, LV_COLOR_NAVY, LV_COLOR_MAGENTA, LV_COLOR_PURPLE, - LV_COLOR_ORANGE}; + uint8_t valueTime = settingsController.GetPTSColorTime(); + uint8_t valueBar = settingsController.GetPTSColorBar(); + uint8_t valueBG = settingsController.GetPTSColorBG(); - if((object == btnNextBar) && (event == LV_EVENT_PRESSED)) { - if ( value < 16 ) { - value += 1; - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + if((object == btnNextTime) && (event == LV_EVENT_PRESSED)) { + if ( valueTime < 17 ) { + valueTime += 1; + settingsController.SetPTSColorTime(valueTime); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); } } - if((object == btnPrevBar) && (event == LV_EVENT_PRESSED)) { - if ( value > 0 ) { - value -= 1; - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + if((object == btnPrevTime) && (event == LV_EVENT_PRESSED)) { + if ( valueTime > 0 ) { + valueTime -= 1; + settingsController.SetPTSColorTime(valueTime); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); } } - if((object == btnNextTime) && (event == LV_EVENT_PRESSED)) { - if ( value < 16 ) { - value += 1; - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + if((object == btnNextBar) && (event == LV_EVENT_PRESSED)) { + if ( valueBar < 17 ) { + valueBar += 1; + settingsController.SetPTSColorBar(valueBar); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); } } - if((object == btnPrevTime) && (event == LV_EVENT_PRESSED)) { - if ( value > 0 ) { - value -= 1; - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + if((object == btnPrevBar) && (event == LV_EVENT_PRESSED)) { + if ( valueBar > 0 ) { + valueBar -= 1; + settingsController.SetPTSColorBar(valueBar); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); } } if((object == btnNextBG) && (event == LV_EVENT_PRESSED)) { - if ( value < 16 ) { - value += 1; - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + if ( valueBG < 17 ) { + valueBG += 1; + settingsController.SetPTSColorBG(valueBG); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } } if((object == btnPrevBG) && (event == LV_EVENT_PRESSED)) { - if ( value > 0 ) { - value -= 1; - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[value]); + if ( valueBG > 0 ) { + valueBG -= 1; + settingsController.SetPTSColorBG(valueBG); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } } -- cgit v0.10.2 From 8f16574992b1bb0f49b884f95cf9b7f5d709c6b6 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Thu, 24 Jun 2021 21:51:23 +0200 Subject: PineTimeStyle color picker tidying diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp index 3673e79..dcdd670 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp @@ -30,7 +30,7 @@ SettingPineTimeStyle::SettingPineTimeStyle( lv_obj_set_size(timebar, 200, 240); lv_obj_align(timebar, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 0); - /* Display the time */ + // 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); @@ -50,7 +50,7 @@ SettingPineTimeStyle::SettingPineTimeStyle( lv_label_set_text(timeAMPM, "A\nM"); lv_obj_align(timeAMPM, timebar, LV_ALIGN_IN_BOTTOM_LEFT, 2, -20); - /* Create a 40px wide bar down the right side of the screen */ + // 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, LV_COLOR_TEAL); @@ -58,7 +58,7 @@ SettingPineTimeStyle::SettingPineTimeStyle( lv_obj_set_size(sidebar, 40, 240); lv_obj_align(sidebar, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0); - /* Display icons */ + // 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_hex(0x000000)); @@ -70,7 +70,7 @@ SettingPineTimeStyle::SettingPineTimeStyle( lv_label_set_text(bleIcon, Symbols::bluetooth); lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); - /* Calendar icon */ + // 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_hex(0x000000)); @@ -108,7 +108,7 @@ SettingPineTimeStyle::SettingPineTimeStyle( lv_obj_set_size(calendarCrossBar2, 8, 3); lv_obj_align(calendarCrossBar2, calendarBar2, LV_ALIGN_IN_BOTTOM_MID, 0, 0); - /* Display date */ + // 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_hex(0x000000)); @@ -155,8 +155,6 @@ SettingPineTimeStyle::SettingPineTimeStyle( lv_obj_set_pos(backgroundLabel, 0, 0); lv_label_set_text(backgroundLabel, ""); -// lv_style_copy(&style_button, &lv_style_plain_color); -// style_button.body.opa = LV_OPA_50; btnNextTime = lv_btn_create(lv_scr_act(), nullptr); btnNextTime->user_data = this; lv_obj_set_size(btnNextTime, 50, 50); @@ -198,29 +196,6 @@ SettingPineTimeStyle::SettingPineTimeStyle( lv_obj_align(btnPrevBG, lv_scr_act(), LV_ALIGN_CENTER, -55, 80); lv_obj_set_style_local_value_str(btnPrevBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<"); lv_obj_set_event_cb(btnPrevBG, event_handler); - -/* - - stepValue = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); - lv_label_set_text_fmt(stepValue,"%i", settingsController.GetStepsGoal()); - lv_label_set_align(stepValue, LV_LABEL_ALIGN_CENTER); - lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); - - btnPlus = lv_btn_create(lv_scr_act(), nullptr); - btnPlus->user_data = this; - lv_obj_set_size(btnPlus, 80, 50); - lv_obj_align(btnPlus, lv_scr_act(), LV_ALIGN_CENTER, 55, 80); - lv_obj_set_style_local_value_str(btnPlus, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "+"); - lv_obj_set_event_cb(btnPlus, event_handler); - - btnMinus = lv_btn_create(lv_scr_act(), nullptr); - btnMinus->user_data = this; - lv_obj_set_size(btnMinus, 80, 50); - lv_obj_set_event_cb(btnMinus, event_handler); - lv_obj_align(btnMinus, lv_scr_act(), LV_ALIGN_CENTER, -55, 80); - lv_obj_set_style_local_value_str(btnMinus, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "-"); -*/ } SettingPineTimeStyle::~SettingPineTimeStyle() { @@ -276,7 +251,6 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } } - if((object == btnPrevBG) && (event == LV_EVENT_PRESSED)) { if ( valueBG > 0 ) { valueBG -= 1; @@ -284,27 +258,4 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } } - - - -/* - uint32_t value = settingsController.GetStepsGoal(); - if(object == btnPlus && (event == LV_EVENT_PRESSED)) { - value += 1000; - if ( value <= 500000 ) { - settingsController.SetStepsGoal(value); - lv_label_set_text_fmt(stepValue,"%i", settingsController.GetStepsGoal()); - lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); - } - } - - if(object == btnMinus && (event == LV_EVENT_PRESSED)) { - value -= 1000; - if ( value >= 1000 ) { - settingsController.SetStepsGoal(value); - lv_label_set_text_fmt(stepValue,"%i", settingsController.GetStepsGoal()); - lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); - } - } -*/ } \ No newline at end of file diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.h b/src/displayapp/screens/settings/SettingPineTimeStyle.h index 5b5e61b..b8ec9e9 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.h +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.h @@ -19,7 +19,6 @@ namespace Pinetime { void UpdateSelected(lv_obj_t *object, lv_event_t event); private: - Controllers::Settings& settingsController; lv_obj_t * btnNextTime; @@ -51,7 +50,6 @@ namespace Pinetime { lv_obj_t * stepGauge; lv_color_t needle_colors[1]; lv_color_t pts_colors[17]; - }; } } -- cgit v0.10.2 From 50b92e5dd6bd879b61e5038d3f064d486db864f6 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Fri, 25 Jun 2021 14:47:56 +0200 Subject: Move array to member variable, retrieve colors from settings for display diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp index dcdd670..bad0fec 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp @@ -12,20 +12,13 @@ namespace { } } -lv_color_t pts_colors[17] = {LV_COLOR_WHITE, LV_COLOR_SILVER, LV_COLOR_GRAY, LV_COLOR_BLACK, - LV_COLOR_RED, LV_COLOR_MAROON, LV_COLOR_YELLOW, LV_COLOR_OLIVE, - LV_COLOR_LIME, LV_COLOR_GREEN, LV_COLOR_CYAN, LV_COLOR_TEAL, - LV_COLOR_BLUE, LV_COLOR_NAVY, LV_COLOR_MAGENTA, LV_COLOR_PURPLE, - LV_COLOR_ORANGE}; - SettingPineTimeStyle::SettingPineTimeStyle( Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) : Screen(app), settingsController{settingsController} { - timebar = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[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, 5, 0); @@ -34,18 +27,18 @@ SettingPineTimeStyle::SettingPineTimeStyle( 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, LV_COLOR_TEAL); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]); lv_label_set_text(timeDD1, "12"); 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, LV_COLOR_TEAL); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]); lv_label_set_text(timeDD2, "34"); 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, LV_COLOR_TEAL); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]); lv_obj_set_style_local_text_line_space(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -3); lv_label_set_text(timeAMPM, "A\nM"); lv_obj_align(timeAMPM, timebar, LV_ALIGN_IN_BOTTOM_LEFT, 2, -20); @@ -53,7 +46,7 @@ SettingPineTimeStyle::SettingPineTimeStyle( // 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, LV_COLOR_TEAL); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[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); diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.h b/src/displayapp/screens/settings/SettingPineTimeStyle.h index b8ec9e9..9b20f9f 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.h +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.h @@ -49,7 +49,11 @@ namespace Pinetime { lv_obj_t * calendarCrossBar2; lv_obj_t * stepGauge; lv_color_t needle_colors[1]; - lv_color_t pts_colors[17]; + lv_color_t pts_colors[17] = {LV_COLOR_WHITE, LV_COLOR_SILVER, LV_COLOR_GRAY, LV_COLOR_BLACK, + LV_COLOR_RED, LV_COLOR_MAROON, LV_COLOR_YELLOW, LV_COLOR_OLIVE, + LV_COLOR_LIME, LV_COLOR_GREEN, LV_COLOR_CYAN, LV_COLOR_TEAL, + LV_COLOR_BLUE, LV_COLOR_NAVY, LV_COLOR_MAGENTA, LV_COLOR_PURPLE, + LV_COLOR_ORANGE}; }; } } -- cgit v0.10.2 From 878dd1a7767bb4677ea629aef9d6fb98e2b2bc1a Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Fri, 25 Jun 2021 14:58:45 +0200 Subject: Use colors from settings for PineTimeStyle watchface diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index 678099c..c75931c 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -64,7 +64,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, /* 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, lv_color_hex(0x000000)); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[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, 5, 0); @@ -73,18 +73,18 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, 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, lv_color_hex(0x008080)); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]); lv_label_set_text(timeDD1, "12"); 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, lv_color_hex(0x008080)); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]); lv_label_set_text(timeDD2, "34"); 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, lv_color_hex(0x008080)); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]); lv_obj_set_style_local_text_line_space(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -3); lv_label_set_text(timeAMPM, ""); lv_obj_align(timeAMPM, timebar, LV_ALIGN_IN_BOTTOM_LEFT, 2, -20); @@ -92,7 +92,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, /* 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, lv_color_hex(0x008080)); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[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); diff --git a/src/displayapp/screens/PineTimeStyle.h b/src/displayapp/screens/PineTimeStyle.h index 70794cc..97b39a0 100644 --- a/src/displayapp/screens/PineTimeStyle.h +++ b/src/displayapp/screens/PineTimeStyle.h @@ -73,6 +73,11 @@ namespace Pinetime { lv_obj_t* notificationIcon; lv_obj_t* stepGauge; lv_color_t needle_colors[1]; + lv_color_t pts_colors[17] = {LV_COLOR_WHITE, LV_COLOR_SILVER, LV_COLOR_GRAY, LV_COLOR_BLACK, + LV_COLOR_RED, LV_COLOR_MAROON, LV_COLOR_YELLOW, LV_COLOR_OLIVE, + LV_COLOR_LIME, LV_COLOR_GREEN, LV_COLOR_CYAN, LV_COLOR_TEAL, + LV_COLOR_BLUE, LV_COLOR_NAVY, LV_COLOR_MAGENTA, LV_COLOR_PURPLE, + LV_COLOR_ORANGE}; Controllers::DateTime& dateTimeController; Controllers::Battery& batteryController; -- cgit v0.10.2 From be22a9b1b8a3ca43cbf9e79d0a4f722d88d87ded Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Fri, 25 Jun 2021 15:09:18 +0200 Subject: Fix off-by-one error, reduce step gauge needle width diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index c75931c..cbabca6 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -191,7 +191,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, 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, 4); + 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); diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp index bad0fec..876d2b4 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp @@ -138,7 +138,7 @@ SettingPineTimeStyle::SettingPineTimeStyle( 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, 4); + 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); @@ -206,7 +206,7 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { uint8_t valueBG = settingsController.GetPTSColorBG(); if((object == btnNextTime) && (event == LV_EVENT_PRESSED)) { - if ( valueTime < 17 ) { + if ( valueTime < 16 ) { valueTime += 1; settingsController.SetPTSColorTime(valueTime); lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); @@ -224,7 +224,7 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { } } if((object == btnNextBar) && (event == LV_EVENT_PRESSED)) { - if ( valueBar < 17 ) { + if ( valueBar < 16 ) { valueBar += 1; settingsController.SetPTSColorBar(valueBar); lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); @@ -238,7 +238,7 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { } } if((object == btnNextBG) && (event == LV_EVENT_PRESSED)) { - if ( valueBG < 17 ) { + if ( valueBG < 16 ) { valueBG += 1; settingsController.SetPTSColorBG(valueBG); lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); -- cgit v0.10.2 From f3b40cb7a62c4927fb9fe921fdaa3b38809163f5 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Fri, 25 Jun 2021 19:04:29 +0200 Subject: Make it loop around when you get to the end of the list of colors diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp index 876d2b4..5e1396a 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp @@ -212,6 +212,12 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + } else { + valueTime = 0; + settingsController.SetPTSColorTime(valueTime); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); } } if((object == btnPrevTime) && (event == LV_EVENT_PRESSED)) { @@ -221,6 +227,12 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + } else { + valueTime = 16; + settingsController.SetPTSColorTime(valueTime); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); } } if((object == btnNextBar) && (event == LV_EVENT_PRESSED)) { @@ -228,6 +240,10 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { valueBar += 1; settingsController.SetPTSColorBar(valueBar); lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); + } else { + valueBar = 0; + settingsController.SetPTSColorBar(valueBar); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); } } if((object == btnPrevBar) && (event == LV_EVENT_PRESSED)) { @@ -235,6 +251,10 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { valueBar -= 1; settingsController.SetPTSColorBar(valueBar); lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); + } else { + valueBar = 16; + settingsController.SetPTSColorBar(valueBar); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); } } if((object == btnNextBG) && (event == LV_EVENT_PRESSED)) { @@ -242,6 +262,10 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { valueBG += 1; settingsController.SetPTSColorBG(valueBG); lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); + } else { + valueBG = 0; + settingsController.SetPTSColorBG(valueBG); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } } if((object == btnPrevBG) && (event == LV_EVENT_PRESSED)) { @@ -249,6 +273,10 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { valueBG -= 1; settingsController.SetPTSColorBG(valueBG); lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); + } else { + valueBG = 16; + settingsController.SetPTSColorBG(valueBG); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } } } \ No newline at end of file -- cgit v0.10.2 From 800daecf9038dc495327da71aff5dcf3cee82e40 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Fri, 25 Jun 2021 21:36:55 +0200 Subject: Add a check to set default colors if all colors are white diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index cbabca6..ad1d2db 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -207,6 +207,13 @@ PineTimeStyle::~PineTimeStyle() { } bool PineTimeStyle::Refresh() { + //Feels like a hack, but if all the colors are white, this is probably not what the user wants + if (settingsController.GetPTSColorTime() + settingsController.GetPTSColorBar() + settingsController.GetPTSColorBG() == 0) { + settingsController.SetPTSColorTime(11); + settingsController.SetPTSColorBar(11); + settingsController.SetPTSColorBG(3); + } + batteryPercentRemaining = batteryController.PercentRemaining(); if (batteryPercentRemaining.IsUpdated()) { auto batteryPercent = batteryPercentRemaining.Get(); -- cgit v0.10.2 From 6889cf1ed86f72f85a208961956ef6dff5972210 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Fri, 25 Jun 2021 21:55:51 +0200 Subject: Fix the fix, whoops diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index ad1d2db..76db86e 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -61,6 +61,13 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, displayedChar[3] = 0; displayedChar[4] = 0; + //Feels like a hack, but if all the colors are white, this is probably not what the user wants + if (settingsController.GetPTSColorTime() + settingsController.GetPTSColorBar() + settingsController.GetPTSColorBG() == 0) { + settingsController.SetPTSColorTime(11); + settingsController.SetPTSColorBar(11); + settingsController.SetPTSColorBG(3); + } + /* Create a 200px wide background rectangle */ timebar = lv_obj_create(lv_scr_act(), nullptr); @@ -207,13 +214,6 @@ PineTimeStyle::~PineTimeStyle() { } bool PineTimeStyle::Refresh() { - //Feels like a hack, but if all the colors are white, this is probably not what the user wants - if (settingsController.GetPTSColorTime() + settingsController.GetPTSColorBar() + settingsController.GetPTSColorBG() == 0) { - settingsController.SetPTSColorTime(11); - settingsController.SetPTSColorBar(11); - settingsController.SetPTSColorBG(3); - } - batteryPercentRemaining = batteryController.PercentRemaining(); if (batteryPercentRemaining.IsUpdated()) { auto batteryPercent = batteryPercentRemaining.Get(); -- cgit v0.10.2 From 660a8597f6edc66deec94782817613e1a4f84a6d Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Sun, 27 Jun 2021 15:24:17 +0200 Subject: Add reset button, reduce button opacity diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp index 5e1396a..ae66546 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp @@ -150,45 +150,59 @@ SettingPineTimeStyle::SettingPineTimeStyle( btnNextTime = lv_btn_create(lv_scr_act(), nullptr); btnNextTime->user_data = this; - lv_obj_set_size(btnNextTime, 50, 50); - lv_obj_align(btnNextTime, lv_scr_act(), LV_ALIGN_CENTER, 55, -80); + 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_30); lv_obj_set_style_local_value_str(btnNextTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">"); lv_obj_set_event_cb(btnNextTime, event_handler); btnPrevTime = lv_btn_create(lv_scr_act(), nullptr); btnPrevTime->user_data = this; - lv_obj_set_size(btnPrevTime, 50, 50); - lv_obj_align(btnPrevTime, lv_scr_act(), LV_ALIGN_CENTER, -55, -80); + 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_30); lv_obj_set_style_local_value_str(btnPrevTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<"); lv_obj_set_event_cb(btnPrevTime, event_handler); btnNextBar = lv_btn_create(lv_scr_act(), nullptr); btnNextBar->user_data = this; - lv_obj_set_size(btnNextBar, 50, 50); - lv_obj_align(btnNextBar, lv_scr_act(), LV_ALIGN_CENTER, 55, 0); + 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_30); lv_obj_set_style_local_value_str(btnNextBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">"); lv_obj_set_event_cb(btnNextBar, event_handler); btnPrevBar = lv_btn_create(lv_scr_act(), nullptr); btnPrevBar->user_data = this; - lv_obj_set_size(btnPrevBar, 50, 50); - lv_obj_align(btnPrevBar, lv_scr_act(), LV_ALIGN_CENTER, -55, 0); + 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_30); lv_obj_set_style_local_value_str(btnPrevBar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<"); lv_obj_set_event_cb(btnPrevBar, event_handler); btnNextBG = lv_btn_create(lv_scr_act(), nullptr); btnNextBG->user_data = this; - lv_obj_set_size(btnNextBG, 50, 50); - lv_obj_align(btnNextBG, lv_scr_act(), LV_ALIGN_CENTER, 55, 80); + 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_30); lv_obj_set_style_local_value_str(btnNextBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, ">"); lv_obj_set_event_cb(btnNextBG, event_handler); btnPrevBG = lv_btn_create(lv_scr_act(), nullptr); btnPrevBG->user_data = this; - lv_obj_set_size(btnPrevBG, 50, 50); - lv_obj_align(btnPrevBG, lv_scr_act(), LV_ALIGN_CENTER, -55, 80); + 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_30); lv_obj_set_style_local_value_str(btnPrevBG, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "<"); lv_obj_set_event_cb(btnPrevBG, event_handler); + + 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_30); + lv_obj_set_style_local_value_str(btnReset, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Rst"); + lv_obj_set_event_cb(btnReset, event_handler); } SettingPineTimeStyle::~SettingPineTimeStyle() { @@ -279,4 +293,14 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } } + if((object == btnReset) && (event == LV_EVENT_PRESSED)) { + settingsController.SetPTSColorTime(11); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]); + settingsController.SetPTSColorBar(11); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]); + settingsController.SetPTSColorBG(3); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[3]); + } } \ No newline at end of file diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.h b/src/displayapp/screens/settings/SettingPineTimeStyle.h index 9b20f9f..fe449b2 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.h +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.h @@ -27,6 +27,7 @@ namespace Pinetime { lv_obj_t * btnPrevBar; lv_obj_t * btnNextBG; lv_obj_t * btnPrevBG; + lv_obj_t * btnReset; lv_obj_t * timeColor; lv_obj_t * barColor; lv_obj_t * bgColor; -- cgit v0.10.2 From 9bd180896e16bf7451bf7063a646ce1d4b9e44f4 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Tue, 29 Jun 2021 21:12:39 +0200 Subject: Replace font file diff --git a/src/displayapp/fonts/open_sans_light.ttf b/src/displayapp/fonts/open_sans_light.ttf index 0d38189..6580d3a 100644 Binary files a/src/displayapp/fonts/open_sans_light.ttf and b/src/displayapp/fonts/open_sans_light.ttf differ -- cgit v0.10.2 From 2edf41be8eea79461a1f9b45a16d13f150c7e5d5 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Tue, 29 Jun 2021 21:15:39 +0200 Subject: Fix bad merge diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index 57c0f3b..76db86e 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -61,7 +61,6 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, displayedChar[3] = 0; displayedChar[4] = 0; -<<<<<<< HEAD //Feels like a hack, but if all the colors are white, this is probably not what the user wants if (settingsController.GetPTSColorTime() + settingsController.GetPTSColorBar() + settingsController.GetPTSColorBG() == 0) { settingsController.SetPTSColorTime(11); @@ -73,12 +72,6 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, timebar = lv_obj_create(lv_scr_act(), nullptr); lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorBG()]); -======= - /* 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, lv_color_hex(0x000000)); ->>>>>>> upstream/develop 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, 5, 0); @@ -87,30 +80,18 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, 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); -<<<<<<< HEAD lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]); -======= - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080)); ->>>>>>> upstream/develop lv_label_set_text(timeDD1, "12"); 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); -<<<<<<< HEAD lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]); -======= - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080)); ->>>>>>> upstream/develop lv_label_set_text(timeDD2, "34"); lv_obj_align(timeDD2, timebar, LV_ALIGN_IN_BOTTOM_MID, 5, -5); timeAMPM = lv_label_create(lv_scr_act(), nullptr); -<<<<<<< HEAD lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]); -======= - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080)); ->>>>>>> upstream/develop lv_obj_set_style_local_text_line_space(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -3); lv_label_set_text(timeAMPM, ""); lv_obj_align(timeAMPM, timebar, LV_ALIGN_IN_BOTTOM_LEFT, 2, -20); @@ -118,11 +99,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, /* Create a 40px wide bar down the right side of the screen */ sidebar = lv_obj_create(lv_scr_act(), nullptr); -<<<<<<< HEAD lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorBar()]); -======= - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080)); ->>>>>>> upstream/develop 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); @@ -221,11 +198,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, 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); -<<<<<<< HEAD lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 3); -======= - lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4); ->>>>>>> upstream/develop lv_obj_set_style_local_pad_inner(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4); backgroundLabel = lv_label_create(lv_scr_act(), nullptr); -- cgit v0.10.2 From f5639db8ed48a332eeeed48a359a3323b0537d39 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Tue, 6 Jul 2021 22:53:00 +0200 Subject: Change step gauge to use percentage of goal for progress diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index 76db86e..b27bd9c 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -186,8 +186,8 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, 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, (settingsController.GetStepsGoal() / 100)); - lv_gauge_set_range(stepGauge, 0, (settingsController.GetStepsGoal() / 100)); + 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); @@ -335,7 +335,7 @@ bool PineTimeStyle::Refresh() { stepCount = motionController.NbSteps(); motionSensorOk = motionController.IsSensorOk(); if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) { - lv_gauge_set_value(stepGauge, 0, (stepCount.Get() / 100)); + 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); -- cgit v0.10.2 From 97c761a5c74994ea1d9bef9c14e6e24afb9b4be2 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Mon, 19 Jul 2021 16:26:12 +0300 Subject: Refresh rework diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 071af0c..450833f 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -239,7 +239,7 @@ void DisplayApp::Refresh() { } void DisplayApp::RunningState() { - if (!currentScreen->Refresh()) { + if (!currentScreen->IsRunning()) { LoadApp(returnToApp, returnDirection); } lv_task_handler(); diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp index 78c7cd9..67b67a5 100644 --- a/src/displayapp/screens/ApplicationList.cpp +++ b/src/displayapp/screens/ApplicationList.cpp @@ -34,12 +34,6 @@ ApplicationList::~ApplicationList() { lv_obj_clean(lv_scr_act()); } -bool ApplicationList::Refresh() { - if (running) - running = screens.Refresh(); - return running; -} - bool ApplicationList::OnTouchEvent(Pinetime::Applications::TouchEvents event) { return screens.OnTouchEvent(event); } diff --git a/src/displayapp/screens/ApplicationList.h b/src/displayapp/screens/ApplicationList.h index 88534ec..103c38a 100644 --- a/src/displayapp/screens/ApplicationList.h +++ b/src/displayapp/screens/ApplicationList.h @@ -18,7 +18,6 @@ namespace Pinetime { Pinetime::Controllers::Battery& batteryController, Controllers::DateTime& dateTimeController); ~ApplicationList() override; - bool Refresh() override; bool OnTouchEvent(TouchEvents event) override; private: @@ -33,4 +32,4 @@ namespace Pinetime { }; } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/BatteryInfo.cpp b/src/displayapp/screens/BatteryInfo.cpp index 0ab47eb..91c2651 100644 --- a/src/displayapp/screens/BatteryInfo.cpp +++ b/src/displayapp/screens/BatteryInfo.cpp @@ -4,11 +4,6 @@ using namespace Pinetime::Applications::Screens; -static void lv_update_task(struct _lv_task_t* task) { - auto user_data = static_cast(task->user_data); - user_data->UpdateScreen(); -} - BatteryInfo::BatteryInfo(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Battery& batteryController) : Screen(app), batteryController {batteryController} { @@ -49,16 +44,16 @@ BatteryInfo::BatteryInfo(Pinetime::Applications::DisplayApp* app, Pinetime::Cont lv_obj_set_pos(backgroundLabel, 0, 0); lv_label_set_text_static(backgroundLabel, ""); - taskUpdate = lv_task_create(lv_update_task, 5000, LV_TASK_PRIO_LOW, this); - UpdateScreen(); + taskRefresh = lv_task_create(RefreshTaskCallback, 5000, LV_TASK_PRIO_MID, this); + Refresh(); } BatteryInfo::~BatteryInfo() { - lv_task_del(taskUpdate); + lv_task_del(taskRefresh); lv_obj_clean(lv_scr_act()); } -void BatteryInfo::UpdateScreen() { +void BatteryInfo::Refresh() { batteryController.Update(); @@ -85,7 +80,3 @@ void BatteryInfo::UpdateScreen() { lv_label_set_text_fmt(voltage, "%1i.%02i volts", batteryVoltage / 1000, batteryVoltage % 1000 / 10); lv_bar_set_value(charging_bar, batteryPercent, LV_ANIM_ON); } - -bool BatteryInfo::Refresh() { - return running; -} diff --git a/src/displayapp/screens/BatteryInfo.h b/src/displayapp/screens/BatteryInfo.h index 6979324..63454a2 100644 --- a/src/displayapp/screens/BatteryInfo.h +++ b/src/displayapp/screens/BatteryInfo.h @@ -19,9 +19,7 @@ namespace Pinetime { BatteryInfo(DisplayApp* app, Pinetime::Controllers::Battery& batteryController); ~BatteryInfo() override; - bool Refresh() override; - - void UpdateScreen(); + void Refresh() override; private: Pinetime::Controllers::Battery& batteryController; @@ -31,7 +29,7 @@ namespace Pinetime { lv_obj_t* charging_bar; lv_obj_t* status; - lv_task_t* taskUpdate; + lv_task_t* taskRefresh; uint8_t batteryPercent = 0; uint16_t batteryVoltage = 0; diff --git a/src/displayapp/screens/Brightness.cpp b/src/displayapp/screens/Brightness.cpp index 47c1056..1278cd6 100644 --- a/src/displayapp/screens/Brightness.cpp +++ b/src/displayapp/screens/Brightness.cpp @@ -30,10 +30,6 @@ Brightness::~Brightness() { lv_obj_clean(lv_scr_act()); } -bool Brightness::Refresh() { - return running; -} - const char* Brightness::LevelToString(Pinetime::Controllers::BrightnessController::Levels level) { switch (level) { case Pinetime::Controllers::BrightnessController::Levels::Off: diff --git a/src/displayapp/screens/Brightness.h b/src/displayapp/screens/Brightness.h index 9ee3375..14e4859 100644 --- a/src/displayapp/screens/Brightness.h +++ b/src/displayapp/screens/Brightness.h @@ -12,7 +12,6 @@ namespace Pinetime { public: Brightness(DisplayApp* app, Controllers::BrightnessController& brightness); ~Brightness() override; - bool Refresh() override; bool OnTouchEvent(TouchEvents event) override; @@ -31,4 +30,4 @@ namespace Pinetime { }; } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index e068497..e3af5e4 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -55,11 +55,6 @@ Clock::~Clock() { lv_obj_clean(lv_scr_act()); } -bool Clock::Refresh() { - screen->Refresh(); - return running; -} - bool Clock::OnTouchEvent(Pinetime::Applications::TouchEvents event) { return screen->OnTouchEvent(event); } @@ -101,4 +96,4 @@ std::unique_ptr Clock::WatchFaceCustomScreen() { return std::make_unique(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); } -*/ \ No newline at end of file +*/ diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h index a48feea..500672a 100644 --- a/src/displayapp/screens/Clock.h +++ b/src/displayapp/screens/Clock.h @@ -34,8 +34,6 @@ namespace Pinetime { Controllers::MotionController& motionController); ~Clock() override; - bool Refresh() override; - bool OnTouchEvent(TouchEvents event) override; private: diff --git a/src/displayapp/screens/FirmwareUpdate.cpp b/src/displayapp/screens/FirmwareUpdate.cpp index 4086b15..11ac7bc 100644 --- a/src/displayapp/screens/FirmwareUpdate.cpp +++ b/src/displayapp/screens/FirmwareUpdate.cpp @@ -30,36 +30,40 @@ FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp* app, Pinetime lv_label_set_text(percentLabel, ""); 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); } FirmwareUpdate::~FirmwareUpdate() { + lv_task_del(taskRefresh); lv_obj_clean(lv_scr_act()); } -bool FirmwareUpdate::Refresh() { +void FirmwareUpdate::Refresh() { switch (bleController.State()) { default: case Pinetime::Controllers::Ble::FirmwareUpdateStates::Idle: case Pinetime::Controllers::Ble::FirmwareUpdateStates::Running: if (state != States::Running) state = States::Running; - return DisplayProgression(); + DisplayProgression(); + return; case Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated: if (state != States::Validated) { UpdateValidated(); state = States::Validated; } - return running; + return; case Pinetime::Controllers::Ble::FirmwareUpdateStates::Error: if (state != States::Error) { UpdateError(); state = States::Error; } - return running; + return; } } -bool FirmwareUpdate::DisplayProgression() const { +void FirmwareUpdate::DisplayProgression() const { float current = bleController.FirmwareUpdateCurrentBytes() / 1024.0f; float total = bleController.FirmwareUpdateTotalBytes() / 1024.0f; int16_t pc = (current / total) * 100.0f; @@ -67,7 +71,6 @@ bool FirmwareUpdate::DisplayProgression() const { lv_label_set_text(percentLabel, percentStr); lv_bar_set_value(bar1, pc, LV_ANIM_OFF); - return running; } void FirmwareUpdate::UpdateValidated() { diff --git a/src/displayapp/screens/FirmwareUpdate.h b/src/displayapp/screens/FirmwareUpdate.h index f4d34df..12cd4ae 100644 --- a/src/displayapp/screens/FirmwareUpdate.h +++ b/src/displayapp/screens/FirmwareUpdate.h @@ -15,7 +15,7 @@ namespace Pinetime { FirmwareUpdate(DisplayApp* app, Pinetime::Controllers::Ble& bleController); ~FirmwareUpdate() override; - bool Refresh() override; + void Refresh() override; private: enum class States { Idle, Running, Validated, Error }; @@ -27,11 +27,13 @@ namespace Pinetime { States state; - bool DisplayProgression() const; + void DisplayProgression() const; void UpdateValidated(); void UpdateError(); + + lv_task_t* taskRefresh; }; } } diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp index 1d05be8..7ad45fa 100644 --- a/src/displayapp/screens/FirmwareValidation.cpp +++ b/src/displayapp/screens/FirmwareValidation.cpp @@ -61,10 +61,6 @@ FirmwareValidation::~FirmwareValidation() { lv_obj_clean(lv_scr_act()); } -bool FirmwareValidation::Refresh() { - return running; -} - void FirmwareValidation::OnButtonEvent(lv_obj_t* object, lv_event_t event) { if (object == buttonValidate && event == LV_EVENT_PRESSED) { validator.Validate(); diff --git a/src/displayapp/screens/FirmwareValidation.h b/src/displayapp/screens/FirmwareValidation.h index 1ef5ba0..bfdb096 100644 --- a/src/displayapp/screens/FirmwareValidation.h +++ b/src/displayapp/screens/FirmwareValidation.h @@ -16,8 +16,6 @@ namespace Pinetime { FirmwareValidation(DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator); ~FirmwareValidation() override; - bool Refresh() override; - void OnButtonEvent(lv_obj_t* object, lv_event_t event); private: diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp index 7db2c6c..eebb776 100644 --- a/src/displayapp/screens/FlashLight.cpp +++ b/src/displayapp/screens/FlashLight.cpp @@ -65,10 +65,6 @@ void FlashLight::OnClickEvent(lv_obj_t* obj, lv_event_t event) { } } -bool FlashLight::Refresh() { - return running; -} - bool FlashLight::OnTouchEvent(Pinetime::Applications::TouchEvents event) { return true; } diff --git a/src/displayapp/screens/FlashLight.h b/src/displayapp/screens/FlashLight.h index a862ffd..7f5ca6c 100644 --- a/src/displayapp/screens/FlashLight.h +++ b/src/displayapp/screens/FlashLight.h @@ -16,8 +16,6 @@ namespace Pinetime { FlashLight(DisplayApp* app, System::SystemTask& systemTask, Controllers::BrightnessController& brightness); ~FlashLight() override; - bool Refresh() override; - bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; void OnClickEvent(lv_obj_t* obj, lv_event_t event); diff --git a/src/displayapp/screens/HeartRate.cpp b/src/displayapp/screens/HeartRate.cpp index 5689b63..b6ece27 100644 --- a/src/displayapp/screens/HeartRate.cpp +++ b/src/displayapp/screens/HeartRate.cpp @@ -64,14 +64,17 @@ HeartRate::HeartRate(Pinetime::Applications::DisplayApp* app, UpdateStartStopButton(isHrRunning); if (isHrRunning) systemTask.PushMessage(Pinetime::System::Messages::DisableSleeping); + + taskRefresh = lv_task_create(RefreshTaskCallback, 100, LV_TASK_PRIO_MID, this); } HeartRate::~HeartRate() { + lv_task_del(taskRefresh); lv_obj_clean(lv_scr_act()); systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping); } -bool HeartRate::Refresh() { +void HeartRate::Refresh() { auto state = heartRateController.State(); switch (state) { @@ -86,8 +89,6 @@ bool HeartRate::Refresh() { lv_label_set_text(label_status, ToString(state)); lv_obj_align(label_status, label_hr, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); - - return running; } void HeartRate::OnStartStopEvent(lv_event_t event) { diff --git a/src/displayapp/screens/HeartRate.h b/src/displayapp/screens/HeartRate.h index a23c5af..7f7d3ad 100644 --- a/src/displayapp/screens/HeartRate.h +++ b/src/displayapp/screens/HeartRate.h @@ -20,7 +20,7 @@ namespace Pinetime { HeartRate(DisplayApp* app, Controllers::HeartRateController& HeartRateController, System::SystemTask& systemTask); ~HeartRate() override; - bool Refresh() override; + void Refresh() override; void OnStartStopEvent(lv_event_t event); @@ -33,6 +33,8 @@ namespace Pinetime { lv_obj_t* label_status; lv_obj_t* btn_startStop; lv_obj_t* label_startStop; + + lv_task_t* taskRefresh; }; } } diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp index 3224008..4dde81a 100644 --- a/src/displayapp/screens/InfiniPaint.cpp +++ b/src/displayapp/screens/InfiniPaint.cpp @@ -15,10 +15,6 @@ InfiniPaint::~InfiniPaint() { lv_obj_clean(lv_scr_act()); } -bool InfiniPaint::Refresh() { - return running; -} - bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { switch (event) { case Pinetime::Applications::TouchEvents::LongTap: diff --git a/src/displayapp/screens/InfiniPaint.h b/src/displayapp/screens/InfiniPaint.h index 6251752..0a70e03 100644 --- a/src/displayapp/screens/InfiniPaint.h +++ b/src/displayapp/screens/InfiniPaint.h @@ -17,8 +17,6 @@ namespace Pinetime { ~InfiniPaint() override; - bool Refresh() override; - bool OnTouchEvent(TouchEvents event) override; bool OnTouchEvent(uint16_t x, uint16_t y) override; diff --git a/src/displayapp/screens/Label.cpp b/src/displayapp/screens/Label.cpp index 0132dbd..8b079d9 100644 --- a/src/displayapp/screens/Label.cpp +++ b/src/displayapp/screens/Label.cpp @@ -36,7 +36,3 @@ Label::Label(uint8_t screenID, uint8_t numScreens, Pinetime::Applications::Displ Label::~Label() { lv_obj_clean(lv_scr_act()); } - -bool Label::Refresh() { - return running; -} diff --git a/src/displayapp/screens/Label.h b/src/displayapp/screens/Label.h index 62b80be..7e86c83 100644 --- a/src/displayapp/screens/Label.h +++ b/src/displayapp/screens/Label.h @@ -12,8 +12,6 @@ namespace Pinetime { Label(uint8_t screenID, uint8_t numScreens, DisplayApp* app, lv_obj_t* labelText); ~Label() override; - bool Refresh() override; - private: bool running = true; @@ -25,4 +23,4 @@ namespace Pinetime { }; } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/List.cpp b/src/displayapp/screens/List.cpp index b4f4d2c..efc505c 100644 --- a/src/displayapp/screens/List.cpp +++ b/src/displayapp/screens/List.cpp @@ -102,11 +102,6 @@ List::~List() { lv_obj_clean(lv_scr_act()); } -bool List::Refresh() { - - return running; -} - void List::OnButtonEvent(lv_obj_t* object, lv_event_t event) { if (event == LV_EVENT_RELEASED) { for (int i = 0; i < MAXLISTITEMS; i++) { diff --git a/src/displayapp/screens/List.h b/src/displayapp/screens/List.h index a45fd1d..d9f61f2 100644 --- a/src/displayapp/screens/List.h +++ b/src/displayapp/screens/List.h @@ -27,8 +27,6 @@ namespace Pinetime { std::array& applications); ~List() override; - bool Refresh() override; - void OnButtonEvent(lv_obj_t* object, lv_event_t event); private: diff --git a/src/displayapp/screens/Meter.cpp b/src/displayapp/screens/Meter.cpp index e0dbdfa..57cde9c 100644 --- a/src/displayapp/screens/Meter.cpp +++ b/src/displayapp/screens/Meter.cpp @@ -20,17 +20,17 @@ Meter::Meter(Pinetime::Applications::DisplayApp* app) : Screen(app) { lv_obj_set_size(lmeter, 200, 200); lv_obj_align(lmeter, nullptr, LV_ALIGN_CENTER, 0, 0); + + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } Meter::~Meter() { - + lv_task_del(taskRefresh); lv_obj_clean(lv_scr_act()); } -bool Meter::Refresh() { +void Meter::Refresh() { lv_linemeter_set_value(lmeter, value++); /*Set the current value*/ if (value >= 60) value = 0; - - return running; } diff --git a/src/displayapp/screens/Meter.h b/src/displayapp/screens/Meter.h index 24af15a..9b3d1d4 100644 --- a/src/displayapp/screens/Meter.h +++ b/src/displayapp/screens/Meter.h @@ -14,13 +14,15 @@ namespace Pinetime { Meter(DisplayApp* app); ~Meter() override; - bool Refresh() override; + void Refresh() override; private: lv_style_t style_lmeter; lv_obj_t* lmeter; uint32_t value = 0; + + lv_task_t* taskRefresh; }; } } diff --git a/src/displayapp/screens/Metronome.cpp b/src/displayapp/screens/Metronome.cpp index 7bfbccb..06cd7ef 100644 --- a/src/displayapp/screens/Metronome.cpp +++ b/src/displayapp/screens/Metronome.cpp @@ -85,9 +85,12 @@ Metronome::Metronome(DisplayApp* app, Controllers::MotorController& motorControl lv_label_set_text(playPauseLabel, Symbols::play); app->SetTouchMode(DisplayApp::TouchModes::Polling); + + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } Metronome::~Metronome() { + lv_task_del(taskRefresh); app->SetTouchMode(DisplayApp::TouchModes::Gestures); systemTask.PushMessage(System::Messages::EnableSleeping); lv_obj_clean(lv_scr_act()); @@ -97,7 +100,7 @@ bool Metronome::OnTouchEvent(Pinetime::Applications::TouchEvents event) { return true; } -bool Metronome::Refresh() { +void Metronome::Refresh() { switch (currentState) { case States::Stopped: { break; @@ -117,7 +120,6 @@ bool Metronome::Refresh() { break; } } - return running; } void Metronome::OnEvent(lv_obj_t* obj, lv_event_t event) { diff --git a/src/displayapp/screens/Metronome.h b/src/displayapp/screens/Metronome.h index 3a1f108..d83dc74 100644 --- a/src/displayapp/screens/Metronome.h +++ b/src/displayapp/screens/Metronome.h @@ -11,7 +11,7 @@ namespace Pinetime::Applications::Screens { public: Metronome(DisplayApp* app, Controllers::MotorController& motorController, System::SystemTask& systemTask); ~Metronome() override; - bool Refresh() override; + void Refresh() override; bool OnTouchEvent(TouchEvents event) override; void OnEvent(lv_obj_t* obj, lv_event_t event); enum class States { Running, Stopped }; @@ -30,5 +30,7 @@ namespace Pinetime::Applications::Screens { lv_obj_t *bpmArc, *bpmTap, *bpmValue, *bpmLegend; lv_obj_t *bpbDropdown, *bpbLegend; lv_obj_t *playPause, *playPauseLabel; + + lv_task_t* taskRefresh; }; } diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp index a8bb3c1..108b942 100644 --- a/src/displayapp/screens/Motion.cpp +++ b/src/displayapp/screens/Motion.cpp @@ -32,18 +32,20 @@ Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionContr lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10); lv_label_set_recolor(label, true); - + 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 ---"); + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } Motion::~Motion() { + lv_task_del(taskRefresh); lv_obj_clean(lv_scr_act()); } -bool Motion::Refresh() { +void Motion::Refresh() { lv_chart_set_next(chart, ser1, motionController.X()); lv_chart_set_next(chart, ser2, motionController.Y()); lv_chart_set_next(chart, ser3, motionController.Z()); @@ -52,8 +54,6 @@ bool Motion::Refresh() { lv_label_set_text_fmt(label, "X #FF0000 %d# Y #008000 %d# Z #FFFF00 %d#", motionController.X() / 0x10, motionController.Y() / 0x10, motionController.Z() / 0x10); lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10); - - return running; } bool Motion::OnButtonPushed() { diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h index 132b20e..3f91ece 100644 --- a/src/displayapp/screens/Motion.h +++ b/src/displayapp/screens/Motion.h @@ -17,7 +17,7 @@ namespace Pinetime { Motion(DisplayApp* app, Controllers::MotionController& motionController); ~Motion() override; - bool Refresh() override; + void Refresh() override; bool OnButtonPushed() override; private: @@ -32,7 +32,9 @@ namespace Pinetime { static constexpr uint8_t nbStepsBufferSize = 9; char nbStepsBuffer[nbStepsBufferSize + 1]; bool running = true; + + lv_task_t* taskRefresh; }; } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp index 9f10f50..beb96fa 100644 --- a/src/displayapp/screens/Music.cpp +++ b/src/displayapp/screens/Music.cpp @@ -146,13 +146,16 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus frameB = false; musicService.event(Controllers::MusicService::EVENT_MUSIC_OPEN); + + taskRefresh = lv_task_create(RefreshTaskCallback, 5000, LV_TASK_PRIO_MID, this); } Music::~Music() { + lv_task_del(taskRefresh); lv_obj_clean(lv_scr_act()); } -bool Music::Refresh() { +void Music::Refresh() { if (artist != musicService.getArtist()) { artist = musicService.getArtist(); currentLength = 0; @@ -216,8 +219,6 @@ bool Music::Refresh() { } else { lv_label_set_text(txtPlayPause, Symbols::play); } - - return running; } void Music::UpdateLength() { @@ -303,4 +304,4 @@ bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) { return true; } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h index ef8f1fe..a2d138b 100644 --- a/src/displayapp/screens/Music.h +++ b/src/displayapp/screens/Music.h @@ -35,7 +35,7 @@ namespace Pinetime { ~Music() override; - bool Refresh() override; + void Refresh() override; void OnObjectEvent(lv_obj_t* obj, lv_event_t event); @@ -78,6 +78,8 @@ namespace Pinetime { bool playing; + lv_task_t* taskRefresh; + /** Watchapp */ }; } diff --git a/src/displayapp/screens/Navigation.cpp b/src/displayapp/screens/Navigation.cpp index 79b04e2..d437cc6 100644 --- a/src/displayapp/screens/Navigation.cpp +++ b/src/displayapp/screens/Navigation.cpp @@ -161,13 +161,16 @@ Navigation::Navigation(Pinetime::Applications::DisplayApp* app, Pinetime::Contro lv_bar_set_anim_time(barProgress, 500); lv_bar_set_range(barProgress, 0, 100); lv_bar_set_value(barProgress, 0, LV_ANIM_OFF); + + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } Navigation::~Navigation() { + lv_task_del(taskRefresh); lv_obj_clean(lv_scr_act()); } -bool Navigation::Refresh() { +void Navigation::Refresh() { if (flag != navService.getFlag()) { flag = navService.getFlag(); lv_label_set_text(imgFlag, iconForName(flag)); @@ -192,8 +195,4 @@ bool Navigation::Refresh() { lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_ORANGE); } } - - return running; } - - diff --git a/src/displayapp/screens/Navigation.h b/src/displayapp/screens/Navigation.h index eb7e00c..48f00a7 100644 --- a/src/displayapp/screens/Navigation.h +++ b/src/displayapp/screens/Navigation.h @@ -35,7 +35,7 @@ namespace Pinetime { Navigation(DisplayApp* app, Pinetime::Controllers::NavigationService& nav); ~Navigation() override; - bool Refresh() override; + void Refresh() override; private: lv_obj_t* imgFlag; @@ -49,6 +49,8 @@ namespace Pinetime { std::string narrative; std::string manDist; int progress; + + lv_task_t* taskRefresh; }; } } diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 38b1242..33e50cc 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -47,13 +47,16 @@ Notifications::Notifications(DisplayApp* app, timeoutTickCountStart = xTaskGetTickCount(); timeoutTickCountEnd = timeoutTickCountStart + (5 * 1024); } + + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } Notifications::~Notifications() { + lv_task_del(taskRefresh); lv_obj_clean(lv_scr_act()); } -bool Notifications::Refresh() { +void Notifications::Refresh() { if (mode == Modes::Preview) { auto tick = xTaskGetTickCount(); int32_t pos = 240 - ((tick - timeoutTickCountStart) / ((timeoutTickCountEnd - timeoutTickCountStart) / 240)); @@ -63,8 +66,6 @@ bool Notifications::Refresh() { timeoutLinePoints[1].x = pos; lv_line_set_points(timeoutLine, timeoutLinePoints, 2); } - - return running; } bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h index 51ca81d..6d47e23 100644 --- a/src/displayapp/screens/Notifications.h +++ b/src/displayapp/screens/Notifications.h @@ -22,7 +22,7 @@ namespace Pinetime { Modes mode); ~Notifications() override; - bool Refresh() override; + void Refresh() override; bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; class NotificationItem { @@ -35,9 +35,6 @@ namespace Pinetime { Modes mode, Pinetime::Controllers::AlertNotificationService& alertNotificationService); ~NotificationItem(); - bool Refresh() { - return false; - } void OnAcceptIncomingCall(lv_event_t event); void OnMuteIncomingCall(lv_event_t event); void OnRejectIncomingCall(lv_event_t event); @@ -78,6 +75,8 @@ namespace Pinetime { lv_obj_t* timeoutLine; uint32_t timeoutTickCountStart; uint32_t timeoutTickCountEnd; + + lv_task_t* taskRefresh; }; } } diff --git a/src/displayapp/screens/Paddle.cpp b/src/displayapp/screens/Paddle.cpp index 5a939ac..87fc872 100644 --- a/src/displayapp/screens/Paddle.cpp +++ b/src/displayapp/screens/Paddle.cpp @@ -29,15 +29,18 @@ Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::Li lv_obj_set_style_local_bg_color(ball, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); lv_obj_set_style_local_radius(ball, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); lv_obj_set_size(ball, ballSize, ballSize); + + taskRefresh = lv_task_create(RefreshTaskCallback, 20, LV_TASK_PRIO_MID, this); } Paddle::~Paddle() { + lv_task_del(taskRefresh); // Reset the touchmode app->SetTouchMode(DisplayApp::TouchModes::Gestures); lv_obj_clean(lv_scr_act()); } -bool Paddle::Refresh() { +void Paddle::Refresh() { ballX += dx; ballY += dy; @@ -69,7 +72,6 @@ bool Paddle::Refresh() { } } lv_label_set_text_fmt(points, "%04d", score); - return running; } bool Paddle::OnTouchEvent(Pinetime::Applications::TouchEvents event) { diff --git a/src/displayapp/screens/Paddle.h b/src/displayapp/screens/Paddle.h index 30ab8f9..fc2131a 100644 --- a/src/displayapp/screens/Paddle.h +++ b/src/displayapp/screens/Paddle.h @@ -16,7 +16,7 @@ namespace Pinetime { Paddle(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl); ~Paddle() override; - bool Refresh() override; + void Refresh() override; bool OnTouchEvent(TouchEvents event) override; bool OnTouchEvent(uint16_t x, uint16_t y) override; @@ -40,6 +40,8 @@ namespace Pinetime { lv_obj_t* paddle; lv_obj_t* ball; lv_obj_t* background; + + lv_task_t* taskRefresh; }; } } diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index 591f3a4..c595223 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -200,13 +200,17 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); lv_label_set_text(backgroundLabel, ""); + + 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::Refresh() { +void PineTimeStyle::Refresh() { batteryPercentRemaining = batteryController.PercentRemaining(); if (batteryPercentRemaining.IsUpdated()) { auto batteryPercent = batteryPercentRemaining.Get(); @@ -335,6 +339,4 @@ bool PineTimeStyle::Refresh() { lv_obj_set_style_local_scale_grad_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); } } - - return running; -} \ No newline at end of file +} diff --git a/src/displayapp/screens/PineTimeStyle.h b/src/displayapp/screens/PineTimeStyle.h index 3b4ded1..88180c5 100644 --- a/src/displayapp/screens/PineTimeStyle.h +++ b/src/displayapp/screens/PineTimeStyle.h @@ -30,7 +30,7 @@ namespace Pinetime { Controllers::MotionController& motionController); ~PineTimeStyle() override; - bool Refresh() override; + void Refresh() override; void OnObjectEvent(lv_obj_t* pObj, lv_event_t i); @@ -80,6 +80,8 @@ namespace Pinetime { Controllers::NotificationManager& notificatioManager; Controllers::Settings& settingsController; Controllers::MotionController& motionController; + + lv_task_t* taskRefresh; }; } } diff --git a/src/displayapp/screens/Screen.cpp b/src/displayapp/screens/Screen.cpp index 1467df3..6ae5b7b 100644 --- a/src/displayapp/screens/Screen.cpp +++ b/src/displayapp/screens/Screen.cpp @@ -1,2 +1,6 @@ #include "Screen.h" -using namespace Pinetime::Applications::Screens; \ No newline at end of file +using namespace Pinetime::Applications::Screens; + +void Screen::RefreshTaskCallback(lv_task_t* task) { + static_cast(task->user_data)->Refresh(); +} diff --git a/src/displayapp/screens/Screen.h b/src/displayapp/screens/Screen.h index 8e49c9d..30de2ad 100644 --- a/src/displayapp/screens/Screen.h +++ b/src/displayapp/screens/Screen.h @@ -2,6 +2,7 @@ #include #include "../TouchEvents.h" +#include namespace Pinetime { namespace Applications { @@ -34,25 +35,20 @@ namespace Pinetime { }; class Screen { + private: + virtual void Refresh() { + } + public: explicit Screen(DisplayApp* app) : app {app} { } virtual ~Screen() = default; - /** - * Most of the time, apps only react to events (touch events, for example). - * In this case you don't need to do anything in this method. - * - * For example, InfiniPaint does nothing in Refresh(). - * But, if you want to update your display periodically, draw an animation... - * you cannot do it in a touch event handler because these handlers are not - * called if the user does not touch the screen. - * - * That's why Refresh() is there: update the display periodically. - * - * @return false if the app can be closed, true if it must continue to run - **/ - virtual bool Refresh() = 0; + static void RefreshTaskCallback(lv_task_t* task); + + bool IsRunning() const { + return running; + } /** @return false if the button hasn't been handled by the app, true if it has been handled */ virtual bool OnButtonPushed() { diff --git a/src/displayapp/screens/ScreenList.h b/src/displayapp/screens/ScreenList.h index ea66bfb..a9d747a 100644 --- a/src/displayapp/screens/ScreenList.h +++ b/src/displayapp/screens/ScreenList.h @@ -30,11 +30,6 @@ namespace Pinetime { lv_obj_clean(lv_scr_act()); } - bool Refresh() override { - running = current->Refresh(); - return running; - } - bool OnTouchEvent(TouchEvents event) override { if (mode == ScreenListModes::UpDown) { @@ -110,4 +105,4 @@ namespace Pinetime { }; } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/Steps.cpp b/src/displayapp/screens/Steps.cpp index 6aabd30..a096bbc 100644 --- a/src/displayapp/screens/Steps.cpp +++ b/src/displayapp/screens/Steps.cpp @@ -50,20 +50,20 @@ Steps::Steps( lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); lv_label_set_text_static(backgroundLabel, ""); + + taskRefresh = lv_task_create(RefreshTaskCallback, 100, LV_TASK_PRIO_MID, this); } Steps::~Steps() { + lv_task_del(taskRefresh); lv_obj_clean(lv_scr_act()); } -bool Steps::Refresh() { - +void Steps::Refresh() { stepsCount = motionController.NbSteps(); - + lv_label_set_text_fmt(lSteps, "%li", stepsCount); lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -20); - - lv_arc_set_value(stepsArc, int16_t(500 * stepsCount / settingsController.GetStepsGoal())); - return running; + lv_arc_set_value(stepsArc, int16_t(500 * stepsCount / settingsController.GetStepsGoal())); } diff --git a/src/displayapp/screens/Steps.h b/src/displayapp/screens/Steps.h index 9c135e2..d7cf31e 100644 --- a/src/displayapp/screens/Steps.h +++ b/src/displayapp/screens/Steps.h @@ -15,24 +15,23 @@ namespace Pinetime { namespace Screens { class Steps : public Screen { - public: - Steps(DisplayApp* app, Controllers::MotionController& motionController, Controllers::Settings &settingsController); - ~Steps() override; + public: + Steps(DisplayApp* app, Controllers::MotionController& motionController, Controllers::Settings& settingsController); + ~Steps() override; - bool Refresh() override; - + void Refresh() override; - private: + private: + Controllers::MotionController& motionController; + Controllers::Settings& settingsController; - Controllers::MotionController& motionController; - Controllers::Settings& settingsController; + lv_obj_t* lSteps; + lv_obj_t* lStepsIcon; + lv_obj_t* stepsArc; - lv_obj_t * lSteps; - lv_obj_t * lStepsIcon; - lv_obj_t * stepsArc; - - uint32_t stepsCount; + uint32_t stepsCount; + lv_task_t* taskRefresh; }; } } diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index f4db5d6..74b49db 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -48,7 +48,6 @@ static void stop_lap_event_handler(lv_obj_t* obj, lv_event_t event) { StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask) : Screen(app), systemTask {systemTask}, - running {true}, currentState {States::Init}, startTime {}, oldTimeElapsed {}, @@ -101,9 +100,12 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask) 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, ""); + + taskRefresh = lv_task_create(RefreshTaskCallback, 20, LV_TASK_PRIO_MID, this); } StopWatch::~StopWatch() { + lv_task_del(taskRefresh); systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping); lv_obj_clean(lv_scr_act()); } @@ -149,7 +151,7 @@ void StopWatch::pause() { systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping); } -bool StopWatch::Refresh() { +void StopWatch::Refresh() { if (currentState == States::Running) { timeElapsed = calculateDelta(startTime, xTaskGetTickCount()); currentTimeSeparated = convertTicksToTimeSegments((oldTimeElapsed + timeElapsed)); @@ -157,7 +159,6 @@ bool StopWatch::Refresh() { lv_label_set_text_fmt(time, "%02d:%02d", currentTimeSeparated.mins, currentTimeSeparated.secs); lv_label_set_text_fmt(msecTime, "%02d", currentTimeSeparated.hundredths); } - return running; } void StopWatch::playPauseBtnEventHandler(lv_event_t event) { @@ -196,8 +197,7 @@ void StopWatch::stopLapBtnEventHandler(lv_event_t event) { bool StopWatch::OnButtonPushed() { if (currentState == States::Running) { pause(); - } else { - running = false; + return true; } - return true; + return false; } diff --git a/src/displayapp/screens/StopWatch.h b/src/displayapp/screens/StopWatch.h index e132f15..25634e9 100644 --- a/src/displayapp/screens/StopWatch.h +++ b/src/displayapp/screens/StopWatch.h @@ -64,7 +64,7 @@ namespace Pinetime::Applications::Screens { public: StopWatch(DisplayApp* app, System::SystemTask& systemTask); ~StopWatch() override; - bool Refresh() override; + void Refresh() override; void playPauseBtnEventHandler(lv_event_t event); void stopLapBtnEventHandler(lv_event_t event); @@ -77,7 +77,6 @@ namespace Pinetime::Applications::Screens { private: Pinetime::System::SystemTask& systemTask; TickType_t timeElapsed; - bool running; States currentState; TickType_t startTime; TickType_t oldTimeElapsed; @@ -86,5 +85,7 @@ namespace Pinetime::Applications::Screens { int lapNr = 0; lv_obj_t *time, *msecTime, *btnPlayPause, *btnStopLap, *txtPlayPause, *txtStopLap; lv_obj_t *lapOneText, *lapTwoText; + + lv_task_t* taskRefresh; }; } diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index f5bf0cc..78399b7 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -63,13 +63,6 @@ SystemInfo::~SystemInfo() { lv_obj_clean(lv_scr_act()); } -bool SystemInfo::Refresh() { - if (running) { - screens.Refresh(); - } - return running; -} - bool SystemInfo::OnButtonPushed() { running = false; return true; diff --git a/src/displayapp/screens/SystemInfo.h b/src/displayapp/screens/SystemInfo.h index 9d471f6..5b1b4ee 100644 --- a/src/displayapp/screens/SystemInfo.h +++ b/src/displayapp/screens/SystemInfo.h @@ -30,7 +30,6 @@ namespace Pinetime { Pinetime::Drivers::WatchdogView& watchdog, Pinetime::Controllers::MotionController& motionController); ~SystemInfo() override; - bool Refresh() override; bool OnButtonPushed() override; bool OnTouchEvent(TouchEvents event) override; @@ -56,4 +55,4 @@ namespace Pinetime { }; } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp index 3eb127c..d2ab9b4 100644 --- a/src/displayapp/screens/Tile.cpp +++ b/src/displayapp/screens/Tile.cpp @@ -120,10 +120,6 @@ void Tile::UpdateScreen() { lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); } -bool Tile::Refresh() { - return running; -} - void Tile::OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId) { if (event == LV_EVENT_VALUE_CHANGED) { app->StartApp(apps[buttonId], DisplayApp::FullRefreshDirections::Up); diff --git a/src/displayapp/screens/Tile.h b/src/displayapp/screens/Tile.h index 4ebd81c..5de5b04 100644 --- a/src/displayapp/screens/Tile.h +++ b/src/displayapp/screens/Tile.h @@ -30,7 +30,6 @@ namespace Pinetime { ~Tile() override; - bool Refresh() override; void UpdateScreen(); void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId); diff --git a/src/displayapp/screens/Timer.cpp b/src/displayapp/screens/Timer.cpp index 99e979b..ae6ed30 100644 --- a/src/displayapp/screens/Timer.cpp +++ b/src/displayapp/screens/Timer.cpp @@ -4,10 +4,8 @@ #include "Symbols.h" #include "lvgl/lvgl.h" - using namespace Pinetime::Applications::Screens; - static void btnEventHandler(lv_obj_t* obj, lv_event_t event) { Timer* screen = static_cast(obj->user_data); screen->OnButtonEvent(obj, event); @@ -22,7 +20,7 @@ void Timer::createButtons() { lv_obj_set_width(btnMinutesUp, 60); txtMUp = lv_label_create(btnMinutesUp, nullptr); lv_label_set_text(txtMUp, "+"); - + btnMinutesDown = lv_btn_create(lv_scr_act(), nullptr); btnMinutesDown->user_data = this; lv_obj_set_event_cb(btnMinutesDown, btnEventHandler); @@ -31,7 +29,7 @@ void Timer::createButtons() { lv_obj_set_width(btnMinutesDown, 60); txtMDown = lv_label_create(btnMinutesDown, nullptr); lv_label_set_text(txtMDown, "-"); - + btnSecondsUp = lv_btn_create(lv_scr_act(), nullptr); btnSecondsUp->user_data = this; lv_obj_set_event_cb(btnSecondsUp, btnEventHandler); @@ -40,7 +38,7 @@ void Timer::createButtons() { lv_obj_set_width(btnSecondsUp, 60); txtSUp = lv_label_create(btnSecondsUp, nullptr); lv_label_set_text(txtSUp, "+"); - + btnSecondsDown = lv_btn_create(lv_scr_act(), nullptr); btnSecondsDown->user_data = this; lv_obj_set_event_cb(btnSecondsDown, btnEventHandler); @@ -49,24 +47,20 @@ void Timer::createButtons() { lv_obj_set_width(btnSecondsDown, 60); txtSDown = lv_label_create(btnSecondsDown, nullptr); lv_label_set_text(txtSDown, "-"); - } - Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController) - : Screen(app), - running{true}, - timerController{timerController} { - + : Screen(app), running {true}, timerController {timerController} { + 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); - + uint32_t seconds = timerController.GetTimeRemaining() / 1000; lv_label_set_text_fmt(time, "%02lu:%02lu", seconds / 60, seconds % 60); lv_obj_align(time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -20); - + btnPlayPause = lv_btn_create(lv_scr_act(), nullptr); btnPlayPause->user_data = this; lv_obj_set_event_cb(btnPlayPause, btnEventHandler); @@ -79,20 +73,20 @@ Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController) lv_label_set_text(txtPlayPause, Symbols::play); createButtons(); } - + + taskRefresh = lv_task_create(RefreshTaskCallback, 20, LV_TASK_PRIO_MID, this); } Timer::~Timer() { + lv_task_del(taskRefresh); lv_obj_clean(lv_scr_act()); - } -bool Timer::Refresh() { +void Timer::Refresh() { if (timerController.IsRunning()) { uint32_t seconds = timerController.GetTimeRemaining() / 1000; lv_label_set_text_fmt(time, "%02lu:%02lu", seconds / 60, seconds % 60); } - return running; } void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { @@ -105,11 +99,11 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { secondsToSet = seconds % 60; timerController.StopTimer(); createButtons(); - + } else if (secondsToSet + minutesToSet > 0) { lv_label_set_text(txtPlayPause, Symbols::pause); timerController.StartTimer((secondsToSet + minutesToSet * 60) * 1000); - + lv_obj_del(btnSecondsDown); btnSecondsDown = nullptr; lv_obj_del(btnSecondsUp); @@ -118,7 +112,6 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { btnMinutesDown = nullptr; lv_obj_del(btnMinutesUp); btnMinutesUp = nullptr; - } } else { if (!timerController.IsRunning()) { @@ -129,7 +122,7 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { minutesToSet++; } lv_label_set_text_fmt(time, "%02d:%02d", minutesToSet, secondsToSet); - + } else if (obj == btnMinutesDown) { if (minutesToSet == 0) { minutesToSet = 59; @@ -137,7 +130,7 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { minutesToSet--; } lv_label_set_text_fmt(time, "%02d:%02d", minutesToSet, secondsToSet); - + } else if (obj == btnSecondsUp) { if (secondsToSet >= 59) { secondsToSet = 0; @@ -145,7 +138,7 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { secondsToSet++; } lv_label_set_text_fmt(time, "%02d:%02d", minutesToSet, secondsToSet); - + } else if (obj == btnSecondsDown) { if (secondsToSet == 0) { secondsToSet = 59; @@ -153,21 +146,16 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) { secondsToSet--; } lv_label_set_text_fmt(time, "%02d:%02d", minutesToSet, secondsToSet); - } } - } - } - } - void Timer::setDone() { lv_label_set_text(time, "00:00"); lv_label_set_text(txtPlayPause, Symbols::play); secondsToSet = 0; minutesToSet = 0; createButtons(); -} \ No newline at end of file +} diff --git a/src/displayapp/screens/Timer.h b/src/displayapp/screens/Timer.h index 0d66f2d..d0fc8ed 100644 --- a/src/displayapp/screens/Timer.h +++ b/src/displayapp/screens/Timer.h @@ -8,35 +8,32 @@ #include "components/timer/TimerController.h" namespace Pinetime::Applications::Screens { - - + class Timer : public Screen { public: - - enum class Modes { - Normal, Done - }; - + enum class Modes { Normal, Done }; + Timer(DisplayApp* app, Controllers::TimerController& timerController); - + ~Timer() override; - - bool Refresh() override; - + + void Refresh() override; + void setDone(); - + void OnButtonEvent(lv_obj_t* obj, lv_event_t event); - + private: - 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 *time, *msecTime, *btnPlayPause, *txtPlayPause, *btnMinutesUp, *btnMinutesDown, *btnSecondsUp, *btnSecondsDown, *txtMUp, + *txtMDown, *txtSUp, *txtSDown; + + lv_task_t* taskRefresh; }; -} \ No newline at end of file +} diff --git a/src/displayapp/screens/Twos.cpp b/src/displayapp/screens/Twos.cpp index eb26807..4201d50 100644 --- a/src/displayapp/screens/Twos.cpp +++ b/src/displayapp/screens/Twos.cpp @@ -102,10 +102,6 @@ Twos::~Twos() { lv_obj_clean(lv_scr_act()); } -bool Twos::Refresh() { - return running; -} - bool Twos::placeNewTile() { std::vector> availableCells; for (int row = 0; row < 4; row++) { @@ -295,4 +291,4 @@ void Twos::updateGridDisplay(Tile grid[][4]) { } } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/Twos.h b/src/displayapp/screens/Twos.h index 3367618..6d85cff 100644 --- a/src/displayapp/screens/Twos.h +++ b/src/displayapp/screens/Twos.h @@ -14,7 +14,6 @@ namespace Pinetime { public: Twos(DisplayApp* app); ~Twos() override; - bool Refresh() override; bool OnTouchEvent(TouchEvents event) override; @@ -36,4 +35,4 @@ namespace Pinetime { }; } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index f188937..b6720bd 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -119,10 +119,12 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app, lv_style_set_line_rounded(&hour_line_style_trace, LV_STATE_DEFAULT, false); lv_obj_add_style(hour_body_trace, LV_LINE_PART_MAIN, &hour_line_style_trace); + taskRefresh = lv_task_create(RefreshTaskCallback, 20, LV_TASK_PRIO_MID, this); UpdateClock(); } WatchFaceAnalog::~WatchFaceAnalog() { + lv_task_del(taskRefresh); lv_style_reset(&hour_line_style); lv_style_reset(&hour_line_style_trace); @@ -176,7 +178,7 @@ void WatchFaceAnalog::UpdateClock() { } } -bool WatchFaceAnalog::Refresh() { +void WatchFaceAnalog::Refresh() { batteryPercentRemaining = batteryController.PercentRemaining(); if (batteryPercentRemaining.IsUpdated()) { auto batteryPercent = batteryPercentRemaining.Get(); @@ -211,6 +213,4 @@ bool WatchFaceAnalog::Refresh() { currentDay = day; } } - - return true; } diff --git a/src/displayapp/screens/WatchFaceAnalog.h b/src/displayapp/screens/WatchFaceAnalog.h index ac7f0ac..c9b19b4 100644 --- a/src/displayapp/screens/WatchFaceAnalog.h +++ b/src/displayapp/screens/WatchFaceAnalog.h @@ -32,7 +32,7 @@ namespace Pinetime { ~WatchFaceAnalog() override; - bool Refresh() override; + void Refresh() override; private: uint8_t sHour, sMinute, sSecond; @@ -83,6 +83,8 @@ namespace Pinetime { Controllers::Settings& settingsController; void UpdateClock(); + + lv_task_t* taskRefresh; }; } } diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index f1285ea..9b6aee2 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -100,13 +100,17 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app, lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FFE7)); lv_label_set_text(stepIcon, Symbols::shoe); lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); + + taskRefresh = lv_task_create(RefreshTaskCallback, 20, LV_TASK_PRIO_MID, this); + Refresh(); } WatchFaceDigital::~WatchFaceDigital() { + lv_task_del(taskRefresh); lv_obj_clean(lv_scr_act()); } -bool WatchFaceDigital::Refresh() { +void WatchFaceDigital::Refresh() { batteryPercentRemaining = batteryController.PercentRemaining(); if (batteryPercentRemaining.IsUpdated()) { auto batteryPercent = batteryPercentRemaining.Get(); @@ -240,6 +244,4 @@ bool WatchFaceDigital::Refresh() { lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2); lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); } - - return running; } diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index 76c8d3d..02ec93c 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -33,7 +33,7 @@ namespace Pinetime { Controllers::MotionController& motionController); ~WatchFaceDigital() override; - bool Refresh() override; + void Refresh() override; void OnObjectEvent(lv_obj_t* pObj, lv_event_t i); @@ -75,6 +75,8 @@ namespace Pinetime { Controllers::Settings& settingsController; Controllers::HeartRateController& heartRateController; Controllers::MotionController& motionController; + + lv_task_t* taskRefresh; }; } } diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index acc2a27..abee168 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -164,7 +164,3 @@ bool QuickSettings::OnTouchEvent(Pinetime::Applications::TouchEvents event) { return true; } } - -bool QuickSettings::Refresh() { - return running; -} diff --git a/src/displayapp/screens/settings/QuickSettings.h b/src/displayapp/screens/settings/QuickSettings.h index a14f46b..7757f28 100644 --- a/src/displayapp/screens/settings/QuickSettings.h +++ b/src/displayapp/screens/settings/QuickSettings.h @@ -27,8 +27,6 @@ namespace Pinetime { ~QuickSettings() override; - bool Refresh() override; - bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; void OnButtonEvent(lv_obj_t* object, lv_event_t event); diff --git a/src/displayapp/screens/settings/SettingDisplay.cpp b/src/displayapp/screens/settings/SettingDisplay.cpp index 4954185..7b31c47 100644 --- a/src/displayapp/screens/settings/SettingDisplay.cpp +++ b/src/displayapp/screens/settings/SettingDisplay.cpp @@ -80,10 +80,6 @@ SettingDisplay::~SettingDisplay() { settingsController.SaveSettings(); } -bool SettingDisplay::Refresh() { - return running; -} - void SettingDisplay::UpdateSelected(lv_obj_t* object, lv_event_t event) { if (event == LV_EVENT_VALUE_CHANGED) { for (int i = 0; i < optionsTotal; i++) { @@ -110,4 +106,4 @@ void SettingDisplay::UpdateSelected(lv_obj_t* object, lv_event_t event) { } } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/settings/SettingDisplay.h b/src/displayapp/screens/settings/SettingDisplay.h index b8ed87e..51b23ac 100644 --- a/src/displayapp/screens/settings/SettingDisplay.h +++ b/src/displayapp/screens/settings/SettingDisplay.h @@ -15,7 +15,6 @@ namespace Pinetime { SettingDisplay(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); ~SettingDisplay() override; - bool Refresh() override; void UpdateSelected(lv_obj_t* object, lv_event_t event); private: diff --git a/src/displayapp/screens/settings/SettingSteps.cpp b/src/displayapp/screens/settings/SettingSteps.cpp index faa843e..bec7972 100644 --- a/src/displayapp/screens/settings/SettingSteps.cpp +++ b/src/displayapp/screens/settings/SettingSteps.cpp @@ -70,11 +70,6 @@ SettingSteps::~SettingSteps() { settingsController.SaveSettings(); } -bool SettingSteps::Refresh() { - return running; -} - - void SettingSteps::UpdateSelected(lv_obj_t *object, lv_event_t event) { uint32_t value = settingsController.GetStepsGoal(); if(object == btnPlus && (event == LV_EVENT_PRESSED)) { @@ -95,4 +90,4 @@ void SettingSteps::UpdateSelected(lv_obj_t *object, lv_event_t event) { } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/settings/SettingSteps.h b/src/displayapp/screens/settings/SettingSteps.h index 0a4c205..5fc05de 100644 --- a/src/displayapp/screens/settings/SettingSteps.h +++ b/src/displayapp/screens/settings/SettingSteps.h @@ -10,22 +10,19 @@ namespace Pinetime { namespace Applications { namespace Screens { - class SettingSteps : public Screen{ - public: - SettingSteps(DisplayApp* app, Pinetime::Controllers::Settings &settingsController); - ~SettingSteps() override; + class SettingSteps : public Screen { + public: + SettingSteps(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); + ~SettingSteps() override; - bool Refresh() override; - void UpdateSelected(lv_obj_t *object, lv_event_t event); - - private: + void UpdateSelected(lv_obj_t* object, lv_event_t event); - Controllers::Settings& settingsController; + private: + Controllers::Settings& settingsController; - lv_obj_t * stepValue; - lv_obj_t * btnPlus; - lv_obj_t * btnMinus; - + lv_obj_t* stepValue; + lv_obj_t* btnPlus; + lv_obj_t* btnMinus; }; } } diff --git a/src/displayapp/screens/settings/SettingTimeFormat.cpp b/src/displayapp/screens/settings/SettingTimeFormat.cpp index 031a2a7..c99e3a0 100644 --- a/src/displayapp/screens/settings/SettingTimeFormat.cpp +++ b/src/displayapp/screens/settings/SettingTimeFormat.cpp @@ -64,10 +64,6 @@ SettingTimeFormat::~SettingTimeFormat() { settingsController.SaveSettings(); } -bool SettingTimeFormat::Refresh() { - return running; -} - void SettingTimeFormat::UpdateSelected(lv_obj_t* object, lv_event_t event) { if (event == LV_EVENT_VALUE_CHANGED) { for (int i = 0; i < optionsTotal; i++) { @@ -86,4 +82,4 @@ void SettingTimeFormat::UpdateSelected(lv_obj_t* object, lv_event_t event) { } } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/settings/SettingTimeFormat.h b/src/displayapp/screens/settings/SettingTimeFormat.h index 9203b45..eac4bdc 100644 --- a/src/displayapp/screens/settings/SettingTimeFormat.h +++ b/src/displayapp/screens/settings/SettingTimeFormat.h @@ -15,7 +15,6 @@ namespace Pinetime { SettingTimeFormat(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); ~SettingTimeFormat() override; - bool Refresh() override; void UpdateSelected(lv_obj_t* object, lv_event_t event); private: diff --git a/src/displayapp/screens/settings/SettingWakeUp.cpp b/src/displayapp/screens/settings/SettingWakeUp.cpp index 0e08035..646afe6 100644 --- a/src/displayapp/screens/settings/SettingWakeUp.cpp +++ b/src/displayapp/screens/settings/SettingWakeUp.cpp @@ -72,10 +72,6 @@ SettingWakeUp::~SettingWakeUp() { settingsController.SaveSettings(); } -bool SettingWakeUp::Refresh() { - return running; -} - void SettingWakeUp::UpdateSelected(lv_obj_t* object, lv_event_t event) { using WakeUpMode = Pinetime::Controllers::Settings::WakeUpMode; if (event == LV_EVENT_VALUE_CHANGED && !ignoringEvents) { diff --git a/src/displayapp/screens/settings/SettingWakeUp.h b/src/displayapp/screens/settings/SettingWakeUp.h index 248dd9a..b9a31dc 100644 --- a/src/displayapp/screens/settings/SettingWakeUp.h +++ b/src/displayapp/screens/settings/SettingWakeUp.h @@ -15,7 +15,6 @@ namespace Pinetime { SettingWakeUp(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); ~SettingWakeUp() override; - bool Refresh() override; void UpdateSelected(lv_obj_t* object, lv_event_t event); private: diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp index 3e73489..1d27acd 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.cpp +++ b/src/displayapp/screens/settings/SettingWatchFace.cpp @@ -75,10 +75,6 @@ SettingWatchFace::~SettingWatchFace() { settingsController.SaveSettings(); } -bool SettingWatchFace::Refresh() { - return running; -} - void SettingWatchFace::UpdateSelected(lv_obj_t* object, lv_event_t event) { if (event == LV_EVENT_VALUE_CHANGED) { for (uint8_t i = 0; i < optionsTotal; i++) { @@ -90,4 +86,4 @@ void SettingWatchFace::UpdateSelected(lv_obj_t* object, lv_event_t event) { } } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/settings/SettingWatchFace.h b/src/displayapp/screens/settings/SettingWatchFace.h index 1930a22..d4a96c6 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.h +++ b/src/displayapp/screens/settings/SettingWatchFace.h @@ -15,7 +15,6 @@ namespace Pinetime { SettingWatchFace(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); ~SettingWatchFace() override; - bool Refresh() override; void UpdateSelected(lv_obj_t* object, lv_event_t event); private: diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index e63a358..c799574 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -26,13 +26,6 @@ Settings::~Settings() { lv_obj_clean(lv_scr_act()); } -bool Settings::Refresh() { - - if (running) - running = screens.Refresh(); - return running; -} - bool Settings::OnTouchEvent(Pinetime::Applications::TouchEvents event) { return screens.OnTouchEvent(event); } diff --git a/src/displayapp/screens/settings/Settings.h b/src/displayapp/screens/settings/Settings.h index 711a6be..02ccff6 100644 --- a/src/displayapp/screens/settings/Settings.h +++ b/src/displayapp/screens/settings/Settings.h @@ -14,8 +14,6 @@ namespace Pinetime { Settings(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); ~Settings() override; - bool Refresh() override; - bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; private: -- cgit v0.10.2 From 331fc2be6931238960c894d0a926f673607455fc Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Mon, 19 Jul 2021 17:06:20 +0300 Subject: Set remaining default periods to LV_DISP_DEF_REFR_PERIOD diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp index beb96fa..2d22877 100644 --- a/src/displayapp/screens/Music.cpp +++ b/src/displayapp/screens/Music.cpp @@ -147,7 +147,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus musicService.event(Controllers::MusicService::EVENT_MUSIC_OPEN); - taskRefresh = lv_task_create(RefreshTaskCallback, 5000, LV_TASK_PRIO_MID, this); + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } Music::~Music() { diff --git a/src/displayapp/screens/Paddle.cpp b/src/displayapp/screens/Paddle.cpp index 87fc872..d43173d 100644 --- a/src/displayapp/screens/Paddle.cpp +++ b/src/displayapp/screens/Paddle.cpp @@ -30,7 +30,7 @@ Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::Li lv_obj_set_style_local_radius(ball, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); lv_obj_set_size(ball, ballSize, ballSize); - taskRefresh = lv_task_create(RefreshTaskCallback, 20, LV_TASK_PRIO_MID, this); + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } Paddle::~Paddle() { diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index 74b49db..0d4feb2 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -101,7 +101,7 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask) lv_obj_align(lapTwoText, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 50, 55); lv_label_set_text(lapTwoText, ""); - taskRefresh = lv_task_create(RefreshTaskCallback, 20, LV_TASK_PRIO_MID, this); + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } StopWatch::~StopWatch() { diff --git a/src/displayapp/screens/Timer.cpp b/src/displayapp/screens/Timer.cpp index ae6ed30..ff3099d 100644 --- a/src/displayapp/screens/Timer.cpp +++ b/src/displayapp/screens/Timer.cpp @@ -74,7 +74,7 @@ Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController) createButtons(); } - taskRefresh = lv_task_create(RefreshTaskCallback, 20, LV_TASK_PRIO_MID, this); + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); } Timer::~Timer() { diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index b6720bd..95c3fe4 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -119,7 +119,7 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app, lv_style_set_line_rounded(&hour_line_style_trace, LV_STATE_DEFAULT, false); lv_obj_add_style(hour_body_trace, LV_LINE_PART_MAIN, &hour_line_style_trace); - taskRefresh = lv_task_create(RefreshTaskCallback, 20, LV_TASK_PRIO_MID, this); + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); UpdateClock(); } diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 9b6aee2..e66e7aa 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -101,7 +101,7 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app, lv_label_set_text(stepIcon, Symbols::shoe); lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); - taskRefresh = lv_task_create(RefreshTaskCallback, 20, LV_TASK_PRIO_MID, this); + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); Refresh(); } -- cgit v0.10.2 From 5e4d3c87e92b8f2dd1020577f3ebad93322b0f6f Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Thu, 22 Jul 2021 15:37:34 +0200 Subject: Remove .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 2f9ac18..0000000 --- a/.gitignore +++ /dev/null @@ -1,41 +0,0 @@ -.idea/ -# Python virtual environment for DFU images -.venv/ - -# CMake -cmake-build-* -cmake-* -CMakeFiles -**/CMakeCache.txt -cmake_install.cmake -Makefile -build -tools - -# Resulting binary files -*.a -*.so -*.s -*.hex -*.bin -!bootloader/bootloader-5.0.4.bin -*.map -*.out -pinetime*.cbp - -# InfiniTime's files -core -sdk -src/Version.h -docker/post_build.sh -Testing/Temporary/ - -# Linux -**/.directory -**/*.swp - -# OSX/MacOS -**/.DS_Store - -# Windows -**/thumbs.db \ No newline at end of file -- cgit v0.10.2 From 547b5a869911bc98e08df05dc56de7ae830f7eeb Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Fri, 23 Jul 2021 15:06:08 +0200 Subject: Restore .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f9ac18 --- /dev/null +++ b/.gitignore @@ -0,0 +1,41 @@ +.idea/ +# Python virtual environment for DFU images +.venv/ + +# CMake +cmake-build-* +cmake-* +CMakeFiles +**/CMakeCache.txt +cmake_install.cmake +Makefile +build +tools + +# Resulting binary files +*.a +*.so +*.s +*.hex +*.bin +!bootloader/bootloader-5.0.4.bin +*.map +*.out +pinetime*.cbp + +# InfiniTime's files +core +sdk +src/Version.h +docker/post_build.sh +Testing/Temporary/ + +# Linux +**/.directory +**/*.swp + +# OSX/MacOS +**/.DS_Store + +# Windows +**/thumbs.db \ No newline at end of file -- cgit v0.10.2 From b3e3d75d0fd077cd4341092f57403b6b3e17c7fd Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Sat, 24 Jul 2021 14:25:27 +0200 Subject: Add extra screen in settings to show scrollbar correctly diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index 7334780..43f60a3 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -49,7 +49,7 @@ std::unique_ptr Settings::CreateScreen1() { {Symbols::clock, "Watch face", Apps::SettingWatchFace}, }}; - return std::make_unique(0, 2, app, settingsController, applications); + return std::make_unique(0, 3, app, settingsController, applications); } std::unique_ptr Settings::CreateScreen2() { @@ -61,7 +61,7 @@ std::unique_ptr Settings::CreateScreen2() { {Symbols::list, "About", Apps::SysInfo}, }}; - return std::make_unique(1, 2, app, settingsController, applications); + return std::make_unique(1, 3, app, settingsController, applications); } std::unique_ptr Settings::CreateScreen3() { @@ -73,5 +73,5 @@ std::unique_ptr Settings::CreateScreen3() { {Symbols::none, "None", Apps::None}, }}; - return std::make_unique(2, 2, app, settingsController, applications); + return std::make_unique(2, 3, app, settingsController, applications); } -- cgit v0.10.2 From e6bc485679022c51486ac3a28b8473b95ff0d115 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Sun, 25 Jul 2021 22:18:39 +0200 Subject: Increment settings value, remove old hacky fix diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index cddef63..40cafe9 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -154,7 +154,7 @@ namespace Pinetime { private: Pinetime::Controllers::FS& fs; - static constexpr uint32_t settingsVersion = 0x0001; + static constexpr uint32_t settingsVersion = 0x0002; struct SettingsData { uint32_t version = settingsVersion; diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index b27bd9c..afce698 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -52,7 +52,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, settingsController {settingsController}, motionController {motionController} { - /* This sets the watchface number to return to after leaving the menu */ + // This sets the watchface number to return to after leaving the menu settingsController.SetClockFace(2); displayedChar[0] = 0; @@ -61,14 +61,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, displayedChar[3] = 0; displayedChar[4] = 0; - //Feels like a hack, but if all the colors are white, this is probably not what the user wants - if (settingsController.GetPTSColorTime() + settingsController.GetPTSColorBar() + settingsController.GetPTSColorBG() == 0) { - settingsController.SetPTSColorTime(11); - settingsController.SetPTSColorBar(11); - settingsController.SetPTSColorBG(3); - } - - /* Create a 200px wide background rectangle */ + //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, pts_colors[settingsController.GetPTSColorBG()]); @@ -76,8 +69,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, lv_obj_set_size(timebar, 200, 240); lv_obj_align(timebar, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 0); - /* Display the time */ - + // 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, pts_colors[settingsController.GetPTSColorTime()]); @@ -96,16 +88,14 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, lv_label_set_text(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 */ - + // 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, pts_colors[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 */ - + // 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_hex(0x000000)); lv_label_set_text(batteryIcon, Symbols::batteryFull); @@ -123,8 +113,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 40); - /* Calendar icon */ - + // 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_hex(0x000000)); lv_obj_set_style_local_radius(calendarOuter, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); @@ -161,8 +150,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, lv_obj_set_size(calendarCrossBar2, 8, 3); lv_obj_align(calendarCrossBar2, calendarBar2, LV_ALIGN_IN_BOTTOM_MID, 0, 0); - /* Display date */ - + // 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_hex(0x000000)); lv_label_set_text(dateDayOfWeek, "THU"); @@ -303,7 +291,7 @@ bool PineTimeStyle::Refresh() { lv_label_set_text(timeAMPM, ampmChar); } - /* Display the time as 2 pairs of digits */ + // Display the time as 2 pairs of digits sprintf(hourStr, "%c%c", hoursChar[0], hoursChar[1]); lv_label_set_text(timeDD1, hourStr); -- cgit v0.10.2 From 28abeae21bb370c45d26912bba4737a1cc6ddca7 Mon Sep 17 00:00:00 2001 From: hubmartin Date: Mon, 2 Aug 2021 21:37:48 +0200 Subject: DRAFT: Put gpio pins to separate file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 40e1f2a..24b5ae4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -615,6 +615,7 @@ set(INCLUDE_FILES drivers/DebugPins.h drivers/InternalFlash.h drivers/Hrs3300.h + drivers/PinMap.h drivers/Bma421.h drivers/Bma421_C/bma4.c drivers/Bma421_C/bma423.c diff --git a/src/components/battery/BatteryController.h b/src/components/battery/BatteryController.h index 1333ad0..cd66ff8 100644 --- a/src/components/battery/BatteryController.h +++ b/src/components/battery/BatteryController.h @@ -3,6 +3,7 @@ #include #include #include +#include namespace Pinetime { namespace Controllers { @@ -72,7 +73,7 @@ namespace Pinetime { static constexpr uint8_t percentRemainingSamples = 5; CircBuffer percentRemainingBuffer {}; - static constexpr uint32_t chargingPin = 12; + static constexpr uint32_t chargingPin = PINMAP_CHARGING_PIN; static constexpr uint32_t powerPresentPin = 19; static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7; uint16_t voltage = 0; diff --git a/src/drivers/Cst816s.h b/src/drivers/Cst816s.h index 14c296e..fa53907 100644 --- a/src/drivers/Cst816s.h +++ b/src/drivers/Cst816s.h @@ -1,6 +1,7 @@ #pragma once #include "TwiMaster.h" +#include namespace Pinetime { namespace Drivers { @@ -40,7 +41,7 @@ namespace Pinetime { private: static constexpr uint8_t pinIrq = 28; - static constexpr uint8_t pinReset = 10; + static constexpr uint8_t pinReset = PINMAP_CST816S_RESET_PIN; static constexpr uint8_t lastTouchId = 0x0f; static constexpr uint8_t touchPointNumIndex = 2; static constexpr uint8_t touchMiscIndex = 8; diff --git a/src/drivers/PinMap.h b/src/drivers/PinMap.h new file mode 100644 index 0000000..61bb10e --- /dev/null +++ b/src/drivers/PinMap.h @@ -0,0 +1,25 @@ +#pragma once + +#ifdef WATCH_P8 + +// BatteryController.h +#define PINMAP_CHARGING_PIN 19 + +// Cst816s.h +#define PINMAP_CST816S_RESET_PIN 13 + +// SystemTask.h +#define PINMAP_BUTTON_PIN 17 + +#else + +// BatteryController.h +#define PINMAP_CHARGING_PIN 12 + +// Cst816s.h +#define PINMAP_CST816S_RESET_PIN 10 + +// SystemTask.h +#define PINMAP_BUTTON_PIN 13 + +#endif \ No newline at end of file diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index ba43429..2756f77 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "SystemMonitor.h" @@ -120,7 +121,7 @@ namespace Pinetime { static constexpr uint8_t pinSpiMiso = 4; static constexpr uint8_t pinSpiCsn = 25; static constexpr uint8_t pinLcdDataCommand = 18; - static constexpr uint8_t pinButton = 13; + static constexpr uint8_t pinButton = PINMAP_BUTTON_PIN; static constexpr uint8_t pinTouchIrq = 28; static constexpr uint8_t pinPowerPresentIrq = 19; -- cgit v0.10.2 From f244c960d3848096b60f735e705819f05a0459d7 Mon Sep 17 00:00:00 2001 From: Martin Hub Date: Tue, 3 Aug 2021 17:41:34 +0200 Subject: Update ota-gadgetbridge-nrfconnect.md diff --git a/doc/gettingStarted/ota-gadgetbridge-nrfconnect.md b/doc/gettingStarted/ota-gadgetbridge-nrfconnect.md index 1187a9b..2f2dd55 100644 --- a/doc/gettingStarted/ota-gadgetbridge-nrfconnect.md +++ b/doc/gettingStarted/ota-gadgetbridge-nrfconnect.md @@ -88,6 +88,10 @@ If you are using OpenOCD with a STLinkV2, you can find more info [on this page]( ### Using Gadgetbridge Good news! Gadgetbridge **automatically** synchronizes the time when connecting to your PineTime! +### Using any Chromium-based web browser +You can use it from your PC, Mac, Android. Browsers now have BLE support. +https://hubmartin.github.io/WebBLEWatch/ + ### Using NRFConnect You must enable the **CTS** *GATT server* into NRFConnect so that InfiniTime can synchronize the time with your smartphone. -- cgit v0.10.2 From 2992f4afd286d26068bba0afdd9337ab6d96aa15 Mon Sep 17 00:00:00 2001 From: Martin Hub Date: Tue, 3 Aug 2021 17:56:02 +0200 Subject: Add FW validation note after DFU flash diff --git a/doc/gettingStarted/ota-gadgetbridge-nrfconnect.md b/doc/gettingStarted/ota-gadgetbridge-nrfconnect.md index 1187a9b..86bbab8 100644 --- a/doc/gettingStarted/ota-gadgetbridge-nrfconnect.md +++ b/doc/gettingStarted/ota-gadgetbridge-nrfconnect.md @@ -47,6 +47,8 @@ Read carefully the warning and tap **Install**: Wait for the transfer to finish. Your PineTime should reset and reboot with the new version of InfiniTime! +Don't forget to **validate** your firmware. In the InfiniTime go to the settings (swipe right, select gear icon) and Firmware option and click **validate**. Otherwise after reboot the previous firmware will be used. + ![Gadgetbridge 5](gadgetbridge5.jpg) ### Using NRFConnect @@ -64,6 +66,8 @@ Select **Distribution packet (ZIP)**: Browse to the DFU file you downloaded previously, the DFU transfer will start automatically. When the transfer is finished, your PineTime will reset and restart on the new version of InfiniTime! +Don't forget to **validate** your firmware. In the InfiniTime go to the settings (swipe right, select gear icon) and Firmware option and click **validate**. Otherwise after reboot the previous firmware will be used. + ![NRFConnect 3](nrfconnect3.jpg) ## How to flash InfiniTime using the SWD interface -- cgit v0.10.2 From c30e54c7b743f7c6364d35412d74ba9be8dc3c04 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Tue, 3 Aug 2021 19:49:54 +0300 Subject: Make it easier for new people to find instructions diff --git a/README.md b/README.md index d9de400..af91616 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,15 @@ -# PineTime +## New to InfiniTime? -[![Build PineTime Firmware](https://github.com/JF002/InfiniTime/workflows/Build%20PineTime%20Firmware/badge.svg?branch=master)](https://github.com/JF002/InfiniTime/actions) - -> The PineTime is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery as well as a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project, which means that it will ultimately be up to the developers and end-users to determine when they deem the PineTime ready to ship. - -> We envision the PineTime as a companion for not only your PinePhone but also for your favorite devices — any phone, tablet, or even PC. - -*https://www.pine64.org/pinetime/* - -The **Pinetime** smartwatch is built around the NRF52832 MCU (512KB Flash, 64KB RAM), a 240*240 LCD display driven by the ST7789 controller, an accelerometer, a heart rate sensor, and a vibration motor. + - [Getting started with InfiniTime 1.0 (quick user guide, update bootloader and InfiniTime,...)](doc/gettingStarted/gettingStarted-1.0.md) + - [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/ota-gadgetbridge-nrfconnect.md) # InfiniTime +[![Build PineTime Firmware](https://github.com/JF002/InfiniTime/workflows/Build%20PineTime%20Firmware/badge.svg?branch=master)](https://github.com/JF002/InfiniTime/actions) + ![InfiniTime logo](images/infinitime-logo.jpg "InfiniTime Logo") -The goal of this project is to design an open-source firmware for the Pinetime smartwatch : +The goal of this project is to design an open-source firmware for the [Pinetime smartwatch](https://www.pine64.org/pinetime/) : - Code written in **modern C++**; - Build system based on **CMake**; @@ -75,11 +70,6 @@ As of now, here is the list of achievements of this project: ## Documentation -### Getting started - - - [Getting started with InfiniTime 1.0 (quick user guide, update bootloader and InfiniTime,...)](doc/gettingStarted/gettingStarted-1.0.md) - - [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/ota-gadgetbridge-nrfconnect.md) - ### Develop - [Generate the fonts and symbols](src/displayapp/fonts/README.md) -- cgit v0.10.2 From 285ac9e4c86f6f1fb96130d2df038fff7ec49ad5 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Tue, 3 Aug 2021 19:51:58 +0300 Subject: Move getting started slightly lower diff --git a/README.md b/README.md index af91616..a6f0d3a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,3 @@ -## New to InfiniTime? - - - [Getting started with InfiniTime 1.0 (quick user guide, update bootloader and InfiniTime,...)](doc/gettingStarted/gettingStarted-1.0.md) - - [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/ota-gadgetbridge-nrfconnect.md) - # InfiniTime [![Build PineTime Firmware](https://github.com/JF002/InfiniTime/workflows/Build%20PineTime%20Firmware/badge.svg?branch=master)](https://github.com/JF002/InfiniTime/actions) @@ -17,6 +12,11 @@ The goal of this project is to design an open-source firmware for the [Pinetime - Using **[LittleVGL/LVGL 7](https://lvgl.io/)** as UI library... - ... and **[NimBLE 1.3.0](https://github.com/apache/mynewt-nimble)** as BLE stack. +## New to InfiniTime? + + - [Getting started with InfiniTime 1.0 (quick user guide, update bootloader and InfiniTime,...)](doc/gettingStarted/gettingStarted-1.0.md) + - [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/ota-gadgetbridge-nrfconnect.md) + ## Overview ![Pinetime screens](images/1.0.0/collage.png "PinetimeScreens") -- cgit v0.10.2 From b7aa04e1f55096d754a7cc291f02f3430f5a3cd9 Mon Sep 17 00:00:00 2001 From: hubmartin Date: Tue, 3 Aug 2021 20:32:23 +0200 Subject: PinMap with namespace and constexpr diff --git a/src/components/battery/BatteryController.cpp b/src/components/battery/BatteryController.cpp index fa476ea..d543ccd 100644 --- a/src/components/battery/BatteryController.cpp +++ b/src/components/battery/BatteryController.cpp @@ -12,12 +12,12 @@ Battery::Battery() { } void Battery::Init() { - nrf_gpio_cfg_input(chargingPin, static_cast GPIO_PIN_CNF_PULL_Pullup); + nrf_gpio_cfg_input(PinMap::Charging, static_cast GPIO_PIN_CNF_PULL_Pullup); } void Battery::Update() { - isCharging = !nrf_gpio_pin_read(chargingPin); - isPowerPresent = !nrf_gpio_pin_read(powerPresentPin); + isCharging = !nrf_gpio_pin_read(PinMap::Charging); + isPowerPresent = !nrf_gpio_pin_read(PinMap::PowerPresent); if (isReading) { return; diff --git a/src/components/battery/BatteryController.h b/src/components/battery/BatteryController.h index cd66ff8..993ef6c 100644 --- a/src/components/battery/BatteryController.h +++ b/src/components/battery/BatteryController.h @@ -73,8 +73,6 @@ namespace Pinetime { static constexpr uint8_t percentRemainingSamples = 5; CircBuffer percentRemainingBuffer {}; - static constexpr uint32_t chargingPin = PINMAP_CHARGING_PIN; - static constexpr uint32_t powerPresentPin = 19; static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7; uint16_t voltage = 0; int percentRemaining = -1; diff --git a/src/components/brightness/BrightnessController.cpp b/src/components/brightness/BrightnessController.cpp index 8ad987d..350dfee 100644 --- a/src/components/brightness/BrightnessController.cpp +++ b/src/components/brightness/BrightnessController.cpp @@ -1,13 +1,13 @@ #include "BrightnessController.h" #include #include "displayapp/screens/Symbols.h" - +#include "drivers/PinMap.h" using namespace Pinetime::Controllers; void BrightnessController::Init() { - nrf_gpio_cfg_output(pinLcdBacklight1); - nrf_gpio_cfg_output(pinLcdBacklight2); - nrf_gpio_cfg_output(pinLcdBacklight3); + nrf_gpio_cfg_output(PinMap::LcdBacklight1); + nrf_gpio_cfg_output(PinMap::LcdBacklight2); + nrf_gpio_cfg_output(PinMap::LcdBacklight3); Set(level); } @@ -16,24 +16,24 @@ void BrightnessController::Set(BrightnessController::Levels level) { switch (level) { default: case Levels::High: - nrf_gpio_pin_clear(pinLcdBacklight1); - nrf_gpio_pin_clear(pinLcdBacklight2); - nrf_gpio_pin_clear(pinLcdBacklight3); + nrf_gpio_pin_clear(PinMap::LcdBacklight1); + nrf_gpio_pin_clear(PinMap::LcdBacklight2); + nrf_gpio_pin_clear(PinMap::LcdBacklight3); break; case Levels::Medium: - nrf_gpio_pin_clear(pinLcdBacklight1); - nrf_gpio_pin_clear(pinLcdBacklight2); - nrf_gpio_pin_set(pinLcdBacklight3); + nrf_gpio_pin_clear(PinMap::LcdBacklight1); + nrf_gpio_pin_clear(PinMap::LcdBacklight2); + nrf_gpio_pin_set(PinMap::LcdBacklight3); break; case Levels::Low: - nrf_gpio_pin_clear(pinLcdBacklight1); - nrf_gpio_pin_set(pinLcdBacklight2); - nrf_gpio_pin_set(pinLcdBacklight3); + nrf_gpio_pin_clear(PinMap::LcdBacklight1); + nrf_gpio_pin_set(PinMap::LcdBacklight2); + nrf_gpio_pin_set(PinMap::LcdBacklight3); break; case Levels::Off: - nrf_gpio_pin_set(pinLcdBacklight1); - nrf_gpio_pin_set(pinLcdBacklight2); - nrf_gpio_pin_set(pinLcdBacklight3); + nrf_gpio_pin_set(PinMap::LcdBacklight1); + nrf_gpio_pin_set(PinMap::LcdBacklight2); + nrf_gpio_pin_set(PinMap::LcdBacklight3); break; } } diff --git a/src/components/brightness/BrightnessController.h b/src/components/brightness/BrightnessController.h index c47158a..0d7ac2f 100644 --- a/src/components/brightness/BrightnessController.h +++ b/src/components/brightness/BrightnessController.h @@ -22,9 +22,6 @@ namespace Pinetime { const char* ToString(); private: - static constexpr uint8_t pinLcdBacklight1 = 14; - static constexpr uint8_t pinLcdBacklight2 = 22; - static constexpr uint8_t pinLcdBacklight3 = 23; Levels level = Levels::High; Levels backupLevel = Levels::High; }; diff --git a/src/components/motor/MotorController.cpp b/src/components/motor/MotorController.cpp index 3afa0ce..1f20936 100644 --- a/src/components/motor/MotorController.cpp +++ b/src/components/motor/MotorController.cpp @@ -2,6 +2,7 @@ #include #include "systemtask/SystemTask.h" #include "app_timer.h" +#include "drivers/PinMap.h" APP_TIMER_DEF(vibTimer); @@ -11,8 +12,8 @@ MotorController::MotorController(Controllers::Settings& settingsController) : se } void MotorController::Init() { - nrf_gpio_cfg_output(pinMotor); - nrf_gpio_pin_set(pinMotor); + nrf_gpio_cfg_output(PinMap::Motor); + nrf_gpio_pin_set(PinMap::Motor); app_timer_create(&vibTimer, APP_TIMER_MODE_SINGLE_SHOT, vibrate); } @@ -21,11 +22,11 @@ void MotorController::SetDuration(uint8_t motorDuration) { if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::OFF) return; - nrf_gpio_pin_clear(pinMotor); + nrf_gpio_pin_clear(PinMap::Motor); /* Start timer for motorDuration miliseconds and timer triggers vibrate() when it finishes*/ app_timer_start(vibTimer, APP_TIMER_TICKS(motorDuration), NULL); } void MotorController::vibrate(void* p_context) { - nrf_gpio_pin_set(pinMotor); + nrf_gpio_pin_set(PinMap::Motor); } \ No newline at end of file diff --git a/src/components/motor/MotorController.h b/src/components/motor/MotorController.h index df61af7..00cd193 100644 --- a/src/components/motor/MotorController.h +++ b/src/components/motor/MotorController.h @@ -6,7 +6,6 @@ namespace Pinetime { namespace Controllers { - static constexpr uint8_t pinMotor = 16; class MotorController { public: diff --git a/src/drivers/Cst816s.cpp b/src/drivers/Cst816s.cpp index fd9792b..b039ab0 100644 --- a/src/drivers/Cst816s.cpp +++ b/src/drivers/Cst816s.cpp @@ -3,6 +3,7 @@ #include #include #include +#include "drivers/PinMap.h" using namespace Pinetime::Drivers; @@ -18,12 +19,12 @@ Cst816S::Cst816S(TwiMaster& twiMaster, uint8_t twiAddress) : twiMaster {twiMaste } void Cst816S::Init() { - nrf_gpio_cfg_output(pinReset); - nrf_gpio_pin_set(pinReset); + nrf_gpio_cfg_output(PinMap::Cst816sReset); + nrf_gpio_pin_set(PinMap::Cst816sReset); vTaskDelay(50); - nrf_gpio_pin_clear(pinReset); + nrf_gpio_pin_clear(PinMap::Cst816sReset); vTaskDelay(5); - nrf_gpio_pin_set(pinReset); + nrf_gpio_pin_set(PinMap::Cst816sReset); vTaskDelay(50); // Wake the touchpanel up @@ -78,9 +79,9 @@ Cst816S::TouchInfos Cst816S::GetTouchInfo() { } void Cst816S::Sleep() { - nrf_gpio_pin_clear(pinReset); + nrf_gpio_pin_clear(PinMap::Cst816sReset); vTaskDelay(5); - nrf_gpio_pin_set(pinReset); + nrf_gpio_pin_set(PinMap::Cst816sReset); vTaskDelay(50); static constexpr uint8_t sleepValue = 0x03; twiMaster.Write(twiAddress, 0xA5, &sleepValue, 1); diff --git a/src/drivers/Cst816s.h b/src/drivers/Cst816s.h index fa53907..b621510 100644 --- a/src/drivers/Cst816s.h +++ b/src/drivers/Cst816s.h @@ -1,7 +1,6 @@ #pragma once #include "TwiMaster.h" -#include namespace Pinetime { namespace Drivers { @@ -40,8 +39,6 @@ namespace Pinetime { void Wakeup(); private: - static constexpr uint8_t pinIrq = 28; - static constexpr uint8_t pinReset = PINMAP_CST816S_RESET_PIN; static constexpr uint8_t lastTouchId = 0x0f; static constexpr uint8_t touchPointNumIndex = 2; static constexpr uint8_t touchMiscIndex = 8; diff --git a/src/drivers/PinMap.h b/src/drivers/PinMap.h index 61bb10e..117cf11 100644 --- a/src/drivers/PinMap.h +++ b/src/drivers/PinMap.h @@ -1,5 +1,42 @@ #pragma once +namespace Pinetime { + namespace PinMap { + #define WATCH_P8 + #ifdef WATCH_P8 + static constexpr uint8_t Charging = 19; + static constexpr uint8_t Cst816sReset = 13; + static constexpr uint8_t Button = 17; + #else + static constexpr uint8_t Charging = 12; + static constexpr uint8_t Cst816sReset = 10; + static constexpr uint8_t Button = 13; + #endif + + static constexpr uint8_t Cst816sIrq = 28; + static constexpr uint8_t PowerPresent = 19; + + static constexpr uint8_t Motor = 16; + + static constexpr uint8_t LcdBacklight1 = 14; + static constexpr uint8_t LcdBacklight2 = 22; + static constexpr uint8_t LcdBacklight3 = 23; + + static constexpr uint8_t SpiSck = 2; + static constexpr uint8_t SpiMosi = 3; + static constexpr uint8_t SpiMiso = 4; + + static constexpr uint8_t SpiFlashCsn = 5; + static constexpr uint8_t SpiLcdCsn = 25; + static constexpr uint8_t LcdDataCommand = 18; + + static constexpr uint8_t TwiScl = 7; + static constexpr uint8_t TwiSda = 6; + + } +} + + #ifdef WATCH_P8 // BatteryController.h diff --git a/src/main.cpp b/src/main.cpp index ffbba5e..408ce43 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -42,6 +42,7 @@ #include "drivers/St7789.h" #include "drivers/TwiMaster.h" #include "drivers/Cst816s.h" +#include "drivers/PinMap.h" #include "systemtask/SystemTask.h" #if NRF_LOG_ENABLED @@ -52,14 +53,6 @@ Pinetime::Logging::NrfLogger logger; Pinetime::Logging::DummyLogger logger; #endif -static constexpr uint8_t pinSpiSck = 2; -static constexpr uint8_t pinSpiMosi = 3; -static constexpr uint8_t pinSpiMiso = 4; -static constexpr uint8_t pinSpiFlashCsn = 5; -static constexpr uint8_t pinLcdCsn = 25; -static constexpr uint8_t pinLcdDataCommand = 18; -static constexpr uint8_t pinTwiScl = 7; -static constexpr uint8_t pinTwiSda = 6; static constexpr uint8_t touchPanelTwiAddress = 0x15; static constexpr uint8_t motionSensorTwiAddress = 0x18; static constexpr uint8_t heartRateSensorTwiAddress = 0x44; @@ -68,14 +61,14 @@ Pinetime::Drivers::SpiMaster spi {Pinetime::Drivers::SpiMaster::SpiModule::SPI0, {Pinetime::Drivers::SpiMaster::BitOrder::Msb_Lsb, Pinetime::Drivers::SpiMaster::Modes::Mode3, Pinetime::Drivers::SpiMaster::Frequencies::Freq8Mhz, - pinSpiSck, - pinSpiMosi, - pinSpiMiso}}; + Pinetime::PinMap::SpiSck, + Pinetime::PinMap::SpiMosi, + Pinetime::PinMap::SpiMiso}}; -Pinetime::Drivers::Spi lcdSpi {spi, pinLcdCsn}; -Pinetime::Drivers::St7789 lcd {lcdSpi, pinLcdDataCommand}; +Pinetime::Drivers::Spi lcdSpi {spi, Pinetime::PinMap::SpiLcdCsn}; +Pinetime::Drivers::St7789 lcd {lcdSpi, Pinetime::PinMap::LcdDataCommand}; -Pinetime::Drivers::Spi flashSpi {spi, pinSpiFlashCsn}; +Pinetime::Drivers::Spi flashSpi {spi, Pinetime::PinMap::SpiFlashCsn}; Pinetime::Drivers::SpiNorFlash spiNorFlash {flashSpi}; // The TWI device should work @ up to 400Khz but there is a HW bug which prevent it from @@ -83,7 +76,7 @@ Pinetime::Drivers::SpiNorFlash spiNorFlash {flashSpi}; // at ~390Khz with correct timings. static constexpr uint32_t MaxTwiFrequencyWithoutHardwareBug {0x06200000}; Pinetime::Drivers::TwiMaster twiMaster {Pinetime::Drivers::TwiMaster::Modules::TWIM1, - Pinetime::Drivers::TwiMaster::Parameters {MaxTwiFrequencyWithoutHardwareBug, pinTwiSda, pinTwiScl}}; + Pinetime::Drivers::TwiMaster::Parameters {MaxTwiFrequencyWithoutHardwareBug, Pinetime::PinMap::TwiSda, Pinetime::PinMap::TwiScl}}; Pinetime::Drivers::Cst816S touchPanel {twiMaster, touchPanelTwiAddress}; #ifdef PINETIME_IS_RECOVERY static constexpr bool isFactory = true; @@ -106,8 +99,6 @@ Pinetime::Controllers::Battery batteryController; Pinetime::Controllers::Ble bleController; void ble_manager_set_ble_connection_callback(void (*connection)()); void ble_manager_set_ble_disconnection_callback(void (*disconnection)()); -static constexpr uint8_t pinTouchIrq = 28; -static constexpr uint8_t pinPowerPresentIrq = 19; Pinetime::Controllers::HeartRateController heartRateController; Pinetime::Applications::HeartRateTask heartRateApp(heartRateSensor, heartRateController); @@ -161,14 +152,14 @@ Pinetime::System::SystemTask systemTask(spi, fs); void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action) { - if (pin == pinTouchIrq) { + if (pin == Pinetime::PinMap::Cst816sIrq) { systemTask.OnTouchEvent(); return; } BaseType_t xHigherPriorityTaskWoken = pdFALSE; - if (pin == pinPowerPresentIrq and action == NRF_GPIOTE_POLARITY_TOGGLE) { + if (pin == Pinetime::PinMap::PowerPresent and action == NRF_GPIOTE_POLARITY_TOGGLE) { xTimerStartFromISR(debounceChargeTimer, &xHigherPriorityTaskWoken); portYIELD_FROM_ISR(xHigherPriorityTaskWoken); return; diff --git a/src/recoveryLoader.cpp b/src/recoveryLoader.cpp index 9818179..acec14c 100644 --- a/src/recoveryLoader.cpp +++ b/src/recoveryLoader.cpp @@ -15,6 +15,7 @@ #include #include #include "recoveryImage.h" +#include "drivers/PinMap.h" #include "displayapp/icons/infinitime/infinitime-nb.c" #include "components/rle/RleDecoder.h" @@ -27,12 +28,6 @@ Pinetime::Logging::NrfLogger logger; Pinetime::Logging::DummyLogger logger; #endif -static constexpr uint8_t pinSpiSck = 2; -static constexpr uint8_t pinSpiMosi = 3; -static constexpr uint8_t pinSpiMiso = 4; -static constexpr uint8_t pinSpiFlashCsn = 5; -static constexpr uint8_t pinLcdCsn = 25; -static constexpr uint8_t pinLcdDataCommand = 18; static constexpr uint8_t displayWidth = 240; static constexpr uint8_t displayHeight = 240; @@ -45,14 +40,14 @@ Pinetime::Drivers::SpiMaster spi {Pinetime::Drivers::SpiMaster::SpiModule::SPI0, {Pinetime::Drivers::SpiMaster::BitOrder::Msb_Lsb, Pinetime::Drivers::SpiMaster::Modes::Mode3, Pinetime::Drivers::SpiMaster::Frequencies::Freq8Mhz, - pinSpiSck, - pinSpiMosi, - pinSpiMiso}}; -Pinetime::Drivers::Spi flashSpi {spi, pinSpiFlashCsn}; + Pinetime::PinMap::SpiSck, + Pinetime::PinMap::SpiMosi, + Pinetime::PinMap::SpiMiso}}; +Pinetime::Drivers::Spi flashSpi {spi, Pinetime::PinMap::SpiFlashCsn}; Pinetime::Drivers::SpiNorFlash spiNorFlash {flashSpi}; -Pinetime::Drivers::Spi lcdSpi {spi, pinLcdCsn}; -Pinetime::Drivers::St7789 lcd {lcdSpi, pinLcdDataCommand}; +Pinetime::Drivers::Spi lcdSpi {spi, Pinetime::PinMap::SpiLcdCsn}; +Pinetime::Drivers::St7789 lcd {lcdSpi, Pinetime::PinMap::LcdDataCommand}; Pinetime::Components::Gfx gfx {lcd}; Pinetime::Controllers::BrightnessController brightnessController; diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 8915ce7..e03a57b 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -21,8 +21,10 @@ #include "drivers/SpiNorFlash.h" #include "drivers/TwiMaster.h" #include "drivers/Hrs3300.h" +#include "drivers/PinMap.h" #include "main.h" + #include using namespace Pinetime::System; @@ -149,7 +151,7 @@ void SystemTask::Work() { heartRateSensor.Disable(); heartRateApp.Start(); - nrf_gpio_cfg_sense_input(pinButton, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pulldown, (nrf_gpio_pin_sense_t) GPIO_PIN_CNF_SENSE_High); + nrf_gpio_cfg_sense_input(PinMap::Button, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pulldown, (nrf_gpio_pin_sense_t) GPIO_PIN_CNF_SENSE_High); nrf_gpio_cfg_output(15); nrf_gpio_pin_set(15); @@ -160,9 +162,9 @@ void SystemTask::Work() { pinConfig.sense = (nrf_gpiote_polarity_t) NRF_GPIOTE_POLARITY_HITOLO; pinConfig.pull = (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pulldown; - nrfx_gpiote_in_init(pinButton, &pinConfig, nrfx_gpiote_evt_handler); + nrfx_gpiote_in_init(PinMap::Button, &pinConfig, nrfx_gpiote_evt_handler); - nrf_gpio_cfg_sense_input(pinTouchIrq, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pullup, (nrf_gpio_pin_sense_t) GPIO_PIN_CNF_SENSE_Low); + nrf_gpio_cfg_sense_input(PinMap::Cst816sIrq, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pullup, (nrf_gpio_pin_sense_t) GPIO_PIN_CNF_SENSE_Low); pinConfig.skip_gpio_setup = true; pinConfig.hi_accuracy = false; @@ -170,19 +172,19 @@ void SystemTask::Work() { pinConfig.sense = (nrf_gpiote_polarity_t) NRF_GPIOTE_POLARITY_HITOLO; pinConfig.pull = (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pullup; - nrfx_gpiote_in_init(pinTouchIrq, &pinConfig, nrfx_gpiote_evt_handler); + nrfx_gpiote_in_init(PinMap::Cst816sIrq, &pinConfig, nrfx_gpiote_evt_handler); pinConfig.sense = NRF_GPIOTE_POLARITY_TOGGLE; pinConfig.pull = NRF_GPIO_PIN_NOPULL; pinConfig.is_watcher = false; pinConfig.hi_accuracy = false; pinConfig.skip_gpio_setup = true; - nrfx_gpiote_in_init(pinPowerPresentIrq, &pinConfig, nrfx_gpiote_evt_handler); + nrfx_gpiote_in_init(PinMap::PowerPresent, &pinConfig, nrfx_gpiote_evt_handler); - if (nrf_gpio_pin_read(pinPowerPresentIrq)) { - nrf_gpio_cfg_sense_input(pinPowerPresentIrq, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW); + if (nrf_gpio_pin_read(PinMap::PowerPresent)) { + nrf_gpio_cfg_sense_input(PinMap::PowerPresent, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW); } else { - nrf_gpio_cfg_sense_input(pinPowerPresentIrq, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH); + nrf_gpio_cfg_sense_input(PinMap::PowerPresent, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH); } idleTimer = xTimerCreate("idleTimer", pdMS_TO_TICKS(2000), pdFALSE, this, IdleTimerCallback); @@ -354,7 +356,7 @@ void SystemTask::Work() { monitor.Process(); uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG); dateTimeController.UpdateTime(systick_counter); - if (!nrf_gpio_pin_read(pinButton)) + if (!nrf_gpio_pin_read(PinMap::Button)) watchdog.Kick(); } // Clear diagnostic suppression diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index 2756f77..e4da6b1 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -116,15 +116,6 @@ namespace Pinetime { Pinetime::Controllers::FS& fs; Pinetime::Controllers::NimbleController nimbleController; - static constexpr uint8_t pinSpiSck = 2; - static constexpr uint8_t pinSpiMosi = 3; - static constexpr uint8_t pinSpiMiso = 4; - static constexpr uint8_t pinSpiCsn = 25; - static constexpr uint8_t pinLcdDataCommand = 18; - static constexpr uint8_t pinButton = PINMAP_BUTTON_PIN; - static constexpr uint8_t pinTouchIrq = 28; - static constexpr uint8_t pinPowerPresentIrq = 19; - static void Process(void* instance); void Work(); void ReloadIdleTimer(); -- cgit v0.10.2 From b3e6da75148fcb54fdb5fe02f6bdc7d7d3905e98 Mon Sep 17 00:00:00 2001 From: hubmartin Date: Tue, 3 Aug 2021 20:40:27 +0200 Subject: Cleanup, set Pinetime as default diff --git a/src/components/battery/BatteryController.cpp b/src/components/battery/BatteryController.cpp index d543ccd..e2fce7f 100644 --- a/src/components/battery/BatteryController.cpp +++ b/src/components/battery/BatteryController.cpp @@ -1,4 +1,5 @@ #include "BatteryController.h" +#include "drivers/PinMap.h" #include #include #include diff --git a/src/components/battery/BatteryController.h b/src/components/battery/BatteryController.h index 993ef6c..5c7fa1f 100644 --- a/src/components/battery/BatteryController.h +++ b/src/components/battery/BatteryController.h @@ -3,7 +3,6 @@ #include #include #include -#include namespace Pinetime { namespace Controllers { diff --git a/src/drivers/PinMap.h b/src/drivers/PinMap.h index 117cf11..c8b091f 100644 --- a/src/drivers/PinMap.h +++ b/src/drivers/PinMap.h @@ -2,61 +2,37 @@ namespace Pinetime { namespace PinMap { - #define WATCH_P8 + #ifdef WATCH_P8 + // COLMI P8 static constexpr uint8_t Charging = 19; static constexpr uint8_t Cst816sReset = 13; static constexpr uint8_t Button = 17; #else + // Pinetime static constexpr uint8_t Charging = 12; static constexpr uint8_t Cst816sReset = 10; static constexpr uint8_t Button = 13; #endif - static constexpr uint8_t Cst816sIrq = 28; - static constexpr uint8_t PowerPresent = 19; + static constexpr uint8_t Cst816sIrq = 28; + static constexpr uint8_t PowerPresent = 19; - static constexpr uint8_t Motor = 16; + static constexpr uint8_t Motor = 16; - static constexpr uint8_t LcdBacklight1 = 14; - static constexpr uint8_t LcdBacklight2 = 22; - static constexpr uint8_t LcdBacklight3 = 23; + static constexpr uint8_t LcdBacklight1 = 14; + static constexpr uint8_t LcdBacklight2 = 22; + static constexpr uint8_t LcdBacklight3 = 23; - static constexpr uint8_t SpiSck = 2; - static constexpr uint8_t SpiMosi = 3; - static constexpr uint8_t SpiMiso = 4; + static constexpr uint8_t SpiSck = 2; + static constexpr uint8_t SpiMosi = 3; + static constexpr uint8_t SpiMiso = 4; - static constexpr uint8_t SpiFlashCsn = 5; - static constexpr uint8_t SpiLcdCsn = 25; - static constexpr uint8_t LcdDataCommand = 18; - - static constexpr uint8_t TwiScl = 7; - static constexpr uint8_t TwiSda = 6; + static constexpr uint8_t SpiFlashCsn = 5; + static constexpr uint8_t SpiLcdCsn = 25; + static constexpr uint8_t LcdDataCommand = 18; + static constexpr uint8_t TwiScl = 7; + static constexpr uint8_t TwiSda = 6; } } - - -#ifdef WATCH_P8 - -// BatteryController.h -#define PINMAP_CHARGING_PIN 19 - -// Cst816s.h -#define PINMAP_CST816S_RESET_PIN 13 - -// SystemTask.h -#define PINMAP_BUTTON_PIN 17 - -#else - -// BatteryController.h -#define PINMAP_CHARGING_PIN 12 - -// Cst816s.h -#define PINMAP_CST816S_RESET_PIN 10 - -// SystemTask.h -#define PINMAP_BUTTON_PIN 13 - -#endif \ No newline at end of file -- cgit v0.10.2 From abd8f343e48bdfa1dc4c8604d843a5c2d8071bc0 Mon Sep 17 00:00:00 2001 From: hubmartin Date: Wed, 4 Aug 2021 14:43:04 +0200 Subject: Rename backlight level pins diff --git a/src/components/brightness/BrightnessController.cpp b/src/components/brightness/BrightnessController.cpp index 350dfee..6c52467 100644 --- a/src/components/brightness/BrightnessController.cpp +++ b/src/components/brightness/BrightnessController.cpp @@ -5,9 +5,9 @@ using namespace Pinetime::Controllers; void BrightnessController::Init() { - nrf_gpio_cfg_output(PinMap::LcdBacklight1); - nrf_gpio_cfg_output(PinMap::LcdBacklight2); - nrf_gpio_cfg_output(PinMap::LcdBacklight3); + nrf_gpio_cfg_output(PinMap::LcdBacklightLow); + nrf_gpio_cfg_output(PinMap::LcdBacklightMedium); + nrf_gpio_cfg_output(PinMap::LcdBacklightHigh); Set(level); } @@ -16,24 +16,24 @@ void BrightnessController::Set(BrightnessController::Levels level) { switch (level) { default: case Levels::High: - nrf_gpio_pin_clear(PinMap::LcdBacklight1); - nrf_gpio_pin_clear(PinMap::LcdBacklight2); - nrf_gpio_pin_clear(PinMap::LcdBacklight3); + nrf_gpio_pin_clear(PinMap::LcdBacklightLow); + nrf_gpio_pin_clear(PinMap::LcdBacklightMedium); + nrf_gpio_pin_clear(PinMap::LcdBacklightHigh); break; case Levels::Medium: - nrf_gpio_pin_clear(PinMap::LcdBacklight1); - nrf_gpio_pin_clear(PinMap::LcdBacklight2); - nrf_gpio_pin_set(PinMap::LcdBacklight3); + nrf_gpio_pin_clear(PinMap::LcdBacklightLow); + nrf_gpio_pin_clear(PinMap::LcdBacklightMedium); + nrf_gpio_pin_set(PinMap::LcdBacklightHigh); break; case Levels::Low: - nrf_gpio_pin_clear(PinMap::LcdBacklight1); - nrf_gpio_pin_set(PinMap::LcdBacklight2); - nrf_gpio_pin_set(PinMap::LcdBacklight3); + nrf_gpio_pin_clear(PinMap::LcdBacklightLow); + nrf_gpio_pin_set(PinMap::LcdBacklightMedium); + nrf_gpio_pin_set(PinMap::LcdBacklightHigh); break; case Levels::Off: - nrf_gpio_pin_set(PinMap::LcdBacklight1); - nrf_gpio_pin_set(PinMap::LcdBacklight2); - nrf_gpio_pin_set(PinMap::LcdBacklight3); + nrf_gpio_pin_set(PinMap::LcdBacklightLow); + nrf_gpio_pin_set(PinMap::LcdBacklightMedium); + nrf_gpio_pin_set(PinMap::LcdBacklightHigh); break; } } diff --git a/src/drivers/PinMap.h b/src/drivers/PinMap.h index c8b091f..5796402 100644 --- a/src/drivers/PinMap.h +++ b/src/drivers/PinMap.h @@ -20,9 +20,9 @@ namespace Pinetime { static constexpr uint8_t Motor = 16; - static constexpr uint8_t LcdBacklight1 = 14; - static constexpr uint8_t LcdBacklight2 = 22; - static constexpr uint8_t LcdBacklight3 = 23; + static constexpr uint8_t LcdBacklightLow = 14; + static constexpr uint8_t LcdBacklightMedium = 22; + static constexpr uint8_t LcdBacklightHigh = 23; static constexpr uint8_t SpiSck = 2; static constexpr uint8_t SpiMosi = 3; -- cgit v0.10.2 From 6bffc7d52840affc5c037d1bb783172b99d4731a Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Thu, 12 Aug 2021 21:28:41 +0200 Subject: Tidying diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index 04128b2..6b0cc59 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -62,7 +62,6 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, displayedChar[4] = 0; //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, pts_colors[settingsController.GetPTSColorBG()]); lv_obj_set_style_local_radius(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); -- cgit v0.10.2 From fbb4e8c6ae461697e7151927205ce134eb26de53 Mon Sep 17 00:00:00 2001 From: mabuch Date: Sat, 14 Aug 2021 14:47:00 +0200 Subject: fix Github Action build Firmware diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4a71b7e..f25fd31 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,7 +44,7 @@ jobs: - name: Install Embedded Arm Toolchain arm-none-eabi-gcc if: steps.cache-toolchain.outputs.cache-hit != 'true' # Install toolchain if not found in cache - uses: fiam/arm-none-eabi-gcc@v1.0.2 + uses: fiam/arm-none-eabi-gcc@v1.0.4 with: # GNU Embedded Toolchain for Arm release name, in the V-YYYY-qZ format (e.g. "9-2019-q4") release: 9-2020-q2 @@ -83,10 +83,16 @@ jobs: if: steps.cache-mcuboot.outputs.cache-hit != 'true' # Install MCUBoot if not found in cache run: | cd ${{ runner.temp }} - git clone --branch v1.5.0 https://github.com/JuulLabs-OSS/mcuboot + git clone --branch v1.5.0 https://github.com/mcu-tools/mcuboot - name: Install imgtool dependencies - run: pip3 install --user -r ${{ runner.temp }}/mcuboot/scripts/requirements.txt + run: | + pip3 install --user -r ${{ runner.temp }}/mcuboot/scripts/requirements.txt + + # cbor is a dependency that is not currently included in mcuboot requirements.txt + - name: Install imgtool dependencies (cbor) + run: | + pip3 install --user cbor - name: Install adafruit-nrfutil run: | @@ -99,6 +105,8 @@ jobs: - name: Checkout source files uses: actions/checkout@v2 + with: + submodules: recursive - name: Show files run: set ; pwd ; ls -l @@ -110,7 +118,7 @@ jobs: run: | mkdir -p build cd build - cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=${{ runner.temp }}/arm-none-eabi -DNRF5_SDK_PATH=${{ runner.temp }}/nrf5_sdk -DUSE_OPENOCD=1 ../ + cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=${{ runner.temp }}/arm-none-eabi -DNRF5_SDK_PATH=${{ runner.temp }}/nrf5_sdk -DUSE_OPENOCD=1 -DBUILD_DFU=1 ../ ######################################################################################### # Make and Upload DFU Package @@ -125,19 +133,10 @@ jobs: cd build make pinetime-mcuboot-app - - name: Create firmware image - run: | - # The generated firmware binary looks like "pinetime-mcuboot-app-0.8.2.bin" - ls -l build/src/pinetime-mcuboot-app*.bin - ${{ runner.temp }}/mcuboot/scripts/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header build/src/pinetime-mcuboot-app*.bin build/src/pinetime-mcuboot-app-img.bin - ${{ runner.temp }}/mcuboot/scripts/imgtool.py verify build/src/pinetime-mcuboot-app-img.bin - - - name: Create DFU package + - name: Unzip DFU package run: | - ~/.local/bin/adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/src/pinetime-mcuboot-app-img.bin build/src/pinetime-mcuboot-app-dfu.zip - unzip -v build/src/pinetime-mcuboot-app-dfu.zip # Unzip the package because Upload Artifact will zip up the files - unzip build/src/pinetime-mcuboot-app-dfu.zip -d build/src/pinetime-mcuboot-app-dfu + unzip build/src/pinetime-mcuboot-app-dfu*.zip -d build/src/pinetime-mcuboot-app-dfu - name: Upload DFU package uses: actions/upload-artifact@v2 -- cgit v0.10.2 From 23bde0d18e99a344b95b5f1507350e186659eec2 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sat, 14 Aug 2021 21:18:11 +0300 Subject: Make battery reading periodic. Add events. Disable pullup diff --git a/src/components/battery/BatteryController.cpp b/src/components/battery/BatteryController.cpp index f8a64ec..aa038c5 100644 --- a/src/components/battery/BatteryController.cpp +++ b/src/components/battery/BatteryController.cpp @@ -9,10 +9,7 @@ Battery* Battery::instance = nullptr; Battery::Battery() { instance = this; -} - -void Battery::Init() { - nrf_gpio_cfg_input(chargingPin, static_cast GPIO_PIN_CNF_PULL_Pullup); + nrf_gpio_cfg_input(chargingPin, static_cast GPIO_PIN_CNF_PULL_Disabled); } void Battery::Update() { @@ -75,5 +72,11 @@ void Battery::SaadcEventHandler(nrfx_saadc_evt_t const* p_event) { nrfx_saadc_uninit(); isReading = false; + + systemTask->PushMessage(System::Messages::BatteryMeasurementDone); } } + +void Battery::Register(Pinetime::System::SystemTask* systemTask) { + this->systemTask = systemTask; +} diff --git a/src/components/battery/BatteryController.h b/src/components/battery/BatteryController.h index 6f09b73..ad304eb 100644 --- a/src/components/battery/BatteryController.h +++ b/src/components/battery/BatteryController.h @@ -1,8 +1,7 @@ #pragma once #include #include -#include -#include +#include namespace Pinetime { namespace Controllers { @@ -11,8 +10,8 @@ namespace Pinetime { public: Battery(); - void Init(); void Update(); + void Register(System::SystemTask* systemTask); uint8_t PercentRemaining() const { return percentRemaining; @@ -49,6 +48,8 @@ namespace Pinetime { static void AdcCallbackStatic(nrfx_saadc_evt_t const* event); bool isReading = false; + + Pinetime::System::SystemTask* systemTask = nullptr; }; } } diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index d4a73f5..c6e9466 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -194,9 +194,6 @@ void DisplayApp::Refresh() { // clockScreen.SetBleConnectionState(bleController.IsConnected() ? Screens::Clock::BleConnectionStates::Connected : // Screens::Clock::BleConnectionStates::NotConnected); break; - case Messages::UpdateBatteryLevel: - batteryController.Update(); - break; case Messages::NewNotification: LoadApp(Apps::NotificationsPreview, DisplayApp::FullRefreshDirections::Down); break; diff --git a/src/displayapp/Messages.h b/src/displayapp/Messages.h index 322505e..8e4884d 100644 --- a/src/displayapp/Messages.h +++ b/src/displayapp/Messages.h @@ -7,7 +7,6 @@ namespace Pinetime { GoToRunning, UpdateDateTime, UpdateBleConnection, - UpdateBatteryLevel, TouchEvent, ButtonPushed, NewNotification, diff --git a/src/displayapp/screens/BatteryInfo.cpp b/src/displayapp/screens/BatteryInfo.cpp index 0ab47eb..31cde07 100644 --- a/src/displayapp/screens/BatteryInfo.cpp +++ b/src/displayapp/screens/BatteryInfo.cpp @@ -59,9 +59,6 @@ BatteryInfo::~BatteryInfo() { } void BatteryInfo::UpdateScreen() { - - batteryController.Update(); - batteryPercent = batteryController.PercentRemaining(); batteryVoltage = batteryController.Voltage(); diff --git a/src/systemtask/Messages.h b/src/systemtask/Messages.h index 3a195e2..ebe6a2b 100644 --- a/src/systemtask/Messages.h +++ b/src/systemtask/Messages.h @@ -20,7 +20,9 @@ namespace Pinetime { EnableSleeping, DisableSleeping, OnNewDay, - OnChargingEvent + OnChargingEvent, + MeasureBatteryTimerExpired, + BatteryMeasurementDone, }; } } diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 8915ce7..7ef6fc6 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -47,6 +47,11 @@ void IdleTimerCallback(TimerHandle_t xTimer) { sysTask->OnIdle(); } +void MeasureBatteryTimerCallback(TimerHandle_t xTimer) { + auto* sysTask = static_cast(pvTimerGetTimerID(xTimer)); + sysTask->PushMessage(Pinetime::System::Messages::MeasureBatteryTimerExpired); +} + SystemTask::SystemTask(Drivers::SpiMaster& spi, Drivers::St7789& lcd, Pinetime::Drivers::SpiNorFlash& spiNorFlash, @@ -126,7 +131,8 @@ void SystemTask::Work() { twiMaster.Init(); touchPanel.Init(); dateTimeController.Register(this); - batteryController.Init(); + batteryController.Register(this); + batteryController.Update(); motorController.Init(); motionSensor.SoftReset(); timerController.Register(this); @@ -143,8 +149,6 @@ void SystemTask::Work() { displayApp.Register(this); displayApp.Start(); - displayApp.PushMessage(Pinetime::Applications::Display::Messages::UpdateBatteryLevel); - heartRateSensor.Init(); heartRateSensor.Disable(); heartRateApp.Start(); @@ -187,7 +191,9 @@ void SystemTask::Work() { idleTimer = xTimerCreate("idleTimer", pdMS_TO_TICKS(2000), pdFALSE, this, IdleTimerCallback); dimTimer = xTimerCreate("dimTimer", pdMS_TO_TICKS(settingsController.GetScreenTimeOut() - 2000), pdFALSE, this, DimTimerCallback); + measureBatteryTimer = xTimerCreate("measureBattery", batteryMeasurementPeriod, pdTRUE, this, MeasureBatteryTimerCallback); xTimerStart(dimTimer, 0); + xTimerStart(measureBatteryTimer, portMAX_DELAY); // Suppress endless loop diagnostic #pragma clang diagnostic push @@ -197,11 +203,6 @@ void SystemTask::Work() { uint8_t msg; if (xQueueReceive(systemTasksMsgQueue, &msg, 100)) { - - batteryController.Update(); - // the battery does not emit events when changing charge levels, so we piggyback - // on any system event to read and update the current values - Messages message = static_cast(msg); switch (message) { case Messages::EnableSleeping: @@ -232,7 +233,6 @@ void SystemTask::Work() { lcd.Wakeup(); displayApp.PushMessage(Pinetime::Applications::Display::Messages::GoToRunning); - displayApp.PushMessage(Pinetime::Applications::Display::Messages::UpdateBatteryLevel); heartRateApp.PushMessage(Pinetime::Applications::HeartRateTask::Messages::WakeUp); isSleeping = false; @@ -326,8 +326,18 @@ void SystemTask::Work() { stepCounterMustBeReset = true; break; case Messages::OnChargingEvent: + batteryController.Update(); motorController.SetDuration(15); - // Battery level is updated on every message - there's no need to do anything + break; + case Messages::MeasureBatteryTimerExpired: + sendBatteryNotification = true; + batteryController.Update(); + break; + case Messages::BatteryMeasurementDone: + if (sendBatteryNotification) { + sendBatteryNotification = false; + nimbleController.NotifyBatteryLevel(batteryController.PercentRemaining()); + } break; default: @@ -346,11 +356,6 @@ void SystemTask::Work() { } } - if (xTaskGetTickCount() - batteryNotificationTick > batteryNotificationPeriod) { - nimbleController.NotifyBatteryLevel(batteryController.PercentRemaining()); - batteryNotificationTick = xTaskGetTickCount(); - } - monitor.Process(); uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG); dateTimeController.UpdateTime(systick_counter); diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index ba43429..14c7ec7 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -131,13 +131,15 @@ namespace Pinetime { uint8_t bleDiscoveryTimer = 0; TimerHandle_t dimTimer; TimerHandle_t idleTimer; + TimerHandle_t measureBatteryTimer; + bool sendBatteryNotification = false; bool doNotGoToSleep = false; void GoToRunning(); void UpdateMotion(); bool stepCounterMustBeReset = false; - static constexpr TickType_t batteryNotificationPeriod = 1000 * 60 * 10; // 1 tick ~= 1ms. 1ms * 60 * 10 = 10 minutes - TickType_t batteryNotificationTick = 0; + static constexpr TickType_t batteryMeasurementPeriod = pdMS_TO_TICKS(10 * 60 * 1000); + TickType_t lastBatteryNotificationTime = 0; #if configUSE_TRACE_FACILITY == 1 SystemMonitor monitor; -- cgit v0.10.2 From 40afae3833efd2220bac168467d82e3ca6c350be Mon Sep 17 00:00:00 2001 From: mabuch Date: Sat, 14 Aug 2021 20:46:29 +0200 Subject: Github Action - update mcuboot version diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f25fd31..4744eae 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -83,17 +83,12 @@ jobs: if: steps.cache-mcuboot.outputs.cache-hit != 'true' # Install MCUBoot if not found in cache run: | cd ${{ runner.temp }} - git clone --branch v1.5.0 https://github.com/mcu-tools/mcuboot + git clone --branch v1.7.2 https://github.com/mcu-tools/mcuboot - name: Install imgtool dependencies run: | pip3 install --user -r ${{ runner.temp }}/mcuboot/scripts/requirements.txt - # cbor is a dependency that is not currently included in mcuboot requirements.txt - - name: Install imgtool dependencies (cbor) - run: | - pip3 install --user cbor - - name: Install adafruit-nrfutil run: | pip3 install --user wheel -- cgit v0.10.2 From 477ff32edc3bc0997f45d943f90f68f8f0608468 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Sun, 15 Aug 2021 10:41:00 +0200 Subject: Add randomise button to color picker diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp index ae66546..a32ce34 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp @@ -203,6 +203,14 @@ SettingPineTimeStyle::SettingPineTimeStyle( lv_obj_set_style_local_bg_opa(btnReset, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_30); lv_obj_set_style_local_value_str(btnReset, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Rst"); lv_obj_set_event_cb(btnReset, event_handler); + + 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_30); + lv_obj_set_style_local_value_str(btnRandom, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Rnd"); + lv_obj_set_event_cb(btnRandom, event_handler); } SettingPineTimeStyle::~SettingPineTimeStyle() { @@ -303,4 +311,17 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { settingsController.SetPTSColorBG(3); lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[3]); } + if((object == btnRandom) && (event == LV_EVENT_PRESSED)) { + uint8_t randTime = rand() % 17; + uint8_t randBar = rand() % 17; + uint8_t randBG = rand() % 17; + settingsController.SetPTSColorTime(randTime); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); + settingsController.SetPTSColorBar(randBar); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randBar]); + settingsController.SetPTSColorBG(randBG); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randBG]); + } } \ No newline at end of file diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.h b/src/displayapp/screens/settings/SettingPineTimeStyle.h index fe449b2..1a01ebb 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.h +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.h @@ -28,6 +28,7 @@ namespace Pinetime { lv_obj_t * btnNextBG; lv_obj_t * btnPrevBG; lv_obj_t * btnReset; + lv_obj_t * btnRandom; lv_obj_t * timeColor; lv_obj_t * barColor; lv_obj_t * bgColor; -- cgit v0.10.2 From c0bb88799c2de0ab8de5d38b3eb511f4f80029d7 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Sun, 15 Aug 2021 12:33:32 +0200 Subject: Add check for randomise button in case colors clash diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp index a32ce34..007c1cf 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp @@ -315,6 +315,11 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { uint8_t randTime = rand() % 17; uint8_t randBar = rand() % 17; uint8_t randBG = rand() % 17; + // Check if the time color is the same as its background, or if the sidebar is black. If so, change them to more useful values. + if ((randTime == randBG) || (randBar == 3)) { + randBG += 1; + randBar = randTime; + } settingsController.SetPTSColorTime(randTime); lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); -- cgit v0.10.2 From 16ea069d55e4bcbba097cf499901eddf1a3828db Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Sun, 15 Aug 2021 14:05:21 +0200 Subject: Remove duplicate code, minor fixes diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp index 007c1cf..dfa806a 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp @@ -230,76 +230,60 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { if((object == btnNextTime) && (event == LV_EVENT_PRESSED)) { if ( valueTime < 16 ) { valueTime += 1; - settingsController.SetPTSColorTime(valueTime); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); } else { valueTime = 0; - settingsController.SetPTSColorTime(valueTime); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); } + settingsController.SetPTSColorTime(valueTime); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); } if((object == btnPrevTime) && (event == LV_EVENT_PRESSED)) { if ( valueTime > 0 ) { valueTime -= 1; - settingsController.SetPTSColorTime(valueTime); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); } else { valueTime = 16; - settingsController.SetPTSColorTime(valueTime); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); } + settingsController.SetPTSColorTime(valueTime); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); } if((object == btnNextBar) && (event == LV_EVENT_PRESSED)) { if ( valueBar < 16 ) { valueBar += 1; - settingsController.SetPTSColorBar(valueBar); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); } else { valueBar = 0; - settingsController.SetPTSColorBar(valueBar); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); } + settingsController.SetPTSColorBar(valueBar); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); } if((object == btnPrevBar) && (event == LV_EVENT_PRESSED)) { if ( valueBar > 0 ) { valueBar -= 1; - settingsController.SetPTSColorBar(valueBar); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); } else { valueBar = 16; - settingsController.SetPTSColorBar(valueBar); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); } + settingsController.SetPTSColorBar(valueBar); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); } if((object == btnNextBG) && (event == LV_EVENT_PRESSED)) { if ( valueBG < 16 ) { valueBG += 1; - settingsController.SetPTSColorBG(valueBG); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } else { valueBG = 0; - settingsController.SetPTSColorBG(valueBG); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } + settingsController.SetPTSColorBG(valueBG); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } if((object == btnPrevBG) && (event == LV_EVENT_PRESSED)) { if ( valueBG > 0 ) { valueBG -= 1; - settingsController.SetPTSColorBG(valueBG); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } else { valueBG = 16; - settingsController.SetPTSColorBG(valueBG); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } + settingsController.SetPTSColorBG(valueBG); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } if((object == btnReset) && (event == LV_EVENT_PRESSED)) { settingsController.SetPTSColorTime(11); @@ -316,8 +300,10 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { uint8_t randBar = rand() % 17; uint8_t randBG = rand() % 17; // Check if the time color is the same as its background, or if the sidebar is black. If so, change them to more useful values. - if ((randTime == randBG) || (randBar == 3)) { + if (randTime == randBG) { randBG += 1; + } + if (randBar == 3) { randBar = randTime; } settingsController.SetPTSColorTime(randTime); -- cgit v0.10.2 From 5789f1527c5c8d1c31e78a6a88c6a2b6158eb671 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Sun, 15 Aug 2021 14:42:30 +0200 Subject: Avoid setting the sidebar black diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp index dfa806a..96b8780 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp @@ -252,6 +252,8 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { if((object == btnNextBar) && (event == LV_EVENT_PRESSED)) { if ( valueBar < 16 ) { valueBar += 1; + // Avoid setting the sidebar black + if ( valueBar == 3 ) { valueBar += 1; } } else { valueBar = 0; } @@ -261,6 +263,8 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { if((object == btnPrevBar) && (event == LV_EVENT_PRESSED)) { if ( valueBar > 0 ) { valueBar -= 1; + // Avoid setting the sidebar black + if ( valueBar == 3 ) { valueBar -= 1; } } else { valueBar = 16; } -- cgit v0.10.2 From 639fd3a9bd9f4a1ada36a4b812b7199543d47457 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Sun, 15 Aug 2021 15:00:54 +0200 Subject: More tidying following review diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp index 96b8780..979e4b6 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp @@ -6,17 +6,14 @@ using namespace Pinetime::Applications::Screens; namespace { - static void event_handler(lv_obj_t * obj, lv_event_t event) { - SettingPineTimeStyle* screen = static_cast(obj->user_data); + static void event_handler(lv_obj_t* obj, lv_event_t event) { + SettingPineTimeStyle* screen = static_cast(obj->user_data); screen->UpdateSelected(obj, event); } } -SettingPineTimeStyle::SettingPineTimeStyle( - Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) : - Screen(app), - settingsController{settingsController} -{ +SettingPineTimeStyle::SettingPineTimeStyle(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) + : Screen(app), settingsController {settingsController} { timebar = lv_obj_create(lv_scr_act(), nullptr); lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorBG()]); lv_obj_set_style_local_radius(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); @@ -140,7 +137,7 @@ SettingPineTimeStyle::SettingPineTimeStyle( 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); @@ -222,74 +219,79 @@ bool SettingPineTimeStyle::Refresh() { return running; } -void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { +void SettingPineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) { uint8_t valueTime = settingsController.GetPTSColorTime(); uint8_t valueBar = settingsController.GetPTSColorBar(); uint8_t valueBG = settingsController.GetPTSColorBG(); - - if((object == btnNextTime) && (event == LV_EVENT_PRESSED)) { - if ( valueTime < 16 ) { - valueTime += 1; - } else { - valueTime = 0; + + if (event == LV_EVENT_CLICKED) { + if (object == btnNextTime) { + if (valueTime < 16) { + valueTime += 1; + } else { + valueTime = 0; + } + settingsController.SetPTSColorTime(valueTime); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); } - settingsController.SetPTSColorTime(valueTime); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - } - if((object == btnPrevTime) && (event == LV_EVENT_PRESSED)) { - if ( valueTime > 0 ) { - valueTime -= 1; - } else { - valueTime = 16; + if (object == btnPrevTime) { + if (valueTime > 0) { + valueTime -= 1; + } else { + valueTime = 16; + } + settingsController.SetPTSColorTime(valueTime); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); } - settingsController.SetPTSColorTime(valueTime); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - } - if((object == btnNextBar) && (event == LV_EVENT_PRESSED)) { - if ( valueBar < 16 ) { - valueBar += 1; - // Avoid setting the sidebar black - if ( valueBar == 3 ) { valueBar += 1; } - } else { - valueBar = 0; + if (object == btnNextBar) { + if (valueBar < 16) { + valueBar += 1; + // Avoid setting the sidebar black + if (valueBar == 3) { + valueBar += 1; + } + } else { + valueBar = 0; + } + settingsController.SetPTSColorBar(valueBar); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); } - settingsController.SetPTSColorBar(valueBar); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); - } - if((object == btnPrevBar) && (event == LV_EVENT_PRESSED)) { - if ( valueBar > 0 ) { - valueBar -= 1; - // Avoid setting the sidebar black - if ( valueBar == 3 ) { valueBar -= 1; } - } else { - valueBar = 16; + if (object == btnPrevBar) { + if (valueBar > 0) { + valueBar -= 1; + // Avoid setting the sidebar black + if (valueBar == 3) { + valueBar -= 1; + } + } else { + valueBar = 16; + } + settingsController.SetPTSColorBar(valueBar); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); } - settingsController.SetPTSColorBar(valueBar); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); - } - if((object == btnNextBG) && (event == LV_EVENT_PRESSED)) { - if ( valueBG < 16 ) { - valueBG += 1; - } else { - valueBG = 0; + if (object == btnNextBG) { + if (valueBG < 16) { + valueBG += 1; + } else { + valueBG = 0; + } + settingsController.SetPTSColorBG(valueBG); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } - settingsController.SetPTSColorBG(valueBG); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); - } - if((object == btnPrevBG) && (event == LV_EVENT_PRESSED)) { - if ( valueBG > 0 ) { - valueBG -= 1; - } else { - valueBG = 16; + if (object == btnPrevBG) { + if (valueBG > 0) { + valueBG -= 1; + } else { + valueBG = 16; + } + settingsController.SetPTSColorBG(valueBG); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); } - settingsController.SetPTSColorBG(valueBG); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); - } - if((object == btnReset) && (event == LV_EVENT_PRESSED)) { + if (object == btnReset) { settingsController.SetPTSColorTime(11); lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]); lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]); @@ -298,25 +300,26 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) { lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]); settingsController.SetPTSColorBG(3); lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[3]); - } - if((object == btnRandom) && (event == LV_EVENT_PRESSED)) { - uint8_t randTime = rand() % 17; - uint8_t randBar = rand() % 17; - uint8_t randBG = rand() % 17; - // Check if the time color is the same as its background, or if the sidebar is black. If so, change them to more useful values. - if (randTime == randBG) { - randBG += 1; } - if (randBar == 3) { - randBar = randTime; + if (object == btnRandom) { + uint8_t randTime = rand() % 17; + uint8_t randBar = rand() % 17; + uint8_t randBG = rand() % 17; + // Check if the time color is the same as its background, or if the sidebar is black. If so, change them to more useful values. + if (randTime == randBG) { + randBG += 1; + } + if (randBar == 3) { + randBar = randTime; + } + settingsController.SetPTSColorTime(randTime); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); + settingsController.SetPTSColorBar(randBar); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randBar]); + settingsController.SetPTSColorBG(randBG); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randBG]); } - settingsController.SetPTSColorTime(randTime); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); - settingsController.SetPTSColorBar(randBar); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randBar]); - settingsController.SetPTSColorBG(randBG); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randBG]); } } \ No newline at end of file -- cgit v0.10.2 From 9851ed33d84aa242dfb98c2c3714a20ddbc53f45 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Sun, 15 Aug 2021 15:28:40 +0200 Subject: Fix potential edge case of sidebar being set black diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp index 979e4b6..e125c8a 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp @@ -310,7 +310,7 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) { randBG += 1; } if (randBar == 3) { - randBar = randTime; + randBar -= 1; } settingsController.SetPTSColorTime(randTime); lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); -- cgit v0.10.2 From 2b30ff4fc6a1835bdc5a94f8754cfd366885c4c0 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Thu, 19 Aug 2021 11:12:34 +0300 Subject: Remove unused variables diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 5150162..e79fa61 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -136,9 +136,6 @@ void DisplayApp::InitHw() { brightnessController.Set(settingsController.GetBrightness()); } -uint32_t acc = 0; -uint32_t count = 0; -bool toggle = true; void DisplayApp::Refresh() { TickType_t queueTimeout; TickType_t delta; diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index c061c14..c95edb4 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -150,7 +150,7 @@ Notifications::NotificationItem::NotificationItem(const char* title, uint8_t notifNb, Modes mode, Pinetime::Controllers::AlertNotificationService& alertNotificationService) - : notifNr {notifNr}, notifNb {notifNb}, mode {mode}, alertNotificationService {alertNotificationService} { + : mode {mode}, alertNotificationService {alertNotificationService} { 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)); diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h index a02d9b4..ff99934 100644 --- a/src/displayapp/screens/Notifications.h +++ b/src/displayapp/screens/Notifications.h @@ -43,21 +43,13 @@ namespace Pinetime { void OnCallButtonEvent(lv_obj_t*, lv_event_t event); private: - uint8_t notifNr = 0; - uint8_t notifNb = 0; - char pageText[4]; - lv_obj_t* container1; - lv_obj_t* t1; - lv_obj_t* l1; - lv_obj_t* l2; lv_obj_t* bt_accept; lv_obj_t* bt_mute; lv_obj_t* bt_reject; lv_obj_t* label_accept; lv_obj_t* label_mute; lv_obj_t* label_reject; - lv_obj_t* bottomPlaceholder; Modes mode; Pinetime::Controllers::AlertNotificationService& alertNotificationService; bool running = true; diff --git a/src/main.cpp b/src/main.cpp index d301be6..d420fcd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -87,16 +87,13 @@ Pinetime::Drivers::TwiMaster twiMaster {Pinetime::Drivers::TwiMaster::Modules::T Pinetime::Drivers::TwiMaster::Parameters {MaxTwiFrequencyWithoutHardwareBug, pinTwiSda, pinTwiScl}}; Pinetime::Drivers::Cst816S touchPanel {twiMaster, touchPanelTwiAddress}; #ifdef PINETIME_IS_RECOVERY -static constexpr bool isFactory = true; #include "displayapp/DummyLittleVgl.h" #include "displayapp/DisplayAppRecovery.h" -Pinetime::Components::LittleVgl lvgl {lcd, touchPanel}; #else -static constexpr bool isFactory = false; #include "displayapp/LittleVgl.h" #include "displayapp/DisplayApp.h" -Pinetime::Components::LittleVgl lvgl {lcd, touchPanel}; #endif +Pinetime::Components::LittleVgl lvgl {lcd, touchPanel}; Pinetime::Drivers::Bma421 motionSensor {twiMaster, motionSensorTwiAddress}; Pinetime::Drivers::Hrs3300 heartRateSensor {twiMaster, heartRateSensorTwiAddress}; @@ -105,8 +102,6 @@ TimerHandle_t debounceTimer; TimerHandle_t debounceChargeTimer; Pinetime::Controllers::Battery batteryController; Pinetime::Controllers::Ble bleController; -void ble_manager_set_ble_connection_callback(void (*connection)()); -void ble_manager_set_ble_disconnection_callback(void (*disconnection)()); static constexpr uint8_t pinTouchIrq = 28; static constexpr uint8_t pinPowerPresentIrq = 19; -- cgit v0.10.2 From 51c5257548efe678ec8e18d8cdea2476672f1238 Mon Sep 17 00:00:00 2001 From: hubmartin Date: Sun, 22 Aug 2021 22:17:57 +0200 Subject: Update startup SCL toggling pinmap definitions diff --git a/src/main.cpp b/src/main.cpp index 7131c68..4d16a6d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -45,6 +45,7 @@ #include "drivers/Cst816s.h" #include "drivers/PinMap.h" #include "systemtask/SystemTask.h" +#include "drivers/PinMap.h" #if NRF_LOG_ENABLED #include "logging/NrfLogger.h" @@ -293,18 +294,18 @@ int main(void) { nrf_drv_clock_init(); // Unblock i2c? - nrf_gpio_cfg(pinTwiScl, + nrf_gpio_cfg(Pinetime::PinMap::TwiScl, NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_DISCONNECT, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_S0D1, NRF_GPIO_PIN_NOSENSE); - nrf_gpio_pin_set(pinTwiScl); + nrf_gpio_pin_set(Pinetime::PinMap::TwiScl); for (uint8_t i = 0; i < 16; i++) { - nrf_gpio_pin_toggle(pinTwiScl); + nrf_gpio_pin_toggle(Pinetime::PinMap::TwiScl); nrf_delay_us(5); } - nrf_gpio_cfg_default(pinTwiScl); + nrf_gpio_cfg_default(Pinetime::PinMap::TwiScl); debounceTimer = xTimerCreate("debounceTimer", 200, pdFALSE, (void*) 0, DebounceTimerCallback); debounceChargeTimer = xTimerCreate("debounceTimerCharge", 200, pdFALSE, (void*) 0, DebounceTimerChargeCallback); -- cgit v0.10.2 From d7293a44dfa6de8cb6ad25c259d33ca07bde3426 Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Thu, 26 Aug 2021 15:11:20 +0200 Subject: Infini-iOS diff --git a/README.md b/README.md index 6549ece..86f1b9d 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ As of now, here is the list of achievements of this project: * [Amazfish](https://openrepos.net/content/piggz/amazfish) (on SailfishOS and Linux) * [Siglo](https://github.com/alexr4535/siglo) (on Linux) * **[Experimental]** [WebBLEWatch](https://hubmartin.github.io/WebBLEWatch/) Synchronize time directly from your web browser. [video](https://youtu.be/IakiuhVDdrY) + * **[Experimental]** [Infini-iOS](https://github.com/xan-m/Infini-iOS) (on iOS) - OTA (Over-the-air) update via BLE - [Bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader) based on [MCUBoot](https://juullabs-oss.github.io/mcuboot/) -- cgit v0.10.2 From b45d7c372d960051d048e4123335af6dacf88297 Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Thu, 26 Aug 2021 19:42:02 +0100 Subject: Correct change test for wake up mode setting diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 93d6d21..0ff1cb8 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -78,7 +78,7 @@ namespace Pinetime { }; void setWakeUpMode(WakeUpMode wakeUp, bool enabled) { - if (!isWakeUpModeOn(wakeUp)) { + if (enabled != isWakeUpModeOn(wakeUp)) { settingsChanged = true; } settings.wakeUpMode.set(static_cast(wakeUp), enabled); -- cgit v0.10.2 From 31bc47d1cb397f5de0275d0d95aac7ca29cc7392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Milants?= Date: Sat, 28 Aug 2021 21:02:11 +0200 Subject: Settings : use enums instead of ints to store colors. Group all PTS settings into a struct. PTS/SettingsPTS : Convert to/from LVGL color and Settings::Color, add functions to reduce code duplication. Adapt SettingPineTimeStyle with the last Screen Interface diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 69c1936..a724290 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -418,6 +418,7 @@ list(APPEND SOURCE_FILES displayapp/screens/BatteryInfo.cpp displayapp/screens/Steps.cpp displayapp/screens/Timer.cpp + displayapp/Colors.cpp ## Settings displayapp/screens/settings/QuickSettings.cpp @@ -611,6 +612,7 @@ set(INCLUDE_FILES displayapp/screens/Metronome.h displayapp/screens/Motion.h displayapp/screens/Timer.h + displayapp/Colors.h drivers/St7789.h drivers/SpiNorFlash.h drivers/SpiMaster.h diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 40cafe9..a294ab7 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -17,6 +17,14 @@ namespace Pinetime { DoubleTap = 1, RaiseWrist = 2, }; + enum class Colors : uint8_t { + White, Silver, Gray, Black, Red, Maroon, Yellow, Olive, Lime, Green, Cyan, Teal, Blue, Navy, Magenta, Purple, Orange + }; + struct PineTimeStyle { + Colors ColorTime = Colors::Teal; + Colors ColorBar = Colors::Teal; + Colors ColorBG = Colors::Black; + }; Settings(Pinetime::Controllers::FS& fs); @@ -33,37 +41,38 @@ namespace Pinetime { return settings.clockFace; }; - void SetPTSColorTime(uint8_t colorTime) { - if (colorTime != settings.PTSColorTime) + void SetPTSColorTime(Colors colorTime) { + if (colorTime != settings.PTS.ColorTime) settingsChanged = true; - settings.PTSColorTime = colorTime; + settings.PTS.ColorTime = colorTime; }; - uint8_t GetPTSColorTime() const { - return settings.PTSColorTime; + Colors GetPTSColorTime() const { + return settings.PTS.ColorTime; }; - void SetPTSColorBar(uint8_t colorBar) { - if (colorBar != settings.PTSColorBar) + void SetPTSColorBar(Colors colorBar) { + if (colorBar != settings.PTS.ColorBar) settingsChanged = true; - settings.PTSColorBar = colorBar; + settings.PTS.ColorBar = colorBar; }; - uint8_t GetPTSColorBar() const { - return settings.PTSColorBar; + Colors GetPTSColorBar() const { + return settings.PTS.ColorBar; }; - void SetPTSColorBG(uint8_t colorBG) { - if (colorBG != settings.PTSColorBG) + void SetPTSColorBG(Colors colorBG) { + if (colorBG != settings.PTS.ColorBG) settingsChanged = true; - settings.PTSColorBG = colorBG; + settings.PTS.ColorBG = colorBG; }; - uint8_t GetPTSColorBG() const { - return settings.PTSColorBG; + Colors GetPTSColorBG() const { + return settings.PTS.ColorBG; }; void SetAppMenu(uint8_t menu) { appMenu = menu; }; - uint8_t GetAppMenu() { + + uint8_t GetAppMenu() const { return appMenu; }; @@ -156,7 +165,6 @@ namespace Pinetime { static constexpr uint32_t settingsVersion = 0x0002; struct SettingsData { - uint32_t version = settingsVersion; uint32_t stepsGoal = 10000; uint32_t screenTimeOut = 15000; @@ -166,9 +174,7 @@ namespace Pinetime { uint8_t clockFace = 0; - uint8_t PTSColorTime = 11; - uint8_t PTSColorBar = 11; - uint8_t PTSColorBG = 3; + PineTimeStyle PTS; std::bitset<3> wakeUpMode {0}; diff --git a/src/displayapp/Colors.cpp b/src/displayapp/Colors.cpp new file mode 100644 index 0000000..f45f072 --- /dev/null +++ b/src/displayapp/Colors.cpp @@ -0,0 +1,27 @@ +#include "Colors.h" + +using namespace Pinetime::Applications; +using namespace Pinetime::Controllers; + +lv_color_t Pinetime::Applications::Convert(Pinetime::Controllers::Settings::Colors color) { + switch (color) { + case Pinetime::Controllers::Settings::Colors::White: return LV_COLOR_WHITE; + case Pinetime::Controllers::Settings::Colors::Silver: return LV_COLOR_SILVER; + case Pinetime::Controllers::Settings::Colors::Gray: return LV_COLOR_GRAY; + case Pinetime::Controllers::Settings::Colors::Black: return LV_COLOR_BLACK; + case Pinetime::Controllers::Settings::Colors::Red: return LV_COLOR_RED; + case Pinetime::Controllers::Settings::Colors::Maroon: return LV_COLOR_MAROON; + case Pinetime::Controllers::Settings::Colors::Yellow: return LV_COLOR_YELLOW; + case Pinetime::Controllers::Settings::Colors::Olive: return LV_COLOR_OLIVE; + case Pinetime::Controllers::Settings::Colors::Lime: return LV_COLOR_LIME; + case Pinetime::Controllers::Settings::Colors::Green: return LV_COLOR_GREEN; + case Pinetime::Controllers::Settings::Colors::Cyan: return LV_COLOR_CYAN; + case Pinetime::Controllers::Settings::Colors::Teal: return LV_COLOR_TEAL; + case Pinetime::Controllers::Settings::Colors::Blue: return LV_COLOR_BLUE; + case Pinetime::Controllers::Settings::Colors::Navy: return LV_COLOR_NAVY; + case Pinetime::Controllers::Settings::Colors::Magenta: return LV_COLOR_MAGENTA; + case Pinetime::Controllers::Settings::Colors::Purple: return LV_COLOR_PURPLE; + case Pinetime::Controllers::Settings::Colors::Orange: return LV_COLOR_ORANGE; + default: return LV_COLOR_WHITE; + } +} diff --git a/src/displayapp/Colors.h b/src/displayapp/Colors.h new file mode 100644 index 0000000..9db7dd2 --- /dev/null +++ b/src/displayapp/Colors.h @@ -0,0 +1,10 @@ +#pragma once + +#include +#include + +namespace Pinetime { + namespace Applications { + lv_color_t Convert(Controllers::Settings::Colors color); + } +} \ No newline at end of file diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index 772e461..7a712f4 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "BatteryIcon.h" #include "BleIcon.h" #include "NotificationIcon.h" @@ -63,7 +64,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, //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, pts_colors[settingsController.GetPTSColorBG()]); + 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, 5, 0); @@ -71,25 +72,25 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app, // Display the time timeDD1 = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); lv_label_set_text(timeDD1, "12"); 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, pts_colors[settingsController.GetPTSColorTime()]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); lv_label_set_text(timeDD2, "34"); 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, pts_colors[settingsController.GetPTSColorTime()]); + 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(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, pts_colors[settingsController.GetPTSColorBar()]); + 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); diff --git a/src/displayapp/screens/PineTimeStyle.h b/src/displayapp/screens/PineTimeStyle.h index 16b6de1..cb74ead 100644 --- a/src/displayapp/screens/PineTimeStyle.h +++ b/src/displayapp/screens/PineTimeStyle.h @@ -68,11 +68,6 @@ namespace Pinetime { lv_obj_t* notificationIcon; lv_obj_t* stepGauge; lv_color_t needle_colors[1]; - lv_color_t pts_colors[17] = {LV_COLOR_WHITE, LV_COLOR_SILVER, LV_COLOR_GRAY, LV_COLOR_BLACK, - LV_COLOR_RED, LV_COLOR_MAROON, LV_COLOR_YELLOW, LV_COLOR_OLIVE, - LV_COLOR_LIME, LV_COLOR_GREEN, LV_COLOR_CYAN, LV_COLOR_TEAL, - LV_COLOR_BLUE, LV_COLOR_NAVY, LV_COLOR_MAGENTA, LV_COLOR_PURPLE, - LV_COLOR_ORANGE}; Controllers::DateTime& dateTimeController; Controllers::Battery& batteryController; diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp index e125c8a..c9af19b 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp @@ -1,5 +1,6 @@ #include "SettingPineTimeStyle.h" #include +#include #include "displayapp/DisplayApp.h" #include "displayapp/screens/Symbols.h" @@ -15,7 +16,7 @@ namespace { SettingPineTimeStyle::SettingPineTimeStyle(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) : Screen(app), settingsController {settingsController} { timebar = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorBG()]); + 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, 5, 0); @@ -24,18 +25,18 @@ SettingPineTimeStyle::SettingPineTimeStyle(Pinetime::Applications::DisplayApp* a 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, pts_colors[settingsController.GetPTSColorTime()]); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); lv_label_set_text(timeDD1, "12"); 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, pts_colors[settingsController.GetPTSColorTime()]); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); lv_label_set_text(timeDD2, "34"); 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, pts_colors[settingsController.GetPTSColorTime()]); + 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(timeAMPM, "A\nM"); lv_obj_align(timeAMPM, timebar, LV_ALIGN_IN_BOTTOM_LEFT, 2, -20); @@ -43,7 +44,7 @@ SettingPineTimeStyle::SettingPineTimeStyle(Pinetime::Applications::DisplayApp* a // 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, pts_colors[settingsController.GetPTSColorBar()]); + 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); @@ -215,91 +216,60 @@ SettingPineTimeStyle::~SettingPineTimeStyle() { settingsController.SaveSettings(); } -bool SettingPineTimeStyle::Refresh() { - return running; -} - void SettingPineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) { - uint8_t valueTime = settingsController.GetPTSColorTime(); - uint8_t valueBar = settingsController.GetPTSColorBar(); - uint8_t valueBG = settingsController.GetPTSColorBG(); + auto valueTime = settingsController.GetPTSColorTime(); + auto valueBar = settingsController.GetPTSColorBar(); + auto valueBG = settingsController.GetPTSColorBG(); if (event == LV_EVENT_CLICKED) { if (object == btnNextTime) { - if (valueTime < 16) { - valueTime += 1; - } else { - valueTime = 0; - } + valueTime = GetNext(valueTime); + settingsController.SetPTSColorTime(valueTime); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[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) { - if (valueTime > 0) { - valueTime -= 1; - } else { - valueTime = 16; - } + valueTime = GetPrevious(valueTime); settingsController.SetPTSColorTime(valueTime); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[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) { - if (valueBar < 16) { - valueBar += 1; - // Avoid setting the sidebar black - if (valueBar == 3) { - valueBar += 1; - } - } else { - valueBar = 0; - } + valueBar = GetNext(valueBar); + if(valueBar == Controllers::Settings::Colors::Black) + valueBar = GetNext(valueBar); settingsController.SetPTSColorBar(valueBar); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar)); } if (object == btnPrevBar) { - if (valueBar > 0) { - valueBar -= 1; - // Avoid setting the sidebar black - if (valueBar == 3) { - valueBar -= 1; - } - } else { - valueBar = 16; - } + valueBar = GetPrevious(valueBar); + if(valueBar == Controllers::Settings::Colors::Black) + valueBar = GetPrevious(valueBar); settingsController.SetPTSColorBar(valueBar); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar)); } if (object == btnNextBG) { - if (valueBG < 16) { - valueBG += 1; - } else { - valueBG = 0; - } + valueBG = GetNext(valueBG); settingsController.SetPTSColorBG(valueBG); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG)); } if (object == btnPrevBG) { - if (valueBG > 0) { - valueBG -= 1; - } else { - valueBG = 16; - } + valueBG = GetPrevious(valueBG); settingsController.SetPTSColorBG(valueBG); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG)); } if (object == btnReset) { - settingsController.SetPTSColorTime(11); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]); - settingsController.SetPTSColorBar(11); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]); - settingsController.SetPTSColorBG(3); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[3]); + 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) { uint8_t randTime = rand() % 17; @@ -312,14 +282,37 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) { if (randBar == 3) { randBar -= 1; } - settingsController.SetPTSColorTime(randTime); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]); - settingsController.SetPTSColorBar(randBar); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randBar]); - settingsController.SetPTSColorBG(randBG); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randBG]); + settingsController.SetPTSColorTime(static_cast(randTime)); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast(randTime))); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast(randTime))); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast(randTime))); + settingsController.SetPTSColorBar(static_cast(randBar)); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast(randBar))); + settingsController.SetPTSColorBG(static_cast(randBG)); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast(randBG))); } } -} \ No newline at end of file +} + +Pinetime::Controllers::Settings::Colors SettingPineTimeStyle::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 SettingPineTimeStyle::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/settings/SettingPineTimeStyle.h b/src/displayapp/screens/settings/SettingPineTimeStyle.h index 1a01ebb..397bd86 100644 --- a/src/displayapp/screens/settings/SettingPineTimeStyle.h +++ b/src/displayapp/screens/settings/SettingPineTimeStyle.h @@ -15,12 +15,14 @@ namespace Pinetime { SettingPineTimeStyle(DisplayApp* app, Pinetime::Controllers::Settings &settingsController); ~SettingPineTimeStyle() override; - bool Refresh() override; void UpdateSelected(lv_obj_t *object, lv_event_t event); private: Controllers::Settings& settingsController; + Pinetime::Controllers::Settings::Colors GetNext(Controllers::Settings::Colors color); + Pinetime::Controllers::Settings::Colors GetPrevious(Controllers::Settings::Colors color); + lv_obj_t * btnNextTime; lv_obj_t * btnPrevTime; lv_obj_t * btnNextBar; @@ -29,9 +31,6 @@ namespace Pinetime { lv_obj_t * btnPrevBG; lv_obj_t * btnReset; lv_obj_t * btnRandom; - lv_obj_t * timeColor; - lv_obj_t * barColor; - lv_obj_t * bgColor; lv_obj_t * timebar; lv_obj_t * sidebar; lv_obj_t * timeDD1; @@ -51,11 +50,6 @@ namespace Pinetime { lv_obj_t * calendarCrossBar2; lv_obj_t * stepGauge; lv_color_t needle_colors[1]; - lv_color_t pts_colors[17] = {LV_COLOR_WHITE, LV_COLOR_SILVER, LV_COLOR_GRAY, LV_COLOR_BLACK, - LV_COLOR_RED, LV_COLOR_MAROON, LV_COLOR_YELLOW, LV_COLOR_OLIVE, - LV_COLOR_LIME, LV_COLOR_GREEN, LV_COLOR_CYAN, LV_COLOR_TEAL, - LV_COLOR_BLUE, LV_COLOR_NAVY, LV_COLOR_MAGENTA, LV_COLOR_PURPLE, - LV_COLOR_ORANGE}; }; } } -- cgit v0.10.2 From 6c023785e53c507f7cb20703f5f3a221ea095068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Milants?= Date: Sat, 28 Aug 2021 21:30:31 +0200 Subject: Fix wake on tap/double tap. diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 03bf670..0617b0c 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -240,12 +240,14 @@ void SystemTask::Work() { isDimmed = false; break; case Messages::TouchWakeUp: { - auto touchInfo = touchPanel.GetTouchInfo(); - if (touchInfo.touching and ((touchInfo.gesture == Pinetime::Drivers::Cst816S::Gestures::DoubleTap and - settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) or - (touchInfo.gesture == Pinetime::Drivers::Cst816S::Gestures::SingleTap and - settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::SingleTap)))) { - GoToRunning(); + if(touchHandler.GetNewTouchInfo()) { + auto gesture = touchHandler.GestureGet(); + if (gesture != Pinetime::Drivers::Cst816S::Gestures::None and ((gesture == Pinetime::Drivers::Cst816S::Gestures::DoubleTap and + settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) or + (gesture == Pinetime::Drivers::Cst816S::Gestures::SingleTap and + settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::SingleTap)))) { + GoToRunning(); + } } } break; case Messages::GoToSleep: -- cgit v0.10.2 From be31f417db1937032ae440e1cf68cb2971284713 Mon Sep 17 00:00:00 2001 From: "James A. Jerkins" Date: Sun, 29 Aug 2021 15:50:04 -0500 Subject: WIP Refactor ble advertising Refactor ble advertising based on ble standards and conventions. Changes are based on the bleprph example code, bluetooth docs, and nimble docs. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f72f50c..c7eda52 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -92,6 +92,9 @@ set(SDK_SOURCE_FILES set(TINYCRYPT_SRC libs/mynewt-nimble/ext/tinycrypt/src/aes_encrypt.c libs/mynewt-nimble/ext/tinycrypt/src/utils.c + libs/mynewt-nimble/ext/tinycrypt/src/cmac_mode.c + libs/mynewt-nimble/ext/tinycrypt/src/ecc.c + libs/mynewt-nimble/ext/tinycrypt/src/ecc_dh.c ) set(NIMBLE_SRC @@ -104,6 +107,10 @@ set(NIMBLE_SRC libs/mynewt-nimble/nimble/host/src/ble_l2cap.c libs/mynewt-nimble/nimble/host/src/ble_hs_mbuf.c libs/mynewt-nimble/nimble/host/src/ble_sm.c + libs/mynewt-nimble/nimble/host/src/ble_sm_cmd.c + libs/mynewt-nimble/nimble/host/src/ble_sm_lgcy.c + libs/mynewt-nimble/nimble/host/src/ble_sm_alg.c + libs/mynewt-nimble/nimble/host/src/ble_sm_sc.c libs/mynewt-nimble/nimble/host/src/ble_gap.c libs/mynewt-nimble/nimble/host/src/ble_gatts.c libs/mynewt-nimble/nimble/host/src/ble_gattc.c @@ -127,10 +134,6 @@ set(NIMBLE_SRC libs/mynewt-nimble/nimble/host/src/ble_hs_atomic.c libs/mynewt-nimble/nimble/host/src/ble_hs_adv.c libs/mynewt-nimble/nimble/host/src/ble_hs_flow.c - libs/mynewt-nimble/nimble/host/src/ble_sm.c - libs/mynewt-nimble/nimble/host/src/ble_sm_cmd.c - libs/mynewt-nimble/nimble/host/src/ble_sm_lgcy.c - libs/mynewt-nimble/nimble/host/src/ble_sm_alg.c libs/mynewt-nimble/nimble/host/src/ble_hs_mqueue.c libs/mynewt-nimble/nimble/host/src/ble_hs_stop.c libs/mynewt-nimble/nimble/host/src/ble_hs_startup.c diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index 5eb227b..4de8fff 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -42,6 +42,19 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask, serviceDiscovery({¤tTimeClient, &alertNotificationClient}) { } +void nimble_on_reset(int reason) { + NRF_LOG_INFO("Resetting state; reason=%d\n", reason); +} + +void nimble_on_sync(void) { + int rc; + + rc = ble_hs_util_ensure_addr(0); + ASSERT(rc == 0); + + nptr->StartAdvertising(); +} + int GAPEventCallback(struct ble_gap_event* event, void* arg) { auto nimbleController = static_cast(arg); return nimbleController->OnGAPEvent(event); @@ -51,6 +64,10 @@ void NimbleController::Init() { while (!ble_hs_synced()) { } + nptr = this; + ble_hs_cfg.reset_cb = nimble_on_reset; + ble_hs_cfg.sync_cb = nimble_on_sync; + ble_svc_gap_init(); ble_svc_gatt_init(); @@ -64,28 +81,31 @@ void NimbleController::Init() { batteryInformationService.Init(); immediateAlertService.Init(); heartRateService.Init(); - int res; - res = ble_hs_util_ensure_addr(0); - ASSERT(res == 0); - res = ble_hs_id_infer_auto(0, &addrType); - ASSERT(res == 0); - res = ble_svc_gap_device_name_set(deviceName); - ASSERT(res == 0); + + int rc; + rc = ble_hs_util_ensure_addr(0); + ASSERT(rc == 0); + rc = ble_hs_id_infer_auto(0, &addrType); + ASSERT(rc == 0); + rc = ble_svc_gap_device_name_set(deviceName); + ASSERT(rc == 0); + rc = ble_svc_gap_device_appearance_set(0xC2); + ASSERT(rc == 0); Pinetime::Controllers::Ble::BleAddress address; - res = ble_hs_id_copy_addr(addrType, address.data(), nullptr); - ASSERT(res == 0); + rc = ble_hs_id_copy_addr(addrType, address.data(), nullptr); + ASSERT(rc == 0); bleController.AddressType((addrType == 0) ? Ble::AddressTypes::Public : Ble::AddressTypes::Random); bleController.Address(std::move(address)); - res = ble_gatts_start(); - ASSERT(res == 0); + rc = ble_gatts_start(); + ASSERT(rc == 0); + + if (!ble_gap_adv_active() && !bleController.IsConnected()) + StartAdvertising(); } void NimbleController::StartAdvertising() { - if (bleController.IsConnected() || ble_gap_conn_active() || ble_gap_adv_active()) - return; - - ble_svc_gap_device_name_set(deviceName); + int rc; /* set adv parameters */ struct ble_gap_adv_params adv_params; @@ -104,9 +124,6 @@ void NimbleController::StartAdvertising() { adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN; fields.flags = BLE_HS_ADV_F_DISC_GEN | BLE_HS_ADV_F_BREDR_UNSUP; - // fields.uuids128 = BLE_UUID128(BLE_UUID128_DECLARE( - // 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - // 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff)); fields.uuids128 = &dfuServiceUuid; fields.num_uuids128 = 1; fields.uuids128_is_complete = 1; @@ -116,27 +133,24 @@ void NimbleController::StartAdvertising() { rsp_fields.name_len = strlen(deviceName); rsp_fields.name_is_complete = 1; - ble_gap_adv_set_fields(&fields); - // ASSERT(res == 0); // TODO this one sometimes fails with error 22 (notsync) + rc = ble_gap_adv_set_fields(&fields); + ASSERT(rc == 0); - ble_gap_adv_rsp_set_fields(&rsp_fields); - // ASSERT(res == 0); + rc = ble_gap_adv_rsp_set_fields(&rsp_fields); + ASSERT(rc == 0); - ble_gap_adv_start(addrType, NULL, 180000, &adv_params, GAPEventCallback, this); - // ASSERT(res == 0);// TODO I've disabled these ASSERT as they sometime asserts and reset the mcu. - // For now, the advertising is restarted as soon as it ends. There may be a race condition - // that prevent the advertising from restarting reliably. - // I remove the assert to prevent this uncesseray crash, but in the long term, the management of - // the advertising should be improve (better error handling, and advertise for 3 minutes after - // the application has been woken up, for example. + rc = ble_gap_adv_start(addrType, NULL, 5000, &adv_params, GAPEventCallback, this); + ASSERT(rc == 0); } int NimbleController::OnGAPEvent(ble_gap_event* event) { switch (event->type) { case BLE_GAP_EVENT_ADV_COMPLETE: NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_ADV_COMPLETE"); - NRF_LOG_INFO("advertise complete; reason=%dn status=%d", event->adv_complete.reason, event->connect.status); + NRF_LOG_INFO("reason=%d; status=%d", event->adv_complete.reason, event->connect.status); + StartAdvertising(); break; + case BLE_GAP_EVENT_CONNECT: { NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_CONNECT"); @@ -145,18 +159,19 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { if (event->connect.status != 0) { /* Connection failed; resume advertising. */ - StartAdvertising(); bleController.Disconnect(); + StartAdvertising(); } else { + connectionHandle = event->connect.conn_handle; bleController.Connect(); systemTask.PushMessage(Pinetime::System::Messages::BleConnected); - connectionHandle = event->connect.conn_handle; - // Service discovery is deffered via systemtask + // Service discovery is deferred via systemtask } } break; + case BLE_GAP_EVENT_DISCONNECT: NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_DISCONNECT"); - NRF_LOG_INFO("disconnect; reason=%d", event->disconnect.reason); + NRF_LOG_INFO("disconnect reason=%d", event->disconnect.reason); /* Connection terminated; resume advertising. */ currentTimeClient.Reset(); @@ -165,15 +180,18 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { bleController.Disconnect(); StartAdvertising(); break; + case BLE_GAP_EVENT_CONN_UPDATE: NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_CONN_UPDATE"); /* The central has updated the connection parameters. */ - NRF_LOG_INFO("connection updated; status=%d ", event->conn_update.status); + NRF_LOG_INFO("update status=%d ", event->conn_update.status); break; + case BLE_GAP_EVENT_ENC_CHANGE: /* Encryption has been enabled or disabled for this connection. */ NRF_LOG_INFO("encryption change event; status=%d ", event->enc_change.status); - return 0; + break; + case BLE_GAP_EVENT_SUBSCRIBE: NRF_LOG_INFO("subscribe event; conn_handle=%d attr_handle=%d " "reason=%d prevn=%d curn=%d previ=%d curi=???\n", @@ -183,10 +201,11 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { event->subscribe.prev_notify, event->subscribe.cur_notify, event->subscribe.prev_indicate); - return 0; + break; + case BLE_GAP_EVENT_MTU: NRF_LOG_INFO("mtu update event; conn_handle=%d cid=%d mtu=%d\n", event->mtu.conn_handle, event->mtu.channel_id, event->mtu.value); - return 0; + break; case BLE_GAP_EVENT_REPEAT_PAIRING: { /* We already have a bond with the peer, but it is attempting to @@ -217,8 +236,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { notifSize); alertNotificationClient.OnNotification(event); - return 0; - } + } break; /* Attribute data is contained in event->notify_rx.attr_data. */ default: diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h index 0cfe983..078d615 100644 --- a/src/components/ble/NimbleController.h +++ b/src/components/ble/NimbleController.h @@ -101,5 +101,7 @@ namespace Pinetime { ServiceDiscovery serviceDiscovery; }; + + static NimbleController* nptr; } } diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 3553f44..2dff925 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -120,7 +120,6 @@ void SystemTask::Work() { fs.Init(); nimbleController.Init(); - nimbleController.StartAdvertising(); lcd.Init(); twiMaster.Init(); @@ -226,7 +225,6 @@ void SystemTask::Work() { touchPanel.Wakeup(); } - nimbleController.StartAdvertising(); xTimerStart(dimTimer, 0); spiNorFlash.Wakeup(); lcd.Wakeup(); -- cgit v0.10.2 From 00a3f84ea764e5da5d982e7603ece1e574306850 Mon Sep 17 00:00:00 2001 From: "James A. Jerkins" Date: Mon, 30 Aug 2021 23:17:16 -0500 Subject: Completely reset connection state on fail diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index 4de8fff..8b4f3ea 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -159,6 +159,9 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { if (event->connect.status != 0) { /* Connection failed; resume advertising. */ + currentTimeClient.Reset(); + alertNotificationClient.Reset(); + connectionHandle = BLE_HS_CONN_HANDLE_NONE; bleController.Disconnect(); StartAdvertising(); } else { -- cgit v0.10.2 From 1635bfafb3fe9dce1ab05102d1bfeac1eca81c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Milants?= Date: Tue, 31 Aug 2021 21:56:21 +0200 Subject: Fix notifications that wouldn't auto close when the timeout elapsed (in preview mode). diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index fd0b86d..22eb290 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -73,7 +73,6 @@ void Notifications::Refresh() { timeoutLinePoints[1].x = pos; lv_line_set_points(timeoutLine, timeoutLinePoints, 2); } - running = currentItem->IsRunning(); } bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { -- cgit v0.10.2 From d69a8e84fa1906a661738ea034eae5f5f37c25bf Mon Sep 17 00:00:00 2001 From: "James A. Jerkins" Date: Wed, 1 Sep 2021 22:48:01 -0500 Subject: Fix race condition, connect->disconnect->discovery diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index 8b4f3ea..0f48609 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -250,7 +250,9 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { } void NimbleController::StartDiscovery() { - serviceDiscovery.StartDiscovery(connectionHandle); + if (connectionHandle != BLE_HS_CONN_HANDLE_NONE) { + serviceDiscovery.StartDiscovery(connectionHandle); + } } uint16_t NimbleController::connHandle() { -- cgit v0.10.2 From 3e1fe687b82d4df237b7b355fa31cb88713193fc Mon Sep 17 00:00:00 2001 From: "James A. Jerkins" Date: Wed, 1 Sep 2021 22:50:56 -0500 Subject: Fix styles issues - no change to functionality diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index 0f48609..8e0fe75 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -151,7 +151,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { StartAdvertising(); break; - case BLE_GAP_EVENT_CONNECT: { + case BLE_GAP_EVENT_CONNECT: NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_CONNECT"); /* A new connection was established or a connection attempt failed. */ @@ -170,7 +170,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { systemTask.PushMessage(Pinetime::System::Messages::BleConnected); // Service discovery is deferred via systemtask } - } break; + break; case BLE_GAP_EVENT_DISCONNECT: NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_DISCONNECT"); @@ -207,7 +207,8 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { break; case BLE_GAP_EVENT_MTU: - NRF_LOG_INFO("mtu update event; conn_handle=%d cid=%d mtu=%d\n", event->mtu.conn_handle, event->mtu.channel_id, event->mtu.value); + NRF_LOG_INFO("mtu update event; conn_handle=%d cid=%d mtu=%d\n", + event->mtu.conn_handle, event->mtu.channel_id, event->mtu.value); break; case BLE_GAP_EVENT_REPEAT_PAIRING: { @@ -224,8 +225,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { /* Return BLE_GAP_REPEAT_PAIRING_RETRY to indicate that the host should * continue with the pairing operation. */ - } - return BLE_GAP_REPEAT_PAIRING_RETRY; + } return BLE_GAP_REPEAT_PAIRING_RETRY; case BLE_GAP_EVENT_NOTIFY_RX: { /* Peer sent us a notification or indication. */ @@ -260,7 +260,7 @@ uint16_t NimbleController::connHandle() { } void NimbleController::NotifyBatteryLevel(uint8_t level) { - if(connectionHandle != BLE_HS_CONN_HANDLE_NONE) { + if (connectionHandle != BLE_HS_CONN_HANDLE_NONE) { batteryInformationService.NotifyBatteryLevel(connectionHandle, level); } } -- cgit v0.10.2 From 6f9f0e8b0e42a5526d47ca664534fb6b0ccb6ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Milants?= Date: Thu, 2 Sep 2021 20:32:50 +0200 Subject: Set version to 1.4.0. diff --git a/CMakeLists.txt b/CMakeLists.txt index b442fc1..cc41a08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10) -project(pinetime VERSION 1.3.0 LANGUAGES C CXX ASM) +project(pinetime VERSION 1.4.0 LANGUAGES C CXX ASM) set(CMAKE_C_STANDARD 99) set(CMAKE_CXX_STANDARD 14) -- cgit v0.10.2 From bd1a571399923014c6411dc7f4677078ee54d0f5 Mon Sep 17 00:00:00 2001 From: Itai Nelken <70802936+Itai-Nelken@users.noreply.github.com> Date: Thu, 2 Sep 2021 23:20:25 +0300 Subject: Update Settings.cpp diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index f82b03c..e3319f0 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -50,8 +50,8 @@ std::unique_ptr Settings::CreateScreen2() { std::array applications {{ {Symbols::shoe, "Steps", Apps::SettingSteps}, {Symbols::batteryHalf, "Battery", Apps::BatteryInfo}, + {Symbols::paintbrush, "PTS Colors", Apps::SettingPineTimeStyle}, {Symbols::check, "Firmware", Apps::FirmwareValidation}, - {Symbols::list, "About", Apps::SysInfo}, }}; return std::make_unique(1, 3, app, settingsController, applications); @@ -60,7 +60,7 @@ std::unique_ptr Settings::CreateScreen2() { std::unique_ptr Settings::CreateScreen3() { std::array applications {{ - {Symbols::paintbrush, "PTS Colors", Apps::SettingPineTimeStyle}, + {Symbols::list, "About", Apps::SysInfo}, {Symbols::none, "None", Apps::None}, {Symbols::none, "None", Apps::None}, {Symbols::none, "None", Apps::None}, -- cgit v0.10.2 From c32ba844e04017a3fd31444c384deb3542bd76be Mon Sep 17 00:00:00 2001 From: "James A. Jerkins" Date: Sat, 4 Sep 2021 15:26:50 -0500 Subject: Linear decrease of advert rate to conserve battery Start advertising aggressively when powered on then slow down linearly over 75 seconds. This will conserve battery by not advertising rapidly the whole time we are seeking a connection. The slowest rate is approximately once every 4.5 seconds to balance responsiveness and battery life. We use a fixed advertising duration of 5 seconds and start with a 62.5 ms advertising interval. Every 5 seconds (the advertising duration) we step up to a larger advertising interval (slower advertising). We continue to increase the advertising interval linearly for 75 seconds from the start of advertising. At 75 seconds we have an advertising interval of 4.44 seconds which we keep until connected. A reboot will restart the sequence. When we receive a disconnect event we restart the sequence with fast advertising and then slow down as described above. Note that we are not using the BLE high duty cycle setting to change the advertising rate. The rate is managed by repeatedly setting the minimum and maximum intervals. The linear rate of decrease and the slowest interval size were determined experimentally by the author. The 5.3 Core spec suggests that you not advertise slower than once every 1.2 seconds to preserve responsiveness but we ignored that suggestion. diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index 8e0fe75..bebca2d 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -122,6 +122,8 @@ void NimbleController::StartAdvertising() { adv_params.conn_mode = BLE_GAP_CONN_MODE_UND; adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN; + adv_params.itvl_min = advInterval; + adv_params.itvl_max = advInterval + 100; fields.flags = BLE_HS_ADV_F_DISC_GEN | BLE_HS_ADV_F_BREDR_UNSUP; fields.uuids128 = &dfuServiceUuid; @@ -148,6 +150,8 @@ 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=%d", event->adv_complete.reason, event->connect.status); + if (advInterval < 7100) + advInterval += 500; StartAdvertising(); break; @@ -181,6 +185,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { alertNotificationClient.Reset(); connectionHandle = BLE_HS_CONN_HANDLE_NONE; bleController.Disconnect(); + advInterval = 100; StartAdvertising(); break; diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h index 078d615..7976110 100644 --- a/src/components/ble/NimbleController.h +++ b/src/components/ble/NimbleController.h @@ -94,6 +94,7 @@ namespace Pinetime { uint8_t addrType; // 1 = Random, 0 = PUBLIC uint16_t connectionHandle = BLE_HS_CONN_HANDLE_NONE; + uint16_t advInterval = 100; // multiplied by 0.625ms, must be in 32..16384 ble_uuid128_t dfuServiceUuid { .u {.type = BLE_UUID_TYPE_128}, -- cgit v0.10.2 From 4820b2ffe8be0b8d1abefd307a4c0fe6d4d41a73 Mon Sep 17 00:00:00 2001 From: "James A. Jerkins" Date: Sun, 5 Sep 2021 15:52:01 -0500 Subject: Revert "Linear decrease of advert rate to conserve battery" This reverts commit c32ba844e04017a3fd31444c384deb3542bd76be. diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index bebca2d..8e0fe75 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -122,8 +122,6 @@ void NimbleController::StartAdvertising() { adv_params.conn_mode = BLE_GAP_CONN_MODE_UND; adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN; - adv_params.itvl_min = advInterval; - adv_params.itvl_max = advInterval + 100; fields.flags = BLE_HS_ADV_F_DISC_GEN | BLE_HS_ADV_F_BREDR_UNSUP; fields.uuids128 = &dfuServiceUuid; @@ -150,8 +148,6 @@ 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=%d", event->adv_complete.reason, event->connect.status); - if (advInterval < 7100) - advInterval += 500; StartAdvertising(); break; @@ -185,7 +181,6 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { alertNotificationClient.Reset(); connectionHandle = BLE_HS_CONN_HANDLE_NONE; bleController.Disconnect(); - advInterval = 100; StartAdvertising(); break; diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h index 7976110..078d615 100644 --- a/src/components/ble/NimbleController.h +++ b/src/components/ble/NimbleController.h @@ -94,7 +94,6 @@ namespace Pinetime { uint8_t addrType; // 1 = Random, 0 = PUBLIC uint16_t connectionHandle = BLE_HS_CONN_HANDLE_NONE; - uint16_t advInterval = 100; // multiplied by 0.625ms, must be in 32..16384 ble_uuid128_t dfuServiceUuid { .u {.type = BLE_UUID_TYPE_128}, -- cgit v0.10.2 From 22571d4b384e40d647cd994202956f08ed32d925 Mon Sep 17 00:00:00 2001 From: "James A. Jerkins" Date: Sun, 5 Sep 2021 15:53:20 -0500 Subject: Advertise fast for at least 30 secs then slow down On power up, advertise aggressively for at least 30 seconds then switch to a longer interval to conserve battery life. This fast/slow pattern is designed to balance connection response time and battery life. When a disconnect event is received restart the fast/slow pattern. When a failed connect event is received, restart the fast/slow pattern. When the screen is activated and ble is not connected, restart the fast/slow pattern. This pattern is consistent with Apple's BLE developer standards (QA 1931). diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index 8e0fe75..226f669 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -122,6 +122,15 @@ void NimbleController::StartAdvertising() { adv_params.conn_mode = BLE_GAP_CONN_MODE_UND; adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN; + /* fast advertise for 30 sec */ + if (fastAdvCount < 15) { + adv_params.itvl_min = 32; + adv_params.itvl_max = 47; + fastAdvCount++; + } else { + adv_params.itvl_min = 1636; + adv_params.itvl_max = 1651; + } fields.flags = BLE_HS_ADV_F_DISC_GEN | BLE_HS_ADV_F_BREDR_UNSUP; fields.uuids128 = &dfuServiceUuid; @@ -139,7 +148,7 @@ void NimbleController::StartAdvertising() { rc = ble_gap_adv_rsp_set_fields(&rsp_fields); ASSERT(rc == 0); - rc = ble_gap_adv_start(addrType, NULL, 5000, &adv_params, GAPEventCallback, this); + rc = ble_gap_adv_start(addrType, NULL, 2000, &adv_params, GAPEventCallback, this); ASSERT(rc == 0); } @@ -163,6 +172,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { alertNotificationClient.Reset(); connectionHandle = BLE_HS_CONN_HANDLE_NONE; bleController.Disconnect(); + fastAdvCount = 0; StartAdvertising(); } else { connectionHandle = event->connect.conn_handle; @@ -181,6 +191,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) { alertNotificationClient.Reset(); connectionHandle = BLE_HS_CONN_HANDLE_NONE; bleController.Disconnect(); + fastAdvCount = 0; StartAdvertising(); break; diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h index 078d615..473bb1a 100644 --- a/src/components/ble/NimbleController.h +++ b/src/components/ble/NimbleController.h @@ -72,6 +72,10 @@ namespace Pinetime { uint16_t connHandle(); void NotifyBatteryLevel(uint8_t level); + void RestartFastAdv() { + fastAdvCount = 0; + } + private: static constexpr const char* deviceName = "InfiniTime"; Pinetime::System::SystemTask& systemTask; @@ -94,6 +98,7 @@ namespace Pinetime { uint8_t addrType; // 1 = Random, 0 = PUBLIC uint16_t connectionHandle = BLE_HS_CONN_HANDLE_NONE; + uint8_t fastAdvCount = 0; ble_uuid128_t dfuServiceUuid { .u {.type = BLE_UUID_TYPE_128}, diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 2dff925..41f346a 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -233,6 +233,9 @@ void SystemTask::Work() { displayApp.PushMessage(Pinetime::Applications::Display::Messages::UpdateBatteryLevel); heartRateApp.PushMessage(Pinetime::Applications::HeartRateTask::Messages::WakeUp); + if (!bleController.IsConnected()) + nimbleController.RestartFastAdv(); + isSleeping = false; isWakingUp = false; isDimmed = false; -- cgit v0.10.2 From e614af1c4a53e943256b3b2acee4bfe7d7204bbf Mon Sep 17 00:00:00 2001 From: hubmartin Date: Mon, 13 Sep 2021 11:41:51 +0200 Subject: Add WATCH_COLMI_P8 option to cmake & docs diff --git a/CMakeLists.txt b/CMakeLists.txt index cc41a08..f2402e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,14 @@ if(BUILD_DFU) set(BUILD_DFU true) endif() +option(WATCH_COLMI_P8 "Build for the Colmi P8" OFF) +set(TARGET_DEVICE "PineTime") + +if(WATCH_COLMI_P8) + set(TARGET_DEVICE "Colmi P8") + add_definitions(-DWATCH_P8) +endif() + set(PROJECT_GIT_COMMIT_HASH "") execute_process(COMMAND git rev-parse --short HEAD @@ -68,6 +76,7 @@ message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${P message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH}) message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH}) message(" * NRF52 SDK : " ${NRF5_SDK_PATH}) +message(" * Target device : " ${TARGET_DEVICE}) set(PROGRAMMER "???") if(USE_JLINK) message(" * Programmer/debugger : JLINK") diff --git a/doc/buildAndProgram.md b/doc/buildAndProgram.md index 87b6dd9..e97bb30 100644 --- a/doc/buildAndProgram.md +++ b/doc/buildAndProgram.md @@ -28,6 +28,7 @@ CMake configures the project according to variables you specify the command line **GDB_CLIENT_BIN_PATH**|Path to arm-none-eabi-gdb executable. Used only if `USE_GDB_CLIENT` is 1.|`-DGDB_CLIENT_BIN_PATH=/home/jf/nrf52/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gdb` **GDB_CLIENT_TARGET_REMOTE**|Target remote connection string. Used only if `USE_GDB_CLIENT` is 1.|`-DGDB_CLIENT_TARGET_REMOTE=/dev/ttyACM0` **BUILD_DFU (\*\*)**|Build DFU files while building (needs [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil)).|`-DBUILD_DFU=1` +**WATCH_COLMI_P8**|Use pin configuration for Colmi P8 watch|`-DWATCH_COLMI_P8=1` ####(**) Note about **CMAKE_BUILD_TYPE**: By default, this variable is set to *Release*. It compiles the code with size and speed optimizations. We use this value for all the binaries we publish when we [release](https://github.com/JF002/InfiniTime/releases) new versions of InfiniTime. -- cgit v0.10.2 From 84a93b54410681ce1aaae80ba7a7e6d3300dcfa1 Mon Sep 17 00:00:00 2001 From: Tim Gates Date: Tue, 14 Sep 2021 04:02:53 +1000 Subject: docs: Fix a few typos (#606) * docs: Fix a few typos There are small typos in: - doc/versioning.md - src/components/ble/NimbleController.cpp - src/libs/mynewt-nimble/CODING_STANDARDS.md - src/libs/mynewt-nimble/docs/btshell/btshell_GAP.rst - src/systemtask/SystemTask.cpp Fixes: - Should read `milliseconds` rather than `miliseconds`. - Should read `unnecessary` rather than `uncesseray`. - Should read `target` rather than `tharget`. - Should read `project` rather than `projct`. - Should read `preferred` rather than `prefered`. - Should read `functioning` rather than `functionning`. - Should read `forever` rather than `forver`. - Should read `existing` rather than `exisiting`. diff --git a/cmake-nRF5x/readme.md b/cmake-nRF5x/readme.md index 2ce7689..0127a2e 100755 --- a/cmake-nRF5x/readme.md +++ b/cmake-nRF5x/readme.md @@ -98,7 +98,7 @@ The script makes use of the following tools: After setup you can use cmake as usual: -1. Generate the actual build files (out-of-source builds are strongly recomended): +1. Generate the actual build files (out-of-source builds are strongly recommended): ```commandline cmake -H. -B"cmake-build" -G "Unix Makefiles" diff --git a/doc/versioning.md b/doc/versioning.md index b08af71..48e0504 100644 --- a/doc/versioning.md +++ b/doc/versioning.md @@ -3,4 +3,4 @@ The versioning of this project is based on [Semantic versionning](https://semver - The **patch** is incremented when we fix a bug on a **released** version (most of the time using a **hotfix** branch). - The **minor** is incremented when we release a new version with new features. It corresponds to a merge of **develop** into **master**. - - The **major** should be incremented when a breaking change is made to the application. We still have to define what is a breaking change in the context of this project. For now, I suggest that it stays **0** until we have a fully functionning firmware suited for the final user. \ No newline at end of file + - The **major** should be incremented when a breaking change is made to the application. We still have to define what is a breaking change in the context of this project. For now, I suggest that it stays **0** until we have a fully functioning firmware suited for the final user. \ No newline at end of file diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index 5eb227b..bde9b07 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -126,7 +126,7 @@ void NimbleController::StartAdvertising() { // ASSERT(res == 0);// TODO I've disabled these ASSERT as they sometime asserts and reset the mcu. // For now, the advertising is restarted as soon as it ends. There may be a race condition // that prevent the advertising from restarting reliably. - // I remove the assert to prevent this uncesseray crash, but in the long term, the management of + // I remove the assert to prevent this unnecessary crash, but in the long term, the management of // the advertising should be improve (better error handling, and advertise for 3 minutes after // the application has been woken up, for example. } diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index d9434b3..690a453 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -350,7 +350,7 @@ void SystemTask::Work() { if (bleDiscoveryTimer == 0) { isBleDiscoveryTimerRunning = false; // Services discovery is deffered from 3 seconds to avoid the conflicts between the host communicating with the - // tharget and vice-versa. I'm not sure if this is the right way to handle this... + // target and vice-versa. I'm not sure if this is the right way to handle this... nimbleController.StartDiscovery(); } else { bleDiscoveryTimer--; -- cgit v0.10.2 From 6356c7f276d09ab32d6f1c1338dac0b00a602232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Milants?= Date: Mon, 13 Sep 2021 20:35:51 +0200 Subject: Fix DisplayAppRecovery : fix include error by forward declaring Controllers in header file. diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp index 17612ef..7a20262 100644 --- a/src/displayapp/DisplayAppRecovery.cpp +++ b/src/displayapp/DisplayAppRecovery.cpp @@ -5,6 +5,7 @@ #include #include #include "displayapp/icons/infinitime/infinitime-nb.c" +#include "components/ble/BleController.h" using namespace Pinetime::Applications; diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h index 8b2bc7f..4184ea4 100644 --- a/src/displayapp/DisplayAppRecovery.h +++ b/src/displayapp/DisplayAppRecovery.h @@ -6,32 +6,38 @@ #include #include #include "components/gfx/Gfx.h" -#include "components/battery/BatteryController.h" -#include "components/brightness/BrightnessController.h" -#include "components/ble/BleController.h" -#include "components/datetime/DateTimeController.h" -#include "components/ble/NotificationManager.h" -#include "components/firmwarevalidator/FirmwareValidator.h" #include "drivers/Cst816s.h" #include #include -#include -#include #include -#include #include "TouchEvents.h" #include "Apps.h" #include "Messages.h" #include "DummyLittleVgl.h" -#include "components/timer/TimerController.h" namespace Pinetime { - namespace System { - class SystemTask; - }; + namespace Drivers { + class St7789; + class Cst816S; + class WatchdogView; + } namespace Controllers { + class Settings; + class Battery; + class Ble; + class DateTime; + class NotificationManager; + class HeartRateController; + class MotionController; class TouchHandler; + class MotorController; + class TimerController; } + + namespace System { + class SystemTask; + }; + namespace Applications { class DisplayApp { public: -- cgit v0.10.2