Merge remote-tracking branch 'upstream/develop' into pinetimestyle-colorpicker
This commit is contained in:
commit
4f21748aa2
|
@ -1,26 +1,36 @@
|
|||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include "BootloaderVersion.h"
|
||||
|
||||
using namespace Pinetime;
|
||||
|
||||
// NOTE : current bootloader does not export its version to the application firmware.
|
||||
// NOTE : version < 1.0.0 of bootloader does not export its version to the application firmware.
|
||||
|
||||
uint32_t BootloaderVersion::Major() {
|
||||
return 0;
|
||||
uint32_t BootloaderVersion::version = 0;
|
||||
char BootloaderVersion::versionString[BootloaderVersion::VERSION_STR_LEN] = "0.0.0";
|
||||
|
||||
const uint32_t BootloaderVersion::Major() {
|
||||
return (BootloaderVersion::version >> 16u) & 0xff;
|
||||
}
|
||||
|
||||
uint32_t BootloaderVersion::Minor() {
|
||||
return 0;
|
||||
const uint32_t BootloaderVersion::Minor() {
|
||||
return (BootloaderVersion::version >> 8u) & 0xff;
|
||||
}
|
||||
|
||||
uint32_t BootloaderVersion::Patch() {
|
||||
return 0;
|
||||
const uint32_t BootloaderVersion::Patch() {
|
||||
return BootloaderVersion::version & 0xff;
|
||||
}
|
||||
|
||||
const char* BootloaderVersion::VersionString() {
|
||||
return "0.0.0";
|
||||
return BootloaderVersion::versionString;
|
||||
}
|
||||
|
||||
bool BootloaderVersion::IsValid() {
|
||||
return false;
|
||||
const bool BootloaderVersion::IsValid() {
|
||||
return BootloaderVersion::version >= 0x00010000;
|
||||
}
|
||||
|
||||
void BootloaderVersion::SetVersion(uint32_t v) {
|
||||
BootloaderVersion::version = v;
|
||||
snprintf(BootloaderVersion::versionString, BootloaderVersion::VERSION_STR_LEN, "%ld.%ld.%ld",
|
||||
BootloaderVersion::Major(), BootloaderVersion::Minor(), BootloaderVersion::Patch());
|
||||
}
|
||||
|
|
|
@ -3,10 +3,15 @@
|
|||
namespace Pinetime {
|
||||
class BootloaderVersion {
|
||||
public:
|
||||
static uint32_t Major();
|
||||
static uint32_t Minor();
|
||||
static uint32_t Patch();
|
||||
static const uint32_t Major();
|
||||
static const uint32_t Minor();
|
||||
static const uint32_t Patch();
|
||||
static const char* VersionString();
|
||||
static bool IsValid();
|
||||
static const bool IsValid();
|
||||
static void SetVersion(uint32_t v);
|
||||
private:
|
||||
static uint32_t version;
|
||||
static constexpr size_t VERSION_STR_LEN = 12;
|
||||
static char versionString[VERSION_STR_LEN];
|
||||
};
|
||||
}
|
|
@ -121,6 +121,11 @@ int DfuService::WritePacketHandler(uint16_t connectionHandle, os_mbuf* om) {
|
|||
NRF_LOG_INFO(
|
||||
"[DFU] -> Start data received : SD size : %d, BT size : %d, app size : %d", softdeviceSize, bootloaderSize, applicationSize);
|
||||
|
||||
// wait until SystemTask has finished waking up all devices
|
||||
while (systemTask.IsSleeping()) {
|
||||
vTaskDelay(50); // 50ms
|
||||
}
|
||||
|
||||
dfuImage.Erase();
|
||||
|
||||
uint8_t data[] {16, 1, 1};
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
* [Jetbrains Mono](https://www.jetbrains.com/fr-fr/lp/mono/)
|
||||
* [Awesome font from LVGL](https://lvgl.io/assets/others/FontAwesome5-Solid+Brands+Regular.woff)
|
||||
* [Open Sans Light from Google](https://fonts.google.com/specimen/Open+Sans)
|
||||
|
||||
## Generate the fonts:
|
||||
|
||||
|
@ -14,6 +15,8 @@
|
|||
* Add a 2nd font, load the file `FontAwesome5-Solid+Brands+Regular.woff` and specify the following
|
||||
range : `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252`
|
||||
* Click on Convert, and download the file `jetbrains_mono_bold_20.c` and copy it in `src/DisplayApp/Fonts`
|
||||
* Add the font .c file path to src/CMakeLists.txt
|
||||
* Add an LV_FONT_DECLARE line in src/libs/lv_conf.h
|
||||
|
||||
Add new symbols:
|
||||
|
||||
|
@ -28,6 +31,21 @@ Add new symbols:
|
|||
static constexpr const char* newSymbol = "\xEF\x86\x85";
|
||||
```
|
||||
|
||||
## Simple method to generate a font
|
||||
|
||||
If you want to generate a basic font containing only numbers and letters, you can use the above settings but instead of specifying a range, simply list the characters you need in the Symbols field and leave the range blank. This is the approach used for the PineTimeStyle watchface.
|
||||
This works well for fonts which will only be used to display numbers, but will fail if you try to add a colon or other punctuation.
|
||||
|
||||
* Open the [LVGL font converter](https://lvgl.io/tools/fontconverter)
|
||||
* Name : open_sans_light
|
||||
* Size : 150
|
||||
* Bpp : 1 bit-per-pixel
|
||||
* Do not enable font compression and horizontal subpixel hinting
|
||||
* Load the file `open_sans_light.tff` (use the file in this repo to ensure the version matches) and specify the following symbols : `0123456789`
|
||||
* Click on Convert, and download the file `open_sans_light.c` and copy it in `src/DisplayApp/Fonts`
|
||||
* Add the font .c file path to src/CMakeLists.txt (search for jetbrains to find the appropriate location/format)
|
||||
* Add an LV_FONT_DECLARE line in src/libs/lv_conf.h (as above)
|
||||
|
||||
#### Navigation font
|
||||
|
||||
To create the navigtion.ttf I use the web app [icomoon](https://icomoon.io/app)
|
||||
|
|
|
@ -61,6 +61,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
|
|||
displayedChar[3] = 0;
|
||||
displayedChar[4] = 0;
|
||||
|
||||
<<<<<<< HEAD
|
||||
//Feels like a hack, but if all the colors are white, this is probably not what the user wants
|
||||
if (settingsController.GetPTSColorTime() + settingsController.GetPTSColorBar() + settingsController.GetPTSColorBG() == 0) {
|
||||
settingsController.SetPTSColorTime(11);
|
||||
|
@ -72,6 +73,12 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
|
|||
|
||||
timebar = lv_obj_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorBG()]);
|
||||
=======
|
||||
/* Create a 200px wide background rectangle */
|
||||
|
||||
timebar = lv_obj_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
|
||||
>>>>>>> upstream/develop
|
||||
lv_obj_set_style_local_radius(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
|
||||
lv_obj_set_size(timebar, 200, 240);
|
||||
lv_obj_align(timebar, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 0);
|
||||
|
@ -80,18 +87,30 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
|
|||
|
||||
timeDD1 = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_text_font(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light);
|
||||
<<<<<<< HEAD
|
||||
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]);
|
||||
=======
|
||||
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080));
|
||||
>>>>>>> upstream/develop
|
||||
lv_label_set_text(timeDD1, "12");
|
||||
lv_obj_align(timeDD1, timebar, LV_ALIGN_IN_TOP_MID, 5, 5);
|
||||
|
||||
timeDD2 = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_text_font(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light);
|
||||
<<<<<<< HEAD
|
||||
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]);
|
||||
=======
|
||||
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080));
|
||||
>>>>>>> upstream/develop
|
||||
lv_label_set_text(timeDD2, "34");
|
||||
lv_obj_align(timeDD2, timebar, LV_ALIGN_IN_BOTTOM_MID, 5, -5);
|
||||
|
||||
timeAMPM = lv_label_create(lv_scr_act(), nullptr);
|
||||
<<<<<<< HEAD
|
||||
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]);
|
||||
=======
|
||||
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080));
|
||||
>>>>>>> upstream/develop
|
||||
lv_obj_set_style_local_text_line_space(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -3);
|
||||
lv_label_set_text(timeAMPM, "");
|
||||
lv_obj_align(timeAMPM, timebar, LV_ALIGN_IN_BOTTOM_LEFT, 2, -20);
|
||||
|
@ -99,7 +118,11 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
|
|||
/* Create a 40px wide bar down the right side of the screen */
|
||||
|
||||
sidebar = lv_obj_create(lv_scr_act(), nullptr);
|
||||
<<<<<<< HEAD
|
||||
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorBar()]);
|
||||
=======
|
||||
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080));
|
||||
>>>>>>> upstream/develop
|
||||
lv_obj_set_style_local_radius(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
|
||||
lv_obj_set_size(sidebar, 40, 240);
|
||||
lv_obj_align(sidebar, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0);
|
||||
|
@ -198,7 +221,11 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
|
|||
lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 4);
|
||||
lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
lv_obj_set_style_local_line_opa(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
<<<<<<< HEAD
|
||||
lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 3);
|
||||
=======
|
||||
lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4);
|
||||
>>>>>>> upstream/develop
|
||||
lv_obj_set_style_local_pad_inner(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4);
|
||||
|
||||
backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../DisplayApp.h"
|
||||
#include "Label.h"
|
||||
#include "Version.h"
|
||||
#include "BootloaderVersion.h"
|
||||
#include "components/battery/BatteryController.h"
|
||||
#include "components/ble/BleController.h"
|
||||
#include "components/brightness/BrightnessController.h"
|
||||
|
@ -83,17 +84,19 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen1() {
|
|||
lv_label_set_recolor(label, true);
|
||||
lv_label_set_text_fmt(label,
|
||||
"#FFFF00 InfiniTime#\n\n"
|
||||
"#444444 Version# %ld.%ld.%ld\n\n"
|
||||
"#444444 Short Ref# %s\n\n"
|
||||
"#444444 Version# %ld.%ld.%ld\n"
|
||||
"#444444 Short Ref# %s\n"
|
||||
"#444444 Build date#\n"
|
||||
"%s\n"
|
||||
"%s\n",
|
||||
"%s\n\n"
|
||||
"#444444 Bootloader# %s",
|
||||
Version::Major(),
|
||||
Version::Minor(),
|
||||
Version::Patch(),
|
||||
Version::GitCommitHash(),
|
||||
__DATE__,
|
||||
__TIME__);
|
||||
__TIME__,
|
||||
BootloaderVersion::VersionString());
|
||||
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
|
||||
return std::make_unique<Screens::Label>(0, 5, app, label);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <drivers/Hrs3300.h>
|
||||
#include <drivers/Bma421.h>
|
||||
|
||||
#include "BootloaderVersion.h"
|
||||
#include "components/battery/BatteryController.h"
|
||||
#include "components/ble/BleController.h"
|
||||
#include "components/ble/NotificationManager.h"
|
||||
|
@ -306,6 +307,9 @@ int main(void) {
|
|||
debounceTimer = xTimerCreate("debounceTimer", 200, pdFALSE, (void*) 0, DebounceTimerCallback);
|
||||
debounceChargeTimer = xTimerCreate("debounceTimerCharge", 200, pdFALSE, (void*) 0, DebounceTimerChargeCallback);
|
||||
|
||||
// retrieve version stored by bootloader
|
||||
Pinetime::BootloaderVersion::SetVersion(NRF_TIMER2->CC[0]);
|
||||
|
||||
lvgl.Init();
|
||||
|
||||
systemTask.Start();
|
||||
|
|
|
@ -73,6 +73,10 @@ namespace Pinetime {
|
|||
return nimbleController;
|
||||
};
|
||||
|
||||
bool IsSleeping() const {
|
||||
return isSleeping;
|
||||
}
|
||||
|
||||
private:
|
||||
TaskHandle_t taskHandle;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user