Merge branch 'develop' into motionservice_fix_typo_in_include

This commit is contained in:
JF 2021-11-28 13:59:09 +01:00 committed by GitHub
commit 583c7ee22f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
194 changed files with 854 additions and 774 deletions

View File

@ -1,6 +1,7 @@
Checks: '*, Checks: '*,
-altera-unroll-loops, -altera-unroll-loops,
-llvmlibc-callee-namespace, -llvmlibc-callee-namespace,
-llvmlibc-implementation-in-namespace,
-llvmlibc-restrict-system-libc-headers, -llvmlibc-restrict-system-libc-headers,
-llvm-header-guard, -llvm-header-guard,
-llvm-namespace-comment, -llvm-namespace-comment,
@ -8,6 +9,7 @@ Checks: '*,
-google-runtime-int, -google-runtime-int,
-google-readability-namespace-comments, -google-readability-namespace-comments,
-fuchsia-statically-constructed-objects, -fuchsia-statically-constructed-objects,
-cppcoreguidelines-prefer-member-initializer,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay, -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-constant-array-index, -cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-type-static-cast-downcast, -cppcoreguidelines-pro-type-static-cast-downcast,

View File

@ -12,7 +12,9 @@
// Set *default* container specific settings.json values on container create. // Set *default* container specific settings.json values on container create.
"settings": { "settings": {
"terminal.integrated.shell.linux": "/bin/bash" "terminal.integrated.shell.linux": "/bin/bash",
"editor.formatOnSave": true,
"clang-format.executable": "clang-format-12"
}, },
// Add the IDs of extensions you want installed when the container is created. // Add the IDs of extensions you want installed when the container is created.

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
project(pinetime VERSION 1.6.0 LANGUAGES C CXX ASM) project(pinetime VERSION 1.7.1 LANGUAGES C CXX ASM)
set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)

113
README.md
View File

