This commit is contained in:
Kieran Cawthray 2021-05-18 15:23:26 +02:00
parent 9ab298c09e
commit 378fa6b401
45 changed files with 101 additions and 865 deletions

View File

@ -22,9 +22,5 @@ Checks: '*,
-hicpp-no-assembler, -hicpp-no-assembler,
-hicpp-avoid-c-arrays, -hicpp-avoid-c-arrays,
-hicpp-uppercase-literal-suffix, -hicpp-uppercase-literal-suffix,
-hicpp-no-array-decay,
-cert-err58-cpp, -cert-err58-cpp,
-cert-err60-cpp' -cert-err60-cpp'
CheckOptions:
- key: readability-function-cognitive-complexity.Threshold
value: 100

View File

@ -55,22 +55,10 @@ if(BUILD_DFU)
set(BUILD_DFU true) set(BUILD_DFU true)
endif() 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("BUILD CONFIGURATION")
message("-------------------") message("-------------------")
message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH}) message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH})
message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH})
message(" * NRF52 SDK : " ${NRF5_SDK_PATH}) message(" * NRF52 SDK : " ${NRF5_SDK_PATH})
set(PROGRAMMER "???") set(PROGRAMMER "???")
if(USE_JLINK) if(USE_JLINK)

View File

@ -72,8 +72,7 @@ As of now, here is the list of achievements of this project:
## Documentation ## Documentation
### Getting started ### 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/gettingStarted.md)
- [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/ota-gadgetbridge-nrfconnect.md)
### Develop ### Develop
- [Generate the fonts and symbols](src/displayapp/fonts/README.md) - [Generate the fonts and symbols](src/displayapp/fonts/README.md)

View File

@ -3,7 +3,6 @@
To build this project, you'll need: 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) - 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 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) - A reasonably recent version of CMake (I use 3.16.5)
## Build steps ## Build steps

View File

@ -8,7 +8,7 @@ As the documentation is part of the source code, you can submit your improvement
## Fix bugs, add functionalities and improve the code ## 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*. 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 ## 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 ? # How to submit a pull request ?
@ -21,7 +21,7 @@ The Pinetime is a cool open source project that deserves to be known. Talk about
- Write documentation related to your new feature is applicable; - 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; - 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; - 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!
@ -29,20 +29,20 @@ If you want to fix a bug, add a functionality or improve the code, you'll first
When your feature branch is ready, **make sure it actually works** and **do not forget to write documentation** about it if it's relevant. 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. 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,... 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? ## 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. 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.
@ -63,7 +63,7 @@ It's OK to include C code if this code comes from another library like FreeRTOS,
## Coding style ## 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 - **Opening brace** at the end of the line
- **Naming** : Choose self-describing variable name - **Naming** : Choose self-describing variable name
- **class** : PascalCase - **class** : PascalCase

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

View File

@ -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).

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

View File

@ -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)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

View File

