Skip to content

Commit 7cdf0ef

Browse files
authored
Merge branch 'main' into loading-vibrations
2 parents 97a55d2 + e6b96c2 commit 7cdf0ef

39 files changed

+783
-486
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ RUN apt-get update -qq \
1111
make \
1212
python3 \
1313
python3-pip \
14+
python3-pil \
1415
tar \
1516
unzip \
1617
wget \

.github/ISSUE_TEMPLATE/bug-report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ body:
77
label: Verification
88
description: Before submitting a bug report, check if similar issues already exist and use those issues to provide your feedback instead.
99
options:
10-
- label: I searched for similar bug reports and found none was relevant.
10+
- label: I searched for similar bug reports (including closed issues) and found none was relevant.
1111
required: true
1212
- type: input
1313
id: desc-brief

.github/ISSUE_TEMPLATE/issue-report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ body:
66
label: Verification
77
description: Before submitting an issue, check if similar issues already exist and use those issues to provide your feedback instead.
88
options:
9-
- label: I searched for similar issues and found none was relevant.
9+
- label: I searched for similar issues (including closed issues) and found none was relevant.
1010
required: true
1111
- type: textarea
1212
attributes:

.github/workflows/main.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ jobs:
3131
uses: actions/checkout@v3
3232
with:
3333
submodules: recursive
34+
- name: Install resource build dependencies
35+
run: |
36+
apt-get update
37+
apt-get -y install --no-install-recommends python3-pil
3438
- name: Build
3539
shell: bash
3640
run: /opt/build.sh all
@@ -61,10 +65,10 @@ jobs:
6165
build-simulator:
6266
runs-on: ubuntu-22.04
6367
steps:
64-
- name: Install SDL2 development package
68+
- name: Install SDL2 and libpng development package
6569
run: |
6670
sudo apt-get update
67-
sudo apt-get -y install libsdl2-dev
71+
sudo apt-get -y install libsdl2-dev libpng-dev
6872
6973
- name: Install Ninja
7074
run: |
@@ -82,7 +86,7 @@ jobs:
8286
- name: Get InfiniSim repo
8387
run: |
8488
git clone https://github.com/InfiniTimeOrg/InfiniSim.git --depth 1 --branch main
85-
git -C InfiniSim submodule update --init lv_drivers libpng
89+
git -C InfiniSim submodule update --init lv_drivers
8690
8791
- name: CMake
8892
# disable BUILD_RESOURCES as this is already done when building the firmware

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
22

33
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose Debug or Release")
44

5-
project(pinetime VERSION 1.12.0 LANGUAGES C CXX ASM)
5+
project(pinetime VERSION 1.13.0 LANGUAGES C CXX ASM)
66

77
set(CMAKE_C_STANDARD 99)
88
set(CMAKE_CXX_STANDARD 14)

