Compare commits

...

10 commits

Author SHA1 Message Date
Dom Rodriguez a9a36793ad
feat: Introduce Flake for development and builds
Some checks are pending
CI / build-firmware (push) Waiting to run
CI / build-simulator (push) Waiting to run
CI / get-base-ref-size (push) Waiting to run
CI / Compare build size (push) Blocked by required conditions
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from #1850 and
c57c57f3c6.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes #1850.

Signed-off-by: Dom Rodriguez <shymega@shymega.org.uk>
2024-09-14 14:27:43 +01:00
mark9064 c8236afbef Restrict debugging monitor to debug builds 2024-09-14 12:10:55 +02:00
mark9064 5040733a97 Clean unused DisplayApp messages 2024-09-14 12:10:14 +02:00
mark9064 fd019c7aad Use DirtyValue for timer 2024-09-14 11:20:47 +02:00
mark9064 975bfc5420 Size optimise NRF SDK build 2024-09-14 11:19:34 +02:00
Victor Kareh 2625ed39e5 DisplayApp: Go to clock on sleep if no app loaded
When turning off the screen, if there is no actual app loaded (i.e. we
are still in the Launcher, Notifications, QuickSettings, or Settings
screens) we should just reload the Clock app directly.
2024-08-22 17:34:25 +02:00
Derry Tutt a3dbcd62f6
Documentation improvements (#2091)
Add documentation about watch faces and applications.
Update getting started documentation.

Co-authored-by: tituscmd <154823939+tituscmd@users.noreply.github.com>
2024-08-18 16:18:15 +02:00
mark9064 4fddf93114 Advertise HR service 2024-08-18 12:00:13 +02:00
Derry Tutt 83922fb3de Remove space before colon 2024-08-18 11:58:56 +02:00
Felipe Martínez 95917c65a5 Update main.yml 2024-08-18 11:55:03 +02:00
51 changed files with 380 additions and 72 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

View file

@ -56,6 +56,11 @@ jobs:
with:
name: InfiniTime MCUBoot image ${{ github.head_ref }}
path: ./build/output/pinetime-mcuboot-app-image-*.bin
- name: Upload standalone ELF artifacts
uses: actions/upload-artifact@v3
with:
name: InfiniTime image ${{ github.head_ref }}
path: ./build/output/src/pinetime-app-*.out
- name: Upload resources artifacts
uses: actions/upload-artifact@v3
with:

View file

@ -9,6 +9,8 @@ Fast open-source firmware for the [PineTime smartwatch](https://pine64.org/devic
- [Getting started with InfiniTime](doc/gettingStarted/gettingStarted-1.0.md)
- [Updating the software](doc/gettingStarted/updating-software.md)
- [About the firmware and bootloader](doc/gettingStarted/about-software.md)
- [Available apps](doc/gettingStarted/Applications.md)
- [Available watch faces](/doc/gettingStarted/Watchfaces.md)
- [PineTimeStyle Watch face](https://pine64.org/documentation/PineTime/Watchfaces/PineTimeStyle)
- [Weather integration](https://pine64.org/documentation/PineTime/Software/InfiniTime_weather/)
@ -35,7 +37,7 @@ Fast open-source firmware for the [PineTime smartwatch](https://pine64.org/devic
### Contributing
- [How to contribute?](CONTRIBUTING.md)
- [How to contribute](CONTRIBUTING.md)
- [Coding conventions](doc/coding-convention.md)
### Build, flash and debug

10
default.nix Normal file
View file

@ -0,0 +1,10 @@
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).defaultNix

View file

@ -0,0 +1,99 @@
# Applications
InfiniTime has 13 apps on the `main` branch at the time of writing.
## List of apps
- Stopwatch
- Alarm
- Timer
- Steps
- Heartrate
- Music
- InfiniPaint
- Paddle
- 2
- InfiniDice
- Metronome
- Maps
- Weather
### Stopwatch
![Stopwatch UI](/doc/gettingStarted/AppsScreenshots/stopwatch.png)
- Press the Start button (bottom right) to start or stop the timer.
- You can also press the side button while the timer is running to pause the timer.
- Press the Flag button (bottom left) to add a lap.
- The stopwatch will not yet continue counting time while the app is closed.
### Alarm
![Alarm UI](/doc/gettingStarted/AppsScreenshots/alarm.png)
- Ajust the time with the time picker.
- Press the Info button in the top middle to see time remaning.
- Use the toggle in the bottom left to turn the alarm on/off.
- Use the button in the bottom right to change the alarm frequency.
- You can choose between once, daily, or Monday - Friday.
### Timer
![Timer UI](/doc/gettingStarted/AppsScreenshots/timer.png)
- Ajust how long the timer should go for with the time picker.
- Press the Start button at the bottom to start/stop the timer.
### Steps
![Steps UI](/doc/gettingStarted/AppsScreenshots/steps.png)
- The total count of steps for the current display will show in the middle of the screen.
- The Reset button in the bottom middle resets the Trip counter. (Total of all steps taken.)
- The progress circle shows the percentage of your daily goal completed.
### Heartrate
![Heartrate UI](/doc/gettingStarted/AppsScreenshots/Heartrate.png)
- Press Start to start measuring your heartrate.
- It may take a bit to get the first measurement.
### Music
![Music UI](/doc/gettingStarted/AppsScreenshots/Music.png)
- This app shows currently playing music.
- Please note that this app is not very useful without a device connected.
- Press the button in the center to play/pause, and the buttons on the left and right to go to the previous and next tracks, respectively.
- Swipe up to get to volume controls.
### InfiniPaint
![InfiniPaint UI](/doc/gettingStarted/AppsScreenshots/Paint.png)
- This app does not allow you to swipe from the top to exit, use the side button instead.
- Draw on the screen to add lines.
- Hold down in one spot to change paint colors.
### Paddle
![Paddle UI](/doc/gettingStarted/AppsScreenshots/Pong.png)
- This app does not allow you to swipe from the top to exit, use the side button instead.
- Drag your finger to move the paddle.
- Goal: Don't let the ball go off the left side of the screen.
### 2
![2 UI](/doc/gettingStarted/AppsScreenshots/2048.png)
- This app does not allow you to swipe from the top to exit, use the side button instead.
- Play a game of 2048.
- Swipe up, down, left, or right tomove the tiles.
- When two tiles with the same number run into each other, they will add together.
- Goal: Don't let the screen fill up with tiles, and get to the 2048 tile to win.
### InfiniDice
![InfiniDice UI](/doc/gettingStarted/AppsScreenshots/Dice.png)
- Ajust the count to change the number of dice.
- Ajust the sides to change the number of sides.
- Press the button at the bottom to roll.
- The result will be on the right side of the screen.
### Metronome
![Metronome UI](/doc/gettingStarted/AppsScreenshots/Metronome.png)
- Ajust the BPM with the circular slider.
- A bug currently makes it always snap to 98 BPM.
- Use the button in the bottom left to start the metronome.
### Maps
![Maps UI](/doc/gettingStarted/AppsScreenshots/Maps.png)
- This app shows info from a navigation app.
- Please note that this app is not very useful without a device connected.
### Weather
![Weather UI](/doc/gettingStarted/AppsScreenshots/Weather.png)
- This app shows weather info.
- Please note that this app is not very useful without a device connected.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

@ -0,0 +1,31 @@
# Watchfaces
InfiniTime has 6 apps on the `main` branch at the time of writing.
## List of apps
- Digital
- Analog
- PineTimeStyle
- Terminal
- Infinineat
- Casio G7710
### Digital
![Digital face](/doc/gettingStarted/Watchfaces/Digital.png)
### Analog
![Analog face](/doc/gettingStarted/Watchfaces/Analog.png)
### PineTimeStyle
![PineTimeStyle face](/doc/gettingStarted/Watchfaces/PineTimeStyle.png)
- You can long-press on the display to change colors, step style, and weather.
### Terminal
![Terminal face](/doc/gettingStarted/Watchfaces/Terminal.png)
### Infinineat
![Infinineat face](/doc/gettingStarted/Watchfaces/Infinineat.png)
- You can long-press on the display to change colors.
### Casio G7710
![Casio G7710 face](/doc/gettingStarted/Watchfaces/CasioG7710.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 256 KiB

View file

@ -14,7 +14,7 @@ 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/
- [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)
@ -46,7 +46,7 @@ On the bottom right, you can see how many steps you have taken today.
![Settings](ui/settings.jpg)
- 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 **down** to display the notification panel. Notifications sent by your companion app will be displayed here.
- Swipe **right** to display the Quick Actions menu. This menu allows you to
- Set the brightness of the display
- Start the **flashlight** app

View file

@ -1,29 +1,35 @@
# Connecting to Gadgetbridge
Launch Gadgetbridge and tap on the **"+"** button on the bottom right to add a new device:
Launch Gadgetbridge and tap on the menu button in the top left:
![Gadgetbridge 0](gadgetbridge0.jpg)
Wait for the scan to complete, your PineTime should be detected:
Press the "Connect new device" button:
![Gadgetbridge 1](gadgetbridge1.jpg)
Your PineTime should appear on the list. Tap on it.
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:
Now that Gadgetbridge is connected to your PineTime, press the three dots on the device card:
![Gadgetbridge 3](gadgetbridge3.jpg)
Read the warning carefully and tap **Install**:
Now press the "File Installer" button:
![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.
Select the firmware you downloaded (`pinetime-mcuboot-app-dfu-x.x.x.zip`) from the [Releases tab](https://github.com/InfiniTimeOrg/InfiniTime/releases/latest):
![Gadgetbridge 5](gadgetbridge5.jpg)
Wait for the transfer to finish. There will be a progress bar on both the watch and the phone. Your PineTime should 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 scroll to the Firmware option and click **validate**. Otherwise, after reboot the previous firmware will be used.
![Validate](validate.png)

View file

@ -6,7 +6,7 @@ If you just want to flash or upgrade InfiniTime on your PineTime, this page is f
You can check the InfiniTime version by first swiping right on the watch face 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)
![InfiniTime 1.14 version](version.png)
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)
@ -49,7 +49,7 @@ Since those resources are not part of the firmware, they need to be flashed and
Resources are packaged into a single .zip file named `infinitime-resources-x.y.z.zip` (where `x`, `y` and `z` are the version numbers of InfiniTime).
You can use the companion app of your choice to flash the resources.
**Note : at the time of writing this page, [Amazfish](https://github.com/piggz/harbour-amazfish) and [ITD](https://gitea.arsenm.dev/Arsen6331/itd) have already integrated this functionality. Other companion apps will hopefully implement it soon!*
**Note: at the time of writing this page, [Amazfish](https://github.com/piggz/harbour-amazfish) and [ITD](https://gitea.arsenm.dev/Arsen6331/itd) have already integrated this functionality. Other companion apps will hopefully implement it soon!*
## Amazfish
Use the `Download file` functionality of Amazfish.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

42
flake.lock Normal file
View file

@ -0,0 +1,42 @@
{
"nodes": {
"flake-compat": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1725634671,
"narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

113
flake.nix Normal file
View file

@ -0,0 +1,113 @@
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
};
outputs = { self, ... }@inputs:
let
forAllSystems = function:
inputs.nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
]
(system: function (import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
}));
in
{
packages = forAllSystems (pkgs:
let
infinitime-nrf5-sdk = pkgs.nrf5-sdk.overrideAttrs (old: {
version = "15.3.0";
src = pkgs.fetchzip {
url = "https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/sdks/nrf5/binaries/nrf5sdk153059ac345.zip";
sha256 = "sha256-pfmhbpgVv5x2ju489XcivguwpnofHbgVA7bFUJRTj08=";
};
});
in
with pkgs; {
default = stdenv.mkDerivation rec {
name = "infinitime";
src = fetchFromGitHub {
owner = "InfiniTimeOrg";
repo = "InfiniTime";
rev = "1.14.1";
hash = "sha256-IrsN+9LgEjgfoRR6H7FhsdLMK+GLxc41IBnSbdpwv/E=";
fetchSubmodules = true;
};
nativeBuildInputs = [
cmake
nodePackages.lv_font_conv
python3
python3.pkgs.cbor
python3.pkgs.click
python3.pkgs.cryptography
python3.pkgs.intelhex
python3.pkgs.pillow
adafruit-nrfutil
patch
git
];
postPatch = ''
# /usr/bin/env is not available in the build sandbox
substituteInPlace src/displayapp/fonts/generate.py --replace "'/usr/bin/env', 'patch'" "'patch'"
substituteInPlace tools/mcuboot/imgtool.py --replace "/usr/bin/env python3" "${python3}/bin/python3"
'';
cmakeFlags = [
''-DARM_NONE_EABI_TOOLCHAIN_PATH=${gcc-arm-embedded-10}''
''-DNRF5_SDK_PATH=${infinitime-nrf5-sdk}/share/nRF5_SDK''
''-DBUILD_DFU=1''
''-DBUILD_RESOURCES=1''
''-DCMAKE_SOURCE_DIR=${src}''
];
installPhase = ''
SOURCES_DIR=${src} BUILD_DIR=. OUTPUT_DIR=$out ./post_build.sh
'';
};
});
devShells = forAllSystems (pkgs:
let
infinitime-nrf5-sdk = pkgs.nrf5-sdk.overrideAttrs (old: {
version = "15.3.0";
src = pkgs.fetchzip {
url = "https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/sdks/nrf5/binaries/nrf5sdk153059ac345.zip";
sha256 = "sha256-pfmhbpgVv5x2ju489XcivguwpnofHbgVA7bFUJRTj08=";
};
});
in
{
default =
pkgs.buildFHSUserEnv {
name = "infinitime-devenv";
# build tools
targetPkgs = pkgs: (with pkgs; [
cmake
nodePackages.lv_font_conv
python3
python3.pkgs.cbor
python3.pkgs.click
python3.pkgs.cryptography
python3.pkgs.intelhex
adafruit-nrfutil
(pkgs.writeShellScriptBin "cmake_infinitime" ''
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH="${pkgs.gcc-arm-embedded-10}" \
-DNRF5_SDK_PATH="${infinitime-nrf5-sdk}/share/nRF5_SDK" \
"$@"
'')
]);
};
});
};
}

10
shell.nix Normal file
View file

@ -0,0 +1,10 @@
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).shellNix

View file

@ -860,7 +860,6 @@ target_compile_options(nrf-sdk PRIVATE
$<$<CONFIG:RELEASE>: ${RELEASE_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
-O3
)
# NimBLE

View file

@ -77,6 +77,10 @@ namespace Pinetime {
uint16_t ComputeCrc(uint8_t const* p_data, uint32_t size, uint16_t const* p_crc);
};
static constexpr ble_uuid128_t serviceUuid {
.u {.type = BLE_UUID_TYPE_128},
.value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x30, 0x15, 0x00, 0x00}};
private:
Pinetime::System::SystemTask& systemTask;
Pinetime::Controllers::Ble& bleController;
@ -90,10 +94,6 @@ namespace Pinetime {
uint16_t revision {0x0008};
static constexpr ble_uuid128_t serviceUuid {
.u {.type = BLE_UUID_TYPE_128},
.value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x30, 0x15, 0x00, 0x00}};
static constexpr ble_uuid128_t packetCharacteristicUuid {
.u {.type = BLE_UUID_TYPE_128},
.value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x32, 0x15, 0x00, 0x00}};

View file

@ -21,14 +21,14 @@ namespace Pinetime {
void SubscribeNotification(uint16_t attributeHandle);
void UnsubscribeNotification(uint16_t attributeHandle);
static constexpr uint16_t heartRateServiceId {0x180D};
static constexpr ble_uuid16_t heartRateServiceUuid {.u {.type = BLE_UUID_TYPE_16}, .value = heartRateServiceId};
private:
NimbleController& nimble;
Controllers::HeartRateController& heartRateController;
static constexpr uint16_t heartRateServiceId {0x180D};
static constexpr uint16_t heartRateMeasurementId {0x2A37};
static constexpr ble_uuid16_t heartRateServiceUuid {.u {.type = BLE_UUID_TYPE_16}, .value = heartRateServiceId};
static constexpr ble_uuid16_t heartRateMeasurementUuid {.u {.type = BLE_UUID_TYPE_16}, .value = heartRateMeasurementId};
struct ble_gatt_chr_def characteristicDefinition[2];

View file

@ -158,7 +158,10 @@ void NimbleController::StartAdvertising() {
}
fields.flags = BLE_HS_ADV_F_DISC_GEN | BLE_HS_ADV_F_BREDR_UNSUP;
fields.uuids128 = &dfuServiceUuid;
fields.uuids16 = &HeartRateService::heartRateServiceUuid;
fields.num_uuids16 = 1;
fields.uuids16_is_complete = 1;
fields.uuids128 = &DfuService::serviceUuid;
fields.num_uuids128 = 1;
fields.uuids128_is_complete = 1;
fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO;

View file

@ -112,10 +112,6 @@ namespace Pinetime {
uint16_t connectionHandle = BLE_HS_CONN_HANDLE_NONE;
uint8_t fastAdvCount = 0;
uint8_t bondId[16] = {0};
ble_uuid128_t dfuServiceUuid {
.u {.type = BLE_UUID_TYPE_128},
.value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x30, 0x15, 0x00, 0x00}};
};
static NimbleController* nptr;

View file

@ -209,21 +209,6 @@ void DisplayApp::Refresh() {
LoadScreen(returnAppStack.Pop(), returnDirection);
};
auto DimScreen = [this]() {
if (brightnessController.Level() != Controllers::BrightnessController::Levels::Off) {
isDimmed = true;
brightnessController.Set(Controllers::BrightnessController::Levels::Low);
}
};
auto RestoreBrightness = [this]() {
if (brightnessController.Level() != Controllers::BrightnessController::Levels::Off) {
isDimmed = false;
lv_disp_trig_activity(nullptr);
ApplyBrightness();
}
};
auto IsPastDimTime = [this]() -> bool {
return lv_disp_get_inactive_time(nullptr) >= pdMS_TO_TICKS(settingsController.GetScreenTimeOut() - 2000);
};
@ -267,14 +252,16 @@ void DisplayApp::Refresh() {
if (!systemTask->IsSleepDisabled() && IsPastDimTime()) {
if (!isDimmed) {
DimScreen();
isDimmed = true;
brightnessController.Set(Controllers::BrightnessController::Levels::Low);
}
if (IsPastSleepTime()) {
systemTask->PushMessage(System::Messages::GoToSleep);
state = States::Idle;
}
} else if (isDimmed) {
RestoreBrightness();
isDimmed = false;
ApplyBrightness();
}
break;
default:
@ -285,23 +272,32 @@ void DisplayApp::Refresh() {
Messages msg;
if (xQueueReceive(msgQueue, &msg, queueTimeout) == pdTRUE) {
switch (msg) {
case Messages::DimScreen:
DimScreen();
break;
case Messages::GoToSleep:
while (brightnessController.Level() != Controllers::BrightnessController::Levels::Low) {
brightnessController.Lower();
vTaskDelay(100);
}
// Don't actually turn off the display for AlwaysOn mode
// Turn brightness down (or set to AlwaysOn mode)
if (settingsController.GetAlwaysOnDisplay()) {
brightnessController.Set(Controllers::BrightnessController::Levels::AlwaysOn);
} else {
brightnessController.Set(Controllers::BrightnessController::Levels::Off);
}
// Since the active screen is not really an app, go back to Clock.
if (currentApp == Apps::Launcher || currentApp == Apps::Notifications || currentApp == Apps::QuickSettings ||
currentApp == Apps::Settings) {
LoadScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None);
// Wait for the clock app to load before moving on.
while (!lv_task_handler()) {
};
}
// Turn LCD display off (or set to low power for AlwaysOn mode)
if (settingsController.GetAlwaysOnDisplay()) {
lcd.LowPowerOn();
// Record idle entry time
alwaysOnTickCount = 0;
alwaysOnStartTime = xTaskGetTickCount();
} else {
brightnessController.Set(Controllers::BrightnessController::Levels::Off);
lcd.Sleep();
}
PushMessageToSystemTask(Pinetime::System::Messages::OnDisplayTaskSleeping);
@ -321,8 +317,7 @@ void DisplayApp::Refresh() {
state = States::Running;
break;
case Messages::UpdateBleConnection:
// clockScreen.SetBleConnectionState(bleController.IsConnected() ? Screens::Clock::BleConnectionStates::Connected :
// Screens::Clock::BleConnectionStates::NotConnected);
// Only used for recovery firmware
break;
case Messages::NewNotification:
LoadNewScreen(Apps::NotificationsPreview, DisplayApp::FullRefreshDirections::Down);
@ -437,16 +432,11 @@ void DisplayApp::Refresh() {
case Messages::BleRadioEnableToggle:
PushMessageToSystemTask(System::Messages::BleRadioEnableToggle);
break;
case Messages::UpdateDateTime:
// Added to remove warning
// What should happen here?
break;
case Messages::Chime:
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None);
motorController.RunForDuration(35);
break;
case Messages::OnChargingEvent:
RestoreBrightness();
motorController.RunForDuration(15);
break;
}

View file

@ -7,7 +7,6 @@ namespace Pinetime {
enum class Messages : uint8_t {
GoToSleep,
GoToRunning,
UpdateDateTime,
UpdateBleConnection,
TouchEvent,
ButtonPushed,
@ -17,7 +16,8 @@ namespace Pinetime {
NewNotification,
TimerDone,
BleFirmwareUpdateStarted,
DimScreen,
// Resets the screen timeout timer when awake
// Does nothing when asleep
NotifyDeviceActivity,
ShowPairingKey,
AlarmTriggered,

View file

@ -17,8 +17,8 @@ namespace {
FirmwareValidation::FirmwareValidation(Pinetime::Controllers::FirmwareValidator& validator) : validator {validator} {
labelVersion = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text_fmt(labelVersion,
"Version : %lu.%lu.%lu\n"
"ShortRef : %s",
"Version: %lu.%lu.%lu\n"
"ShortRef: %s",
Version::Major(),
Version::Minor(),
Version::Patch(),

View file

@ -104,9 +104,7 @@ void Timer::UpdateMask() {
void Timer::Refresh() {
if (timer.IsRunning()) {
auto secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(timer.GetTimeRemaining());
minuteCounter.SetValue(secondsRemaining.count() / 60);
secondCounter.SetValue(secondsRemaining.count() % 60);
DisplayTime();
} else if (buttonPressing && xTaskGetTickCount() > pressTime + pdMS_TO_TICKS(150)) {
lv_label_set_text_static(txtPlayPause, "Reset");
maskPosition += 15;
@ -119,6 +117,14 @@ void Timer::Refresh() {
}
}
void Timer::DisplayTime() {
displaySeconds = std::chrono::duration_cast<std::chrono::seconds>(timer.GetTimeRemaining());
if (displaySeconds.IsUpdated()) {
minuteCounter.SetValue(displaySeconds.Get().count() / 60);
secondCounter.SetValue(displaySeconds.Get().count() % 60);
}
}
void Timer::SetTimerRunning() {
minuteCounter.HideControls();
secondCounter.HideControls();
@ -133,9 +139,7 @@ void Timer::SetTimerStopped() {
void Timer::ToggleRunning() {
if (timer.IsRunning()) {
auto secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(timer.GetTimeRemaining());
minuteCounter.SetValue(secondsRemaining.count() / 60);
secondCounter.SetValue(secondsRemaining.count() % 60);
DisplayTime();
timer.StopTimer();
SetTimerStopped();
} else if (secondCounter.GetValue() + minuteCounter.GetValue() > 0) {
@ -147,7 +151,6 @@ void Timer::ToggleRunning() {
}
void Timer::Reset() {
minuteCounter.SetValue(0);
secondCounter.SetValue(0);
DisplayTime();
SetTimerStopped();
}

View file

@ -5,6 +5,7 @@
#include "systemtask/SystemTask.h"
#include "displayapp/LittleVgl.h"
#include "displayapp/widgets/Counter.h"
#include "utility/DirtyValue.h"
#include <lvgl/lvgl.h>
#include "components/timer/Timer.h"
@ -26,6 +27,7 @@ namespace Pinetime::Applications {
void SetTimerRunning();
void SetTimerStopped();
void UpdateMask();
void DisplayTime();
Pinetime::Controllers::Timer& timer;
lv_obj_t* btnPlayPause;
@ -43,6 +45,7 @@ namespace Pinetime::Applications {
bool buttonPressing = false;
lv_coord_t maskPosition = 0;
TickType_t pressTime = 0;
Utility::DirtyValue<std::chrono::seconds> displaySeconds;
};
}

View file

@ -1,5 +1,5 @@
#include "systemtask/SystemTask.h"
#if configUSE_TRACE_FACILITY == 1
#if NRF_LOG_ENABLED
// FreeRtosMonitor
#include <FreeRTOS.h>
#include <task.h>

View file

@ -194,7 +194,6 @@ void SystemTask::Work() {
if (!bleController.IsFirmwareUpdating()) {
doNotGoToSleep = false;
}
displayApp.PushMessage(Pinetime::Applications::Display::Messages::NotifyDeviceActivity);
break;
case Messages::DisableSleeping:
doNotGoToSleep = true;
@ -245,8 +244,6 @@ void SystemTask::Work() {
heartRateApp.PushMessage(Pinetime::Applications::HeartRateTask::Messages::GoToSleep);
break;
case Messages::OnNewTime:
displayApp.PushMessage(Pinetime::Applications::Display::Messages::NotifyDeviceActivity);
displayApp.PushMessage(Pinetime::Applications::Display::Messages::UpdateDateTime);
if (alarmController.State() == Controllers::AlarmController::AlarmState::Set) {
alarmController.ScheduleAlarm();
}
@ -255,8 +252,6 @@ void SystemTask::Work() {
if (settingsController.GetNotificationStatus() == Pinetime::Controllers::Settings::Notification::On) {
if (state == SystemTaskState::Sleeping) {
GoToRunning();
} else {
displayApp.PushMessage(Pinetime::Applications::Display::Messages::NotifyDeviceActivity);
}
displayApp.PushMessage(Pinetime::Applications::Display::Messages::NewNotification);
}