@ -19,11 +19,8 @@ RUN apt-get update -qq \
libffi-dev \ libffi-dev \
libssl-dev \ libssl-dev \
python3-dev \ python3-dev \
git \
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/*; && rm -rf /var/cache/apt/* /var/lib/apt/lists/*;
# Git needed for PROJECT_GIT_COMMIT_HASH variable setting
# Needs to be installed as root # Needs to be installed as root
RUN pip3 install adafruit-nrfutil RUN pip3 install adafruit-nrfutil
RUN pip3 install -Iv cryptography==3.3 RUN pip3 install -Iv cryptography==3.3

View File

@ -19,11 +19,8 @@ RUN apt-get update -qq \
libssl-dev \ libssl-dev \
python3-dev \ python3-dev \
python \ python \
git \
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/*; && 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 adafruit-nrfutil
RUN pip3 install -Iv cryptography==3.3 RUN pip3 install -Iv cryptography==3.3

View File

@ -406,7 +406,6 @@ list(APPEND SOURCE_FILES
displayapp/screens/FlashLight.cpp displayapp/screens/FlashLight.cpp
displayapp/screens/List.cpp displayapp/screens/List.cpp
displayapp/screens/BatteryInfo.cpp displayapp/screens/BatteryInfo.cpp
displayapp/screens/Steps.cpp
## Settings ## Settings
displayapp/screens/settings/QuickSettings.cpp displayapp/screens/settings/QuickSettings.cpp
@ -415,12 +414,12 @@ list(APPEND SOURCE_FILES
displayapp/screens/settings/SettingTimeFormat.cpp displayapp/screens/settings/SettingTimeFormat.cpp
displayapp/screens/settings/SettingWakeUp.cpp displayapp/screens/settings/SettingWakeUp.cpp
displayapp/screens/settings/SettingDisplay.cpp displayapp/screens/settings/SettingDisplay.cpp
displayapp/screens/settings/SettingSteps.cpp
## Watch faces ## Watch faces
displayapp/icons/bg_clock.c displayapp/icons/bg_clock.c
displayapp/screens/WatchFaceAnalog.cpp displayapp/screens/WatchFaceAnalog.cpp
displayapp/screens/WatchFaceDigital.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_extrabold_compressed.c
displayapp/fonts/jetbrains_mono_bold_20.c displayapp/fonts/jetbrains_mono_bold_20.c
displayapp/fonts/jetbrains_mono_76.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/fonts/lv_font_sys_48.c
displayapp/lv_pinetime_theme.c displayapp/lv_pinetime_theme.c

View File

@ -8,13 +8,11 @@ namespace Pinetime {
static constexpr uint32_t Major() {return major;} static constexpr uint32_t Major() {return major;}
static constexpr uint32_t Minor() {return minor;} static constexpr uint32_t Minor() {return minor;}
static constexpr uint32_t Patch() {return patch;} static constexpr uint32_t Patch() {return patch;}
static constexpr const char* GitCommitHash() {return commitHash;}
static constexpr const char* VersionString() {return versionString;} static constexpr const char* VersionString() {return versionString;}
private: private:
static constexpr uint32_t major = @PROJECT_VERSION_MAJOR@; static constexpr uint32_t major = @PROJECT_VERSION_MAJOR@;
static constexpr uint32_t minor = @PROJECT_VERSION_MINOR@; static constexpr uint32_t minor = @PROJECT_VERSION_MINOR@;
static constexpr uint32_t patch = @PROJECT_VERSION_PATCH@; 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@"; static constexpr const char* versionString = "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@";
}; };
} }

View File

@ -8,13 +8,13 @@ namespace Pinetime {
public: public:
void Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps); void Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps);
int16_t X() const { uint16_t X() const {
return x; return x;
} }
int16_t Y() const { uint16_t Y() const {
return y; return y;
} }
int16_t Z() const { uint16_t Z() const {
return z; return z;
} }
uint32_t NbSteps() const { uint32_t NbSteps() const {

View File

@ -86,14 +86,6 @@ namespace Pinetime {
return settings.brightLevel; 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: private:
Pinetime::Drivers::SpiNorFlash& spiNorFlash; Pinetime::Drivers::SpiNorFlash& spiNorFlash;
struct SettingsData { struct SettingsData {
@ -103,7 +95,7 @@ namespace Pinetime {
uint8_t clockFace = 0; uint8_t clockFace = 0;
uint32_t stepsGoal = 10000; uint32_t stepsGoal = 1000;
uint32_t screenTimeOut = 15000; uint32_t screenTimeOut = 15000;
WakeUpMode wakeUpMode = WakeUpMode::None; WakeUpMode wakeUpMode = WakeUpMode::None;

View File

@ -21,14 +21,12 @@ namespace Pinetime {
Navigation, Navigation,
StopWatch, StopWatch,
Motion, Motion,
Steps,
QuickSettings, QuickSettings,
Settings, Settings,
SettingWatchFace, SettingWatchFace,
SettingTimeFormat, SettingTimeFormat,
SettingDisplay, SettingDisplay,
SettingWakeUp, SettingWakeUp
SettingSteps
}; };
} }
} }

View File

@ -25,7 +25,6 @@
#include "displayapp/screens/Twos.h" #include "displayapp/screens/Twos.h"
#include "displayapp/screens/FlashLight.h" #include "displayapp/screens/FlashLight.h"
#include "displayapp/screens/BatteryInfo.h" #include "displayapp/screens/BatteryInfo.h"
#include "displayapp/screens/Steps.h"
#include "drivers/Cst816s.h" #include "drivers/Cst816s.h"
#include "drivers/St7789.h" #include "drivers/St7789.h"
@ -38,7 +37,6 @@
#include "displayapp/screens/settings/SettingTimeFormat.h" #include "displayapp/screens/settings/SettingTimeFormat.h"
#include "displayapp/screens/settings/SettingWakeUp.h" #include "displayapp/screens/settings/SettingWakeUp.h"
#include "displayapp/screens/settings/SettingDisplay.h" #include "displayapp/screens/settings/SettingDisplay.h"
#include "displayapp/screens/settings/SettingSteps.h"
using namespace Pinetime::Applications; using namespace Pinetime::Applications;
using namespace Pinetime::Applications::Display; using namespace Pinetime::Applications::Display;
@ -67,7 +65,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
notificationManager {notificationManager}, notificationManager {notificationManager},
heartRateController {heartRateController}, heartRateController {heartRateController},
settingsController {settingsController}, settingsController {settingsController},
motorController {motorController}, motorController{motorController},
motionController {motionController} { motionController {motionController} {
msgQueue = xQueueCreate(queueSize, itemSize); msgQueue = xQueueCreate(queueSize, itemSize);
// Start clock when smartwatch boots // Start clock when smartwatch boots
@ -75,9 +73,8 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
} }
void DisplayApp::Start() { 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); APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
}
} }
void DisplayApp::Process(void* instance) { 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 // Send a dummy notification to unlock the lvgl display driver for the first iteration
xTaskNotifyGive(xTaskGetCurrentTaskHandle()); xTaskNotifyGive(xTaskGetCurrentTaskHandle());
while (true) { while (1) {
app->Refresh(); app->Refresh();
} }
} }
@ -216,7 +213,7 @@ void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction)
LoadApp(app, 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; returnToApp = app;
returnDirection = direction; returnDirection = direction;
returnTouchEvent = touchEvent; returnTouchEvent = touchEvent;
@ -227,12 +224,12 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
SetFullRefresh(direction); SetFullRefresh(direction);
// default return to launcher // default return to launcher
ReturnApp(Apps::Launcher, FullRefreshDirections::Down, TouchEvents::SwipeDown); returnApp(Apps::Launcher, FullRefreshDirections::Down, TouchEvents::SwipeDown);
switch (app) { switch (app) {
case Apps::Launcher: case Apps::Launcher:
currentScreen = std::make_unique<Screens::ApplicationList>(this, settingsController, batteryController, dateTimeController); currentScreen = std::make_unique<Screens::ApplicationList>(this, settingsController, batteryController, dateTimeController);
ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown); returnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break; break;
case Apps::None: case Apps::None:
case Apps::Clock: case Apps::Clock:
@ -248,7 +245,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
case Apps::FirmwareValidation: case Apps::FirmwareValidation:
currentScreen = std::make_unique<Screens::FirmwareValidation>(this, validator); currentScreen = std::make_unique<Screens::FirmwareValidation>(this, validator);
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break; break;
case Apps::FirmwareUpdate: case Apps::FirmwareUpdate:
currentScreen = std::make_unique<Screens::FirmwareUpdate>(this, bleController); currentScreen = std::make_unique<Screens::FirmwareUpdate>(this, bleController);
@ -257,58 +254,54 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
case Apps::Notifications: case Apps::Notifications:
currentScreen = std::make_unique<Screens::Notifications>( currentScreen = std::make_unique<Screens::Notifications>(
this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Normal); this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Normal);
ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); returnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
break; break;
case Apps::NotificationsPreview: case Apps::NotificationsPreview:
currentScreen = std::make_unique<Screens::Notifications>( currentScreen = std::make_unique<Screens::Notifications>(
this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Preview); this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Preview);
ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); returnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
break; break;
// Settings // Settings
case Apps::QuickSettings: case Apps::QuickSettings:
currentScreen = std::make_unique<Screens::QuickSettings>( currentScreen =
this, batteryController, dateTimeController, brightnessController, motorController, settingsController); std::make_unique<Screens::QuickSettings>(this, batteryController, dateTimeController, brightnessController, motorController, settingsController);
ReturnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft); returnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft);
break; break;
case Apps::Settings: case Apps::Settings:
currentScreen = std::make_unique<Screens::Settings>(this, settingsController); currentScreen = std::make_unique<Screens::Settings>(this, settingsController);
ReturnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown); returnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break; break;
case Apps::SettingWatchFace: case Apps::SettingWatchFace:
currentScreen = std::make_unique<Screens::SettingWatchFace>(this, settingsController); currentScreen = std::make_unique<Screens::SettingWatchFace>(this, settingsController);
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break; break;
case Apps::SettingTimeFormat: case Apps::SettingTimeFormat:
currentScreen = std::make_unique<Screens::SettingTimeFormat>(this, settingsController); currentScreen = std::make_unique<Screens::SettingTimeFormat>(this, settingsController);
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break; break;
case Apps::SettingWakeUp: case Apps::SettingWakeUp:
currentScreen = std::make_unique<Screens::SettingWakeUp>(this, settingsController); currentScreen = std::make_unique<Screens::SettingWakeUp>(this, settingsController);
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break; break;
case Apps::SettingDisplay: case Apps::SettingDisplay:
currentScreen = std::make_unique<Screens::SettingDisplay>(this, settingsController); currentScreen = std::make_unique<Screens::SettingDisplay>(this, settingsController);
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::SettingSteps:
currentScreen = std::make_unique<Screens::SettingSteps>(this, settingsController);
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break; break;
case Apps::BatteryInfo: case Apps::BatteryInfo:
currentScreen = std::make_unique<Screens::BatteryInfo>(this, batteryController); currentScreen = std::make_unique<Screens::BatteryInfo>(this, batteryController);
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break; break;
case Apps::SysInfo: case Apps::SysInfo:
currentScreen = currentScreen =
std::make_unique<Screens::SystemInfo>(this, dateTimeController, batteryController, brightnessController, bleController, watchdog); std::make_unique<Screens::SystemInfo>(this, dateTimeController, batteryController, brightnessController, bleController, watchdog);
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break; break;
// //
case Apps::FlashLight: case Apps::FlashLight:
currentScreen = std::make_unique<Screens::FlashLight>(this, systemTask, brightnessController); currentScreen = std::make_unique<Screens::FlashLight>(this, systemTask, brightnessController);
ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None); returnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None);
break; break;
case Apps::StopWatch: case Apps::StopWatch:
currentScreen = std::make_unique<Screens::StopWatch>(this); currentScreen = std::make_unique<Screens::StopWatch>(this);
@ -334,9 +327,6 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
case Apps::Motion: case Apps::Motion:
currentScreen = std::make_unique<Screens::Motion>(this, motionController); currentScreen = std::make_unique<Screens::Motion>(this, motionController);
break; break;
case Apps::Steps:
currentScreen = std::make_unique<Screens::Steps>(this, motionController, settingsController);
break;
} }
currentApp = app; currentApp = app;
} }
@ -359,9 +349,8 @@ TouchEvents DisplayApp::OnTouchEvent() {
if (info.isTouch) { if (info.isTouch) {
switch (info.gesture) { switch (info.gesture) {
case Pinetime::Drivers::Cst816S::Gestures::SingleTap: case Pinetime::Drivers::Cst816S::Gestures::SingleTap:
if (touchMode == TouchModes::Gestures) { if (touchMode == TouchModes::Gestures)
lvgl.SetNewTapEvent(info.x, info.y); lvgl.SetNewTapEvent(info.x, info.y);
}
return TouchEvents::Tap; return TouchEvents::Tap;
case Pinetime::Drivers::Cst816S::Gestures::LongPress: case Pinetime::Drivers::Cst816S::Gestures::LongPress:
return TouchEvents::LongTap; return TouchEvents::LongTap;

View File

@ -103,7 +103,7 @@ namespace Pinetime {
static void Process(void* instance); static void Process(void* instance);
void InitHw(); void InitHw();
void Refresh(); 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); void LoadApp(Apps app, DisplayApp::FullRefreshDirections direction);
}; };
} }

View File

@ -37,7 +37,7 @@ void DisplayApp::Process(void* instance) {
xTaskNotifyGive(xTaskGetCurrentTaskHandle()); xTaskNotifyGive(xTaskGetCurrentTaskHandle());
app->InitHw(); app->InitHw();
while (true) { while (1) {
app->Refresh(); app->Refresh();
} }
} }
@ -51,11 +51,10 @@ void DisplayApp::Refresh() {
if (xQueueReceive(msgQueue, &msg, 200)) { if (xQueueReceive(msgQueue, &msg, 200)) {
switch (msg) { switch (msg) {
case Display::Messages::UpdateBleConnection: case Display::Messages::UpdateBleConnection:
if (bleController.IsConnected()) { if (bleController.IsConnected())
DisplayLogo(colorBlue); DisplayLogo(colorBlue);
} else { else
DisplayLogo(colorWhite); DisplayLogo(colorWhite);
}
break; break;
case Display::Messages::BleFirmwareUpdateStarted: case Display::Messages::BleFirmwareUpdateStarted:
DisplayLogo(colorGreen); DisplayLogo(colorGreen);

View File

@ -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, 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, 0xe3,
0xe3, 0xfc, 0x7c, 0x7f, 0x8f, 0x8f, 0xf0, 0xe1,
0xfe, 0x0, 0x3f, 0xc0, 0x7, 0xf8, 0x0, 0xff,
0x0, 0x1f, 0xe0, 0x3, 0xfc, 0x0, 0x7f, 0x80,
0xf, 0xf0, 0x1, 0xef, 0x0, 0x79, 0xf0, 0x1f,
0x1f, 0x7, 0xc3, 0xff, 0xf8, 0x1f, 0xfc, 0x0,
0xfe, 0x0,
/* U+0031 "1" */
0x3, 0xf0, 0x0, 0xfe, 0x0, 0x3f, 0xc0, 0x1f,
0xf8, 0x7, 0xcf, 0x1, 0xf1, 0xe0, 0x3c, 0x3c,
0x7, 0x7, 0x80, 0x80, 0xf0, 0x0, 0x1e, 0x0,
0x3, 0xc0, 0x0, 0x78, 0x0, 0xf, 0x0, 0x1,
0xe0, 0x0, 0x3c, 0x0, 0x7, 0x80, 0x0, 0xf0,
0x0, 0x1e, 0x0, 0x3, 0xc0, 0x0, 0x78, 0x0,
0xf, 0x0, 0x1, 0xe0, 0x0, 0x3c, 0x0, 0x7,
0x80, 0x0, 0xf0, 0x0, 0x1e, 0x0, 0x3, 0xc0,
0x0, 0x78, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xf8,
/* U+0032 "2" */
0x3, 0xf8, 0x1, 0xff, 0xc0, 0x7f, 0xfe, 0x1f,
0x7, 0xc7, 0xc0, 0x3c, 0xf0, 0x7, 0xbc, 0x0,
0x7f, 0x80, 0xf, 0xf0, 0x1, 0xe0, 0x0, 0x3c,
0x0, 0x7, 0x80, 0x1, 0xf0, 0x0, 0x3c, 0x0,
0xf, 0x80, 0x1, 0xe0, 0x0, 0x7c, 0x0, 0x1f,
0x0, 0x7, 0xc0, 0x1, 0xf0, 0x0, 0x7e, 0x0,
0xf, 0x80, 0x3, 0xe0, 0x0, 0xf8, 0x0, 0x3e,
0x0, 0xf, 0x80, 0x3, 0xe0, 0x0, 0xf8, 0x0,
0x3e, 0x0, 0x7, 0xff, 0xfe, 0xff, 0xff, 0xdf,
0xff, 0xf8,
/* U+0033 "3" */
0x7f, 0xff, 0x8f, 0xff, 0xf1, 0xff, 0xfe, 0x0,
0x3, 0xc0, 0x0, 0xf0, 0x0, 0x3c, 0x0, 0xf,
0x0, 0x3, 0xc0, 0x0, 0xf0, 0x0, 0x3e, 0x0,
0x7, 0x80, 0x1, 0xfe, 0x0, 0x3f, 0xf0, 0x7,
0xff, 0x0, 0x3, 0xf0, 0x0, 0x1e, 0x0, 0x3,
0xc0, 0x0, 0x3c, 0x0, 0x7, 0x80, 0x0, 0xf0,
0x0, 0x1e, 0x0, 0x3, 0xfc, 0x0, 0x7f, 0x80,
0xf, 0xf0, 0x1, 0xef, 0x0, 0x79, 0xf0, 0x1f,
0x1f, 0x7, 0xc3, 0xff, 0xf0, 0x1f, 0xfc, 0x0,
0xfe, 0x0,
/* U+0034 "4" */
0x0, 0x1e, 0x0, 0xf, 0x80, 0x3, 0xc0, 0x1,
0xe0, 0x0, 0x78, 0x0, 0x3c, 0x0, 0x1f, 0x0,
0x7, 0x80, 0x3, 0xc0, 0x1, 0xf0, 0x0, 0x78,
0x0, 0x3e, 0x0, 0xf, 0x0, 0x7, 0x80, 0xf3,
0xe0, 0x3c, 0xf0, 0xf, 0x7c, 0x3, 0xde, 0x0,
0xff, 0x0, 0x3f, 0xc0, 0xf, 0xf0, 0x3, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x3,
0xc0, 0x0, 0xf0, 0x0, 0x3c, 0x0, 0xf, 0x0,
0x3, 0xc0, 0x0, 0xf0, 0x0, 0x3c,
/* U+0035 "5" */
0x7f, 0xff, 0x9f, 0xff, 0xe7, 0xff, 0xf9, 0xe0,
0x0, 0x78, 0x0, 0x1e, 0x0, 0x7, 0x80, 0x1,
0xe0, 0x0, 0x78, 0x0, 0x1e, 0x0, 0x7, 0x8f,
0x81, 0xef, 0xf8, 0x7f, 0xff, 0x1f, 0x87, 0xe7,
0xc0, 0x79, 0xe0, 0x1f, 0x0, 0x3, 0xc0, 0x0,
0xf0, 0x0, 0x3c, 0x0, 0xf, 0x0, 0x3, 0xc0,
0x0, 0xf0, 0x0, 0x3c, 0x0, 0xf, 0xf0, 0x3,
0xde, 0x1, 0xe7, 0x80, 0x78, 0xf8, 0x7e, 0x3f,
0xff, 0x3, 0xff, 0x80, 0x3f, 0x0,
/* U+0036 "6" */
0x0, 0x3c, 0x0, 0x7, 0x80, 0x0, 0x78, 0x0,
0xf, 0x0, 0x1, 0xe0, 0x0, 0x1e, 0x0, 0x3,
0xc0, 0x0, 0x3c, 0x0, 0x7, 0x80, 0x0, 0x70,
0x0, 0xf, 0x0, 0x1, 0xe7, 0xc0, 0x1f, 0xff,
0x3, 0xff, 0xfc, 0x3f, 0xf, 0xc7, 0xc0, 0x3e,
0x78, 0x1, 0xe7, 0x80, 0x1f, 0xf0, 0x0, 0xff,
0x0, 0xf, 0xf0, 0x0, 0xff, 0x0, 0xf, 0xf0,
0x0, 0xff, 0x0, 0xf, 0xf8, 0x1, 0xe7, 0x80,
0x1e, 0x7c, 0x3, 0xe3, 0xf0, 0xfc, 0x1f, 0xff,
0x80, 0xff, 0xf0, 0x1, 0xf8, 0x0,
/* U+0037 "7" */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x0, 0x1e, 0xf0, 0x1, 0xef, 0x0, 0x1e, 0xf0,
0x3, 0xcf, 0x0, 0x3c, 0x0, 0x3, 0x80, 0x0,
0x78, 0x0, 0x7, 0x80, 0x0, 0xf0, 0x0, 0xf,
0x0, 0x0, 0xf0, 0x0, 0x1e, 0x0, 0x1, 0xe0,
0x0, 0x3c, 0x0, 0x3, 0xc0, 0x0, 0x3c, 0x0,
0x7, 0x80, 0x0, 0x78, 0x0, 0x7, 0x80, 0x0,
0xf0, 0x0, 0xf, 0x0, 0x1, 0xe0, 0x0, 0x1e,
0x0, 0x1, 0xe0, 0x0, 0x3c, 0x0, 0x3, 0xc0,
0x0, 0x7c, 0x0, 0x7, 0x80, 0x0,
/* U+0038 "8" */
0x1, 0xf8, 0x0, 0xff, 0xf0, 0x1f, 0xff, 0x83,
0xf0, 0xfc, 0x3c, 0x3, 0xc7, 0xc0, 0x3e, 0x78,
0x1, 0xe7, 0x80, 0x1e, 0x78, 0x1, 0xe7, 0x80,
0x1e, 0x3c, 0x3, 0xc3, 0xe0, 0x7c, 0x1f, 0xf,
0x80, 0xff, 0xf0, 0x3, 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*/

