Skip to content

Commit 73d3e41

Browse files
committed
Merge branch 'develop' into pinmap
2 parents 8390d0e + c9aeef9 commit 73d3e41

17 files changed

Lines changed: 71 additions & 86 deletions

File tree

.github/workflows/main.yml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444

4545
- name: Install Embedded Arm Toolchain arm-none-eabi-gcc
4646
if: steps.cache-toolchain.outputs.cache-hit != 'true' # Install toolchain if not found in cache
47-
uses: fiam/arm-none-eabi-gcc@v1.0.2
47+
uses: fiam/arm-none-eabi-gcc@v1.0.4
4848
with:
4949
# GNU Embedded Toolchain for Arm release name, in the V-YYYY-qZ format (e.g. "9-2019-q4")
5050
release: 9-2020-q2
@@ -83,10 +83,11 @@ jobs:
8383
if: steps.cache-mcuboot.outputs.cache-hit != 'true' # Install MCUBoot if not found in cache
8484
run: |
8585
cd ${{ runner.temp }}
86-
git clone --branch v1.5.0 https://github.com/JuulLabs-OSS/mcuboot
86+
git clone --branch v1.7.2 https://github.com/mcu-tools/mcuboot
8787
8888
- name: Install imgtool dependencies
89-
run: pip3 install --user -r ${{ runner.temp }}/mcuboot/scripts/requirements.txt
89+
run: |
90+
pip3 install --user -r ${{ runner.temp }}/mcuboot/scripts/requirements.txt
9091
9192
- name: Install adafruit-nrfutil
9293
run: |
@@ -99,6 +100,8 @@ jobs:
99100

100101
- name: Checkout source files
101102
uses: actions/checkout@v2
103+
with:
104+
submodules: recursive
102105

103106
- name: Show files
104107
run: set ; pwd ; ls -l
@@ -110,7 +113,7 @@ jobs:
110113
run: |
111114
mkdir -p build
112115
cd build
113-
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=${{ runner.temp }}/arm-none-eabi -DNRF5_SDK_PATH=${{ runner.temp }}/nrf5_sdk -DUSE_OPENOCD=1 ../
116+
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=${{ runner.temp }}/arm-none-eabi -DNRF5_SDK_PATH=${{ runner.temp }}/nrf5_sdk -DUSE_OPENOCD=1 -DBUILD_DFU=1 ../
114117
115118
#########################################################################################
116119
# Make and Upload DFU Package
@@ -125,19 +128,10 @@ jobs:
125128
cd build
126129
make pinetime-mcuboot-app
127130
128-
- name: Create firmware image
129-
run: |
130-
# The generated firmware binary looks like "pinetime-mcuboot-app-0.8.2.bin"
131-
ls -l build/src/pinetime-mcuboot-app*.bin
132-
${{ runner.temp }}/mcuboot/scripts/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header build/src/pinetime-mcuboot-app*.bin build/src/pinetime-mcuboot-app-img.bin
133-
${{ runner.temp }}/mcuboot/scripts/imgtool.py verify build/src/pinetime-mcuboot-app-img.bin
134-
135-
- name: Create DFU package
131+
- name: Unzip DFU package
136132
run: |
137-
~/.local/bin/adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/src/pinetime-mcuboot-app-img.bin build/src/pinetime-mcuboot-app-dfu.zip
138-
unzip -v build/src/pinetime-mcuboot-app-dfu.zip
139133
# Unzip the package because Upload Artifact will zip up the files
140-
unzip build/src/pinetime-mcuboot-app-dfu.zip -d build/src/pinetime-mcuboot-app-dfu
134+
unzip build/src/pinetime-mcuboot-app-dfu*.zip -d build/src/pinetime-mcuboot-app-dfu
141135
142136
- name: Upload DFU package
143137
uses: actions/upload-artifact@v2

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.10)
2-
project(pinetime VERSION 1.3.0 LANGUAGES C CXX ASM)
2+
project(pinetime VERSION 1.4.0 LANGUAGES C CXX ASM)
33

44
set(CMAKE_C_STANDARD 99)
55
set(CMAKE_CXX_STANDARD 14)

README.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
1-
# PineTime
1+
# InfiniTime
22