doc/buildAndProgram.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,23 @@ CMake configures the project according to variables you specify the command line
4242
**NRF5_SDK_PATH**|path to the NRF52 SDK|`-DNRF5_SDK_PATH=/home/jf/nrf52/Pinetime/sdk`|
4343
**CMAKE_BUILD_TYPE (\*)**| Build type (Release or Debug). Release is applied by default if this variable is not specified.|`-DCMAKE_BUILD_TYPE=Debug`
4444
**BUILD_DFU (\*\*)**|Build DFU files while building (needs [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil)).|`-DBUILD_DFU=1`
45-
**BUILD_RESOURCES (\*\*)**| Generate external resource while building (needs [lv_font_conv](https://github.com/lvgl/lv_font_conv) and [lv_img_conv](https://github.com/lvgl/lv_img_conv). |`-DBUILD_RESOURCES=1`
45+
**BUILD_RESOURCES (\*\*)**| Generate external resource while building (needs [lv_font_conv](https://github.com/lvgl/lv_font_conv) and [python3-pil/pillow](https://pillow.readthedocs.io) module). |`-DBUILD_RESOURCES=1`
4646
**TARGET_DEVICE**|Target device, used for hardware configuration. Allowed: `PINETIME, MOY-TFK5, MOY-TIN5, MOY-TON5, MOY-UNK`|`-DTARGET_DEVICE=PINETIME` (Default)
4747
4848
#### (\*) Note about **CMAKE_BUILD_TYPE**
4949
By default, this variable is set to *Release*. It compiles the code with size and speed optimizations. We use this value for all the binaries we publish when we [release](https://github.com/InfiniTimeOrg/InfiniTime/releases) new versions of InfiniTime.
5050
51-
The *Debug* mode disables all optimizations, which makes the code easier to debug. However, the binary size will likely be too big to fit in the internal flash memory. If you want to build and debug a *Debug* binary, you'll need to disable some parts of the code. For example, the icons for the **Navigation** app use a lot of memory space. You can comment the content of `m_iconMap` in the [Navigation](https://github.com/InfiniTimeOrg/InfiniTime/blob/main/src/displayapp/screens/Navigation.h#L148) application to free some memory.
51+
The *Debug* mode disables all optimizations, which makes the code easier to debug. However, the binary size will likely be too big to fit in the internal flash memory. If you want to build and debug a *Debug* binary, you can disable some parts of the code that are not needed for the test you want to achieve. You can also apply the *Debug* mode selectively on parts of the application by applying the `DEBUG_FLAGS` only for the part (CMake target) you want to debug. For example, let's say you want to debug code related to LittleFS, simply set the compilation options for the RELEASE configuration of the target to `DEBUG_FLAGS` (in `src/CMakeLists.txt`). This will force the compilation of that target in *Debug* mode while the rest of the project will be built in *Release* mode. Example:
52+
53+
```
54+
target_compile_options(littlefs PRIVATE
55+
${COMMON_FLAGS}
56+
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
57+
$<$<CONFIG:RELEASE>: ${DEBUG_FLAGS}> # Change from RELEASE_FLAGS to DEBUG_FLAGS
58+
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
59+
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
60+
)
61+
```
5262

5363
#### (\*\*) Note about **BUILD_DFU**
5464
DFU files are the files you'll need to install your build of InfiniTime using OTA (over-the-air) mechanism. To generate the DFU file, the Python tool [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil) is needed on your system. Check that this tool is properly installed before enabling this option.
@@ -88,4 +98,4 @@ Binary files are generated into the folder `src`:
8898
- **pinetime-mcuboot-app-image** : MCUBoot image of the firmware
8999
- **pinetime-mcuboot-app-dfu** : DFU file of the firmware
90100
91-
The same files are generated for **pinetime-recovery** and **pinetime-recoveryloader**
101+
The same files are generated for **pinetime-recovery** and **pinetime-recovery-loader**

doc/buildWithDocker.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ Based on Ubuntu 22.04 with the following build dependencies:
1111
- adafruit-nrfutil
1212
- lv_font_conv
1313

14+
## Clone the repository
15+
16+
Before building, local repository must be fully initialized.
17+
18+
```
19+
git clone https://github.com/InfiniTimeOrg/InfiniTime.git
20+
cd InfiniTime
21+
git submodule update --init
22+
```
23+
1424
## Run a container to build the project
1525

1626
The `infinitime-build` image contains all the dependencies you need.

docker/Dockerfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ RUN apt-get update -qq \
1111
make \
1212
python3 \
1313
python3-pip \
14+
python3-pil \
1415
python-is-python3 \
1516
tar \
1617
unzip \
@@ -39,10 +40,6 @@ RUN pip3 install -Iv cryptography==3.3
3940
RUN pip3 install cbor
4041
RUN npm i [email protected] -g
4142

42-
RUN npm i [email protected] -g
43-
RUN npm i @swc/core -g
44-
RUN npm i [email protected] -g
45-
4643
# build.sh knows how to compile
4744
COPY build.sh /opt/
4845

src/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ list(APPEND SOURCE_FILES
427427
displayapp/screens/settings/SettingBluetooth.cpp
428428

429429
## Watch faces
430-
displayapp/icons/bg_clock.c
431430
displayapp/screens/WatchFaceAnalog.cpp
432431
displayapp/screens/WatchFaceDigital.cpp
433432
displayapp/screens/WatchFaceInfineat.cpp
@@ -494,6 +493,8 @@ list(APPEND SOURCE_FILES
494493

495494
buttonhandler/ButtonHandler.cpp
496495
touchhandler/TouchHandler.cpp
496+
497+
utility/Math.cpp
497498
)
498499

499500
list(APPEND RECOVERY_SOURCE_FILES
@@ -559,6 +560,8 @@ list(APPEND RECOVERY_SOURCE_FILES
559560
components/fs/FS.cpp
560561
buttonhandler/ButtonHandler.cpp
561562
touchhandler/TouchHandler.cpp
563+
564+
utility/Math.cpp
562565
)
563566

564567
list(APPEND RECOVERYLOADER_SOURCE_FILES
@@ -678,6 +681,7 @@ set(INCLUDE_FILES
678681
components/motor/MotorController.h
679682
buttonhandler/ButtonHandler.h
680683
touchhandler/TouchHandler.h
684+
utility/Math.h
681685
)
682686

683687
include_directories(

src/components/ble/NotificationManager.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ namespace Pinetime {
2727
struct Notification {
2828
using Id = uint8_t;
2929
using Idx = uint8_t;
30-
Id id = 0;
31-
bool valid = false;
32-
uint8_t size;
30+
3331
std::array<char, MessageSize + 1> message;
32+
uint8_t size;
3433
Categories category = Categories::Unknown;
34+
Id id = 0;
35+
bool valid = false;
3536

3637
const char* Message() const;
3738
const char* Title() const;

src/components/ble/weather/WeatherService.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,8 @@ namespace Pinetime {
404404
std::unique_ptr<WeatherData::Clouds>& WeatherService::GetCurrentClouds() {
405405
uint64_t currentTimestamp = GetCurrentUnixTimestamp();
406406
for (auto&& header : this->timeline) {
407-
if (header->eventType == WeatherData::eventtype::Clouds && IsEventStillValid(header, currentTimestamp)) {
407+
if (header->eventType == WeatherData::eventtype::Clouds && currentTimestamp >= header->timestamp &&
408+
IsEventStillValid(header, currentTimestamp)) {
408409
return reinterpret_cast<std::unique_ptr<WeatherData::Clouds>&>(header);
409410
}
410411
}
@@ -415,7 +416,8 @@ namespace Pinetime {
415416
std::unique_ptr<WeatherData::Obscuration>& WeatherService::GetCurrentObscuration() {
416417
uint64_t currentTimestamp = GetCurrentUnixTimestamp();
417418
for (auto&& header : this->timeline) {
418-
if (header->eventType == WeatherData::eventtype::Obscuration && IsEventStillValid(header, currentTimestamp)) {
419+
if (header->eventType == WeatherData::eventtype::Obscuration && currentTimestamp >= header->timestamp &&
420+
IsEventStillValid(header, currentTimestamp)) {
419421
return reinterpret_cast<std::unique_ptr<WeatherData::Obscuration>&>(header);
420422
}
421423
}
@@ -426,7 +428,8 @@ namespace Pinetime {
426428
std::unique_ptr<WeatherData::Precipitation>& WeatherService::GetCurrentPrecipitation() {
427429
uint64_t currentTimestamp = GetCurrentUnixTimestamp();
428430
for (auto&& header : this->timeline) {
429-
if (header->eventType == WeatherData::eventtype::Precipitation && IsEventStillValid(header, currentTimestamp)) {
431+
if (header->eventType == WeatherData::eventtype::Precipitation && currentTimestamp >= header->timestamp &&
432+
IsEventStillValid(header, currentTimestamp)) {
430433
return reinterpret_cast<std::unique_ptr<WeatherData::Precipitation>&>(header);
431434
}
432435
}
@@ -437,7 +440,8 @@ namespace Pinetime {
437440
std::unique_ptr<WeatherData::Wind>& WeatherService::GetCurrentWind() {
438441
uint64_t currentTimestamp = GetCurrentUnixTimestamp();
439442
for (auto&& header : this->timeline) {
440-
if (header->eventType == WeatherData::eventtype::Wind && IsEventStillValid(header, currentTimestamp)) {
443+
if (header->eventType == WeatherData::eventtype::Wind && currentTimestamp >= header->timestamp &&
444+
IsEventStillValid(header, currentTimestamp)) {
441445
return reinterpret_cast<std::unique_ptr<WeatherData::Wind>&>(header);
442446
}
443447
}
@@ -448,7 +452,8 @@ namespace Pinetime {
448452
std::unique_ptr<WeatherData::Temperature>& WeatherService::GetCurrentTemperature() {
449453
uint64_t currentTimestamp = GetCurrentUnixTimestamp();
450454
for (auto&& header : this->timeline) {
451-
if (header->eventType == WeatherData::eventtype::Temperature && IsEventStillValid(header, currentTimestamp)) {
455+
if (header->eventType == WeatherData::eventtype::Temperature && currentTimestamp >= header->timestamp &&
456+
IsEventStillValid(header, currentTimestamp)) {
452457
return reinterpret_cast<std::unique_ptr<WeatherData::Temperature>&>(header);
453458
}
454459
}
@@ -459,7 +464,8 @@ namespace Pinetime {
459464
std::unique_ptr<WeatherData::Humidity>& WeatherService::GetCurrentHumidity() {
460465
uint64_t currentTimestamp = GetCurrentUnixTimestamp();
461466
for (auto&& header : this->timeline) {
462-
if (header->eventType == WeatherData::eventtype::Humidity && IsEventStillValid(header, currentTimestamp)) {
467+
if (header->eventType == WeatherData::eventtype::Humidity && currentTimestamp >= header->timestamp &&
468+
IsEventStillValid(header, currentTimestamp)) {
463469
return reinterpret_cast<std::unique_ptr<WeatherData::Humidity>&>(header);
464470
}
465471
}
@@ -470,7 +476,8 @@ namespace Pinetime {
470476
std::unique_ptr<WeatherData::Pressure>& WeatherService::GetCurrentPressure() {
471477
uint64_t currentTimestamp = GetCurrentUnixTimestamp();
472478
for (auto&& header : this->timeline) {
473-
if (header->eventType == WeatherData::eventtype::Pressure && IsEventStillValid(header, currentTimestamp)) {
479+
if (header->eventType == WeatherData::eventtype::Pressure && currentTimestamp >= header->timestamp &&
480+
IsEventStillValid(header, currentTimestamp)) {
474481
return reinterpret_cast<std::unique_ptr<WeatherData::Pressure>&>(header);
475482
}
476483
}
@@ -481,7 +488,8 @@ namespace Pinetime {
481488
std::unique_ptr<WeatherData::Location>& WeatherService::GetCurrentLocation() {
482489
uint64_t currentTimestamp = GetCurrentUnixTimestamp();
483490
for (auto&& header : this->timeline) {
484-
if (header->eventType == WeatherData::eventtype::Location && IsEventStillValid(header, currentTimestamp)) {
491+
if (header->eventType == WeatherData::eventtype::Location && currentTimestamp >= header->timestamp &&
492+
IsEventStillValid(header, currentTimestamp)) {
485493
return reinterpret_cast<std::unique_ptr<WeatherData::Location>&>(header);
486494
}
487495
}
@@ -492,7 +500,8 @@ namespace Pinetime {
492500
std::unique_ptr<WeatherData::AirQuality>& WeatherService::GetCurrentQuality() {
493501
uint64_t currentTimestamp = GetCurrentUnixTimestamp();
494502
for (auto&& header : this->timeline) {
495-
if (header->eventType == WeatherData::eventtype::AirQuality && IsEventStillValid(header, currentTimestamp)) {
503+
if (header->eventType == WeatherData::eventtype::AirQuality && currentTimestamp >= header->timestamp &&
504+
IsEventStillValid(header, currentTimestamp)) {
496505
return reinterpret_cast<std::unique_ptr<WeatherData::AirQuality>&>(header);
497506
}
498507
}

0 commit comments

Comments
 (0)