View File

@ -49,7 +49,7 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen1() {
{Symbols::stopWatch, Apps::StopWatch}, {Symbols::stopWatch, Apps::StopWatch},
{Symbols::music, Apps::Music}, {Symbols::music, Apps::Music},
{Symbols::map, Apps::Navigation}, {Symbols::map, Apps::Navigation},
{Symbols::shoe, Apps::Steps}, {Symbols::shoe, Apps::Motion},
{Symbols::heartBeat, Apps::HeartRate}, {Symbols::heartBeat, Apps::HeartRate},
{"", Apps::None}, {"", Apps::None},
}}; }};
@ -62,7 +62,7 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
{Symbols::paintbrush, Apps::Paint}, {Symbols::paintbrush, Apps::Paint},
{Symbols::paddle, Apps::Paddle}, {Symbols::paddle, Apps::Paddle},
{"2", Apps::Twos}, {"2", Apps::Twos},
{"M", Apps::Motion}, {"", Apps::None},
{"", Apps::None}, {"", Apps::None},
{"", Apps::None}, {"", Apps::None},
}}; }};

View File

@ -14,6 +14,7 @@
#include "../DisplayApp.h" #include "../DisplayApp.h"
#include "WatchFaceDigital.h" #include "WatchFaceDigital.h"
#include "WatchFaceAnalog.h" #include "WatchFaceAnalog.h"
#include "PineTimeStyle.h"
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;
@ -42,6 +43,9 @@ Clock::Clock(DisplayApp* app,
[this]() -> std::unique_ptr<Screen> { [this]() -> std::unique_ptr<Screen> {
return WatchFaceAnalogScreen(); return WatchFaceAnalogScreen();
}, },
[this]() -> std::unique_ptr<Screen> {
return PineTimeStyleScreen();
},
// Examples for more watch faces // Examples for more watch faces
//[this]() -> std::unique_ptr<Screen> { return WatchFaceMinimalScreen(); }, //[this]() -> std::unique_ptr<Screen> { return WatchFaceMinimalScreen(); },
//[this]() -> std::unique_ptr<Screen> { return WatchFaceCustomScreen(); } //[this]() -> std::unique_ptr<Screen> { return WatchFaceCustomScreen(); }
@ -80,6 +84,16 @@ std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
} }
std::unique_ptr<Screen> Clock::PineTimeStyleScreen() {
return std::make_unique<Screens::PineTimeStyle>(app,
dateTimeController,
batteryController,
bleController,
notificatioManager,
settingsController,
heartRateController);
}
/* /*
// Examples for more watch faces // Examples for more watch faces
std::unique_ptr<Screen> Clock::WatchFaceMinimalScreen() { std::unique_ptr<Screen> Clock::WatchFaceMinimalScreen() {

View File

@ -47,9 +47,10 @@ namespace Pinetime {
Controllers::HeartRateController& heartRateController; Controllers::HeartRateController& heartRateController;
Controllers::MotionController& motionController; Controllers::MotionController& motionController;
ScreenList<2> screens; ScreenList<3> screens;
std::unique_ptr<Screen> WatchFaceDigitalScreen(); std::unique_ptr<Screen> WatchFaceDigitalScreen();
std::unique_ptr<Screen> WatchFaceAnalogScreen(); std::unique_ptr<Screen> WatchFaceAnalogScreen();
std::unique_ptr<Screen> PineTimeStyleScreen();
// Examples for more watch faces // Examples for more watch faces
// std::unique_ptr<Screen> WatchFaceMinimalScreen(); // std::unique_ptr<Screen> WatchFaceMinimalScreen();

View File

@ -27,17 +27,6 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp* app,
sprintf(version, "%ld.%ld.%ld", Version::Major(), Version::Minor(), Version::Patch()); sprintf(version, "%ld.%ld.%ld", Version::Major(), Version::Minor(), Version::Patch());
lv_label_set_text(labelVersionValue, version); 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); labelIsValidated = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(labelIsValidated, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 50); lv_obj_align(labelIsValidated, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 50);
lv_label_set_recolor(labelIsValidated, true); lv_label_set_recolor(labelIsValidated, true);

View File

@ -25,10 +25,7 @@ namespace Pinetime {
lv_obj_t* labelVersionInfo; lv_obj_t* labelVersionInfo;
lv_obj_t* labelVersionValue; lv_obj_t* labelVersionValue;
lv_obj_t* labelShortRefInfo;
lv_obj_t* labelShortRefValue;
char version[9]; char version[9];
char shortref[9];
lv_obj_t* labelIsValidated; lv_obj_t* labelIsValidated;
lv_obj_t* buttonValidate; lv_obj_t* buttonValidate;
lv_obj_t* labelButtonValidate; lv_obj_t* labelButtonValidate;

View File

@ -3,6 +3,8 @@
#include "../DisplayApp.h" #include "../DisplayApp.h"
using namespace Pinetime::Applications::Screens; 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) Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionController& motionController)
: Screen(app), 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_init_points(chart, ser3, 0);
lv_chart_refresh(chart); /*Required after direct set*/ 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); labelStep = lv_label_create(lv_scr_act(), NULL);
lv_obj_align(labelStep, chart, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); 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() { Motion::~Motion() {
@ -48,10 +47,8 @@ bool Motion::Refresh() {
lv_chart_set_next(chart, ser2, motionController.Y()); lv_chart_set_next(chart, ser2, motionController.Y());
lv_chart_set_next(chart, ser3, motionController.Z()); lv_chart_set_next(chart, ser3, motionController.Z());
lv_label_set_text_fmt(labelStep, "Steps %lu", motionController.NbSteps()); snprintf(nbStepsBuffer, nbStepsBufferSize, "%lu", motionController.NbSteps());
lv_label_set_text(labelStepValue, nbStepsBuffer);
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; return running;
} }

View File

@ -26,9 +26,9 @@ namespace Pinetime {
lv_chart_series_t* ser1; lv_chart_series_t* ser1;
lv_chart_series_t* ser2; lv_chart_series_t* ser2;
lv_chart_series_t* ser3; lv_chart_series_t* ser3;
lv_obj_t* label;
lv_obj_t* labelStep; lv_obj_t* labelStep;
lv_obj_t* labelStepValue;
static constexpr uint8_t nbStepsBufferSize = 9; static constexpr uint8_t nbStepsBufferSize = 9;
char nbStepsBuffer[nbStepsBufferSize + 1]; char nbStepsBuffer[nbStepsBufferSize + 1];
bool running = true; bool running = true;

View File

@ -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)); lv_obj_set_style_local_text_color(alert_type, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x888888));
if (title == nullptr) if (title == nullptr)
title = "Notification"; 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_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); lv_obj_align(alert_type, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 16);
///////// /////////

