Skip to content

Commit f61e88b

Browse files
committed
Merge branch 'develop' into update_touch_driver
2 parents e468acc + 392c7ad commit f61e88b

28 files changed

Lines changed: 110 additions & 107 deletions

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.4.0 LANGUAGES C CXX ASM)
2+
project(pinetime VERSION 1.6.0 LANGUAGES C CXX ASM)
33

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ As of now, here is the list of achievements of this project:
6767
* **[Experimental]** [WebBLEWatch](https://hubmartin.github.io/WebBLEWatch/) Synchronize time directly from your web browser. [video](https://youtu.be/IakiuhVDdrY)
6868
* **[Experimental]** [Infini-iOS](https://github.com/xan-m/Infini-iOS) (on iOS)
6969
- OTA (Over-the-air) update via BLE
70-
- [Bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader) based on [MCUBoot](https://juullabs-oss.github.io/mcuboot/)
70+
- [Bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader) based on [MCUBoot](https://www.mcuboot.com)
7171

7272
## Documentation
7373

doc/contribute.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ You want to fix a bug, add a cool new functionality or improve the code? See *Ho
1818

1919
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!
2020

21-
# How to submit a pull request ?
21+
# How to submit a pull request?
2222

2323
## TL;DR
2424

25-
- Create a branch from develop;
26-
- Work on a single subject in this branch. Create multiple branches/pulls-requests if you want to work on multiple subjects (bugs, features,...);
27-
- Test your modifications on the actual hardware;
28-
- Check the code formatting against our coding conventions and [clang-format](../.clang-format) and [clang-tidy](../.clang-tidy);
29-
- Clean your code and remove files that are not needed;
30-
- Write documentation related to your new feature if applicable;
31-
- Create a pull request and write a great description about it : what does your PR do, why, how,... Add pictures and video if possible;
32-
- Wait for someone to review your PR and take part in the review process;
25+
- Create a branch from develop
26+
- Work on a single subject in this branch. Create multiple branches/pulls-requests if you want to work on multiple subjects (bugs, features,...)
27+
- Test your modifications on the actual hardware
28+
- Check the code formatting against our coding conventions and [clang-format](../.clang-format) and [clang-tidy](../.clang-tidy)
29+
- Clean your code and remove files that are not needed
30+
- Write documentation related to your new feature if applicable
31+
- Create a pull request and write a great description about it: what does your PR do, why, how,... Add pictures and video if possible
32+
- Wait for someone to review your PR and take part in the review process
3333
- Your PR will eventually be merged :)
3434

3535
Your contributions are more than welcome!

src/components/battery/BatteryController.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ void Battery::Update() {
1717
isCharging = !nrf_gpio_pin_read(PinMap::Charging);
1818
isPowerPresent = !nrf_gpio_pin_read(PinMap::PowerPresent);
1919

20+
if (isPowerPresent && !isCharging) {
21+
isFull = true;
22+
} else if (!isPowerPresent) {
23+
isFull = false;
24+
}
25+
2026
if (isReading) {
2127
return;
2228
}
@@ -63,12 +69,12 @@ void Battery::SaadcEventHandler(nrfx_saadc_evt_t const* p_event) {
6369
// p_event->data.done.p_buffer[0] = (adc_voltage / reference_voltage) * 1024
6470
voltage = p_event->data.done.p_buffer[0] * (8 * 600) / 1024;
6571

66-
if (voltage > battery_max) {
72+
if (isFull) {
6773
percentRemaining = 100;
6874
} else if (voltage < battery_min) {
6975
percentRemaining = 0;
7076
} else {
71-
percentRemaining = (voltage - battery_min) * 100 / (battery_max - battery_min);
77+
percentRemaining = std::min((voltage - battery_min) * 100 / (battery_max - battery_min), isCharging ? 99 : 100);
7278
}
7379

7480
nrfx_saadc_uninit();

src/components/battery/BatteryController.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ namespace Pinetime {
2222
}
2323

2424
bool IsCharging() const {
25-
return isCharging;
25+
// isCharging will go up and down when fully charged
26+
// isFull makes sure this returns false while fully charged.
27+
return isCharging && !isFull;
2628
}
2729

2830
bool IsPowerPresent() const {
@@ -37,6 +39,7 @@ namespace Pinetime {
3739
uint16_t voltage = 0;
3840
uint8_t percentRemaining = 0;
3941

42+
bool isFull = false;
4043
bool isCharging = false;
4144
bool isPowerPresent = false;
4245

src/components/ble/BatteryInformationService.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ int BatteryInformationService::OnBatteryServiceRequested(uint16_t connectionHand
4343
ble_gatt_access_ctxt* context) {
4444
if (attributeHandle == batteryLevelHandle) {
4545
NRF_LOG_INFO("BATTERY : handle = %d", batteryLevelHandle);
46-
static uint8_t batteryValue = batteryController.PercentRemaining();
46+
uint8_t batteryValue = batteryController.PercentRemaining();
4747
int res = os_mbuf_append(context->om, &batteryValue, 1);
4848
return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
4949
}

src/components/ble/NotificationManager.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,6 @@ bool NotificationManager::AreNewNotificationsAvailable() {
7979
return newNotification;
8080
}
8181

82-
bool NotificationManager::IsVibrationEnabled() {
83-
return vibrationEnabled;
84-
}
85-
86-
void NotificationManager::ToggleVibrations() {
87-
vibrationEnabled = !vibrationEnabled;
88-
}
89-
9082
bool NotificationManager::ClearNewNotificationFlag() {
9183
return newNotification.exchange(false);
9284
}

src/components/ble/NotificationManager.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ namespace Pinetime {
4444
Notification GetPrevious(Notification::Id id);
4545
bool ClearNewNotificationFlag();
4646
bool AreNewNotificationsAvailable();
47-
bool IsVibrationEnabled();
48-
void ToggleVibrations();
4947

5048
static constexpr size_t MaximumMessageSize() {
5149
return MessageSize;
@@ -60,7 +58,6 @@ namespace Pinetime {
6058
uint8_t writeIndex = 0;
6159
bool empty = true;
6260
std::atomic<bool> newNotification {false};
63-
bool vibrationEnabled = true;
6461
};
6562
}
66-
}
63+
}

src/components/datetime/DateTimeController.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ using namespace Pinetime::Controllers;
77

88
void DateTime::SetCurrentTime(std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> t) {
99
this->currentDateTime = t;
10+
UpdateTime(previousSystickCounter); // Update internal state without updating the time
1011
}
1112

1213
void DateTime::SetTime(

src/components/fs/FS.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace Pinetime {
5353
*
5454
*/
5555
static constexpr size_t startAddress = 0x0B4000;
56-
static constexpr size_t size = 0x3C0000;
56+
static constexpr size_t size = 0x34C000;
5757
static constexpr size_t blockSize = 4096;
5858

5959
bool resourcesValid = false;

0 commit comments

Comments
 (0)