@ -1,81 +1,33 @@
# InfiniTime # [InfiniTime](https://github.com/InfiniTimeOrg/InfiniTime)
[![Build PineTime Firmware](https://github.com/InfiniTimeOrg/InfiniTime/workflows/Build%20PineTime%20Firmware/badge.svg?branch=master)](https://github.com/InfiniTimeOrg/InfiniTime/actions) [![Build PineTime Firmware](https://github.com/InfiniTimeOrg/InfiniTime/workflows/Build%20PineTime%20Firmware/badge.svg?branch=master)](https://github.com/InfiniTimeOrg/InfiniTime/actions)
![InfiniTime logo](images/infinitime-logo.jpg "InfiniTime Logo") ![InfiniTime logo](images/infinitime-logo-small.jpg "InfiniTime Logo")
The goal of this project is to design an open-source firmware for the [Pinetime smartwatch](https://www.pine64.org/pinetime/) : Fast open-source firmware for the [PineTime smartwatch](https://www.pine64.org/pinetime/) with many features, written in modern C++.
- Code written in **modern C++**;
- Build system based on **CMake**;
- Based on **[FreeRTOS 10.0.0](https://freertos.org)** real-time OS.
- 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? ## New to InfiniTime?
- [Getting started with InfiniTime 1.0 (quick user guide, update bootloader and InfiniTime,...)](doc/gettingStarted/gettingStarted-1.0.md) - [Getting started with InfiniTime](doc/gettingStarted/gettingStarted-1.0.md)
- [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/ota-gadgetbridge-nrfconnect.md) - [Updating the software](doc/gettingStarted/updating-software.md)
- [About the firmware and bootloader](doc/gettingStarted/about-software.md)
### Companion apps
- [Gadgetbridge](https://gadgetbridge.org/) (Android)
- [AmazFish](https://openrepos.net/content/piggz/amazfish/) (SailfishOS)
- [Siglo](https://github.com/alexr4535/siglo) (Linux)
- [InfiniLink](https://github.com/xan-m/InfiniLink) **[Experimental]** (iOS)
## Overview ## Development
![Pinetime screens](images/1.0.0/collage.png "PinetimeScreens")
As of now, here is the list of achievements of this project:
- Fast and optimized LCD driver
- BLE communication
- Rich user interface via display, touchscreen and pushbutton
- Time synchronization via BLE
- Notification via BLE
- Heart rate measurements
- Step counting
- Wake-up on wrist rotation
- Quick actions
* Disable vibration on notification
* Brightness settings
* Flashlight
* Settings
- 3 watch faces:
* Digital
* Analog
* [PineTimeStyle](https://wiki.pine64.org/wiki/PineTimeStyle)
- Multiple 'apps' :
* Music (control the playback of music on your phone)
* Heart rate (measure your heart rate)
* Navigation (displays navigation instructions coming from the companion app)
* Notification (displays the last notification received)
* Paddle (single player pong-like game)
* Twos (2048 clone game)
* Stopwatch
* Steps (displays the number of steps taken)
* Timer (set a countdown timer that will notify you when it expires)
* Metronome (vibrates to a given bpm with a customizable beats per bar)
- User settings:
* Display timeout
* Wake-up condition
* Time format (12/24h)
* Default watch face
* Daily step goal
* Battery status
* Firmware validation
* System information
- Supported by 3 companion apps (development is in progress):
* [Gadgetbridge](https://codeberg.org/Freeyourgadget/Gadgetbridge/) (on Android via F-Droid)
* [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]** [InfiniLink](https://github.com/xan-m/InfiniLink) (on iOS)
- OTA (Over-the-air) update via BLE
- [Bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader) based on [MCUBoot](https://www.mcuboot.com)
## Documentation
### Develop
- [Rough structure of the code](doc/code/Intro.md) - [Rough structure of the code](doc/code/Intro.md)
- [How to implement an application](doc/code/Apps.md) - [How to implement an application](doc/code/Apps.md)
- [Generate the fonts and symbols](src/displayapp/fonts/README.md) - [Generate the fonts and symbols](src/displayapp/fonts/README.md)
- [Creating a stopwatch in Pinetime(article)](https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html) - [Creating a stopwatch in Pinetime(article)](https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html)
- [Tips on designing an app UI](doc/ui_guidelines.md)
### Contributing
- [How to contribute?](/doc/contribute.md)
- [Coding conventions](/doc/coding-convention.md)
### Build, flash and debug ### Build, flash and debug
@ -84,16 +36,11 @@ As of now, here is the list of achievements of this project:
- [Files included in the release notes](doc/filesInReleaseNotes.md) - [Files included in the release notes](doc/filesInReleaseNotes.md)
- [Build the project](doc/buildAndProgram.md) - [Build the project](doc/buildAndProgram.md)
- [Flash the firmware using OpenOCD and STLinkV2](doc/openOCD.md) - [Flash the firmware using OpenOCD and STLinkV2](doc/openOCD.md)
- [Flash the firmware using SWD interface](doc/SWD.md)
- [Build the project with Docker](doc/buildWithDocker.md) - [Build the project with Docker](doc/buildWithDocker.md)
- [Build the project with VSCode](doc/buildWithVScode.md) - [Build the project with VSCode](doc/buildWithVScode.md)
- [Bootloader, OTA and DFU](./bootloader/README.md) - [Bootloader, OTA and DFU](./bootloader/README.md)
- [Stub using NRF52-DK](./doc/PinetimeStubWithNrf52DK.md) - [Stub using NRF52-DK](./doc/PinetimeStubWithNrf52DK.md)
- Logging with JLink RTT.
- Using files from the releases
### Contribute
- [How to contribute ?](doc/contribute.md)
### API ### API
@ -103,30 +50,6 @@ As of now, here is the list of achievements of this project:
- [Memory analysis](./doc/MemoryAnalysis.md) - [Memory analysis](./doc/MemoryAnalysis.md)
### Using the firmware
- [Integration with Gadgetbridge](doc/companionapps/Gadgetbridge.md)
- [Integration with AmazFish](doc/companionapps/Amazfish.md)
- [Firmware update, OTA](doc/companionapps/NrfconnectOTA.md)
## TODO - contribute
This project is far from being finished, and there are still a lot of things to do for this project to become a firmware usable by the general public.
Here a quick list out of my head of things to do for this project:
- Improve BLE communication stability and reliability
- Improve OTA and MCUBoot bootloader
- Add more functionalities : Alarm, chronometer, configuration, activities, heart rate logging, games,...
- Add more BLE functionalities : call notifications, agenda, configuration, data logging,...
- Measure power consumption and improve battery life
- Improve documentation, take better pictures and video than mine
- Improve the UI
- Create companion app for multiple OSes (Linux, Android, iOS) and platforms (desktop, ARM, mobile). Do not forget the other devices from Pine64 like [the Pinephone](https://www.pine64.org/pinephone/) and the [Pinebook Pro](https://www.pine64.org/pinebook-pro/).
- Design a simple CI (preferably self-hosted and easy to reproduce).
Do not hesitate to clone/fork the code, hack it and create pull-requests. I'll do my best to review and merge them :)
## Licenses ## Licenses
This project is released under the GNU General Public License version 3 or, at your option, any later version. This project is released under the GNU General Public License version 3 or, at your option, any later version.

View File

@ -115,8 +115,6 @@ sudo dfu.py -z /home/jf/nrf52/bootloader/dfu.zip -a <pinetime MAC address> --leg
**Note** : dfu.py is a slightly modified version of [this repo](https://github.com/daniel-thompson/ota-dfu-python). **Note** : dfu.py is a slightly modified version of [this repo](https://github.com/daniel-thompson/ota-dfu-python).
See [this page](../doc/CompanionApps/NrfconnectOTA.md) for more info about OTA with NRFConect
### Firmware validation ### Firmware validation
Once the OTA is done, InfiniTime will reset the watch to apply the update. When the watch reboots, the new firmware is running. Once the OTA is done, InfiniTime will reset the watch to apply the update. When the watch reboots, the new firmware is running.
@ -126,12 +124,12 @@ If the new firmware is working correctly, open the application menu and tap on t
Firmware validation application in the menu: Firmware validation application in the menu:
![Firmware Validation App](../doc/CompanionApps/firmwareValidationApp.jpg "Firmware Validation App") ![Firmware Validation App](../doc/bootloader/firmwareValidationApp.jpg "Firmware Validation App")
The firmware is not validated yet. Tap 'Validate' to validate it, or 'Reset' to rollback to the previous version. The firmware is not validated yet. Tap 'Validate' to validate it, or 'Reset' to rollback to the previous version.
![Firmware Not Validated](../doc/CompanionApps/firmwareNoValidated.jpg "Firmware Not Validated") ![Firmware Not Validated](../doc/bootloader/firmwareNoValidated.jpg "Firmware Not Validated")
The firmware is validated! The firmware is validated!
![Firmware Validated](../doc/CompanionApps/firmwareValidated.jpg "Firmware Validated") ![Firmware Validated](../doc/bootloader/firmwareValidated.jpg "Firmware Validated")

View File

@ -3,13 +3,13 @@
The motion service exposes step count and raw X/Y/Z motion value as READ and NOTIFY characteristics. The motion service exposes step count and raw X/Y/Z motion value as READ and NOTIFY characteristics.
## Service ## Service
The service UUID is **00020000-78fc-48fe-8e23-433b3a1942d0** The service UUID is **00030000-78fc-48fe-8e23-433b3a1942d0**
## Characteristics ## Characteristics
### Step count (UUID 00020001-78fc-48fe-8e23-433b3a1942d0) ### Step count (UUID 00030001-78fc-48fe-8e23-433b3a1942d0)
The current number of steps represented as a single `uint32_t` (4 bytes) value. The current number of steps represented as a single `uint32_t` (4 bytes) value.
### Raw motion values (UUID 00020002-78fc-48fe-8e23-433b3a1942d0) ### Raw motion values (UUID 00030002-78fc-48fe-8e23-433b3a1942d0)
The current raw motion values. This is a 3 `int16_t` array: The current raw motion values. This is a 3 `int16_t` array:
- [0] : X - [0] : X

14
doc/SWD.md Normal file
View File

@ -0,0 +1,14 @@
# 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 of flashing a tool in the MCU that will flash the boot logo into this SPI flash memory. This first step is optional but recommended (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!

View File

Before

Width:  |  Height:  |  Size: 187 KiB

After

Width:  |  Height:  |  Size: 187 KiB

View File

Before

Width:  |  Height:  |  Size: 208 KiB

After

Width:  |  Height:  |  Size: 208 KiB

View File

Before

Width:  |  Height:  |  Size: 176 KiB

After

Width:  |  Height:  |  Size: 176 KiB

View File

@ -1,11 +1,12 @@
# Apps # Apps
This page will teach you: This page will teach you:
- what apps in InfiniTime are - what screens and apps are in InfiniTime
- how to implement your own app - how to implement your own app
## Theory ## Theory
Apps are the things you can launch from the app selection you get by swiping up.
At the moment, settings and even the app launcher itself or the clock are implemented very similarly, this might change in the future though. The user interface of InfiniTime is made up of **screens**.
Screens that are opened from the app launcher are considered **apps**.
Every app in InfiniTime is it's own class. Every app in InfiniTime is it's own class.
An instance of the class is created when the app is launched and destroyed when the user exits the app. An instance of the class is created when the app is launched and destroyed when the user exits the app.
They run inside the "displayapp" task (briefly discussed [here](./Intro.md)). They run inside the "displayapp" task (briefly discussed [here](./Intro.md)).
@ -23,27 +24,21 @@ it does not need to override any of these functions, as LVGL can also handle tou
If you have any doubts, you can always look at how the other apps are doing things. If you have any doubts, you can always look at how the other apps are doing things.
### Continuous updating ### Continuous updating
If your app needs to be updated continuously, yo can do so by overriding the `Refresh()` function in your class If your app needs to be updated continuously, you can do so by overriding the `Refresh()` function in your class
and calling `lv_task_create` inside the constructor. and calling `lv_task_create` inside the constructor.
An example call could look like this: <br>
`taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);` <br> An example call could look like this:
```cpp
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
```
With `taskRefresh` being a member variable of your class and of type `lv_task_t*`. With `taskRefresh` being a member variable of your class and of type `lv_task_t*`.
Remember to delete the task again using `lv_task_del`. Remember to delete the task again using `lv_task_del`.
The function `RefreshTaskCallback` is inherited from screen and just calls your `Refresh` function. The function `RefreshTaskCallback` is inherited from `Screen` and just calls your `Refresh` function.
### Apps with multiple screens
InfiniTime provides a mini-library in [displayapp/screens/ScreenList.h](/src/displayapp/screens/ScreenList.h)
which makes it relatively easy to add multiple screens to your app.
To use it, #include it in the header file of your app and add a ScreenList member to your class.
The template argument should be the number of screens you need.
You will also need to add `CreateScreen` functions that return `std::unique_ptr<Screen>`
to your class, one for every screen you have.
There are still some things left to to that I won't cover here.
To figure them out, have a look at the "apps" ApplicationList, Settings and SystemInfo.
## Creating your own app ## Creating your own app
A minimal app could look like this: <br> A minimal app could look like this:
MyApp.h: MyApp.h:
```cpp ```cpp
#pragma once #pragma once
@ -66,13 +61,13 @@ namespace Pinetime {
MyApp.cpp: MyApp.cpp:
```cpp ```cpp
#include "MyApp.h" #include "displayapp/screens/MyApp.h"
#include "displayapp/DisplayApp.h" #include "displayapp/DisplayApp.h"
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;
MyApp::MyApp(DisplayApp* app) : Screen(app) { MyApp::MyApp(DisplayApp* app) : Screen(app) {
lv_obj_t* title = lv_label_create(lv_scr_act(), NULL); lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text_static(title, "My test application"); lv_label_set_text_static(title, "My test application");
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER); lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
lv_obj_align(title, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); lv_obj_align(title, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
@ -95,12 +90,10 @@ Now, go to the function `DisplayApp::LoadApp` and add another case to the switch
The case will be the id you gave your app earlier. The case will be the id you gave your app earlier.
If your app needs any additional arguments, this is the place to pass them. If your app needs any additional arguments, this is the place to pass them.
If you want your app to be launched from the regular app launcher, go to [displayapp/screens/ApplicationList.cpp](/src/displayapp/screens/ApplicationList.cpp). If you want to add your app in the app launcher, add your app in [displayapp/screens/ApplicationList.cpp](/src/displayapp/screens/ApplicationList.cpp) to one of the `CreateScreen` functions, or add another `CreateScreen` function if there are no empty spaces for your app. If your app is a setting, do the same procedure in [displayapp/screens/settings/Settings.cpp](/src/displayapp/screens/settings/Settings.cpp).
Add your app to one of the `CreateScreen` functions, or add another `CreateScreen` function if there are no empty spaces for your app. <br>
If your app is a setting, do the same procedure in [displayapp/screens/settings/Settings.cpp](/src/displayapp/screens/settings/Settings.cpp).
You should now be able to [build](../buildAndProgram.md) the firmware You should now be able to [build](../buildAndProgram.md) the firmware
and flash it to your PineTime. Yay! and flash it to your PineTime. Yay!
Please remember to pay attention to the [UI guidelines](../ui_guidelines.md) Please remember to pay attention to the [UI guidelines](../ui_guidelines.md)
when designing an app that you want to include in mainstream InfiniTime. when designing an app that you want to be included in InfiniTime.

View File

@ -21,7 +21,8 @@ Both functions are located inside [systemtask/SystemTask.cpp](/src/systemtask/Sy
It also starts the **task "displayapp"**, which is responsible for launching and running apps, controlling the screen and handling touch events (or forwarding them to the active app). It also starts the **task "displayapp"**, which is responsible for launching and running apps, controlling the screen and handling touch events (or forwarding them to the active app).
You can find the "displayapp" task inside [displayapp/DisplayApp.cpp](/src/displayapp/DisplayApp.cpp). You can find the "displayapp" task inside [displayapp/DisplayApp.cpp](/src/displayapp/DisplayApp.cpp).
There are also other tasks that are responsible for Bluetooth ("ll" and "ble" inside [libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c](/src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c)) There are also other tasks that are responsible for Bluetooth ("ll" and "ble" inside [libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c](/src/libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c))
and periodic tasks like heartrate measurements ([heartratetask/HeartRateTask.cpp](/src/heartratetask/HeartRateTask.cpp)). <br> and periodic tasks like heartrate measurements ([heartratetask/HeartRateTask.cpp](/src/heartratetask/HeartRateTask.cpp)).
While it is possible for you to create your own task when you need it, it is recommended to just add functionality to `SystemTask::Work()` if possible. While it is possible for you to create your own task when you need it, it is recommended to just add functionality to `SystemTask::Work()` if possible.
If you absolutely need to create another task, try to guess how much [stack space](https://www.freertos.org/FAQMem.html#StackSize) (in words/4-byte packets) If you absolutely need to create another task, try to guess how much [stack space](https://www.freertos.org/FAQMem.html#StackSize) (in words/4-byte packets)
it will need instead of just typing in a large-ish number. it will need instead of just typing in a large-ish number.

41
doc/coding-convention.md Normal file
View File

@ -0,0 +1,41 @@
# Coding convention
## 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.
C code is accepted if it 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.
Using an autoformatter is highly recommended, but make sure it's configured properly.
There are preconfigured autoformatter rules for:
* CLion (IntelliJ) in [.idea/codeStyles/Project.xml](/.idea/codeStyles/Project.xml)
* `clang-format`
Also use `clang-tidy` to check the code for other issues.
If there are no preconfigured rules for your IDE, you can use one of the existing ones to configure your IDE.
- **Indentation** : 2 spaces, no tabulation
- **Opening brace** at the end of the line
- **Naming** : Choose self-describing variable name
- **class** : PascalCase
- **namespace** : PascalCase
- **variable** : camelCase, **no** prefix/suffix ('_', 'm_',...) for class members
- **Include guard** : `#pragma once` (no `#ifdef __MODULE__ / #define __MODULE__ / #endif`)
- **Includes** :
- files from the project : `#include "relative/path/to/the/file.h"`
- external files and std : `#include <file.h>`
- use includes relative to included directories like `src`, not relative to the current file. Don't do: `#include "../file.h"`
- Only use [primary spellings for operators and tokens](https://en.cppreference.com/w/cpp/language/operator_alternative)
- Use auto sparingly. Don't use auto for [fundamental/built-in types](https://en.cppreference.com/w/cpp/language/types) and [fixed width integer types](https://en.cppreference.com/w/cpp/types/integer), except when initializing with a cast to avoid duplicating the type name.
- Examples:
- `auto* app = static_cast<DisplayApp*>(instance);`
- `auto number = static_cast<uint8_t>(variable);`
- `uint8_t returnValue = MyFunction();`
- Use nullptr instead of NULL

View File

@ -1,16 +0,0 @@
# Amazfish
[Amazfish](https://openrepos.net/content/piggz/amazfish) is a companion app that supports many smartwatches and activity trackers running on [SailfishOS](https://sailfishos.org/).
## Features
The following features are implemented:
- Scanning & detection of Pinetime-JF / InfiniTime
- Connection / disconnection
- Time synchronization
- Notifications
- Music control
- Navigation with Puremaps
## Demo
[This video](https://seafile.codingfield.com/f/21c5d023452740279e36/) shows how to connect to the Pinetime and control the playback of the music on the phone.
Amazfish and Sailfish OS are running on the [Pinephone](https://www.pine64.org/pinephone/), another awesome device from Pine64.

View File

@ -1,13 +0,0 @@
# Integration with Gadgetbridge
[Gadgetbridge](https://gadgetbridge.org/) is an Android application that supports many smartwatches and fitness trackers.
The integration of InfiniTime (previously Pinetime-JF) is now merged into the master branch (https://codeberg.org/Freeyourgadget/Gadgetbridge/) and initial support is available [starting with version 0.47](https://codeberg.org/Freeyourgadget/Gadgetbridge/src/branch/master/CHANGELOG.md). Note that the official version is only available on F-Droid (as of May 2021), and the unofficial fork available on the Play Store is outdated and does not support Infinitime.
## Features
The following features are implemented:
- Scanning & detection of Pinetime-JF / InfiniTime
- Connection / disconnection
- Notifications
## Demo
[This video](https://seafile.codingfield.com/f/0a2920b9d765462385e4/) shows how to scan, connect, send notification (using the debug screen) and disconnect from the Pinetime.

View File

@ -1,12 +0,0 @@
# OTA using NRFConnect
[NRFConnect](https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Connect-for-mobile) is a powerful application (running on Android and iOS) which allows to scan and connect to BLE devices.
## Features
- Scanning, connect, disconnect
- Time synchronization
- OTA
InfiniTime implements the Nordic DFU protocol for the OTA functionality. NRFConnect also supports this protocol.
# Demo
[This video](https://seafile.codingfield.com/f/a52b69683a05472a90c7/) shows how to use NRFConnect to update the firmware running on the Pinetime.

View File

@ -14,10 +14,6 @@ As the documentation is part of the source code, you can submit your improvement
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
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? # How to submit a pull request?
## TL;DR ## TL;DR
@ -25,7 +21,7 @@ The Pinetime is a cool open source project that deserves to be known. Talk about
- Create a branch from develop - Create a branch from develop
- Work on a single subject in this branch. Create multiple branches/pulls-requests if you want to work on multiple subjects (bugs, features,...) - Work on a single subject in this branch. Create multiple branches/pulls-requests if you want to work on multiple subjects (bugs, features,...)
- Test your modifications on the actual hardware - Test your modifications on the actual hardware
- Check the code formatting against our coding conventions and [clang-format](../.clang-format) and [clang-tidy](../.clang-tidy) - Check your code against the [coding conventions](/doc/coding-convention.md) and [clang-format](../.clang-format) and [clang-tidy](../.clang-tidy)
- Clean your code and remove files that are not needed - Clean your code and remove files that are not needed
- Write documentation related to your new feature if applicable - Write documentation related to your new feature if applicable
- Create a pull request and write a great description about it: what does your PR do, why, how,... Add pictures and video if possible - Create a pull request and write a great description about it: what does your PR do, why, how,... Add pictures and video if possible
@ -38,9 +34,9 @@ If you want to fix a bug, add functionality or improve the code, you'll first ne
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.
**Creating a pull request containing modifications that haven't been tested is strongly discouraged.** 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. **Creating a pull request containing modifications that haven't been tested is strongly discouraged.** 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. Before submitting a PR, check your code against the [coding conventions](/doc/coding-convention.md). This project also provides [clang-format](../.clang-format) and [clang-tidy](../.clang-tidy) configuration files. You should use them to ensure correct formatting of your code.
Don't forget to check the files you are going to commit and remove those which aren't necessary (config files from your IDE, for example). Remove old comments, commented code,... Don't forget to check the files you are going to commit and remove those which aren't necessary (config files from your IDE, for example). Remove old comments, commented code,...
@ -52,52 +48,14 @@ Once the pull request is reviewed and accepted, it'll be merged into **develop**
## 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. Everything you do to make reviewing easier will **get your PR merged faster**. Reviewing pull requests is a **very time consuming task**. Everything you do to make reviewing easier will **get your PR merged faster**.
When reviewing PRs, 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. Reviewers 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.
Then, reviewing **a few files that were modified for a single purpose** is a lot more easier than to review 30 files modified for many reasons (bug fix, UI improvements, typos in doc,...), even if all these changes make sense. Also, it's possible that we agree on some modification but not on some other, so we won't be able to merge the PR because of the changes that are not accepted. Reviewing **a few files that were modified for a single purpose** is a lot easier than reviewing 30 files modified for many reasons (bug fix, UI improvements, typos in doc,...), even if all the changes make sense. Also, it's possible that we agree on some modification but not on another, so we won't be able to merge the PR because of the changes that are not accepted.
We do our best to keep the code as consistent as possible. If the formatting of the code in your PR is not consistent with our code base, we'll ask you to review it, which will take more time. The code base should be kept as consistent as possible. If the formatting of your code is not consistent with the rest of the code base, we'll ask you to review it.
The last step of the review consists of **testing** the modification. If it doesn't work out of the box, we'll ask your to review your code and to ensure that it works as expected. Lastly the changes are tested. If it doesn't work out of the box, we'll ask you to review your code and to ensure that it works as expected.
It's totally normal for a PR to need some more work even after it was created, that's why we review them. But every round trip takes time, so it's good practice to try to reduce them as much as possible by following those simple rules. It's totally normal for a PR to need some more work even after it was created, that's why we review them. But every round trip takes time, so it's good practice to try to reduce them as much as possible by following those simple rules.
# Coding convention
## 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.
C code is accepted if it 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.
Using an autoformatter is highly recommended, but make sure it's configured properly.
There are preconfigured autoformatter rules for:
* CLion (IntelliJ) in .idea/codeStyles/Project.xml
If there are no preconfigured rules for your IDE, you can use one of the existing ones to configure your IDE.
- **Indentation** : 2 spaces, no tabulation
- **Opening brace** at the end of the line
- **Naming** : Choose self-describing variable name
- **class** : PascalCase
- **namespace** : PascalCase
- **variable** : camelCase, **no** prefix/suffix ('_', 'm_',...) for class members
- **Include guard** : `#pragma once` (no `#ifdef __MODULE__ / #define __MODULE__ / #endif`)
- **Includes** :
- files from the project : `#include "relative/path/to/the/file.h"`
- external files and std : `#include <file.h>`
- Only use [primary spellings for operators and tokens](https://en.cppreference.com/w/cpp/language/operator_alternative)
- Use auto sparingly. Don't use auto for [fundamental/built-in types](https://en.cppreference.com/w/cpp/language/types) and [fixed width integer types](https://en.cppreference.com/w/cpp/types/integer), except when initializing with a cast to avoid duplicating the type name.
- Examples:
- `auto* app = static_cast<DisplayApp*>(instance);`
- `auto number = static_cast<uint8_t>(variable);`
- `uint8_t returnValue = MyFunction();`
- Use nullptr instead of NULL

View File

@ -0,0 +1,26 @@
# Firmware, InfiniTime, Bootloader, Recovery firmware, OTA, DFU... What is it?
You may have already encountered 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 confusing if you're not familiar with the project.
A **firmware** is software running on the embedded hardware of a device.
InfiniTime has three distinct firmwares:
- **[InfiniTime](https://github.com/InfiniTimeOrg/InfiniTime)** is the operating system.
- **[The bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader)** is responsible for safely applying firmware updates and runs before booting into InfiniTime.
- **The recovery firmware** is a special *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.
**OTA** (**O**ver **T**he **A**ir) refers to updating of the firmware over BLE (**B**luetooth **L**ow **E**nergy). This is a functionality that allows the user to update the firmware on their device wirelessly.
**DFU** (**D**evice **F**irmware **U**pdate) is 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).
## 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: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -1,119 +1,57 @@
# Getting started with InfiniTime 1.0 # Getting started with InfiniTime
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. On April 22 2021, InfiniTime and Pine64 [announced the release of InfiniTime 1.0.0](https://www.pine64.org/2021/04/22/its-time-infinitime-1-0/) and the availability of PineTime smartwatches as an *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? It is highly recommended to update the firmware to the latest version when you receive your watch and when a new InfiniTime version is released. More information on updating the firmware [here](/doc/gettingStarted/updating-software.md).
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. ## InfiniTime quick user guide
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/InfiniTimeOrg/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/InfiniTimeOrg/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**evice **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/InfiniTimeOrg/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 successful 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 2021 (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/InfiniTimeOrg/InfiniTime/releases/tag/0.14.1) and [InfiniTime 1.0](https://github.com/InfiniTimeOrg/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 Gadgetbridge 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/InfiniTimeOrg/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/InfiniTimeOrg/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-functioning 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 ### 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. By default, InfiniTime starts on the digital watchface. It'll probably display the epoch time (1 Jan 1970, 00:00).
You can sync the time using companion apps.
- Gadgetbridge automatically synchronizes the time when you connect it to your watch. More information on Gadgetbridge [here](/doc/gettingStarted/ota-gadgetbridge.md)
- [Sync the time with NRFConnect](/doc/gettingStarted/time-nrfconnect.md)
- Sync the time with your browser https://hubmartin.github.io/WebBLEWatch/
You can also set the time in the settings without a companion app. (version >1.7.0)
InfiniTime doesn't handle daylight savings automatically, so make sure to set the correct the time or sync it with a companion app
### Digital watch face
![Digital watch face](ui/watchface.jpg)
This is what the default digital watch face looks like. You can change watch faces in the settings.
The indicator on the top left is visible if you have unread notifications
On the top right there are status icons
- The battery icon shows roughly how much charge is remaining
- The Bluetooth icon is visible when the watch is connected to a companion app
- A plug icon is shown when the watch is plugged into a charger.
On the bottom left you can see your heart rate if you have the measurement enabled in the heart rate app.
On the bottom right you can see how many steps you have taken today.
### Navigation in the menu ### Navigation in the menu
![Quick actions](quickactions.jpg) ![Application menu](ui/applist.jpg)
![Settings](settings.jpg) ![Notifications](ui/notifications.jpg)
![Application menu](appmenu.jpg) ![Quick actions](ui/quicksettings.jpg)
![Settings](ui/settings.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 **up** to display the application menus. Apps (stopwatch, music, step, games,...) can be started from this menu.
- Swipe **down** to display the notification panel. Notification sent by your companion app will be displayed here.
- Swipe **right** to display the Quick Actions menu. This menu allows you to - Swipe **right** to display the Quick Actions menu. This menu allows you to
- Set the brightness of the display - Set the brightness of the display
- Start the **flashlight** app - Start the **flashlight** app
- Enable/disable vibrations on notifications (Do Not Disturb mode) - Enable/disable notifications (Do Not Disturb mode)
- Enter the **settings** menu - Enter the **settings** menu
- Settings - Swipe up and down to see all options
- Display timeout - Click the button to go back a screen.
- Wake up event (Tap, wrist rotation) - You can hold the button for a short time to return to the watch face. (version >1.7.0)
- 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,109 +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/InfiniTimeOrg/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!
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
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!
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
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 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.
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)

View File

@ -0,0 +1,29 @@
# Connecting to 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)
# Updating with Gadgetbridge
Now that Gadgetbridge is connected to your PineTime, use a file browser application and find the DFU file (`pinetime-mcuboot-app-dfu-x.x.x.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!
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)

View File

@ -0,0 +1,22 @@
# Updating with 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)
Find the DFU file (`pinetime-mcuboot-app-dfu-x.x.x.zip`) 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)
# Demo
[This video](https://seafile.codingfield.com/f/a52b69683a05472a90c7/) shows how to use NRFConnect to update the firmware running on the Pinetime.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

View File

@ -0,0 +1,11 @@
### Syncing time
You must enable the **CTS** *GATT server* in 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.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

View File

@ -0,0 +1,41 @@
# Updating InfiniTime
If you just want to flash or upgrade InfiniTime on your PineTime, this page is for you! If you want more information about the software and the update procedure, check out [this](/doc/gettingStarted/about-software.md) page.
## Checking the version of InfiniTime
You can check the InfiniTime version by first swiping right on the watchface to open quick settings, tapping the cogwheel to open settings, swipe up until you find an entry named "About" and tap on it.
![InfiniTime 1.0 version](version-1.0.jpg)
PineTimes shipped after June 2021 will ship with the latest version of [the bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader/releases/tag/1.0.0) and [recovery firmware](https://github.com/InfiniTimeOrg/InfiniTime/releases/tag/0.14.1)
The bootloader is run right before booting into InfiniTime. It is easily recognizable with its 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)
## Updating with companion apps
To update your PineTime, you can use one of the [compatible companion applications](/README.md#companion-apps).
The updating process differs slightly on every companion app, so you'll need to familiarize yourself with the companion app of your choice.
All releases of InfiniTime are available on the [release page of the GitHub repo](https://github.com/InfiniTimeOrg/InfiniTime/releases) under assets.
To update the firmware, you need to download the DFU of the firmware version that you'd like to install, for example `pinetime-mcuboot-app-dfu-1.6.0.zip`, and flash it with your companion app.
We have prepared instructions for flashing InfiniTime with Gadgetbridge and NRFConnect.
- [Updating with Gadgetbridge](/doc/gettingStarted/ota-gadgetbridge.md)
- [Updating with NRFConnect](/doc/gettingStarted/ota-nrfconnect.md)
## Firmware validation
Firmware updates must be manually validated. If the firmware isn't validated and the watch resets, the watch will revert to the previous firmware. This is a safety feature to prevent bricking your device with 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 settings menu*
- Open settings by tapping the cogwheel on the bottom right
- Swipe up until you find an entry named **Firmware** and tap on it
- If the firmware is not validated yet, you can either validate the running firmware, or reset and revert to the previous firmware version

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -4,13 +4,10 @@
- Buttons should generally be at least 50px high - Buttons should generally be at least 50px high
- Buttons should generally be on the bottom edge - Buttons should generally be on the bottom edge
- Make interactable objects **big** - Make interactable objects **big**
- Recommendations for inner padding, aka distance between buttons:
- When aligning 4 objects: 4px, e.g. Settings
- When aligning 3 objects: 6px, e.g. App list
- When aligning 2 objects: 10px, e.g. Quick settings
- When using a page indicator, leave 8px for it on the right side - When using a page indicator, leave 8px for it on the right side
- It is acceptable to leave 8px on the left side as well to center the content - It is acceptable to leave 8px on the left side as well to center the content
- Top bar takes at least 20px + padding - Top bar takes at least 20px + padding
- Top bar right icons move 8px to the left when using a page indicator - Top bar right icons move 8px to the left when using a page indicator
- A black background helps to hide the screen border, allowing the UI to look less cramped when utilizing the entire display area.
![example layouts](./ui/example.png) ![example layouts](./ui/example.png)

View File

@ -1,6 +1,6 @@
# Versioning # Versioning
The versioning of this project is based on [Semantic versionning](https://semver.org/) : The versioning of this project is based on [Semantic versioning](https://semver.org/):
- The **patch** is incremented when we fix a bug on a **released** version (most of the time using a **hotfix** branch). - The **patch** is incremented when a bug is fixed 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 **minor** is incremented when a new version with new features is released. 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 functioning firmware suited for the final user. - 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.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -1,5 +1,8 @@
#pragma once #pragma once
#include <cstdint>
#include <cstddef>
namespace Pinetime { namespace Pinetime {
class BootloaderVersion { class BootloaderVersion {
public: public:

View File

@ -507,6 +507,7 @@ list(APPEND SOURCE_FILES
components/heartrate/Ptagc.cpp components/heartrate/Ptagc.cpp
components/heartrate/HeartRateController.cpp components/heartrate/HeartRateController.cpp
buttonhandler/ButtonHandler.cpp
touchhandler/TouchHandler.cpp touchhandler/TouchHandler.cpp
) )
@ -567,6 +568,7 @@ list(APPEND RECOVERY_SOURCE_FILES
components/heartrate/Ptagc.cpp components/heartrate/Ptagc.cpp
components/motor/MotorController.cpp components/motor/MotorController.cpp
components/fs/FS.cpp components/fs/FS.cpp
buttonhandler/ButtonHandler.cpp
touchhandler/TouchHandler.cpp touchhandler/TouchHandler.cpp
) )
@ -681,6 +683,7 @@ set(INCLUDE_FILES
components/heartrate/Ptagc.h components/heartrate/Ptagc.h
components/heartrate/HeartRateController.h components/heartrate/HeartRateController.h
components/motor/MotorController.h components/motor/MotorController.h
buttonhandler/ButtonHandler.h
touchhandler/TouchHandler.h touchhandler/TouchHandler.h
) )

View File

@ -2,6 +2,8 @@
@VERSION_EDIT_WARNING@ @VERSION_EDIT_WARNING@
#include <cstdint>
namespace Pinetime { namespace Pinetime {
class Version { class Version {
public: public:

View File

@ -0,0 +1,7 @@
#pragma once
namespace Pinetime {
namespace Controllers {
enum class ButtonActions { None, Click, DoubleClick, LongPress, LongerPress };
}
}

View File

@ -0,0 +1,78 @@
#include "ButtonHandler.h"
using namespace Pinetime::Controllers;
void ButtonTimerCallback(TimerHandle_t xTimer) {
auto* sysTask = static_cast<Pinetime::System::SystemTask*>(pvTimerGetTimerID(xTimer));
sysTask->PushMessage(Pinetime::System::Messages::HandleButtonTimerEvent);
}
void ButtonHandler::Init(Pinetime::System::SystemTask* systemTask) {
buttonTimer = xTimerCreate("buttonTimer", 0, pdFALSE, systemTask, ButtonTimerCallback);
}
ButtonActions ButtonHandler::HandleEvent(Events event) {
static constexpr TickType_t doubleClickTime = pdMS_TO_TICKS(200);
static constexpr TickType_t longPressTime = pdMS_TO_TICKS(400);
static constexpr TickType_t longerPressTime = pdMS_TO_TICKS(2000);
if (event == Events::Press) {
buttonPressed = true;
} else if (event == Events::Release) {
releaseTime = xTaskGetTickCount();
buttonPressed = false;
}
switch (state) {
case States::Idle:
if (event == Events::Press) {
xTimerChangePeriod(buttonTimer, doubleClickTime, 0);
xTimerStart(buttonTimer, 0);
state = States::Pressed;
}
break;
case States::Pressed:
if (event == Events::Press) {
if (xTaskGetTickCount() - releaseTime < doubleClickTime) {
xTimerStop(buttonTimer, 0);
state = States::Idle;
return ButtonActions::DoubleClick;
}
} else if (event == Events::Release) {
xTimerChangePeriod(buttonTimer, doubleClickTime, 0);
xTimerStart(buttonTimer, 0);
} else if (event == Events::Timer) {
if (buttonPressed) {
xTimerChangePeriod(buttonTimer, longPressTime - doubleClickTime, 0);
xTimerStart(buttonTimer, 0);
state = States::Holding;
} else {
state = States::Idle;
return ButtonActions::Click;
}
}
break;
case States::Holding:
if (event == Events::Release) {
xTimerStop(buttonTimer, 0);
state = States::Idle;
return ButtonActions::Click;
} else if (event == Events::Timer) {
xTimerChangePeriod(buttonTimer, longerPressTime - longPressTime - doubleClickTime, 0);
xTimerStart(buttonTimer, 0);
state = States::LongHeld;
return ButtonActions::LongPress;
}
break;
case States::LongHeld:
if (event == Events::Release) {
xTimerStop(buttonTimer, 0);
state = States::Idle;
} else if (event == Events::Timer) {
state = States::Idle;
return ButtonActions::LongerPress;
}
break;
}
return ButtonActions::None;
}

View File

@ -0,0 +1,24 @@
#pragma once
#include "ButtonActions.h"
#include "systemtask/SystemTask.h"
#include <FreeRTOS.h>
#include <timers.h>
namespace Pinetime {
namespace Controllers {
class ButtonHandler {
public:
enum class Events : uint8_t { Press, Release, Timer };
void Init(Pinetime::System::SystemTask* systemTask);
ButtonActions HandleEvent(Events event);
private:
enum class States : uint8_t { Idle, Pressed, Holding, LongHeld };
TickType_t releaseTime = 0;
TimerHandle_t buttonTimer;
bool buttonPressed = false;
States state = States::Idle;
};
}
}

View File

@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "AlarmController.h" #include "components/alarm/AlarmController.h"
#include "systemtask/SystemTask.h" #include "systemtask/SystemTask.h"
#include "app_timer.h" #include "app_timer.h"
#include "task.h" #include "task.h"

View File

@ -1,4 +1,4 @@
#include "BatteryController.h" #include "components/battery/BatteryController.h"
#include "drivers/PinMap.h" #include "drivers/PinMap.h"
#include <hal/nrf_gpio.h> #include <hal/nrf_gpio.h>
#include <nrfx_saadc.h> #include <nrfx_saadc.h>

View File

@ -1,6 +1,6 @@
#include "AlertNotificationClient.h" #include "components/ble/AlertNotificationClient.h"
#include <algorithm> #include <algorithm>
#include "NotificationManager.h" #include "components/ble/NotificationManager.h"
#include "systemtask/SystemTask.h" #include "systemtask/SystemTask.h"
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;

View File

@ -7,7 +7,7 @@
#include <host/ble_gap.h> #include <host/ble_gap.h>
#undef max #undef max
#undef min #undef min
#include "BleClient.h" #include "components/ble/BleClient.h"
namespace Pinetime { namespace Pinetime {

View File

@ -1,8 +1,8 @@
#include "AlertNotificationService.h" #include "components/ble/AlertNotificationService.h"
#include <hal/nrf_rtc.h> #include <hal/nrf_rtc.h>
#include <cstring> #include <cstring>
#include <algorithm> #include <algorithm>
#include "NotificationManager.h" #include "components/ble/NotificationManager.h"
#include "systemtask/SystemTask.h" #include "systemtask/SystemTask.h"
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;

View File

@ -1,5 +1,5 @@
#include "components/ble/BatteryInformationService.h"
#include <nrf_log.h> #include <nrf_log.h>
#include "BatteryInformationService.h"
#include "components/battery/BatteryController.h" #include "components/battery/BatteryController.h"
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;

View File

@ -1,4 +1,4 @@
#include "BleController.h" #include "components/ble/BleController.h"
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;

View File

@ -1,4 +1,4 @@
#include "CurrentTimeClient.h" #include "components/ble/CurrentTimeClient.h"
#include <hal/nrf_rtc.h> #include <hal/nrf_rtc.h>
#include <nrf_log.h> #include <nrf_log.h>
#include "components/datetime/DateTimeController.h" #include "components/datetime/DateTimeController.h"

View File

@ -5,7 +5,7 @@
#undef max #undef max
#undef min #undef min
#include <cstdint> #include <cstdint>
#include "BleClient.h" #include "components/ble/BleClient.h"
namespace Pinetime { namespace Pinetime {
namespace Controllers { namespace Controllers {

View File

@ -1,4 +1,4 @@
#include "CurrentTimeService.h" #include "components/ble/CurrentTimeService.h"
#include <hal/nrf_rtc.h> #include <hal/nrf_rtc.h>
#include <nrf_log.h> #include <nrf_log.h>

View File

@ -1,4 +1,4 @@
#include "DeviceInformationService.h" #include "components/ble/DeviceInformationService.h"
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include <cstdint>
#define min // workaround: nimble's min/max macros conflict with libstdc++ #define min // workaround: nimble's min/max macros conflict with libstdc++
#define max #define max
#include <host/ble_gap.h> #include <host/ble_gap.h>

View File

@ -1,4 +1,4 @@
#include "DfuService.h" #include "components/ble/DfuService.h"
#include <cstring> #include <cstring>
#include "components/ble/BleController.h" #include "components/ble/BleController.h"
#include "drivers/SpiNorFlash.h" #include "drivers/SpiNorFlash.h"

View File

@ -1,4 +1,4 @@
#include "HeartRateService.h" #include "components/ble/HeartRateService.h"
#include "components/heartrate/HeartRateController.h" #include "components/heartrate/HeartRateController.h"
#include "systemtask/SystemTask.h" #include "systemtask/SystemTask.h"

View File

@ -1,6 +1,6 @@
#include "ImmediateAlertService.h" #include "components/ble/ImmediateAlertService.h"
#include <cstring> #include <cstring>
#include "NotificationManager.h" #include "components/ble/NotificationManager.h"
#include "systemtask/SystemTask.h" #include "systemtask/SystemTask.h"
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;

View File

@ -1,11 +1,11 @@
#include "MotionService.h" #include "components/ble/MotionService.h"
#include "components/motion/MotionController.h" #include "components/motion/MotionController.h"
#include "systemtask/SystemTask.h" #include "systemtask/SystemTask.h"
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;
namespace { namespace {
// 0002yyxx-78fc-48fe-8e23-433b3a1942d0 // 0003yyxx-78fc-48fe-8e23-433b3a1942d0
constexpr ble_uuid128_t CharUuid(uint8_t x, uint8_t y) { constexpr ble_uuid128_t CharUuid(uint8_t x, uint8_t y) {
return ble_uuid128_t{ return ble_uuid128_t{
.u = {.type = BLE_UUID_TYPE_128}, .u = {.type = BLE_UUID_TYPE_128},
@ -13,7 +13,7 @@ namespace {
}; };
} }
// 00020000-78fc-48fe-8e23-433b3a1942d0 // 00030000-78fc-48fe-8e23-433b3a1942d0
constexpr ble_uuid128_t BaseUuid() { constexpr ble_uuid128_t BaseUuid() {
return CharUuid(0x00, 0x00); return CharUuid(0x00, 0x00);
} }

View File

@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "MusicService.h" #include "components/ble/MusicService.h"
#include "systemtask/SystemTask.h" #include "systemtask/SystemTask.h"
namespace { namespace {

View File

@ -16,7 +16,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "NavigationService.h" #include "components/ble/NavigationService.h"
#include "systemtask/SystemTask.h" #include "systemtask/SystemTask.h"

View File

@ -1,4 +1,4 @@
#include "NimbleController.h" #include "components/ble/NimbleController.h"
#include <hal/nrf_rtc.h> #include <hal/nrf_rtc.h>
#define min // workaround: nimble's min/max macros conflict with libstdc++ #define min // workaround: nimble's min/max macros conflict with libstdc++
#define max #define max

View File

@ -7,19 +7,19 @@
#include <host/ble_gap.h> #include <host/ble_gap.h>
#undef max #undef max
#undef min #undef min
#include "AlertNotificationClient.h" #include "components/ble/AlertNotificationClient.h"
#include "AlertNotificationService.h" #include "components/ble/AlertNotificationService.h"
#include "BatteryInformationService.h" #include "components/ble/BatteryInformationService.h"
#include "CurrentTimeClient.h" #include "components/ble/CurrentTimeClient.h"
#include "CurrentTimeService.h" #include "components/ble/CurrentTimeService.h"
#include "DeviceInformationService.h" #include "components/ble/DeviceInformationService.h"
#include "DfuService.h" #include "components/ble/DfuService.h"
#include "ImmediateAlertService.h" #include "components/ble/ImmediateAlertService.h"
#include "MusicService.h" #include "components/ble/MusicService.h"
#include "NavigationService.h" #include "components/ble/NavigationService.h"
#include "ServiceDiscovery.h" #include "components/ble/ServiceDiscovery.h"
#include "HeartRateService.h" #include "components/ble/HeartRateService.h"
#include "MotionService.h" #include "components/ble/MotionService.h"
namespace Pinetime { namespace Pinetime {
namespace Drivers { namespace Drivers {

View File

@ -1,4 +1,4 @@
#include "NotificationManager.h" #include "components/ble/NotificationManager.h"
#include <cstring> #include <cstring>
#include <algorithm> #include <algorithm>

View File

@ -1,6 +1,6 @@
#include "ServiceDiscovery.h" #include "components/ble/ServiceDiscovery.h"
#include <libraries/log/nrf_log.h> #include <libraries/log/nrf_log.h>
#include "BleClient.h" #include "components/ble/BleClient.h"
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;

View File

@ -1,4 +1,4 @@
#include "BrightnessController.h" #include "components/brightness/BrightnessController.h"
#include <hal/nrf_gpio.h> #include <hal/nrf_gpio.h>
#include "displayapp/screens/Symbols.h" #include "displayapp/screens/Symbols.h"
#include "drivers/PinMap.h" #include "drivers/PinMap.h"

View File

@ -1,4 +1,4 @@
#include "DateTimeController.h" #include "components/datetime/DateTimeController.h"
#include <date/date.h> #include <date/date.h>
#include <libraries/log/nrf_log.h> #include <libraries/log/nrf_log.h>
#include <systemtask/SystemTask.h> #include <systemtask/SystemTask.h>

View File

@ -1,4 +1,4 @@
#include "FirmwareValidator.h" #include "components/firmwarevalidator/FirmwareValidator.h"
#include <hal/nrf_rtc.h> #include <hal/nrf_rtc.h>
#include "drivers/InternalFlash.h" #include "drivers/InternalFlash.h"

View File

@ -1,4 +1,4 @@
#include "FS.h" #include "components/fs/FS.h"
#include <cstring> #include <cstring>
#include <littlefs/lfs.h> #include <littlefs/lfs.h>
#include <lvgl/lvgl.h> #include <lvgl/lvgl.h>

View File

@ -1,4 +1,4 @@
#include "Gfx.h" #include "components/gfx/Gfx.h"
#include "drivers/St7789.h" #include "drivers/St7789.h"
using namespace Pinetime::Components; using namespace Pinetime::Components;

View File

@ -4,7 +4,7 @@
C++ port Copyright (C) 2021 Jean-François Milants C++ port Copyright (C) 2021 Jean-François Milants
*/ */
#include "Biquad.h" #include "components/heartrate/Biquad.h"
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;

View File

@ -1,4 +1,4 @@
#include "HeartRateController.h" #include "components/heartrate/HeartRateController.h"
#include <heartratetask/HeartRateTask.h> #include <heartratetask/HeartRateTask.h>
#include <systemtask/SystemTask.h> #include <systemtask/SystemTask.h>

View File

@ -4,9 +4,9 @@
C++ port Copyright (C) 2021 Jean-François Milants C++ port Copyright (C) 2021 Jean-François Milants
*/ */
#include "components/heartrate/Ppg.h"
#include <vector> #include <vector>
#include <nrf_log.h> #include <nrf_log.h>
#include "Ppg.h"
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;
/** Original implementation from wasp-os : https://github.com/daniel-thompson/wasp-os/blob/master/wasp/ppg.py */ /** Original implementation from wasp-os : https://github.com/daniel-thompson/wasp-os/blob/master/wasp/ppg.py */

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include <array> #include <array>
#include "Biquad.h" #include "components/heartrate/Biquad.h"
#include "Ptagc.h" #include "components/heartrate/Ptagc.h"
namespace Pinetime { namespace Pinetime {
namespace Controllers { namespace Controllers {

View File

@ -4,8 +4,8 @@
C++ port Copyright (C) 2021 Jean-François Milants C++ port Copyright (C) 2021 Jean-François Milants
*/ */
#include "components/heartrate/Ptagc.h"
#include <cmath> #include <cmath>
#include "Ptagc.h"
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;

View File

@ -1,4 +1,4 @@
#include "MotionController.h" #include "components/motion/MotionController.h"
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;

View File

@ -1,4 +1,4 @@
#include "MotorController.h" #include "components/motor/MotorController.h"
#include <hal/nrf_gpio.h> #include <hal/nrf_gpio.h>
#include "systemtask/SystemTask.h" #include "systemtask/SystemTask.h"
#include "app_timer.h" #include "app_timer.h"

View File

@ -1,4 +1,4 @@
#include "RleDecoder.h" #include "components/rle/RleDecoder.h"
using namespace Pinetime::Tools; using namespace Pinetime::Tools;

View File

@ -1,4 +1,4 @@
#include "Settings.h" #include "components/settings/Settings.h"
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>

View File

@ -2,7 +2,7 @@
// Created by florian on 16.05.21. // Created by florian on 16.05.21.
// //
#include "TimerController.h" #include "components/timer/TimerController.h"
#include "systemtask/SystemTask.h" #include "systemtask/SystemTask.h"
#include "app_timer.h" #include "app_timer.h"
#include "task.h" #include "task.h"

View File

@ -1,4 +1,4 @@
#include "Colors.h" #include "displayapp/Colors.h"
using namespace Pinetime::Applications; using namespace Pinetime::Applications;
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <lvgl/src/lv_misc/lv_color.h> #include <lvgl/src/lv_misc/lv_color.h>
#include <components/settings/Settings.h> #include "components/settings/Settings.h"
namespace Pinetime { namespace Pinetime {
namespace Applications { namespace Applications {

View File

@ -1,9 +1,9 @@
#include "DisplayApp.h" #include "displayapp/DisplayApp.h"
#include <libraries/log/nrf_log.h> #include <libraries/log/nrf_log.h>
#include <displayapp/screens/HeartRate.h> #include "displayapp/screens/HeartRate.h"
#include <displayapp/screens/Motion.h> #include "displayapp/screens/Motion.h"
#include <displayapp/screens/Timer.h> #include "displayapp/screens/Timer.h"
#include <displayapp/screens/Alarm.h> #include "displayapp/screens/Alarm.h"
#include "components/battery/BatteryController.h" #include "components/battery/BatteryController.h"
#include "components/ble/BleController.h" #include "components/ble/BleController.h"
#include "components/datetime/DateTimeController.h" #include "components/datetime/DateTimeController.h"
@ -260,6 +260,26 @@ void DisplayApp::Refresh() {
} }
} }
break; break;
case Messages::ButtonLongPressed:
if (currentApp != Apps::Clock) {
if (currentApp == Apps::Notifications) {
LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::Up);
} else if (currentApp == Apps::QuickSettings) {
LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::LeftAnim);
} else {
LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::Down);
}
}
break;
case Messages::ButtonLongerPressed:
// Create reboot app and open it instead
LoadApp(Apps::SysInfo, DisplayApp::FullRefreshDirections::Up);
break;
case Messages::ButtonDoubleClicked:
if (currentApp != Apps::Notifications && currentApp != Apps::NotificationsPreview) {
LoadApp(Apps::Notifications, DisplayApp::FullRefreshDirections::Down);
}
break;
case Messages::BleFirmwareUpdateStarted: case Messages::BleFirmwareUpdateStarted:
LoadApp(Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down); LoadApp(Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down);

View File

@ -5,9 +5,9 @@
#include <task.h> #include <task.h>
#include <memory> #include <memory>
#include <systemtask/Messages.h> #include <systemtask/Messages.h>
#include "Apps.h" #include "displayapp/Apps.h"
#include "LittleVgl.h" #include "displayapp/LittleVgl.h"
#include "TouchEvents.h" #include "displayapp/TouchEvents.h"
#include "components/brightness/BrightnessController.h" #include "components/brightness/BrightnessController.h"
#include "components/motor/MotorController.h" #include "components/motor/MotorController.h"
#include "components/firmwarevalidator/FirmwareValidator.h" #include "components/firmwarevalidator/FirmwareValidator.h"
@ -17,7 +17,7 @@
#include "components/alarm/AlarmController.h" #include "components/alarm/AlarmController.h"
#include "touchhandler/TouchHandler.h" #include "touchhandler/TouchHandler.h"
#include "Messages.h" #include "displayapp/Messages.h"
#include "BootErrors.h" #include "BootErrors.h"
namespace Pinetime { namespace Pinetime {

View File

@ -1,9 +1,9 @@
#include "DisplayAppRecovery.h" #include "displayapp/DisplayAppRecovery.h"
#include <FreeRTOS.h> #include <FreeRTOS.h>
#include <task.h> #include <task.h>
#include <libraries/log/nrf_log.h> #include <libraries/log/nrf_log.h>
#include <components/rle/RleDecoder.h> #include "components/rle/RleDecoder.h"
#include <touchhandler/TouchHandler.h> #include "touchhandler/TouchHandler.h"
#include "displayapp/icons/infinitime/infinitime-nb.c" #include "displayapp/icons/infinitime/infinitime-nb.c"
#include "components/ble/BleController.h" #include "components/ble/BleController.h"

View File

@ -10,11 +10,11 @@
#include <date/date.h> #include <date/date.h>
#include <drivers/Watchdog.h> #include <drivers/Watchdog.h>
#include <components/motor/MotorController.h> #include <components/motor/MotorController.h>
#include <BootErrors.h> #include "BootErrors.h"
#include "TouchEvents.h" #include "displayapp/TouchEvents.h"
#include "Apps.h" #include "displayapp/Apps.h"
#include "Messages.h" #include "displayapp/Messages.h"
#include "DummyLittleVgl.h" #include "displayapp/DummyLittleVgl.h"
namespace Pinetime { namespace Pinetime {
namespace Drivers { namespace Drivers {

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include <libs/lvgl/src/lv_core/lv_style.h> #include <lvgl/src/lv_core/lv_style.h>
#include <libs/lvgl/src/lv_themes/lv_theme.h> #include <lvgl/src/lv_themes/lv_theme.h>
#include <libs/lvgl/src/lv_hal/lv_hal.h> #include <lvgl/src/lv_hal/lv_hal.h>
#include <drivers/St7789.h> #include <drivers/St7789.h>
#include <drivers/Cst816s.h> #include <drivers/Cst816s.h>

View File

@ -1,5 +1,5 @@
#include "LittleVgl.h" #include "displayapp/LittleVgl.h"
#include "lv_pinetime_theme.h" #include "displayapp/lv_pinetime_theme.h"
#include <FreeRTOS.h> #include <FreeRTOS.h>
#include <task.h> #include <task.h>

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include <cstdint>
namespace Pinetime { namespace Pinetime {
namespace Applications { namespace Applications {
namespace Display { namespace Display {
@ -9,6 +10,9 @@ namespace Pinetime {
UpdateBleConnection, UpdateBleConnection,
TouchEvent, TouchEvent,
ButtonPushed, ButtonPushed,
ButtonLongPressed,
ButtonLongerPressed,
ButtonDoubleClicked,
NewNotification, NewNotification,
TimerDone, TimerDone,
BleFirmwareUpdateStarted, BleFirmwareUpdateStarted,

View File

@ -6,7 +6,7 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_pinetime_theme.h" #include "displayapp/lv_pinetime_theme.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -15,9 +15,9 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "Alarm.h" #include "displayapp/screens/Alarm.h"
#include "Screen.h" #include "displayapp/screens/Screen.h"
#include "Symbols.h" #include "displayapp/screens/Symbols.h"
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;
using Pinetime::Controllers::AlarmController; using Pinetime::Controllers::AlarmController;

View File

@ -17,9 +17,9 @@
*/ */
#pragma once #pragma once
#include "Screen.h" #include "displayapp/screens/Screen.h"
#include "systemtask/SystemTask.h" #include "systemtask/SystemTask.h"
#include "../LittleVgl.h" #include "displayapp/LittleVgl.h"
#include "components/alarm/AlarmController.h" #include "components/alarm/AlarmController.h"
namespace Pinetime { namespace Pinetime {
@ -40,7 +40,9 @@ namespace Pinetime {
Controllers::AlarmController& alarmController; Controllers::AlarmController& alarmController;
lv_obj_t *time, *btnEnable, *txtEnable, *btnMinutesUp, *btnMinutesDown, *btnHoursUp, *btnHoursDown, *txtMinUp, *txtMinDown, lv_obj_t *time, *btnEnable, *txtEnable, *btnMinutesUp, *btnMinutesDown, *btnHoursUp, *btnHoursDown, *txtMinUp, *txtMinDown,
*txtHrUp, *txtHrDown, *btnRecur, *txtRecur, *btnMessage, *txtMessage, *btnInfo, *txtInfo; *txtHrUp, *txtHrDown, *btnRecur, *txtRecur, *btnInfo, *txtInfo;
lv_obj_t* txtMessage = nullptr;
lv_obj_t* btnMessage = nullptr;
enum class EnableButtonState { On, Off, Alerting }; enum class EnableButtonState { On, Off, Alerting };
void SetEnableButtonState(); void SetEnableButtonState();

View File

@ -1,10 +1,10 @@
#include "ApplicationList.h" #include "displayapp/screens/ApplicationList.h"
#include <lvgl/lvgl.h> #include <lvgl/lvgl.h>
#include <array> #include <array>
#include "Symbols.h" #include "displayapp/screens/Symbols.h"
#include "Tile.h" #include "displayapp/screens/Tile.h"
#include "displayapp/Apps.h" #include "displayapp/Apps.h"
#include "../DisplayApp.h" #include "displayapp/DisplayApp.h"
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;

View File

@ -2,8 +2,8 @@
#include <memory> #include <memory>
#include "Screen.h" #include "displayapp/screens/Screen.h"
#include "ScreenList.h" #include "displayapp/screens/ScreenList.h"
#include "components/datetime/DateTimeController.h" #include "components/datetime/DateTimeController.h"
#include "components/settings/Settings.h" #include "components/settings/Settings.h"
#include "components/battery/BatteryController.h" #include "components/battery/BatteryController.h"

View File

@ -1,6 +1,6 @@
#include "displayapp/screens/BatteryIcon.h"
#include <cstdint> #include <cstdint>
#include "BatteryIcon.h" #include "displayapp/screens/Symbols.h"
#include "Symbols.h"
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include <cstdint>
namespace Pinetime { namespace Pinetime {
namespace Applications { namespace Applications {

Some files were not shown because too many files have changed in this diff Show More