View File

@ -1,72 +0,0 @@
#include "Steps.h"
#include <lvgl/lvgl.h>
#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;
}

View File

@ -1,39 +0,0 @@
#pragma once
#include <cstdint>
#include <lvgl/lvgl.h>
#include "Screen.h"
#include <components/motion/MotionController.h>
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;
};
}
}
}

View File

@ -115,9 +115,8 @@ bool StopWatch::Refresh() {
// Init state when an user first opens the app // Init state when an user first opens the app
// and when a stop/reset button is pressed // and when a stop/reset button is pressed
case States::Init: { case States::Init: {
if (btnStopLap != nullptr) { if (btnStopLap) {
lv_obj_del(btnStopLap); lv_obj_del(btnStopLap);
btnStopLap = nullptr;
} }
// The initial default value // The initial default value
lv_label_set_text(time, "00:00"); lv_label_set_text(time, "00:00");

View File

@ -69,14 +69,12 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen1() {
lv_label_set_text_fmt(label, lv_label_set_text_fmt(label,
"#FFFF00 InfiniTime#\n\n" "#FFFF00 InfiniTime#\n\n"
"#444444 Version# %ld.%ld.%ld\n\n" "#444444 Version# %ld.%ld.%ld\n\n"
"#444444 Short Ref# %s\n\n"
"#444444 Build date#\n" "#444444 Build date#\n"
"%s\n" "\t%s\n"
"%s\n", "\t%s\n",
Version::Major(), Version::Major(),
Version::Minor(), Version::Minor(),
Version::Patch(), Version::Patch(),
Version::GitCommitHash(),
__DATE__, __DATE__,
__TIME__); __TIME__);
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);

View File

@ -1,98 +0,0 @@
#include "SettingSteps.h"
#include <lvgl/lvgl.h>
#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<SettingSteps *>(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);
}
}
}

