summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/contribute.md37
-rw-r--r--src/displayapp/DisplayApp.cpp5
-rw-r--r--src/displayapp/DisplayApp.h3
-rw-r--r--src/displayapp/DisplayAppRecovery.cpp1
-rw-r--r--src/displayapp/DisplayAppRecovery.h2
-rw-r--r--src/displayapp/fonts/README.md6
-rw-r--r--src/displayapp/screens/Navigation.cpp2
-rw-r--r--src/displayapp/screens/settings/QuickSettings.cpp3
-rw-r--r--src/displayapp/screens/settings/QuickSettings.h3
m---------src/libs/lvgl0
-rw-r--r--src/systemtask/SystemTask.cpp1
-rw-r--r--tools/bin2c.py4
12 files changed, 57 insertions, 10 deletions
diff --git a/doc/contribute.md b/doc/contribute.md
index fe385125..7958eea1 100644
--- a/doc/contribute.md
+++ b/doc/contribute.md
@@ -11,18 +11,49 @@ You want to fix a bug, add a cool new functionality or improve the code? See *Ho
Pinetime is a cool open source project that deserves to be know. 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!
# How to submit a pull request ?
+
+## TL;DR
+ - Create a branch from develop;
+ - Work on a single subject in this branch. Create multiple branches/pulls-requests if you want to work on multiple subjects (bugs, features,...);
+ - Test your modifications on the actual hardware;
+ - Check the code formatting against our coding conventions and [clang-format](../.clang-format) and [clang-tidy](../.clang-tidy);
+ - Clean your code and remove files that are not needed;
+ - Write documentation related to your new feature is applicable;
+ - Create the pull-request and write a great description about it : what does your PR do, why, how,... Add pictures and video if possible;
+ - Wait for someone to review your PR and take part in the review process;
+ - You PR will eventually be merged :)
+
Your contribution is more than welcome!
-If you want to fix a bug, add a functionality or improve the code, you'll first need to create a branch from the **develop** branch (see [this page about the branching model](./branches.md)). This branch is called a feature branch, and you should choose a name that explains what you are working on (ex: "add-doc-about-contributions"). In this branch, try to focus on only one topic, bug or feature. For example, if you created this branch to work on the UI of a specific application, do not commit modifications about the SPI driver. If you want to work on multiple topics, create one branch per topic.
+If you want to fix a bug, add a functionality or improve the code, you'll first need to create a branch from the **develop** branch (see [this page about the branching model](./branches.md)). This branch is called a feature branch, and you should choose a name that explains what you are working on (ex: "add-doc-about-contributions"). In this branch, **focus on only one topic, bug or feature**. For example, if you created this branch to work on the UI of a specific application, do not commit modifications about the SPI driver. If you want to work on multiple topics, create one branch per topic.
+
+When your feature branch is ready, **make sure it actually works** and **do not forget to write documentation** about it if it's relevant.
-When your feature branch is ready, make sure it actually works and do not forget to write documentation about it if necessary.
+I **strongly discourage to create a PR containing modifications that haven't been tested**. If, for any reason, you cannot test your modifications but want to publish them anyway, **please mention it in the description**. This way, other contributors might be willing to test it and provide feedbacks about your code.
-Then, you can submit a pull-request for review. Try to describe your pull request as much as possible: what did you do in this branch, how does it work, how is it designed, are there any limitations,... This will help the contributors to understand and review your code easily.
+Also, before submitting your PR, check the coding style of your code against the **coding conventions** detailed below. This project also provides [clang-format](../.clang-format) and [clang-tidy](../.clang-tidy) configuration files. You can use them to ensure correct formatting of your code.
+
+Do not forget to check the files you are going to commit and remove those who are not necessary (config files from your IDE, for example). Remove old comments, commented code,...
+
+Then, you can submit a pull-request for review. Try to **describe your pull request as much as possible**: what did you do in this branch, how does it work, how is it designed, are there any limitations,... This will help the contributors to understand and review your code easily. You can add pictures and video to the description so that contributors will have a quick overview of you work.
Other contributors can post comments about the pull request, maybe ask for more info or adjustements in the code.
Once the pull request is reviewed an accepted, it'll be merge in **develop** and will be released in the next release version of the firmware.
+## Why all these rules?
+Reviewing pull-requests is a **very time consuming task** for the creator of this project ([JF002](https://github.com/JF002)) and for other contributors who take the time to review them. Every little thing you do to make their lifes easier will **increase the chances your PR will be merge quickly**.
+
+When reviewing PR, the author and contributors will first look at the **description**. If it's easy to understand what the PR does, why the modification is needed or interesting and how it's done, a good part of the work is already done : we understand the PR and its context.
+
+Then, reviewing **a few files that were modified for a single purpose** is a lot more easier than to review 30 files modified for many reasons (bug fix, UI improvements, typos in doc,...), even if all these changes make sense. Also, it's possible that we agree on some modification but not on some other, and we won't be able to merge the PR because of the changes that are not accepted.
+
+We do our best to keep the code as consistent as possible, and that mean we pay attention to the **formatting** of the code. If the code formatting is not consistent with our code base, we'll ask you to review it, which will take more time.
+
+The last step of the review consists in **testing** the modification. If it doesn't work out of the box, we'll ask your to review your code and to ensure that it works as expected.
+
+It's totally normal for a PR to need some more work even after it was created, that's why we review them. But every round trip takes time, and it's good practice to try to reduce them as much as possible by following those simple rules.
+
# Coding convention
## Language
The language of this project is **C++**, and all new code must be written in C++. (Modern) C++ provides a lot of useful tools and functionalities that are beneficial for embedded software development like `constexpr`, `template` and anything that provides zero-cost abstraction.
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index 68f2d971..3a20c766 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -7,6 +7,7 @@
#include "components/datetime/DateTimeController.h"
#include "components/ble/NotificationManager.h"
#include "components/motion/MotionController.h"
+#include "components/motor/MotorController.h"
#include "displayapp/screens/ApplicationList.h"
#include "displayapp/screens/Brightness.h"
#include "displayapp/screens/Clock.h"
@@ -51,6 +52,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
Pinetime::Controllers::NotificationManager& notificationManager,
Pinetime::Controllers::HeartRateController& heartRateController,
Controllers::Settings& settingsController,
+ Pinetime::Controllers::MotorController& motorController,
Pinetime::Controllers::MotionController& motionController)
: lcd {lcd},
lvgl {lvgl},
@@ -63,6 +65,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
notificationManager {notificationManager},
heartRateController {heartRateController},
settingsController {settingsController},
+ motorController{motorController},
motionController {motionController} {
msgQueue = xQueueCreate(queueSize, itemSize);
// Start clock when smartwatch boots
@@ -262,7 +265,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
// Settings
case Apps::QuickSettings:
currentScreen =
- std::make_unique<Screens::QuickSettings>(this, batteryController, dateTimeController, brightnessController, settingsController);
+ std::make_unique<Screens::QuickSettings>(this, batteryController, dateTimeController, brightnessController, motorController, settingsController);
returnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft);
break;
case Apps::Settings:
diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h
index ff5ddac8..75e52755 100644
--- a/src/displayapp/DisplayApp.h
+++ b/src/displayapp/DisplayApp.h
@@ -8,6 +8,7 @@
#include "LittleVgl.h"
#include "TouchEvents.h"
#include "components/brightness/BrightnessController.h"
+#include "components/motor/MotorController.h"
#include "components/firmwarevalidator/FirmwareValidator.h"
#include "components/settings/Settings.h"
#include "displayapp/screens/Screen.h"
@@ -51,6 +52,7 @@ namespace Pinetime {
Pinetime::Controllers::NotificationManager& notificationManager,
Pinetime::Controllers::HeartRateController& heartRateController,
Controllers::Settings& settingsController,
+ Pinetime::Controllers::MotorController& motorController,
Pinetime::Controllers::MotionController& motionController);
void Start();
void PushMessage(Display::Messages msg);
@@ -72,6 +74,7 @@ namespace Pinetime {
Pinetime::Controllers::NotificationManager& notificationManager;
Pinetime::Controllers::HeartRateController& heartRateController;
Pinetime::Controllers::Settings& settingsController;
+ Pinetime::Controllers::MotorController& motorController;
Pinetime::Controllers::MotionController& motionController;
Pinetime::Controllers::FirmwareValidator validator;
diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp
index 5c7dd03d..6db987fa 100644
--- a/src/displayapp/DisplayAppRecovery.cpp
+++ b/src/displayapp/DisplayAppRecovery.cpp
@@ -18,6 +18,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
Pinetime::Controllers::NotificationManager& notificationManager,
Pinetime::Controllers::HeartRateController& heartRateController,
Pinetime::Controllers::Settings& settingsController,
+ Pinetime::Controllers::MotorController& motorController,
Pinetime::Controllers::MotionController& motionController)
: lcd {lcd}, bleController {bleController} {
msgQueue = xQueueCreate(queueSize, itemSize);
diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h
index 025be6c0..30b8e0a1 100644
--- a/src/displayapp/DisplayAppRecovery.h
+++ b/src/displayapp/DisplayAppRecovery.h
@@ -17,6 +17,7 @@
#include <drivers/Watchdog.h>
#include <components/heartrate/HeartRateController.h>
#include <components/motion/MotionController.h>
+#include <components/motor/MotorController.h>
#include <components/settings/Settings.h>
#include "TouchEvents.h"
#include "Apps.h"
@@ -41,6 +42,7 @@ namespace Pinetime {
Pinetime::Controllers::NotificationManager& notificationManager,
Pinetime::Controllers::HeartRateController& heartRateController,
Pinetime::Controllers::Settings& settingsController,
+ Pinetime::Controllers::MotorController& motorController,
Pinetime::Controllers::MotionController& motionController);
void Start();
void PushMessage(Pinetime::Applications::Display::Messages msg);
diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md
index 494654cd..f43e9c52 100644
--- a/src/displayapp/fonts/README.md
+++ b/src/displayapp/fonts/README.md
@@ -22,10 +22,10 @@ Add new symbols:
readme updated with newest range list)
* Convert this hex value into a UTF-8 code
using [this site](http://www.ltg.ed.ac.uk/~richard/utf-8.cgi?input=f185&mode=hex)
-* Define the new symbols in `src/DisplayApp/Screens/Symbols.h`:
+* Define the new symbols in `src/displayapp/screens/Symbols.h`:
```
-static constex char* newSymbol = "\xEF\x86\x85";
+static constexpr const char* newSymbol = "\xEF\x86\x85";
```
#### Navigation font
@@ -41,4 +41,4 @@ ttf file : navigation.ttf name : lv_font_navi_80 size : 80px Bpp : 2 bit-per-pix
$lv_font_conv --font navigation.ttf -r '0xe900-0xe929' --size 80 --format lvgl --bpp 2 --no-prefilter -o
lv_font_navi_80.c
-#### I use the method above to create the other ttf \ No newline at end of file
+#### I use the method above to create the other ttf
diff --git a/src/displayapp/screens/Navigation.cpp b/src/displayapp/screens/Navigation.cpp
index fe9b5a83..b5ce8b83 100644
--- a/src/displayapp/screens/Navigation.cpp
+++ b/src/displayapp/screens/Navigation.cpp
@@ -40,7 +40,7 @@ Navigation::Navigation(Pinetime::Applications::DisplayApp* app, Pinetime::Contro
txtNarrative = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(txtNarrative, LV_LABEL_LONG_BREAK);
lv_obj_set_width(txtNarrative, LV_HOR_RES);
- lv_label_set_text(txtNarrative, "Welcome to navigation!");
+ lv_label_set_text(txtNarrative, "Navigation");
lv_label_set_align(txtNarrative, LV_LABEL_ALIGN_CENTER);
lv_obj_align(txtNarrative, nullptr, LV_ALIGN_CENTER, 0, 10);
diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp
index d19e4222..3994794d 100644
--- a/src/displayapp/screens/settings/QuickSettings.cpp
+++ b/src/displayapp/screens/settings/QuickSettings.cpp
@@ -21,11 +21,13 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
Pinetime::Controllers::Battery& batteryController,
Controllers::DateTime& dateTimeController,
Controllers::BrightnessController& brightness,
+ Controllers::MotorController& motorController,
Pinetime::Controllers::Settings& settingsController)
: Screen(app),
batteryController {batteryController},
dateTimeController {dateTimeController},
brightness {brightness},
+ motorController{motorController},
settingsController {settingsController} {
// Time
@@ -138,6 +140,7 @@ void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
if (lv_obj_get_state(btn3, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) {
settingsController.SetVibrationStatus(Controllers::Settings::Vibration::ON);
+ motorController.SetDuration(35);
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn);
} else {
settingsController.SetVibrationStatus(Controllers::Settings::Vibration::OFF);
diff --git a/src/displayapp/screens/settings/QuickSettings.h b/src/displayapp/screens/settings/QuickSettings.h
index 8d04bec3..a14f46bf 100644
--- a/src/displayapp/screens/settings/QuickSettings.h
+++ b/src/displayapp/screens/settings/QuickSettings.h
@@ -7,6 +7,7 @@
#include <lvgl/lvgl.h>
#include "components/datetime/DateTimeController.h"
#include "components/brightness/BrightnessController.h"
+#include "components/motor/MotorController.h"
#include "components/settings/Settings.h"
#include "components/battery/BatteryController.h"
@@ -21,6 +22,7 @@ namespace Pinetime {
Pinetime::Controllers::Battery& batteryController,
Controllers::DateTime& dateTimeController,
Controllers::BrightnessController& brightness,
+ Controllers::MotorController& motorController,
Pinetime::Controllers::Settings& settingsController);
~QuickSettings() override;
@@ -36,6 +38,7 @@ namespace Pinetime {
Pinetime::Controllers::Battery& batteryController;
Controllers::DateTime& dateTimeController;
Controllers::BrightnessController& brightness;
+ Controllers::MotorController& motorController;
Controllers::Settings& settingsController;
lv_task_t* taskUpdate;
diff --git a/src/libs/lvgl b/src/libs/lvgl
-Subproject 1b6501dc3babf39538f4a02aa9fb14c2aaebca2
+Subproject 23430cf20e32294549fff9b2879a9466dacc19b
diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp
index 5b03fbbb..6d695e2c 100644
--- a/src/systemtask/SystemTask.cpp
+++ b/src/systemtask/SystemTask.cpp
@@ -115,6 +115,7 @@ void SystemTask::Work() {
notificationManager,
heartRateController,
settingsController,
+ motorController,
motionController);
displayApp->Start();
diff --git a/tools/bin2c.py b/tools/bin2c.py
index 1d66656a..e5fdb158 100644
--- a/tools/bin2c.py
+++ b/tools/bin2c.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#-*- coding: utf-8 -*-
"""
bin2c
@@ -71,4 +71,4 @@ def main():
if __name__ == '__main__':
- main() \ No newline at end of file
+ main()