33
[![Build PineTime Firmware](https://github.com/JF002/InfiniTime/workflows/Build%20PineTime%20Firmware/badge.svg?branch=master)](https://github.com/JF002/InfiniTime/actions)
44

5-
> The PineTime is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery as well as a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project, which means that it will ultimately be up to the developers and end-users to determine when they deem the PineTime ready to ship.
6-
7-
> We envision the PineTime as a companion for not only your PinePhone but also for your favorite devices — any phone, tablet, or even PC.
8-
9-
*https://www.pine64.org/pinetime/*
10-
11-
The **Pinetime** smartwatch is built around the NRF52832 MCU (512KB Flash, 64KB RAM), a 240*240 LCD display driven by the ST7789 controller, an accelerometer, a heart rate sensor, and a vibration motor.
12-
13-
# InfiniTime
14-
155
![InfiniTime logo](images/infinitime-logo.jpg "InfiniTime Logo")
166

17-
The goal of this project is to design an open-source firmware for the Pinetime smartwatch :
7+
The goal of this project is to design an open-source firmware for the [Pinetime smartwatch](https://www.pine64.org/pinetime/) :
188

199
- Code written in **modern C++**;
2010
- Build system based on **CMake**;
2111
- Based on **[FreeRTOS 10.0.0](https://freertos.org)** real-time OS.
2212
- Using **[LittleVGL/LVGL 7](https://lvgl.io/)** as UI library...
2313
- ... and **[NimBLE 1.3.0](https://github.com/apache/mynewt-nimble)** as BLE stack.
2414

15+
## New to InfiniTime?
16+
17+
- [Getting started with InfiniTime 1.0 (quick user guide, update bootloader and InfiniTime,...)](doc/gettingStarted/gettingStarted-1.0.md)
18+
- [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/ota-gadgetbridge-nrfconnect.md)
19+
2520
## Overview
2621

2722
![Pinetime screens](images/1.0.0/collage.png "PinetimeScreens")
@@ -70,16 +65,12 @@ As of now, here is the list of achievements of this project:
7065
* [Amazfish](https://openrepos.net/content/piggz/amazfish) (on SailfishOS and Linux)
7166
* [Siglo](https://github.com/alexr4535/siglo) (on Linux)
7267
* **[Experimental]** [WebBLEWatch](https://hubmartin.github.io/WebBLEWatch/) Synchronize time directly from your web browser. [video](https://youtu.be/IakiuhVDdrY)
68+
* **[Experimental]** [Infini-iOS](https://github.com/xan-m/Infini-iOS) (on iOS)
7369
- OTA (Over-the-air) update via BLE
7470
- [Bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader) based on [MCUBoot](https://juullabs-oss.github.io/mcuboot/)
7571

7672
## Documentation
7773

78-
### Getting started
79-
80-
- [Getting started with InfiniTime 1.0 (quick user guide, update bootloader and InfiniTime,...)](doc/gettingStarted/gettingStarted-1.0.md)
81-
- [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/ota-gadgetbridge-nrfconnect.md)
82-
8374
### Develop
8475

8576
- [Generate the fonts and symbols](src/displayapp/fonts/README.md)

doc/gettingStarted/ota-gadgetbridge-nrfconnect.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ Read carefully the warning and tap **Install**:
4747

4848
Wait for the transfer to finish. Your PineTime should reset and reboot with the new version of InfiniTime!
4949

50+
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.
51+
5052
![Gadgetbridge 5](gadgetbridge5.jpg)
5153

5254
### Using NRFConnect
@@ -64,6 +66,8 @@ Select **Distribution packet (ZIP)**:
6466

6567
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!
6668

69+
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.
70+
6771
![NRFConnect 3](nrfconnect3.jpg)
6872

6973
## How to flash InfiniTime using the SWD interface
@@ -88,6 +92,10 @@ If you are using OpenOCD with a STLinkV2, you can find more info [on this page](
8892
### Using Gadgetbridge
8993
Good news! Gadgetbridge **automatically** synchronizes the time when connecting to your PineTime!
9094

95+
### Using any Chromium-based web browser
96+
You can use it from your PC, Mac, Android. Browsers now have BLE support.
97+
https://hubmartin.github.io/WebBLEWatch/
98+
9199
### Using NRFConnect
92100
You must enable the **CTS** *GATT server* into NRFConnect so that InfiniTime can synchronize the time with your smartphone.
93101

src/components/battery/BatteryController.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ Battery* Battery::instance = nullptr;
1010

1111
Battery::Battery() {
1212
instance = this;
13-
}
14-
15-
void Battery::Init() {
16-
nrf_gpio_cfg_input(PinMap::Charging, static_cast<nrf_gpio_pin_pull_t> GPIO_PIN_CNF_PULL_Pullup);
13+
nrf_gpio_cfg_input(PinMap::Charging, static_cast<nrf_gpio_pin_pull_t> GPIO_PIN_CNF_PULL_Disabled);
1714
}
1815

1916
void Battery::Update() {
@@ -76,5 +73,11 @@ void Battery::SaadcEventHandler(nrfx_saadc_evt_t const* p_event) {
7673

7774
nrfx_saadc_uninit();
7875
isReading = false;
76+
77+
systemTask->PushMessage(System::Messages::BatteryMeasurementDone);
7978
}
8079
}
80+
81+
void Battery::Register(Pinetime::System::SystemTask* systemTask) {
82+
this->systemTask = systemTask;
83+
}

src/components/battery/BatteryController.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#pragma once
22
#include <cstdint>
33
#include <drivers/include/nrfx_saadc.h>
4-
#include <array>
5-
#include <numeric>
4+
#include <systemtask/SystemTask.h>
65

76
namespace Pinetime {
87
namespace Controllers {
@@ -11,8 +10,8 @@ namespace Pinetime {
1110
public:
1211
Battery();
1312

14-
void Init();
1513
void Update();
14+
void Register(System::SystemTask* systemTask);
1615

1716
uint8_t PercentRemaining() const {
1817
return percentRemaining;
@@ -47,6 +46,8 @@ namespace Pinetime {
4746
static void AdcCallbackStatic(nrfx_saadc_evt_t const* event);
4847

4948
bool isReading = false;
49+
50+
Pinetime::System::SystemTask* systemTask = nullptr;
5051
};
5152
}
5253
}

src/components/settings/Settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ namespace Pinetime {
114114
};
115115

116116
void setWakeUpMode(WakeUpMode wakeUp, bool enabled) {
117-
if (!isWakeUpModeOn(wakeUp)) {
117+
if (enabled != isWakeUpModeOn(wakeUp)) {
118118
settingsChanged = true;
119119
}
120120
settings.wakeUpMode.set(static_cast<size_t>(wakeUp), enabled);

src/displayapp/DisplayApp.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,6 @@ void DisplayApp::InitHw() {
136136
brightnessController.Set(settingsController.GetBrightness());
137137
}
138138

139-
uint32_t acc = 0;
140-
uint32_t count = 0;
141-
bool toggle = true;
142139
void DisplayApp::Refresh() {
143140
TickType_t queueTimeout;
144141
TickType_t delta;
@@ -194,9 +191,6 @@ void DisplayApp::Refresh() {
194191
// clockScreen.SetBleConnectionState(bleController.IsConnected() ? Screens::Clock::BleConnectionStates::Connected :
195192
// Screens::Clock::BleConnectionStates::NotConnected);
196193
break;
197-
case Messages::UpdateBatteryLevel:
198-
batteryController.Update();
199-
break;
200194
case Messages::NewNotification:
201195
LoadApp(Apps::NotificationsPreview, DisplayApp::FullRefreshDirections::Down);
202196
break;

src/displayapp/Messages.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ namespace Pinetime {
77
GoToRunning,
88
UpdateDateTime,
99
UpdateBleConnection,
10-
UpdateBatteryLevel,
1110
TouchEvent,
1211
ButtonPushed,
1312
NewNotification,

src/displayapp/screens/BatteryInfo.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ BatteryInfo::~BatteryInfo() {
5555

5656
void BatteryInfo::Refresh() {
5757

58-
batteryController.Update();
59-
6058
batteryPercent = batteryController.PercentRemaining();
6159
batteryVoltage = batteryController.Voltage();
6260

0 commit comments

Comments
 (0)