View File

@ -1,32 +0,0 @@
#pragma once
#include <cstdint>
#include <lvgl/lvgl.h>
#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;
};
}
}
}

View File

@ -58,6 +58,15 @@ SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pine
lv_checkbox_set_checked(cbOption[optionsTotal], true); lv_checkbox_set_checked(cbOption[optionsTotal], true);
} }
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++; optionsTotal++;
} }

View File

@ -21,7 +21,7 @@ namespace Pinetime {
private: private:
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
uint8_t optionsTotal; uint8_t optionsTotal;
lv_obj_t* cbOption[2]; lv_obj_t* cbOption[3];
}; };
} }
} }

View File

@ -44,7 +44,9 @@ std::unique_ptr<Screen> Settings::CreateScreen1() {
{Symbols::clock, "Wake Up", Apps::SettingWakeUp}, {Symbols::clock, "Wake Up", Apps::SettingWakeUp},
{Symbols::clock, "Time format", Apps::SettingTimeFormat}, {Symbols::clock, "Time format", Apps::SettingTimeFormat},
{Symbols::clock, "Watch face", Apps::SettingWatchFace}, {Symbols::clock, "Watch face", Apps::SettingWatchFace},
}}; }
};
return std::unique_ptr<Screen>(new Screens::List(0, 2, app, settingsController, applications)); return std::unique_ptr<Screen>(new Screens::List(0, 2, app, settingsController, applications));
} }
@ -52,11 +54,13 @@ std::unique_ptr<Screen> Settings::CreateScreen1() {
std::unique_ptr<Screen> Settings::CreateScreen2() { std::unique_ptr<Screen> Settings::CreateScreen2() {
std::array<Screens::List::Applications, 4> applications {{ std::array<Screens::List::Applications, 4> applications {{
{Symbols::shoe, "Steps", Apps::SettingSteps},
{Symbols::batteryHalf, "Battery", Apps::BatteryInfo}, {Symbols::batteryHalf, "Battery", Apps::BatteryInfo},
{Symbols::check, "Firmware", Apps::FirmwareValidation}, {Symbols::check, "Firmware", Apps::FirmwareValidation},
{Symbols::list, "About", Apps::SysInfo}, {Symbols::list, "About", Apps::SysInfo},
}}; {"", "", Apps::None},
}
};
return std::unique_ptr<Screen>(new Screens::List(1, 2, app, settingsController, applications)); return std::unique_ptr<Screen>(new Screens::List(1, 2, app, settingsController, applications));
} }

View File

@ -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) \ #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(jetbrains_mono_bold_20) \
LV_FONT_DECLARE(jetbrains_mono_extrabold_compressed) \ LV_FONT_DECLARE(jetbrains_mono_extrabold_compressed) \
LV_FONT_DECLARE(jetbrains_mono_42) \
LV_FONT_DECLARE(jetbrains_mono_76) \ LV_FONT_DECLARE(jetbrains_mono_76) \
LV_FONT_DECLARE(open_sans_light) \
LV_FONT_DECLARE(lv_font_sys_48) LV_FONT_DECLARE(lv_font_sys_48)
/* Enable it if you have fonts with a lot of characters. /* Enable it if you have fonts with a lot of characters.

View File

@ -12,9 +12,8 @@ void NrfLogger::Init() {
NRF_LOG_DEFAULT_BACKENDS_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); APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
}
} }
void NrfLogger::Process(void*) { void NrfLogger::Process(void*) {
@ -22,7 +21,7 @@ void NrfLogger::Process(void*) {
// Suppress endless loop diagnostic // Suppress endless loop diagnostic
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma ide diagnostic ignored "EndlessLoop" #pragma ide diagnostic ignored "EndlessLoop"
while (true) { while (1) {
NRF_LOG_FLUSH(); NRF_LOG_FLUSH();
vTaskDelay(100); // Not good for power consumption, it will wake up every 100ms... vTaskDelay(100); // Not good for power consumption, it will wake up every 100ms...
} }