Skip to content

Commit

Permalink
Merge main into unifyDockerDevcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
BloodStainedCrow committed Apr 20, 2023
1 parent 379c4e7 commit 7cbc2a8
Show file tree
Hide file tree
Showing 163 changed files with 1,196 additions and 1,298 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug-report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ body:
attributes:
label: Version
description: |
What [version of the firmware](https://github.com/JF002/InfiniTime/blob/develop/doc/gettingStarted/gettingStarted-1.0.md#how-to-check-the-version-of-infinitime-and-the-bootloader) are you running?
If you are running an older version, please consider [updating to the latest firmware](https://github.com/JF002/InfiniTime/blob/develop/doc/gettingStarted/gettingStarted-1.0.md#how-to-update-your-pinetime).
What [version of the firmware](https://github.com/InfiniTimeOrg/InfiniTime/blob/main/doc/gettingStarted/updating-software.md#checking-the-version-of-infinitime) are you running?
If you are running an older version, please consider [updating to the latest firmware](https://github.com/InfiniTimeOrg/InfiniTime/blob/main/doc/gettingStarted/updating-software.md#updating-with-companion-apps).
If you are running directly from git, specify the branch or the commit hash directly.
placeholder: "Ex. v1.6.0 or develop or fc922b60"
placeholder: "Ex. v1.11.0 or main or fc922b60"
validations:
required: true
- type: input
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/issue-report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ body:
attributes:
label: Version
description: |
What [version of the firmware](https://github.com/JF002/InfiniTime/blob/develop/doc/gettingStarted/gettingStarted-1.0.md#how-to-check-the-version-of-infinitime-and-the-bootloader) are you running?
If you are running an older version, please consider [updating to the latest firmware](https://github.com/JF002/InfiniTime/blob/develop/doc/gettingStarted/gettingStarted-1.0.md#how-to-update-your-pinetime).
What [version of the firmware](https://github.com/InfiniTimeOrg/InfiniTime/blob/main/doc/gettingStarted/updating-software.md#checking-the-version-of-infinitime) are you running?
If you are running an older version, please consider [updating to the latest firmware](https://github.com/InfiniTimeOrg/InfiniTime/blob/main/doc/gettingStarted/updating-software.md#updating-with-companion-apps).
If you are running directly from git, specify the branch or the commit hash directly.
placeholder: Ex. v1.6.0 or develop or fc922b60
placeholder: Ex. v1.11.0 or main or fc922b60
validations:
required: false
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Build and push Docker image

on:
push:
branches: [ develop ]
branches: [ main ]
paths:
- 'docker/**'
pull_request:
branches: [ develop ]
branches: [ main ]
paths:
- 'docker/**'
# Allows you to run this workflow manually from the Actions tab
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Code formatting

on:
pull_request:
branches: [ develop ]
branches: [ main ]
paths:
- '**.cpp'
- '**.h'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: CI
# Run this workflow whenever the build may be affected
on:
push:
branches: [ master, develop ]
branches: [ main ]
paths-ignore:
- 'doc/**'
- '**.md'
pull_request:
branches: [ develop ]
branches: [ main ]
paths-ignore:
- 'doc/**'
- '**.md'
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/pr-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: PR comment

on:
pull_request_target:
branches: [ develop ]
branches: [ main ]
paths-ignore:
- 'doc/**'
- '**.md'
Expand All @@ -23,9 +23,16 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}

- if: steps.wait-for-build.outputs.conclusion != 'success'
run: exit 1
run: |
tee comment << EOF
Build checks have not completed. Possible reasons for this are:
1. The checks need to be approved by a maintainer
2. The branch has conflicts
3. The firmware build has failed
EOF
- name: Download artifact
- if: steps.wait-for-build.outputs.conclusion == 'success'
name: Download artifact
uses: dawidd6/action-download-artifact@bd10f381a96414ce2b13a11bfa89902ba7cea07f
with:
workflow: main.yml
Expand All @@ -39,7 +46,6 @@ jobs:
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Build size and comparison to

- name: Create or update comment
uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808
Expand Down
5 changes: 1 addition & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
[submodule "src/libs/lvgl"]
path = src/libs/lvgl
url = https://github.com/joaquimorg/lvgl.git
url = https://github.com/InfiniTimeOrg/lvgl.git
[submodule "src/libs/littlefs"]
path = src/libs/littlefs
url = https://github.com/littlefs-project/littlefs.git
[submodule "src/libs/QCBOR"]
path = src/libs/QCBOR
url = https://github.com/laurencelundblade/QCBOR.git
[submodule "src/libs/date"]
path = src/libs/date
url = https://github.com/HowardHinnant/date.git
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)

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

project(pinetime VERSION 1.11.0 LANGUAGES C CXX ASM)
project(pinetime VERSION 1.12.0 LANGUAGES C CXX ASM)

set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 14)
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Here are things you can do to help.
- [Write and improve documentation](#documentation)
- [Fix bugs, add functionalities and improve the code](#how-to-create-a-pull-request)
- Participate in the discussions within issues and PRs. Your feedback is appreciated!
- Review pull requests. Follow the instructions [here](maintainer-guide.md#reviewing-prs)
- Review pull requests. Follow the instructions [here](doc/maintainer-guide.md#reviewing-prs)

## Documentation

Expand All @@ -22,7 +22,7 @@ The workflow is based on [GitHub flow](https://docs.github.com/en/get-started/qu

To create a pull request,
you need a [fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks) of the repo.
Create a new [branch](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches) from develop,
Create a new [branch](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches) from main,
make changes in this branch,
[commit](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/about-commits) them,
and create a [pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
Expand All @@ -31,11 +31,11 @@ and create a [pull request](https://docs.github.com/en/pull-requests/collaborati

When making changes to the firmware:

- Consider if your feature aligns with the [InfiniTime vision](InfiniTimeVision.md)
- Consider if your feature aligns with the [InfiniTime vision](doc/InfiniTimeVision.md)
- Test your changes on a PineTime or InfiniSim
- Make sure the code conforms to the [coding conventions](coding-convention.md)
- Make sure the code conforms to the [coding conventions](doc/coding-convention.md)

You can also check the [maintainer's guide](maintainer-guide.md)
You can also check the [maintainer's guide](doc/maintainer-guide.md)
for what maintainers will look at in PRs.

### Commit conventions
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# [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)

![InfiniTime logo](doc/logo/infinitime-logo-small.jpg "InfiniTime Logo")

Fast open-source firmware for the [PineTime smartwatch](https://www.pine64.org/pinetime/) with many features, written in modern C++.
Expand Down
2 changes: 1 addition & 1 deletion doc/ExternalResources.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This page describes how the resources are integrated in InfiniTime from a develo

## Resources generation

Resources are generated at build time via the [CMake target `Generate Resources`](https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/src/resources/CMakeLists.txt#L19).
Resources are generated at build time via the [CMake target `Generate Resources`](https://github.com/InfiniTimeOrg/InfiniTime/blob/main/src/resources/CMakeLists.txt#L19).
It runs 3 Python scripts that respectively convert the fonts to binary format, convert the images to binary format and package everything in a .zip file.

The resulting file `infinitime-resources-x.y.z.zip` contains the images and fonts converted in binary `.bin` files and a JSON file `resources.json`.
Expand Down
4 changes: 2 additions & 2 deletions doc/MemoryAnalysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ In Infinitime 1.1, the biggest buffers are the buffers allocated for LVGL (14KB)

### Stack

The stack will be used for everything except tasks, which have their own stack allocated by FreeRTOS. The stack is 8192B and is allocated in the [linker script](https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/nrf_common.ld#L148).
The stack will be used for everything except tasks, which have their own stack allocated by FreeRTOS. The stack is 8192B and is allocated in the [linker script](https://github.com/InfiniTimeOrg/InfiniTime/blob/main/nrf_common.ld#L148).
An easy way to monitor its usage is by filling the section with a known pattern at boot time, then use the firmware and dump the memory. You can then check the maximum stack usage by checking the address from the beginning of the stack that were overwritten.

#### Fill the stack section by a known pattern:
Expand Down Expand Up @@ -216,7 +216,7 @@ According to my experimentations, we don't use the stack that much, and 8192 byt

### Heap

The heap is declared in the [linker script](https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/nrf_common.ld#L136) and its current size is 8192 bytes. The heap is used for dynamic memory allocation(`malloc()`, `new`...).
The heap is declared in the [linker script](https://github.com/InfiniTimeOrg/InfiniTime/blob/main/nrf_common.ld#L136) and its current size is 8192 bytes. The heap is used for dynamic memory allocation(`malloc()`, `new`...).

Heap monitoring is not easy, but it seems that we can use the following code to know the current usage of the heap:

Expand Down
16 changes: 7 additions & 9 deletions doc/branches.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Branches

The branching model of this project is based on the workflow named [Git flow](https://nvie.com/posts/a-successful-git-branching-model/).
The project has 1 main branch, aptly called **main**.
This branch contains the latest development that will be tagged for the next release once it's considered stable.

The project is based on 2 main branches:
New features should be implemented in **feature branches** created from **main**.
When the feature is ready, a pull request is created and it'll be merged into **main** when it is successfully reviewed and accepted.

- **master** : this branch is always ready to be deployed. It means that at any time, we should be able to build the branch and release a new version of the application.
- **develop** : this branch contains the latest development that will be integrated in the next release once it's considered as stable.
To release a new version of the application, when main is considered stable, a tag is created on the version bump commit in **main** and the release is generated (a tag is applied to git, the release note is finalized, binaries are built,...).

New features should be implemented in **feature branches** created from **develop**. When the feature is ready, a pull-request is created and it'll be merge into **develop** when it is successfully reviewed and accepted.

To release a new version of the application, when develop is considered stable, a **release** branch is created from **develop**. This can be considered as a *release candidate* branch. When everything is OK, this release branch is merged into **master** and the release is generated (a tag is applied to git, the release note is finalized, binaries are built,...) from **master**.

Git flow also supports the creation of **hotfix** branches when a bug is discovered in a released version. The **hotfix** branch is created from **master** and will be used only to implement a fix to this bug. Multiple hotfix branches can be created for the same release if multiple bugs are discovered.
We also supports the creation of **hotfix** branches when a bug is discovered in a released version. The **hotfix** branch is created from the latest tag and will be used only to implement a fix to this bug.
Multiple hotfix branches can be created for the same release if multiple bugs are discovered.
2 changes: 1 addition & 1 deletion doc/buildAndProgram.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ CMake configures the project according to variables you specify the command line
#### (\*) Note about **CMAKE_BUILD_TYPE**
By default, this variable is set to *Release*. It compiles the code with size and speed optimizations. We use this value for all the binaries we publish when we [release](https://github.com/InfiniTimeOrg/InfiniTime/releases) new versions of InfiniTime.
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/develop/src/displayapp/screens/Navigation.h#L148) application to free some memory.
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.

#### (\*\*) Note about **BUILD_DFU**
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.
Expand Down
2 changes: 1 addition & 1 deletion doc/buildWithVScode.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The .devcontainer folder contains the configuration and scripts for using a Dock

Using the [Remote-Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension is recommended. It will handle configuring the Docker virtual machine and setting everything up.

More documentation is available in the [readme for devcontainers](usingDevcontainers.md)
More documentation is available in the [readme in .devcontainer](../.devcontainer/README.md)

### DevContainer on Ubuntu

Expand Down
2 changes: 1 addition & 1 deletion doc/versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
The versioning of this project is based on [Semantic versioning](https://semver.org/):

- 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 a new version with new features is released. 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 tag of a commit in **main**.
- 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.
17 changes: 4 additions & 13 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ list(APPEND SOURCE_FILES
components/firmwarevalidator/FirmwareValidator.cpp
components/motor/MotorController.cpp
components/settings/Settings.cpp
components/timer/TimerController.cpp
components/timer/Timer.cpp
components/alarm/AlarmController.cpp
components/fs/FS.cpp
drivers/Cst816s.cpp
Expand Down Expand Up @@ -537,7 +537,7 @@ list(APPEND RECOVERY_SOURCE_FILES
components/ble/MotionService.cpp
components/firmwarevalidator/FirmwareValidator.cpp
components/settings/Settings.cpp
components/timer/TimerController.cpp
components/timer/Timer.cpp
components/alarm/AlarmController.cpp
drivers/Cst816s.cpp
FreeRTOS/port.c
Expand Down Expand Up @@ -653,19 +653,11 @@ set(INCLUDE_FILES
components/ble/MotionService.h
components/ble/weather/WeatherService.h
components/settings/Settings.h
components/timer/TimerController.h
components/timer/Timer.h
components/alarm/AlarmController.h
drivers/Cst816s.h
FreeRTOS/portmacro.h
FreeRTOS/portmacro_cmsis.h
libs/date/include/date/tz.h
libs/date/include/date/chrono_io.h
libs/date/include/date/date.h
libs/date/include/date/islamic.h
libs/date/include/date/iso_week.h
libs/date/include/date/julian.h
libs/date/include/date/ptz.h
libs/date/include/date/tz_private.h
displayapp/LittleVgl.h
displayapp/InfiniTimeTheme.h
systemtask/SystemTask.h
Expand All @@ -690,7 +682,6 @@ include_directories(
include_directories(SYSTEM
libs/
FreeRTOS/
libs/date/include
libs/mynewt-nimble/porting/npl/freertos/include
libs/mynewt-nimble/nimble/include
libs/mynewt-nimble/porting/nimble/include
Expand Down Expand Up @@ -781,7 +772,7 @@ link_directories(


set(COMMON_FLAGS -MP -MD -mthumb -mabi=aapcs -ftree-vrp -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin -fshort-enums -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fstack-usage -fno-exceptions -fno-non-call-exceptions)
set(WARNING_FLAGS -Wall -Wextra -Warray-bounds=2 -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wformat-nonliteral -Wno-missing-field-initializers -Wno-unknown-pragmas -Wno-expansion-to-defined -Wreturn-type -Werror=return-type)
set(WARNING_FLAGS -Wall -Wextra -Warray-bounds=2 -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wformat-nonliteral -Wno-missing-field-initializers -Wno-unknown-pragmas -Wno-expansion-to-defined -Wreturn-type -Werror=return-type -Werror)
set(DEBUG_FLAGS -Og -g3)
set(RELEASE_FLAGS -Os)
set(CXX_FLAGS -fno-rtti)
Expand Down
1 change: 0 additions & 1 deletion src/components/alarm/AlarmController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,4 @@ void AlarmController::StopAlerting() {
// set next instance
ScheduleAlarm();
}
systemTask->PushMessage(System::Messages::StopRinging);
}
12 changes: 1 addition & 11 deletions src/components/battery/BatteryController.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "components/battery/BatteryController.h"
#include "components/utility/LinearApproximation.h"
#include "utility/LinearApproximation.h"
#include "drivers/PinMap.h"
#include <hal/nrf_gpio.h>
#include <nrfx_saadc.h>
Expand Down Expand Up @@ -81,20 +81,10 @@ void Battery::SaadcEventHandler(nrfx_saadc_evt_t const* p_event) {
newPercent = std::min(approx.GetValue(voltage), isCharging ? uint8_t {99} : uint8_t {100});
}

if (isPowerPresent) {
batteryLowNotified = false;
}

if ((isPowerPresent && newPercent > percentRemaining) || (!isPowerPresent && newPercent < percentRemaining) || firstMeasurement) {
firstMeasurement = false;
percentRemaining = newPercent;
systemTask->PushMessage(System::Messages::BatteryPercentageUpdated);

// warn about low battery when not charging and below threshold
if (BatteryIsLow() && !isPowerPresent && !batteryLowNotified) {
systemTask->PushMessage(System::Messages::LowBattery);
batteryLowNotified = true;
}
}

nrfx_saadc_uninit();
Expand Down
7 changes: 0 additions & 7 deletions src/components/battery/BatteryController.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ namespace Pinetime {
return percentRemaining;
}

bool BatteryIsLow() const {
return percentRemaining <= lowBatteryThreshold;
}

uint16_t Voltage() const {
return voltage;
}
Expand All @@ -43,7 +39,6 @@ namespace Pinetime {
static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7;
uint16_t voltage = 0;
uint8_t percentRemaining = 0;
bool batteryLowNotified = false;

bool isFull = false;
bool isCharging = false;
Expand All @@ -55,8 +50,6 @@ namespace Pinetime {
void SaadcEventHandler(nrfx_saadc_evt_t const* p_event);
static void AdcCallbackStatic(nrfx_saadc_evt_t const* event);

static constexpr uint8_t lowBatteryThreshold {15};

bool isReading = false;

Pinetime::System::SystemTask* systemTask = nullptr;
Expand Down
Loading

0 comments on commit 7cbc2a8

Please sign in to comment.