1
0
Fork 0

Merge branch 'develop'

# Conflicts:
#	CMakeLists.txt
This commit is contained in:
JF 2020-07-11 21:09:34 +02:00
commit 64c14274fc
43 changed files with 561 additions and 9345 deletions

View file

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
project(pinetime VERSION 0.6.2 LANGUAGES C CXX ASM) project(pinetime VERSION 0.7.0 LANGUAGES C CXX ASM)
set(NRF_TARGET "nrf52") set(NRF_TARGET "nrf52")

75
doc/MemoryAnalysis.md Normal file
View file

@ -0,0 +1,75 @@
# Memory analysis
## FreeRTOS heap and task stack
FreeRTOS statically allocate its own heap buffer in a global variable named `ucHeap`. This is an aray of *uint8_t*. Its size is specified by the definition `configTOTAL_HEAP_SIZE` in *FreeRTOSConfig.h*
FreeRTOS uses this buffer to allocate memory for tasks stack and all the RTOS object created during runtime (timers, mutexes,...).
The function `xPortGetFreeHeapSize()` returns the amount of memory available in this *ucHeap* buffer. If this value reaches 0, FreeRTOS runs out of memory.
```
NRF_LOG_INFO("Free heap : %d", xPortGetFreeHeapSize());
```
The function `uxTaskGetSystemState()` fetches some information about the running tasks like its name and the minimum amount of stack space that has remained for the task since the task was created:
```
TaskStatus_t tasksStatus[10]
auto nb = uxTaskGetSystemState(tasksStatus, 10, NULL);
for (int i = 0; i < nb; i++) {
NRF_LOG_INFO("Task [%s] - %d", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark);
```
## Global heap
Heap is used for **dynamic memory allocation (malloc() / new)**. NRF SDK defaults the heap size to 8KB. The size of the heap can be specified by defining `__HEAP_SIZE=8192` in *src/CMakeLists.txt*:
```
add_definitions(-D__HEAP_SIZE=8192)
```
You can trace the dynamic memory allocation by using the flag `--wrap` of the linker. When this flag is enabled, the linker will replace the calls to a specific function by a call to __wrap_the_function(). For example, if you specify `-Wl,-wrap,malloc` in the linker flags, the linker will replace all calls to `void* malloc(size_t)` by calls to `void* __wrap_malloc(size_t)`. This is a function you'll have to define in your code. In this function, you can call `__real_malloc()` to call the actual `malloc()' function.
This technic allows you to wrap all calls to malloc() with you own code.
In *src/CMakeLists.txt*:
```
set_target_properties(${EXECUTABLE_NAME} PROPERTIES
...
LINK_FLAGS "-Wl,-wrap,malloc ..."
...
)
```
In *main.cpp*:
```
uint32_t totalMalloc = 0;
extern "C" {
extern void* __real_malloc(size_t s);
void *__wrap_malloc(size_t s) {
totalMalloc += s;
return __real_malloc(s);
}
}
```
This function sums all the memory that is allocated during the runtime. You can monitor or log this value. You can also place breakpoints in this function to determine where the dynamic memory allocation occurs in your code.
# Global stack
The stack is used to allocate memory used by functions : **parameters and local variables**. NRF SDK defaults the heap size to 8KB. The size of the heap can be specified by defining `__STACK_SIZE=8192` in *src/CMakeLists.txt*:
```
add_definitions(-D__STACK_SIZE=8192)
```
*NOTE*: FreeRTOS uses its own stack buffer. Thus, the global stack is only used for main() and IRQ handlers. It should be possible to reduce its size to a much lower value.
**NOTE**: [?] How to track the global stack usage?
#LittleVGL buffer
*TODO*
#NimBLE buffers
*TODO*

View file

@ -44,7 +44,7 @@ set(SDK_SOURCE_FILES
# FreeRTOS # FreeRTOS
${NRF5_SDK_PATH}/external/freertos/source/croutine.c ${NRF5_SDK_PATH}/external/freertos/source/croutine.c
${NRF5_SDK_PATH}/external/freertos/source/event_groups.c ${NRF5_SDK_PATH}/external/freertos/source/event_groups.c
${NRF5_SDK_PATH}/external/freertos/source/portable/MemMang/heap_1.c ${NRF5_SDK_PATH}/external/freertos/source/portable/MemMang/heap_4.c
${NRF5_SDK_PATH}/external/freertos/source/list.c ${NRF5_SDK_PATH}/external/freertos/source/list.c
${NRF5_SDK_PATH}/external/freertos/source/queue.c ${NRF5_SDK_PATH}/external/freertos/source/queue.c
${NRF5_SDK_PATH}/external/freertos/source/stream_buffer.c ${NRF5_SDK_PATH}/external/freertos/source/stream_buffer.c
@ -363,7 +363,7 @@ list(APPEND SOURCE_FILES
${TINYCRYPT_SRC} ${TINYCRYPT_SRC}
${NIMBLE_SRC} ${NIMBLE_SRC}
${LVGL_SRC} ${LVGL_SRC}
${IMAGE_FILES} #${IMAGE_FILES}
${SDK_SOURCE_FILES} ${SDK_SOURCE_FILES}
DisplayApp/LittleVgl.cpp DisplayApp/LittleVgl.cpp
@ -442,6 +442,8 @@ set(INCLUDE_FILES
libs/date/includes/date/tz_private.h libs/date/includes/date/tz_private.h
DisplayApp/LittleVgl.h DisplayApp/LittleVgl.h
SystemTask/SystemTask.h SystemTask/SystemTask.h
SystemTask/SystemMonitor.h
DisplayApp/Screens/Symbols.h
) )
include_directories( include_directories(
@ -547,6 +549,8 @@ add_definitions(-DOS_CPUTIME_FREQ)
add_definitions(-DNRF52 -DNRF52832 -DNRF52832_XXAA -DNRF52_PAN_74 -DNRF52_PAN_64 -DNRF52_PAN_12 -DNRF52_PAN_58 -DNRF52_PAN_54 -DNRF52_PAN_31 -DNRF52_PAN_51 -DNRF52_PAN_36 -DNRF52_PAN_15 -DNRF52_PAN_20 -DNRF52_PAN_55 -DBOARD_PCA10040) add_definitions(-DNRF52 -DNRF52832 -DNRF52832_XXAA -DNRF52_PAN_74 -DNRF52_PAN_64 -DNRF52_PAN_12 -DNRF52_PAN_58 -DNRF52_PAN_54 -DNRF52_PAN_31 -DNRF52_PAN_51 -DNRF52_PAN_36 -DNRF52_PAN_15 -DNRF52_PAN_20 -DNRF52_PAN_55 -DBOARD_PCA10040)
add_definitions(-DFREERTOS) add_definitions(-DFREERTOS)
add_definitions(-DDEBUG_NRF_USER) add_definitions(-DDEBUG_NRF_USER)
add_definitions(-D__STACK_SIZE=8192)
add_definitions(-D__HEAP_SIZE=8192)
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release") set(CMAKE_BUILD_TYPE "Release")

View file

@ -105,14 +105,25 @@ int AlertNotificationClient::OnDescriptorDiscoveryEventCallback(uint16_t connect
void AlertNotificationClient::OnNotification(ble_gap_event *event) { void AlertNotificationClient::OnNotification(ble_gap_event *event) {
if(event->notify_rx.attr_handle == newAlertHandle) { if(event->notify_rx.attr_handle == newAlertHandle) {
size_t notifSize = OS_MBUF_PKTLEN(event->notify_rx.om); // TODO implement this with more memory safety (and constexpr)
uint8_t data[notifSize + 1]; static const size_t maxBufferSize{21};
data[notifSize] = '\0'; static const size_t maxMessageSize{18};
os_mbuf_copydata(event->notify_rx.om, 0, notifSize, data); size_t bufferSize = min(OS_MBUF_PKTLEN(event->notify_rx.om), maxBufferSize);
char *s = (char *) &data[2];
NRF_LOG_INFO("DATA : %s", s);
notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, s, notifSize + 1); uint8_t data[bufferSize];
os_mbuf_copydata(event->notify_rx.om, 0, bufferSize, data);
char *s = (char *) &data[3];
auto messageSize = min(maxMessageSize, (bufferSize-3));
for (int i = 0; i < messageSize-1; i++) {
if (s[i] == 0x00) {
s[i] = 0x0A;
}
}
s[messageSize-1] = '\0';
notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, s, messageSize);
systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification);
} }
} }

View file

@ -4,6 +4,7 @@
#include <SystemTask/SystemTask.h> #include <SystemTask/SystemTask.h>
#include "AlertNotificationService.h" #include "AlertNotificationService.h"
#include <cstring>
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;
@ -55,22 +56,25 @@ int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle
struct ble_gatt_access_ctxt *ctxt) { struct ble_gatt_access_ctxt *ctxt) {
if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
size_t notifSize = OS_MBUF_PKTLEN(ctxt->om); // TODO implement this with more memory safety (and constexpr)
uint8_t data[notifSize + 1]; static const size_t maxBufferSize{21};
data[notifSize] = '\0'; static const size_t maxMessageSize{18};
os_mbuf_copydata(ctxt->om, 0, notifSize, data); size_t bufferSize = min(OS_MBUF_PKTLEN(ctxt->om), maxBufferSize);
char *s = (char *) &data[3];
NRF_LOG_INFO("DATA : %s", s);
for(int i = 0; i <= notifSize; i++) uint8_t data[bufferSize];
{ os_mbuf_copydata(ctxt->om, 0, bufferSize, data);
if(s[i] == 0x00)
{ char *s = (char *) &data[3];
auto messageSize = min(maxMessageSize, (bufferSize-3));
for (int i = 0; i < messageSize-1; i++) {
if (s[i] == 0x00) {
s[i] = 0x0A; s[i] = 0x0A;
} }
} }
s[messageSize-1] = '\0';
m_notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, s, notifSize + 1); m_notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, s, messageSize);
m_systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); m_systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification);
} }
return 0; return 0;

View file

@ -25,7 +25,7 @@ namespace Pinetime {
static constexpr char* manufacturerName = "Codingfield"; static constexpr char* manufacturerName = "Codingfield";
static constexpr char* modelNumber = "1"; static constexpr char* modelNumber = "1";
static constexpr char* serialNumber = "9.8.7.6.5.4"; static constexpr char* serialNumber = "9.8.7.6.5.4";
static constexpr char* fwRevision = "0.5.0"; static constexpr char* fwRevision = "0.7.0";
static constexpr char* hwRevision = "1.0.0"; static constexpr char* hwRevision = "1.0.0";
static constexpr ble_uuid16_t deviceInfoUuid { static constexpr ble_uuid16_t deviceInfoUuid {

View file

@ -4,11 +4,12 @@
using namespace Pinetime::Controllers; using namespace Pinetime::Controllers;
void NotificationManager::Push(Pinetime::Controllers::NotificationManager::Categories category, void NotificationManager::Push(Pinetime::Controllers::NotificationManager::Categories category,
const char *message, uint8_t messageSize) { const char *message, uint8_t currentMessageSize) {
// TODO handle edge cases on read/write index // TODO handle edge cases on read/write index
auto checkedSize = std::min(currentMessageSize, uint8_t{18});
auto& notif = notifications[writeIndex]; auto& notif = notifications[writeIndex];
std::memcpy(notif.message.data(), message, messageSize); std::memcpy(notif.message.data(), message, checkedSize);
notif.message[messageSize] = '\0'; notif.message[checkedSize] = '\0';
notif.category = category; notif.category = category;
writeIndex = (writeIndex + 1 < TotalNbNotifications) ? writeIndex + 1 : 0; writeIndex = (writeIndex + 1 < TotalNbNotifications) ? writeIndex + 1 : 0;

View file

@ -7,10 +7,10 @@ namespace Pinetime {
class NotificationManager { class NotificationManager {
public: public:
enum class Categories {Unknown, SimpleAlert, Email, News, IncomingCall, MissedCall, Sms, VoiceMail, Schedule, HighProriotyAlert, InstantMessage }; enum class Categories {Unknown, SimpleAlert, Email, News, IncomingCall, MissedCall, Sms, VoiceMail, Schedule, HighProriotyAlert, InstantMessage };
static constexpr uint8_t MessageSize = 18; static constexpr uint8_t MessageSize{18};
struct Notification { struct Notification {
std::array<char, MessageSize> message; std::array<char, MessageSize+1> message;
Categories category = Categories::Unknown; Categories category = Categories::Unknown;
}; };

View file

@ -10,7 +10,6 @@
#include <Components/Brightness/BrightnessController.h> #include <Components/Brightness/BrightnessController.h>
#include <Components/Ble/BleController.h> #include <Components/Ble/BleController.h>
#include <Components/DateTime/DateTimeController.h> #include <Components/DateTime/DateTimeController.h>
#include "Fonts/lcdfont14.h"
#include "../drivers/Cst816s.h" #include "../drivers/Cst816s.h"
#include "LittleVgl.h" #include "LittleVgl.h"
#include <date/date.h> #include <date/date.h>

View file

@ -0,0 +1,23 @@
#Fonts
* [Jetbrains Mono](https://www.jetbrains.com/fr-fr/lp/mono/)
* [Awesome font from LVGL](https://lvgl.io/assets/others/FontAwesome5-Solid+Brands+Regular.woff)
## Generate the fonts:
* Open the [LVGL font converter](https://lvgl.io/tools/fontconverter)
* Name : jetbrains_mono_bold_20
* Size : 20
* Bpp : 1 bit-per-pixel
* Do not enable font compression and horizontal subpixel hinting
* Load the file `JetBrainsMono-Bold.woff` and specify the following range : `0x20-0x7f`
* 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`
* Click on Convert, and download the file `jetbrains_mono_bold_20.c` and copy it in `src/DisplayApp/Fonts`
Add new symbols:
* Browse the [cheatsheet](https://fontawesome.com/cheatsheet/free/solid) and find your new symbols
* For each symbol, add its hex code (0xf641 for the 'Ad' icon, for example) to the *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`:
```
static constex char* newSymbol = "\xEF\x86\x85";
```

View file

@ -33,9 +33,9 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
0x82, 0x30, 0xc4, 0x0, 0x82, 0x30, 0xc4, 0x0,
/* U+24 "$" */ /* U+24 "$" */
0x1c, 0x7, 0x3, 0xf1, 0xfe, 0xe3, 0xf8, 0x7e, 0x8, 0x2, 0x1, 0xc1, 0xfe, 0xeb, 0xf2, 0x7c,
0x3, 0xe0, 0x7f, 0x7, 0xe0, 0x3c, 0x7, 0xe1, 0x83, 0xa0, 0x7c, 0xf, 0xc0, 0xf8, 0x27, 0x9,
0xfc, 0xf7, 0xf8, 0xfc, 0x1c, 0x7, 0x0, 0xf2, 0x7f, 0xf9, 0xfc, 0x8, 0x2, 0x0, 0x80,
/* U+25 "%" */ /* U+25 "%" */
0x78, 0x1f, 0x83, 0x30, 0x66, 0x1f, 0xcc, 0xf2, 0x78, 0x1f, 0x83, 0x30, 0x66, 0x1f, 0xcc, 0xf2,
@ -83,7 +83,7 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
0xe, 0x3, 0x80, 0xc0, 0x70, 0x18, 0xe, 0x0, 0xe, 0x3, 0x80, 0xc0, 0x70, 0x18, 0xe, 0x0,
/* U+30 "0" */ /* U+30 "0" */
0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xfb, 0x7e, 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xed, 0xfb, 0x7e,
0xdf, 0xb7, 0xed, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, 0xdf, 0xb7, 0xed, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f,
0x8f, 0x80, 0x8f, 0x80,
@ -241,7 +241,7 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
0xb8, 0x70, 0xb8, 0x70,
/* U+53 "S" */ /* U+53 "S" */
0x3f, 0x1f, 0xee, 0x3f, 0x87, 0xe0, 0x3e, 0x7, 0x3f, 0x1f, 0xee, 0x1f, 0x87, 0xe0, 0x3e, 0x7,
0xf0, 0x7e, 0x3, 0xc0, 0x7e, 0x1f, 0xcf, 0x7f, 0xf0, 0x7e, 0x3, 0xc0, 0x7e, 0x1f, 0xcf, 0x7f,
0x8f, 0xc0, 0x8f, 0xc0,
@ -260,9 +260,9 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
0x80, 0xf0, 0xf, 0x0, 0xf0, 0x80, 0xf0, 0xf, 0x0, 0xf0,
/* U+57 "W" */ /* U+57 "W" */
0xc6, 0x3c, 0x73, 0x47, 0x36, 0xf3, 0x6f, 0x26, 0xc6, 0x78, 0xcf, 0x39, 0xe7, 0x3e, 0xa6, 0xd6,
0xf6, 0x6d, 0x66, 0xd6, 0x69, 0x66, 0x9e, 0x69, 0xda, 0xdb, 0x5b, 0x6b, 0x6d, 0x2d, 0xe7, 0x3c,
0xe6, 0x9e, 0x39, 0xe3, 0x9e, 0xe7, 0x9c, 0xe3, 0x80,
/* U+58 "X" */ /* U+58 "X" */
0xe1, 0xd8, 0x67, 0x38, 0xcc, 0x3f, 0x7, 0x81, 0xe1, 0xd8, 0x67, 0x38, 0xcc, 0x3f, 0x7, 0x81,
@ -302,8 +302,8 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
0x63, 0x8e, 0x63, 0x8e,
/* U+61 "a" */ /* U+61 "a" */
0x1f, 0x1f, 0xef, 0x1c, 0x7, 0x3f, 0xdf, 0xfe, 0x3f, 0x1f, 0xee, 0x1c, 0x7, 0x3f, 0xdf, 0xfe,
0x1f, 0x87, 0xe3, 0xff, 0xf7, 0x9c, 0x1f, 0x87, 0xe3, 0xff, 0xf7, 0xdc,
/* U+62 "b" */ /* U+62 "b" */
0xe0, 0x38, 0xe, 0x3, 0xbc, 0xff, 0xbc, 0xfe, 0xe0, 0x38, 0xe, 0x3, 0xbc, 0xff, 0xbc, 0xfe,
@ -338,12 +338,12 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
0xc7, 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1c, 0xc7, 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1c,
/* U+69 "i" */ /* U+69 "i" */
0x8, 0x7, 0x0, 0x80, 0x0, 0xfc, 0x3f, 0x1, 0x1c, 0x7, 0x0, 0x0, 0x0, 0xfc, 0x3f, 0x1,
0xc0, 0x70, 0x1c, 0x7, 0x1, 0xc0, 0x70, 0x1c, 0xc0, 0x70, 0x1c, 0x7, 0x1, 0xc0, 0x70, 0x1c,
0x3f, 0xff, 0xfc, 0x3f, 0xff, 0xfc,
/* U+6A "j" */ /* U+6A "j" */
0x2, 0x7, 0x2, 0x0, 0x7f, 0x7f, 0x7, 0x7, 0x7, 0x7, 0x0, 0x0, 0x7f, 0x7f, 0x7, 0x7,
0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0xf, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0xf,
0xfe, 0xfc, 0xfe, 0xfc,
@ -367,7 +367,7 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
/* U+6F "o" */ /* U+6F "o" */
0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e,
0x1f, 0x87, 0xf3, 0xdf, 0xe1, 0xf0, 0x1f, 0x87, 0xf3, 0xdf, 0xe3, 0xf0,
/* U+70 "p" */ /* U+70 "p" */
0xef, 0x3f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, 0xef, 0x3f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e,
@ -401,9 +401,8 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
0x30, 0xfc, 0x1e, 0x7, 0x81, 0xe0, 0x30, 0xfc, 0x1e, 0x7, 0x81, 0xe0,
/* U+77 "w" */ /* U+77 "w" */
0xc6, 0x24, 0x62, 0x4e, 0x66, 0xf6, 0x6f, 0x66, 0xc6, 0x79, 0xcf, 0x39, 0xb5, 0x36, 0xa6, 0xd6,
0xf6, 0x6b, 0x66, 0x94, 0x79, 0x43, 0x9c, 0x39, 0xda, 0xdb, 0x4e, 0x79, 0xcf, 0x38, 0xc7, 0x0,
0xc0,
/* U+78 "x" */ /* U+78 "x" */
0xe1, 0xdc, 0xe3, 0x30, 0xfc, 0x1e, 0x7, 0x81, 0xe1, 0xdc, 0xe3, 0x30, 0xfc, 0x1e, 0x7, 0x81,
@ -415,11 +414,11 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
0x6, 0x0, 0x6, 0x0,
/* U+7A "z" */ /* U+7A "z" */
0xff, 0xff, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xff, 0xff, 0xc1, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0,
0xe0, 0xe0, 0x7f, 0xff, 0xe0, 0xe0, 0xe0, 0x7f, 0xff, 0xe0,
/* U+7B "{" */ /* U+7B "{" */
0x3, 0x87, 0xc3, 0x81, 0xc0, 0xe0, 0x70, 0x38, 0x7, 0x87, 0xc3, 0x81, 0xc0, 0xe0, 0x70, 0x38,
0x1c, 0xfc, 0x7e, 0x3, 0x81, 0xc0, 0xe0, 0x70, 0x1c, 0xfc, 0x7e, 0x3, 0x81, 0xc0, 0xe0, 0x70,
0x38, 0x1c, 0xf, 0x83, 0xc0, 0x38, 0x1c, 0xf, 0x83, 0xc0,
@ -432,7 +431,110 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
0x7, 0x1, 0xc0, 0x70, 0xf8, 0x3c, 0x0, 0x7, 0x1, 0xc0, 0x70, 0xf8, 0x3c, 0x0,
/* U+7E "~" */ /* U+7E "~" */
0x78, 0xff, 0x3c, 0xff, 0x1e 0x78, 0xff, 0x3c, 0xff, 0x1e,
/* U+F017 "" */
0x3, 0xf8, 0x1, 0xff, 0xc0, 0x7f, 0xfc, 0x1f,
0xff, 0xc7, 0xf1, 0xfc, 0xfe, 0x3f, 0x9f, 0xc7,
0xf7, 0xf8, 0xff, 0xff, 0x1f, 0xff, 0xe3, 0xff,
0xfc, 0x3f, 0xff, 0x83, 0xff, 0xfc, 0x7e, 0xff,
0xcf, 0x9f, 0xff, 0xf1, 0xff, 0xfc, 0x1f, 0xff,
0x1, 0xff, 0xc0, 0x1f, 0xf0, 0x0, 0x70, 0x0,
/* U+F03A "" */
0xf0, 0x0, 0xf, 0x3f, 0xff, 0xf3, 0xff, 0xff,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0xf, 0x0, 0x0, 0xf3, 0xff, 0xff, 0x3f,
0xff, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0xf, 0x0, 0x0, 0xf3, 0xff, 0xff, 0x3f, 0xff,
0xf0, 0x0, 0x0,
/* U+F129 "" */
0x3c, 0x7e, 0x7e, 0x7e, 0x3c, 0x0, 0x0, 0xfc,
0xfc, 0xfc, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
0xff, 0xff, 0xff,
/* U+F185 "" */
0x0, 0x60, 0x0, 0x6, 0x0, 0x0, 0xf0, 0x1,
0xcf, 0x38, 0x1f, 0xff, 0x81, 0xf0, 0xf8, 0xc,
0xf3, 0x1, 0xdf, 0xb8, 0x7b, 0xfd, 0xef, 0xbf,
0xdf, 0x7b, 0xfd, 0xe1, 0x9f, 0x98, 0xc, 0xf3,
0x0, 0xc0, 0x30, 0x1f, 0xf, 0x81, 0xff, 0xf8,
0x1c, 0xf3, 0x80, 0xf, 0x0, 0x0, 0x60, 0x0,
0x6, 0x0,
/* U+F1E6 "" */
0x18, 0x30, 0x70, 0x70, 0xe0, 0xe1, 0xc1, 0xc3,
0x83, 0x80, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x7f,
0xfc, 0xff, 0xf9, 0xff, 0xf1, 0xff, 0xc3, 0xff,
0x83, 0xfe, 0x3, 0xf8, 0x1, 0xc0, 0x3, 0x80,
0x7, 0x0, 0xe, 0x0,
/* U+F21E "" */
0x1e, 0x7, 0x83, 0xf9, 0xfe, 0x7f, 0xff, 0xef,
0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xfc,
0xf7, 0xf7, 0xd6, 0x3e, 0x79, 0x6b, 0xe0, 0x34,
0x80, 0x1f, 0x9f, 0x80, 0xf9, 0xf0, 0x7, 0xfe,
0x0, 0x3f, 0xc0, 0x1, 0xf8, 0x0, 0xf, 0x0,
0x0, 0x60, 0x0,
/* U+F240 "" */
0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0,
0x1, 0xfd, 0xff, 0xfe, 0xfe, 0xff, 0xff, 0x7f,
0x7f, 0xff, 0x9f, 0xbf, 0xff, 0xcf, 0xdf, 0xff,
0xe7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff,
0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0,
/* U+F241 "" */
0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0,
0x1, 0xfd, 0xff, 0xe0, 0xfe, 0xff, 0xf0, 0x7f,
0x7f, 0xf8, 0x1f, 0xbf, 0xfc, 0xf, 0xdf, 0xfe,
0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff,
0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0,
/* U+F242 "" */
0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0,
0x1, 0xfd, 0xfe, 0x0, 0xfe, 0xff, 0x0, 0x7f,
0x7f, 0x80, 0x1f, 0xbf, 0xc0, 0xf, 0xdf, 0xe0,
0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff,
0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0,
/* U+F243 "" */
0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0,
0x1, 0xfd, 0xf0, 0x0, 0xfe, 0xf8, 0x0, 0x7f,
0x7c, 0x0, 0x1f, 0xbe, 0x0, 0xf, 0xdf, 0x0,
0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff,
0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0,
/* U+F244 "" */
0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0,
0x1, 0xfc, 0x0, 0x0, 0xfe, 0x0, 0x0, 0x7f,
0x0, 0x0, 0x1f, 0x80, 0x0, 0xf, 0xc0, 0x0,
0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff,
0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0,
/* U+F293 "" */
0x7, 0xe0, 0x3f, 0xe0, 0xfb, 0xe3, 0xf3, 0xe7,
0xe3, 0xdf, 0xd3, 0xf9, 0xb3, 0xf9, 0x4f, 0xf8,
0x3f, 0xf8, 0xff, 0xf1, 0xff, 0xc1, 0xff, 0x29,
0xfc, 0xd9, 0xff, 0xa7, 0xbf, 0x1e, 0x7e, 0x7c,
0x7d, 0xf0, 0x7f, 0xe0, 0x7f, 0x0,
/* U+F294 "" */
0x0, 0x0, 0x80, 0x18, 0x3, 0x80, 0x78, 0x8d,
0xb9, 0x9b, 0xb6, 0x3f, 0x83, 0xe0, 0x38, 0x7,
0x81, 0xf8, 0x6d, 0x99, 0x9a, 0x36, 0x7, 0x80,
0xe0, 0x18, 0x2, 0x0, 0x0,
/* U+F54B "" */
0x0, 0xf, 0xf8, 0x1, 0xdf, 0xff, 0x1, 0xef,
0xff, 0xc0, 0xf7, 0xff, 0xf0, 0x7b, 0xff, 0xf8,
0x1d, 0xff, 0xfc, 0x0, 0x1f, 0xfc, 0x0, 0x3,
0xfc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x7, 0xf8, 0x0, 0xf, 0xfe,
0x3, 0xbf, 0xff, 0x83, 0xdf, 0xff, 0xc1, 0xef,
0xff, 0xe0, 0xf7, 0xff, 0xe0, 0x3b, 0xff, 0xe0,
0x0, 0x7f, 0xc0, 0x0
}; };
@ -446,58 +548,58 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 1, .adv_w = 192, .box_w = 3, .box_h = 14, .ofs_x = 4, .ofs_y = 0}, {.bitmap_index = 1, .adv_w = 192, .box_w = 3, .box_h = 14, .ofs_x = 4, .ofs_y = 0},
{.bitmap_index = 7, .adv_w = 192, .box_w = 7, .box_h = 6, .ofs_x = 3, .ofs_y = 8}, {.bitmap_index = 7, .adv_w = 192, .box_w = 7, .box_h = 6, .ofs_x = 3, .ofs_y = 8},
{.bitmap_index = 13, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 13, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 33, .adv_w = 192, .box_w = 10, .box_h = 18, .ofs_x = 1, .ofs_y = -2}, {.bitmap_index = 33, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -3},
{.bitmap_index = 56, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 57, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 76, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 77, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 96, .adv_w = 192, .box_w = 3, .box_h = 6, .ofs_x = 5, .ofs_y = 8}, {.bitmap_index = 97, .adv_w = 192, .box_w = 3, .box_h = 6, .ofs_x = 5, .ofs_y = 8},
{.bitmap_index = 99, .adv_w = 192, .box_w = 7, .box_h = 19, .ofs_x = 3, .ofs_y = -2}, {.bitmap_index = 100, .adv_w = 192, .box_w = 7, .box_h = 19, .ofs_x = 3, .ofs_y = -2},
{.bitmap_index = 116, .adv_w = 192, .box_w = 7, .box_h = 19, .ofs_x = 2, .ofs_y = -2}, {.bitmap_index = 117, .adv_w = 192, .box_w = 7, .box_h = 19, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 133, .adv_w = 192, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = 1}, {.bitmap_index = 134, .adv_w = 192, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 146, .adv_w = 192, .box_w = 10, .box_h = 9, .ofs_x = 1, .ofs_y = 2}, {.bitmap_index = 147, .adv_w = 192, .box_w = 10, .box_h = 9, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 158, .adv_w = 192, .box_w = 5, .box_h = 6, .ofs_x = 3, .ofs_y = -3}, {.bitmap_index = 159, .adv_w = 192, .box_w = 5, .box_h = 6, .ofs_x = 3, .ofs_y = -3},
{.bitmap_index = 162, .adv_w = 192, .box_w = 8, .box_h = 2, .ofs_x = 2, .ofs_y = 5}, {.bitmap_index = 163, .adv_w = 192, .box_w = 8, .box_h = 2, .ofs_x = 2, .ofs_y = 5},
{.bitmap_index = 164, .adv_w = 192, .box_w = 4, .box_h = 4, .ofs_x = 4, .ofs_y = 0}, {.bitmap_index = 165, .adv_w = 192, .box_w = 4, .box_h = 4, .ofs_x = 4, .ofs_y = 0},
{.bitmap_index = 166, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, {.bitmap_index = 167, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 190, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 191, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 208, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, {.bitmap_index = 209, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 224, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 225, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 242, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 243, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 260, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 261, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 276, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, {.bitmap_index = 277, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 292, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 293, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 310, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 311, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 328, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 329, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 346, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 347, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 364, .adv_w = 192, .box_w = 3, .box_h = 11, .ofs_x = 4, .ofs_y = 0}, {.bitmap_index = 365, .adv_w = 192, .box_w = 3, .box_h = 11, .ofs_x = 4, .ofs_y = 0},
{.bitmap_index = 369, .adv_w = 192, .box_w = 5, .box_h = 14, .ofs_x = 3, .ofs_y = -3}, {.bitmap_index = 370, .adv_w = 192, .box_w = 5, .box_h = 14, .ofs_x = 3, .ofs_y = -3},
{.bitmap_index = 378, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 1}, {.bitmap_index = 379, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 391, .adv_w = 192, .box_w = 9, .box_h = 7, .ofs_x = 2, .ofs_y = 3}, {.bitmap_index = 392, .adv_w = 192, .box_w = 9, .box_h = 7, .ofs_x = 2, .ofs_y = 3},
{.bitmap_index = 399, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 1}, {.bitmap_index = 400, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 412, .adv_w = 192, .box_w = 8, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, {.bitmap_index = 413, .adv_w = 192, .box_w = 8, .box_h = 14, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 426, .adv_w = 192, .box_w = 11, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, {.bitmap_index = 427, .adv_w = 192, .box_w = 11, .box_h = 17, .ofs_x = 1, .ofs_y = -3},
{.bitmap_index = 450, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, {.bitmap_index = 451, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 471, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 472, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 489, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 490, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 507, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 508, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 525, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, {.bitmap_index = 526, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 541, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, {.bitmap_index = 542, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 557, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 558, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 575, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 576, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 591, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, {.bitmap_index = 592, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 607, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 608, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 625, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 626, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 645, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, {.bitmap_index = 646, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 661, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 662, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 679, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 680, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 695, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 696, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 713, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 714, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 731, .adv_w = 192, .box_w = 10, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, {.bitmap_index = 732, .adv_w = 192, .box_w = 10, .box_h = 17, .ofs_x = 1, .ofs_y = -3},
{.bitmap_index = 753, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 754, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 771, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 772, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 789, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 790, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 807, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 808, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 823, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, {.bitmap_index = 824, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 844, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, {.bitmap_index = 845, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 865, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 865, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 883, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 883, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 903, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, {.bitmap_index = 903, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0},
@ -529,21 +631,38 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 1296, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 1296, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1314, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 1314, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1327, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 1327, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1341, .adv_w = 192, .box_w = 12, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, {.bitmap_index = 1341, .adv_w = 192, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1358, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 1357, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1372, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, {.bitmap_index = 1371, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3},
{.bitmap_index = 1390, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, {.bitmap_index = 1389, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1403, .adv_w = 192, .box_w = 9, .box_h = 18, .ofs_x = 2, .ofs_y = -2}, {.bitmap_index = 1402, .adv_w = 192, .box_w = 9, .box_h = 18, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 1424, .adv_w = 192, .box_w = 3, .box_h = 18, .ofs_x = 5, .ofs_y = -2}, {.bitmap_index = 1423, .adv_w = 192, .box_w = 3, .box_h = 18, .ofs_x = 5, .ofs_y = -2},
{.bitmap_index = 1431, .adv_w = 192, .box_w = 10, .box_h = 18, .ofs_x = 1, .ofs_y = -2}, {.bitmap_index = 1430, .adv_w = 192, .box_w = 10, .box_h = 18, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 1454, .adv_w = 192, .box_w = 10, .box_h = 4, .ofs_x = 1, .ofs_y = 5} {.bitmap_index = 1453, .adv_w = 192, .box_w = 10, .box_h = 4, .ofs_x = 1, .ofs_y = 5},
{.bitmap_index = 1458, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3},
{.bitmap_index = 1506, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 1549, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 1568, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3},
{.bitmap_index = 1618, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 1654, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 1697, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1735, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1773, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1811, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1849, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 1887, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3},
{.bitmap_index = 1925, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
{.bitmap_index = 1954, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}
}; };
/*--------------------- /*---------------------
* CHARACTER MAPPING * CHARACTER MAPPING
*--------------------*/ *--------------------*/
static const uint16_t unicode_list_1[] = {
0x0, 0x23, 0x112, 0x16e, 0x1cf, 0x207, 0x229, 0x22a,
0x22b, 0x22c, 0x22d, 0x27c, 0x27d, 0x534
};
/*Collect the unicode lists and glyph_id offsets*/ /*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] = static const lv_font_fmt_txt_cmap_t cmaps[] =
@ -551,6 +670,10 @@ static const lv_font_fmt_txt_cmap_t cmaps[] =
{ {
.range_start = 32, .range_length = 95, .glyph_id_start = 1, .range_start = 32, .range_length = 95, .glyph_id_start = 1,
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
},
{
.range_start = 61463, .range_length = 1333, .glyph_id_start = 96,
.unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 14, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
} }
}; };
@ -567,7 +690,7 @@ static lv_font_fmt_txt_dsc_t font_dsc = {
.cmaps = cmaps, .cmaps = cmaps,
.kern_dsc = NULL, .kern_dsc = NULL,
.kern_scale = 0, .kern_scale = 0,
.cmap_num = 1, .cmap_num = 2,
.bpp = 1, .bpp = 1,
.kern_classes = 0, .kern_classes = 0,
.bitmap_format = 0 .bitmap_format = 0
@ -582,7 +705,7 @@ static lv_font_fmt_txt_dsc_t font_dsc = {
lv_font_t jetbrains_mono_bold_20 = { lv_font_t jetbrains_mono_bold_20 = {
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.line_height = 20, /*The maximum line height required by the font*/ .line_height = 21, /*The maximum line height required by the font*/
.base_line = 3, /*Baseline measured from the bottom of the line*/ .base_line = 3, /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE, .subpx = LV_FONT_SUBPX_NONE,

File diff suppressed because it is too large Load diff

View file

@ -1,5 +0,0 @@
// Font data for LCD 14pt
extern const uint8_t lCD_14ptBitmaps[];
extern const FONT_INFO lCD_14ptFontInfo;
extern const FONT_CHAR_INFO lCD_14ptDescriptors[];

File diff suppressed because it is too large Load diff

View file

@ -1,5 +0,0 @@
// Font data for LCD 70pt
extern const uint8_t lCD_70ptBitmaps[];
extern const FONT_INFO lCD_70ptFontInfo;
extern const FONT_CHAR_INFO lCD_70ptDescriptors[];

View file

@ -17,6 +17,8 @@ LV_FONT_DECLARE(jetbrains_mono_extrabold_compressed)
LV_FONT_DECLARE(jetbrains_mono_bold_20) LV_FONT_DECLARE(jetbrains_mono_bold_20)
} }
lv_style_t* LabelBigStyle = nullptr;
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) { static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) {
auto* lvgl = static_cast<LittleVgl*>(disp_drv->user_data); auto* lvgl = static_cast<LittleVgl*>(disp_drv->user_data);
lvgl->FlushDisplay(area, color_p); lvgl->FlushDisplay(area, color_p);
@ -361,6 +363,10 @@ void LittleVgl::InitThemeLabel() {
lv_style_copy(&prim, &bg); lv_style_copy(&prim, &bg);
prim.text.color = lv_color_hsv_to_rgb(hue, 5, 95); prim.text.color = lv_color_hsv_to_rgb(hue, 5, 95);
lv_style_copy(&labelBigStyle, &prim);
labelBigStyle.text.font = &jetbrains_mono_extrabold_compressed;
LabelBigStyle = &(this->labelBigStyle);
lv_style_copy(&sec, &bg); lv_style_copy(&sec, &bg);
sec.text.color = lv_color_hsv_to_rgb(hue, 15, 65); sec.text.color = lv_color_hsv_to_rgb(hue, 15, 65);

View file

@ -79,6 +79,7 @@ namespace Pinetime {
uint16_t hue = 10; uint16_t hue = 10;
lv_theme_t theme; lv_theme_t theme;
lv_style_t btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina; lv_style_t btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina;
lv_style_t labelBigStyle;
lv_style_t prim, sec, hint; lv_style_t prim, sec, hint;
lv_style_t led; lv_style_t led;
lv_style_t bar_bg, bar_indic; lv_style_t bar_bg, bar_indic;

View file

@ -1,62 +1,21 @@
#include "BatteryIcon.h" #include "BatteryIcon.h"
#include "Symbols.h"
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;
const char* BatteryIcon::GetBatteryIcon(float batteryPercent) {
extern lv_img_dsc_t ck_os_battery_error; if(batteryPercent > 90.0f) return Symbols::batteryFull;
extern lv_img_dsc_t ck_os_batterycharging_100; if(batteryPercent > 75.0f) return Symbols::batteryThreeQuarter;
extern lv_img_dsc_t ck_os_batterycharging_090; if(batteryPercent > 50.0f) return Symbols::batteryHalf;
extern lv_img_dsc_t ck_os_batterycharging_080; if(batteryPercent > 25.0f) return Symbols::batteryOneQuarter;
extern lv_img_dsc_t ck_os_batterycharging_070; return Symbols::batteryEmpty;
extern lv_img_dsc_t ck_os_batterycharging_060;
extern lv_img_dsc_t ck_os_batterycharging_050;
extern lv_img_dsc_t ck_os_batterycharging_040;
extern lv_img_dsc_t ck_os_batterycharging_030;
extern lv_img_dsc_t ck_os_batterycharging_020;
extern lv_img_dsc_t ck_os_batterycharging_010;
extern lv_img_dsc_t ck_os_batterycharging_005;
extern lv_img_dsc_t ck_os_battery_100;
extern lv_img_dsc_t ck_os_battery_090;
extern lv_img_dsc_t ck_os_battery_080;
extern lv_img_dsc_t ck_os_battery_070;
extern lv_img_dsc_t ck_os_battery_060;
extern lv_img_dsc_t ck_os_battery_050;
extern lv_img_dsc_t ck_os_battery_040;
extern lv_img_dsc_t ck_os_battery_030;
extern lv_img_dsc_t ck_os_battery_020;
extern lv_img_dsc_t ck_os_battery_010;
extern lv_img_dsc_t ck_os_battery_005;
lv_img_dsc_t *BatteryIcon::GetIcon(bool isCharging, float batteryPercent) {
if(isCharging) {
if(batteryPercent > 90.0f) return &ck_os_batterycharging_100;
else if(batteryPercent > 80.0f) return &ck_os_batterycharging_090;
else if(batteryPercent > 70.0f) return &ck_os_batterycharging_080;
else if(batteryPercent > 60.0f) return &ck_os_batterycharging_070;
else if(batteryPercent > 50.0f) return &ck_os_batterycharging_060;
else if(batteryPercent > 40.0f) return &ck_os_batterycharging_050;
else if(batteryPercent > 30.0f) return &ck_os_batterycharging_040;
else if(batteryPercent > 20.0f) return &ck_os_batterycharging_030;
else if(batteryPercent > 10.0f) return &ck_os_batterycharging_020;
else if(batteryPercent > 5.0f) return &ck_os_batterycharging_010;
else return &ck_os_batterycharging_005;
} else {
if(batteryPercent > 90.0f) return &ck_os_battery_100;
else if(batteryPercent > 80.0f) return &ck_os_battery_090;
else if(batteryPercent > 70.0f) return &ck_os_battery_080;
else if(batteryPercent > 60.0f) return &ck_os_battery_070;
else if(batteryPercent > 50.0f) return &ck_os_battery_060;
else if(batteryPercent > 40.0f) return &ck_os_battery_050;
else if(batteryPercent > 30.0f) return &ck_os_battery_040;
else if(batteryPercent > 20.0f) return &ck_os_battery_030;
else if(batteryPercent > 10.0f) return &ck_os_battery_020;
else if(batteryPercent > 5.0f) return &ck_os_battery_010;
else return &ck_os_battery_005;
}
} }
lv_img_dsc_t *BatteryIcon::GetUnknownIcon() { const char* BatteryIcon::GetUnknownIcon() {
return &ck_os_battery_error; return Symbols::batteryEmpty;
}
const char *BatteryIcon::GetPlugIcon(bool isCharging) {
if(isCharging)
return Symbols::plug;
else return "";
} }

View file

@ -7,8 +7,9 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class BatteryIcon { class BatteryIcon {
public: public:
static lv_img_dsc_t* GetUnknownIcon(); static const char* GetUnknownIcon();
static lv_img_dsc_t* GetIcon(bool isCharging, float batteryPercent); static const char* GetBatteryIcon(float batteryPercent);
static const char* GetPlugIcon(bool isCharging);
}; };
} }
} }

View file

@ -1,12 +1,8 @@
#include "BleIcon.h" #include "BleIcon.h"
#include "Symbols.h"
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;
const char* BleIcon::GetIcon(bool isConnected) {
extern lv_img_dsc_t ck_os_bt_connected; if(isConnected) return Symbols::bluetooth;
extern lv_img_dsc_t ck_os_bt_disconnected; else return "";
lv_img_dsc_t *BleIcon::GetIcon(bool isConnected) {
if(isConnected) return &ck_os_bt_connected;
else return &ck_os_bt_disconnected;
} }

View file

@ -1,13 +1,11 @@
#pragma once #pragma once
#include <libs/lvgl/src/lv_draw/lv_img_decoder.h>
namespace Pinetime { namespace Pinetime {
namespace Applications { namespace Applications {
namespace Screens { namespace Screens {
class BleIcon { class BleIcon {
public: public:
static lv_img_dsc_t* GetIcon(bool isConnected); static const char* GetIcon(bool isConnected);
}; };
} }
} }

View file

@ -1,17 +1,16 @@
#include <cstdio> #include <cstdio>
#include <libs/date/includes/date/date.h> #include <libs/date/includes/date/date.h>
#include <Components/DateTime/DateTimeController.h> #include <Components/DateTime/DateTimeController.h>
#include <Version.h>
#include <libs/lvgl/lvgl.h> #include <libs/lvgl/lvgl.h>
#include "Clock.h" #include "Clock.h"
#include "../DisplayApp.h" #include "../DisplayApp.h"
#include "BatteryIcon.h" #include "BatteryIcon.h"
#include "BleIcon.h" #include "BleIcon.h"
#include "Symbols.h"
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;
extern lv_font_t jetbrains_mono_extrabold_compressed; extern lv_font_t jetbrains_mono_extrabold_compressed;
extern lv_font_t jetbrains_mono_bold_20; extern lv_font_t jetbrains_mono_bold_20;
extern lv_style_t* LabelBigStyle;
static void event_handler(lv_obj_t * obj, lv_event_t event) { static void event_handler(lv_obj_t * obj, lv_event_t event) {
Clock* screen = static_cast<Clock *>(obj->user_data); Clock* screen = static_cast<Clock *>(obj->user_data);
@ -21,7 +20,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
Clock::Clock(DisplayApp* app, Clock::Clock(DisplayApp* app,
Controllers::DateTime& dateTimeController, Controllers::DateTime& dateTimeController,
Controllers::Battery& batteryController, Controllers::Battery& batteryController,
Controllers::Ble& bleController) : Screen(app), currentDateTime{{}}, version {{}}, Controllers::Ble& bleController) : Screen(app), currentDateTime{{}},
dateTimeController{dateTimeController}, batteryController{batteryController}, bleController{bleController} { dateTimeController{dateTimeController}, batteryController{batteryController}, bleController{bleController} {
displayedChar[0] = 0; displayedChar[0] = 0;
displayedChar[1] = 0; displayedChar[1] = 0;
@ -29,39 +28,56 @@ Clock::Clock(DisplayApp* app,
displayedChar[3] = 0; displayedChar[3] = 0;
displayedChar[4] = 0; displayedChar[4] = 0;
batteryIcon = lv_img_create(lv_scr_act(), NULL); batteryIcon = lv_label_create(lv_scr_act(), NULL);
lv_img_set_src(batteryIcon, BatteryIcon::GetUnknownIcon()); lv_label_set_text(batteryIcon, Symbols::batteryFull);
lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0); lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 2);
batteryPlug = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(batteryPlug, Symbols::plug);
lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0);
bleIcon = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(bleIcon, Symbols::bluetooth);
lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0);
bleIcon = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(bleIcon, BleIcon::GetIcon(false));
lv_obj_align(bleIcon, batteryIcon, LV_ALIGN_OUT_LEFT_MID, 0, 0);
label_date = lv_label_create(lv_scr_act(), NULL); label_date = lv_label_create(lv_scr_act(), NULL);
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60); lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);
labelStyle = const_cast<lv_style_t *>(lv_label_get_style(label_date, LV_LABEL_STYLE_MAIN));
labelStyle->text.font = &jetbrains_mono_bold_20;
lv_style_copy(&labelBigStyle, labelStyle);
labelBigStyle.text.font = &jetbrains_mono_extrabold_compressed;
lv_label_set_style(label_date, LV_LABEL_STYLE_MAIN, labelStyle);
label_time = lv_label_create(lv_scr_act(), NULL); label_time = lv_label_create(lv_scr_act(), NULL);
lv_label_set_style(label_time, LV_LABEL_STYLE_MAIN, &labelBigStyle); lv_label_set_style(label_time, LV_LABEL_STYLE_MAIN, LabelBigStyle);
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0); lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0);
backgroundLabel = lv_label_create(lv_scr_act(), NULL); backgroundLabel = lv_label_create(lv_scr_act(), NULL);
backgroundLabel->user_data = this; backgroundLabel->user_data = this;
lv_label_set_style(backgroundLabel, LV_LABEL_STYLE_MAIN, labelStyle);
lv_obj_set_click(backgroundLabel, true); lv_obj_set_click(backgroundLabel, true);
lv_obj_set_event_cb(backgroundLabel, event_handler); lv_obj_set_event_cb(backgroundLabel, event_handler);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0); lv_obj_set_pos(backgroundLabel, 0, 0);
lv_label_set_text(backgroundLabel, ""); lv_label_set_text(backgroundLabel, "");
heartbeatIcon = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(heartbeatIcon, Symbols::heartBeat);
lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2);
heartbeatValue = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(heartbeatValue, "0");
lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
heartbeatBpm = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(heartbeatBpm, "BPM");
lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
stepValue = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(stepValue, "0");
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2);
stepIcon = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(stepIcon, Symbols::shoe);
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
} }
Clock::~Clock() { Clock::~Clock() {
@ -72,17 +88,22 @@ bool Clock::Refresh() {
batteryPercentRemaining = batteryController.PercentRemaining(); batteryPercentRemaining = batteryController.PercentRemaining();
if (batteryPercentRemaining.IsUpdated()) { if (batteryPercentRemaining.IsUpdated()) {
auto batteryPercent = batteryPercentRemaining.Get(); auto batteryPercent = batteryPercentRemaining.Get();
lv_img_set_src(batteryIcon, BatteryIcon::GetIcon(batteryController.IsCharging() || batteryController.IsPowerPresent(), batteryPercent)); lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
auto isCharging = batteryController.IsCharging() || batteryController.IsPowerPresent();
lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(isCharging));
} }
bleState = bleController.IsConnected(); bleState = bleController.IsConnected();
if (bleState.IsUpdated()) { if (bleState.IsUpdated()) {
if(bleState.Get() == true) { if(bleState.Get() == true) {
lv_img_set_src(bleIcon, BleIcon::GetIcon(true)); lv_label_set_text(bleIcon, BleIcon::GetIcon(true));
} else { } else {
lv_img_set_src(bleIcon, BleIcon::GetIcon(false)); lv_label_set_text(bleIcon, BleIcon::GetIcon(false));
} }
} }
lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 5);
lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0);
lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0);
currentDateTime = dateTimeController.CurrentDateTime(); currentDateTime = dateTimeController.CurrentDateTime();
@ -133,6 +154,25 @@ bool Clock::Refresh() {
} }
} }
// TODO heartbeat = heartBeatController.GetValue();
if(heartbeat.IsUpdated()) {
char heartbeatBuffer[4];
sprintf(heartbeatBuffer, "%d", heartbeat.Get());
lv_label_set_text(heartbeatValue, heartbeatBuffer);
lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2);
lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
}
// TODO stepCount = stepController.GetValue();
if(stepCount.IsUpdated()) {
char stepBuffer[5];
sprintf(stepBuffer, "%lu", stepCount.Get());
lv_label_set_text(stepValue, stepBuffer);
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2);
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
}
return running; return running;
} }

View file

@ -2,16 +2,12 @@
#include <cstdint> #include <cstdint>
#include <chrono> #include <chrono>
#include <Components/Gfx/Gfx.h>
#include "Screen.h" #include "Screen.h"
#include <bits/unique_ptr.h> #include <bits/unique_ptr.h>
#include <libs/lvgl/src/lv_core/lv_style.h> #include <libs/lvgl/src/lv_core/lv_style.h>
#include <libs/lvgl/src/lv_core/lv_obj.h> #include <libs/lvgl/src/lv_core/lv_obj.h>
#include <Components/Battery/BatteryController.h> #include <Components/Battery/BatteryController.h>
#include <Components/Ble/BleController.h> #include <Components/Ble/BleController.h>
#include "../Fonts/lcdfont14.h"
#include "../Fonts/lcdfont70.h"
#include "../../Version.h"
namespace Pinetime { namespace Pinetime {
namespace Applications { namespace Applications {
@ -64,20 +60,21 @@ namespace Pinetime {
DirtyValue<uint8_t> batteryPercentRemaining {0}; DirtyValue<uint8_t> batteryPercentRemaining {0};
DirtyValue<bool> bleState {false}; DirtyValue<bool> bleState {false};
DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime; DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime;
DirtyValue<Pinetime::Version> version; DirtyValue<uint32_t> stepCount {0};
DirtyValue<uint8_t> heartbeat {0};
lv_style_t* labelStyle;
lv_style_t labelBigStyle;
lv_obj_t * label_battery;
lv_obj_t * label_ble;
lv_obj_t* label_time; lv_obj_t* label_time;
lv_obj_t* label_date; lv_obj_t* label_date;
lv_obj_t* label_version;
lv_obj_t* backgroundLabel; lv_obj_t* backgroundLabel;
lv_obj_t * batteryIcon; lv_obj_t * batteryIcon;
lv_obj_t * bleIcon; lv_obj_t * bleIcon;
lv_obj_t* batteryPlug;
lv_obj_t* heartbeatIcon;
lv_obj_t* heartbeatValue;
lv_obj_t* heartbeatBpm;
lv_obj_t* stepIcon;
lv_obj_t* stepValue;
Controllers::DateTime& dateTimeController; Controllers::DateTime& dateTimeController;
Controllers::Battery& batteryController; Controllers::Battery& batteryController;

View file

@ -2,16 +2,11 @@
#include <cstdint> #include <cstdint>
#include <chrono> #include <chrono>
#include <Components/Gfx/Gfx.h>
#include "Screen.h" #include "Screen.h"
#include <bits/unique_ptr.h> #include <bits/unique_ptr.h>
#include <libs/lvgl/src/lv_core/lv_style.h> #include <libs/lvgl/src/lv_core/lv_style.h>
#include <libs/lvgl/src/lv_core/lv_obj.h> #include <libs/lvgl/src/lv_core/lv_obj.h>
#include <Components/Battery/BatteryController.h>
#include <Components/Ble/BleController.h> #include <Components/Ble/BleController.h>
#include "../Fonts/lcdfont14.h"
#include "../Fonts/lcdfont70.h"
#include "../../Version.h"
namespace Pinetime { namespace Pinetime {
namespace Applications { namespace Applications {

View file

@ -1,17 +1,10 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <chrono>
#include <Components/Gfx/Gfx.h>
#include "Screen.h" #include "Screen.h"
#include <bits/unique_ptr.h> #include <bits/unique_ptr.h>
#include <libs/lvgl/src/lv_core/lv_style.h> #include <libs/lvgl/src/lv_core/lv_style.h>
#include <libs/lvgl/src/lv_core/lv_obj.h> #include <libs/lvgl/src/lv_core/lv_obj.h>
#include <Components/Battery/BatteryController.h>
#include <Components/Ble/BleController.h>
#include "../Fonts/lcdfont14.h"
#include "../Fonts/lcdfont70.h"
#include "../../Version.h"
namespace Pinetime { namespace Pinetime {
namespace Applications { namespace Applications {

View file

@ -24,17 +24,12 @@ Message::Message(DisplayApp* app) : Screen(app) {
backgroundLabel = lv_label_create(lv_scr_act(), NULL); backgroundLabel = lv_label_create(lv_scr_act(), NULL);
backgroundLabel->user_data = this; backgroundLabel->user_data = this;
labelStyle = const_cast<lv_style_t *>(lv_label_get_style(backgroundLabel, LV_LABEL_STYLE_MAIN));
labelStyle->text.font = &jetbrains_mono_bold_20;
lv_label_set_style(backgroundLabel, LV_LABEL_STYLE_MAIN, labelStyle);
lv_obj_set_click(backgroundLabel, true); lv_obj_set_click(backgroundLabel, true);
lv_obj_set_event_cb(backgroundLabel, event_handler); lv_obj_set_event_cb(backgroundLabel, event_handler);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0); lv_obj_set_pos(backgroundLabel, 0, 0);
lv_label_set_text(backgroundLabel, ""); lv_label_set_text(backgroundLabel, "");
// lv_obj_align(backgroundLabel, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
button = lv_btn_create(lv_scr_act(), NULL); button = lv_btn_create(lv_scr_act(), NULL);
lv_obj_set_event_cb(button, event_handler); lv_obj_set_event_cb(button, event_handler);
@ -42,11 +37,9 @@ Message::Message(DisplayApp* app) : Screen(app) {
button->user_data = this; button->user_data = this;
label = lv_label_create(button, NULL); label = lv_label_create(button, NULL);
lv_label_set_style(label, LV_LABEL_STYLE_MAIN, labelStyle);
lv_label_set_text(label, "Hello!"); lv_label_set_text(label, "Hello!");
labelClick = lv_label_create(lv_scr_act(), NULL); labelClick = lv_label_create(lv_scr_act(), NULL);
lv_label_set_style(labelClick, LV_LABEL_STYLE_MAIN, labelStyle);
lv_obj_align(labelClick, button, LV_ALIGN_OUT_BOTTOM_MID, 0, 30); lv_obj_align(labelClick, button, LV_ALIGN_OUT_BOTTOM_MID, 0, 30);
lv_label_set_text(labelClick, "0"); lv_label_set_text(labelClick, "0");
} }

View file

@ -1,13 +1,8 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <chrono>
#include <Components/Gfx/Gfx.h>
#include "Screen.h" #include "Screen.h"
#include <bits/unique_ptr.h> #include <bits/unique_ptr.h>
#include "../Fonts/lcdfont14.h"
#include "../Fonts/lcdfont70.h"
#include "../../Version.h"
#include <lvgl/src/lv_core/lv_style.h> #include <lvgl/src/lv_core/lv_style.h>
namespace Pinetime { namespace Pinetime {
@ -22,8 +17,6 @@ namespace Pinetime {
void OnObjectEvent(lv_obj_t* obj, lv_event_t event); void OnObjectEvent(lv_obj_t* obj, lv_event_t event);
private: private:
lv_style_t* labelStyle;
lv_obj_t * label; lv_obj_t * label;
lv_obj_t* backgroundLabel; lv_obj_t* backgroundLabel;
lv_obj_t * button; lv_obj_t * button;

View file

@ -2,16 +2,10 @@
#include <cstdint> #include <cstdint>
#include <chrono> #include <chrono>
#include <Components/Gfx/Gfx.h>
#include "Screen.h" #include "Screen.h"
#include <bits/unique_ptr.h> #include <bits/unique_ptr.h>
#include <libs/lvgl/src/lv_core/lv_style.h> #include <libs/lvgl/src/lv_core/lv_style.h>
#include <libs/lvgl/src/lv_core/lv_obj.h> #include <libs/lvgl/src/lv_core/lv_obj.h>
#include <Components/Battery/BatteryController.h>
#include <Components/Ble/BleController.h>
#include "../Fonts/lcdfont14.h"
#include "../Fonts/lcdfont70.h"
#include "../../Version.h"
namespace Pinetime { namespace Pinetime {
namespace Applications { namespace Applications {

View file

@ -2,16 +2,10 @@
#include <cstdint> #include <cstdint>
#include <chrono> #include <chrono>
#include <Components/Gfx/Gfx.h>
#include "Screen.h" #include "Screen.h"
#include <bits/unique_ptr.h> #include <bits/unique_ptr.h>
#include <libs/lvgl/src/lv_core/lv_style.h> #include <libs/lvgl/src/lv_core/lv_style.h>
#include <libs/lvgl/src/lv_core/lv_obj.h> #include <libs/lvgl/src/lv_core/lv_obj.h>
#include <Components/Battery/BatteryController.h>
#include <Components/Ble/BleController.h>
#include "../Fonts/lcdfont14.h"
#include "../Fonts/lcdfont70.h"
#include "../../Version.h"
namespace Pinetime { namespace Pinetime {
namespace Applications { namespace Applications {

View file

@ -1,6 +1,7 @@
#include <libs/lvgl/lvgl.h> #include <libs/lvgl/lvgl.h>
#include <DisplayApp/DisplayApp.h> #include <DisplayApp/DisplayApp.h>
#include "ScreenList.h" #include "ScreenList.h"
#include "../../Version.h"
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;

View file

@ -0,0 +1,24 @@
#pragma once
namespace Pinetime {
namespace Applications {
namespace Screens {
namespace Symbols {
static constexpr char* batteryFull = "\xEF\x89\x80";
static constexpr char* batteryEmpty = "\xEF\x89\x84";
static constexpr char* batteryThreeQuarter = "\xEF\x89\x81";
static constexpr char* batteryHalf = "\xEF\x89\x82";
static constexpr char* batteryOneQuarter = "\xEF\x89\x83";
static constexpr char* heartBeat = "\xEF\x88\x9E";
static constexpr char* bluetoothFull = "\xEF\x8A\x93";
static constexpr char* bluetooth = "\xEF\x8A\x94";
static constexpr char* plug = "\xEF\x87\xA6";
static constexpr char* shoe = "\xEF\x95\x8B";
static constexpr char* clock = "\xEF\x80\x97";
static constexpr char* info = "\xEF\x84\xA9";
static constexpr char* list = "\xEF\x80\xBA";
static constexpr char* sun = "\xEF\x86\x85";
}
}
}
}

View file

@ -1,13 +1,8 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <chrono>
#include <Components/Gfx/Gfx.h>
#include "Screen.h" #include "Screen.h"
#include <bits/unique_ptr.h> #include <bits/unique_ptr.h>
#include "../Fonts/lcdfont14.h"
#include "../Fonts/lcdfont70.h"
#include "../../Version.h"
#include <lvgl/src/lv_core/lv_style.h> #include <lvgl/src/lv_core/lv_style.h>
namespace Pinetime { namespace Pinetime {

View file

@ -3,7 +3,8 @@
#include <libs/lvgl/lvgl.h> #include <libs/lvgl/lvgl.h>
#include "Tile.h" #include "Tile.h"
#include <DisplayApp/DisplayApp.h> #include <DisplayApp/DisplayApp.h>
#include "Symbols.h"
#include "../../Version.h"
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;
@ -16,89 +17,17 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
screen->OnObjectEvent(obj, event, eventData); screen->OnObjectEvent(obj, event, eventData);
} }
static const char * btnm_map1[] = {"Meter", "Gauge", "Clock", "\n", "Soft\nversion", "App2", "Brightness", ""}; static const char * btnm_map1[] = {Symbols::heartBeat, Symbols::shoe, Symbols::clock, "\n", Symbols::info, Symbols::list, Symbols::sun, ""};
Tile::Tile(DisplayApp* app) : Screen(app) { Tile::Tile(DisplayApp* app) : Screen(app) {
modal.reset(new Modal(app)); modal.reset(new Modal(app));
/*
static lv_point_t valid_pos[] = {{0,0}, {LV_COORD_MIN, LV_COORD_MIN}};
tileview = lv_tileview_create(lv_scr_act(), NULL);
lv_tileview_set_valid_positions(tileview, valid_pos, 1);
lv_tileview_set_edge_flash(tileview, false);
tile1 = lv_obj_create(tileview, NULL);
lv_obj_set_pos(tile1, 0, 0);
lv_obj_set_size(tile1, LV_HOR_RES, LV_VER_RES);
lv_tileview_add_element(tileview, tile1);
*/
btnm1 = lv_btnm_create(lv_scr_act(), NULL); btnm1 = lv_btnm_create(lv_scr_act(), NULL);
lv_btnm_set_map(btnm1, btnm_map1); lv_btnm_set_map(btnm1, btnm_map1);
lv_obj_set_size(btnm1, LV_HOR_RES, LV_VER_RES); lv_obj_set_size(btnm1, LV_HOR_RES, LV_VER_RES);
// labelRelStyle = const_cast<lv_style_t *>(lv_label_get_style(btnm1, LV_BTNM_STYLE_BTN_REL));
// labelRelStyle->text.font = &jetbrains_mono_bold_20;
// labelRelStyle->body.grad_color = labelRelStyle->body.main_color;
// lv_btnm_set_style(btnm1, LV_BTNM_STYLE_BTN_REL, labelRelStyle);
//
// labelPrStyle = const_cast<lv_style_t *>(lv_label_get_style(btnm1, LV_BTNM_STYLE_BTN_PR));
// labelPrStyle->text.font = &jetbrains_mono_bold_20;
// labelPrStyle->body.grad_color = labelPrStyle->body.shadow.color;
// lv_btnm_set_style(btnm1, LV_BTNM_STYLE_BTN_PR, labelPrStyle);
//TODO better style handling
// lv_obj_align(btnm1, tile1, LV_ALIGN_CENTER, 0, 0);
btnm1->user_data = this; btnm1->user_data = this;
lv_obj_set_event_cb(btnm1, event_handler); lv_obj_set_event_cb(btnm1, event_handler);
/*
tile2 = lv_obj_create(tileview, NULL);
lv_obj_set_pos(tile2, 0, LV_VER_RES);
lv_obj_set_size(tile2, LV_HOR_RES, LV_VER_RES);
lv_tileview_add_element(tileview, tile2);
btnm2 = lv_btnm_create(tileview, NULL);
lv_btnm_set_map(btnm2, btnm_map2);
lv_obj_align(btnm2, tile2, LV_ALIGN_CENTER, 0, 0);
*/
/*
tile1 = lv_obj_create(tileview, NULL);
lv_obj_set_pos(tile1, 0, 0);
lv_obj_set_size(tile1, LV_HOR_RES, LV_VER_RES);
lv_tileview_add_element(tileview, tile1);
btn1 = lv_btn_create(tile1, NULL);
lv_obj_align(btn1, tile1, LV_ALIGN_CENTER, 0, 0);
label1 = lv_label_create(btn1, NULL);
lv_label_set_text(label1, "Button1");
*/
/*
tile2 = lv_obj_create(tileview, NULL);
lv_obj_set_pos(tile2, 0, LV_VER_RES);
lv_obj_set_size(tile2, LV_HOR_RES, LV_VER_RES);
lv_tileview_add_element(tileview, tile2);
btn2 = lv_btn_create(tile2, NULL);
lv_obj_align(btn2, tile2, LV_ALIGN_CENTER, 0, 0);
label2 = lv_label_create(btn2, NULL);
lv_label_set_text(label2, "Button2");
tile3 = lv_obj_create(tileview, NULL);
lv_obj_set_pos(tile3, 0, LV_VER_RES*2);
lv_obj_set_size(tile3, LV_HOR_RES, LV_VER_RES);
lv_tileview_add_element(tileview, tile3);
btn3 = lv_btn_create(tile3, NULL);
lv_obj_align(btn3, tile3, LV_ALIGN_CENTER, 0, 0);
label3 = lv_label_create(btn3, NULL);
lv_label_set_text(label3, "Button3");
*/
} }
Tile::~Tile() { Tile::~Tile() {

View file

@ -1,13 +1,8 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <chrono>
#include <Components/Gfx/Gfx.h>
#include "Screen.h" #include "Screen.h"
#include <bits/unique_ptr.h> #include <bits/unique_ptr.h>
#include "../Fonts/lcdfont14.h"
#include "../Fonts/lcdfont70.h"
#include "../../Version.h"
#include "Modal.h" #include "Modal.h"
#include <lvgl/src/lv_core/lv_style.h> #include <lvgl/src/lv_core/lv_style.h>

View file

@ -63,7 +63,7 @@
#define configTICK_RATE_HZ 1024 #define configTICK_RATE_HZ 1024
#define configMAX_PRIORITIES ( 3 ) #define configMAX_PRIORITIES ( 3 )
#define configMINIMAL_STACK_SIZE ( 120 ) #define configMINIMAL_STACK_SIZE ( 120 )
#define configTOTAL_HEAP_SIZE ( 1024*20 ) #define configTOTAL_HEAP_SIZE ( 1024*11 )
#define configMAX_TASK_NAME_LEN ( 4 ) #define configMAX_TASK_NAME_LEN ( 4 )
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1 #define configIDLE_SHOULD_YIELD 1
@ -85,7 +85,7 @@
/* Run time and task stats gathering related definitions. */ /* Run time and task stats gathering related definitions. */
#define configGENERATE_RUN_TIME_STATS 0 #define configGENERATE_RUN_TIME_STATS 0
#define configUSE_TRACE_FACILITY 0 #define configUSE_TRACE_FACILITY 1
#define configUSE_STATS_FORMATTING_FUNCTIONS 0 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
/* Co-routine definitions. */ /* Co-routine definitions. */
@ -96,7 +96,7 @@
#define configUSE_TIMERS 1 #define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( 0 ) #define configTIMER_TASK_PRIORITY ( 0 )
#define configTIMER_QUEUE_LENGTH 32 #define configTIMER_QUEUE_LENGTH 32
#define configTIMER_TASK_STACK_DEPTH ( 240 ) #define configTIMER_TASK_STACK_DEPTH ( 200 )
/* Tickless Idle configuration. */ /* Tickless Idle configuration. */
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2 #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2

View file

@ -13,7 +13,7 @@ void NrfLogger::Init() {
NRF_LOG_DEFAULT_BACKENDS_INIT(); NRF_LOG_DEFAULT_BACKENDS_INIT();
if (pdPASS != xTaskCreate(NrfLogger::Process, "LOGGER", 512, nullptr, 0, &m_logger_thread)) if (pdPASS != xTaskCreate(NrfLogger::Process, "LOGGER", 200, this, 0, &m_logger_thread))
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
} }

View file

@ -0,0 +1,46 @@
#pragma once
#include <FreeRTOS.h>
#include <task.h>
#include <nrf_log.h>
namespace Pinetime {
namespace System {
struct DummyMonitor {};
struct FreeRtosMonitor {};
template<class T>
class SystemMonitor {
public:
SystemMonitor() = delete;
};
template<>
class SystemMonitor<DummyMonitor> {
public:
void Process() const {}
};
template<>
class SystemMonitor<FreeRtosMonitor> {
public:
void Process() const {
if(xTaskGetTickCount() - lastTick > 10000) {
NRF_LOG_INFO("---------------------------------------\nFree heap : %d", xPortGetFreeHeapSize());
auto nb = uxTaskGetSystemState(tasksStatus, 10, NULL);
for (int i = 0; i < nb; i++) {
NRF_LOG_INFO("Task [%s] - %d", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark);
if (tasksStatus[i].usStackHighWaterMark < 20)
NRF_LOG_INFO("WARNING!!! Task %s task is nearly full, only %dB available", tasksStatus[i].pcTaskName,
tasksStatus[i].usStackHighWaterMark * 4);
}
lastTick = xTaskGetTickCount();
}
}
private:
mutable TickType_t lastTick = 0;
mutable TaskStatus_t tasksStatus[10];
};
}
}

View file

@ -120,15 +120,15 @@ void SystemTask::Work() {
isSleeping = true; isSleeping = true;
break; break;
case Messages::OnNewTime: case Messages::OnNewTime:
xTimerReset(idleTimer, 0); ReloadIdleTimer();
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateDateTime); displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateDateTime);
break; break;
case Messages::OnNewNotification: case Messages::OnNewNotification:
xTimerReset(idleTimer, 0); if(isSleeping) GoToRunning();
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification); displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification);
break; break;
case Messages::BleConnected: case Messages::BleConnected:
xTimerReset(idleTimer, 0); ReloadIdleTimer();
isBleDiscoveryTimerRunning = true; isBleDiscoveryTimerRunning = true;
bleDiscoveryTimer = 5; bleDiscoveryTimer = 5;
break; break;
@ -145,10 +145,10 @@ void SystemTask::Work() {
NVIC_SystemReset(); NVIC_SystemReset();
break; break;
case Messages::OnTouchEvent: case Messages::OnTouchEvent:
xTimerReset(idleTimer, 0); ReloadIdleTimer();
break; break;
case Messages::OnButtonEvent: case Messages::OnButtonEvent:
xTimerReset(idleTimer, 0); ReloadIdleTimer();
break; break;
default: break; default: break;
} }
@ -169,6 +169,8 @@ void SystemTask::Work() {
dateTimeController.UpdateTime(systick_counter); dateTimeController.UpdateTime(systick_counter);
batteryController.Update(); batteryController.Update();
monitor.Process();
if(!nrf_gpio_pin_read(pinButton)) if(!nrf_gpio_pin_read(pinButton))
watchdog.Kick(); watchdog.Kick();
} }
@ -215,3 +217,8 @@ void SystemTask::OnIdle() {
NRF_LOG_INFO("Idle timeout -> Going to sleep") NRF_LOG_INFO("Idle timeout -> Going to sleep")
PushMessage(Messages::GoToSleep); PushMessage(Messages::GoToSleep);
} }
void SystemTask::ReloadIdleTimer() const {
if(isSleeping) return;
xTimerReset(idleTimer, 0);
}

View file

@ -10,6 +10,7 @@
#include <drivers/Watchdog.h> #include <drivers/Watchdog.h>
#include <Components/Ble/NimbleController.h> #include <Components/Ble/NimbleController.h>
#include <drivers/SpiNorFlash.h> #include <drivers/SpiNorFlash.h>
#include "SystemMonitor.h"
namespace Pinetime { namespace Pinetime {
namespace System { namespace System {
@ -65,6 +66,7 @@ namespace Pinetime {
static void Process(void* instance); static void Process(void* instance);
void Work(); void Work();
void ReloadIdleTimer() const;
bool isBleDiscoveryTimerRunning = false; bool isBleDiscoveryTimerRunning = false;
uint8_t bleDiscoveryTimer = 0; uint8_t bleDiscoveryTimer = 0;
static constexpr uint32_t idleTime = 15000; static constexpr uint32_t idleTime = 15000;
@ -72,6 +74,12 @@ namespace Pinetime {
bool doNotGoToSleep = false; bool doNotGoToSleep = false;
void GoToRunning(); void GoToRunning();
#if configUSE_TRACE_FACILITY == 1
SystemMonitor<FreeRtosMonitor> monitor;
#else
SystemMonitor<DummyMonitor> monitor;
#endif
}; };
} }
} }

View file

@ -21,7 +21,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include <sdk/components/libraries/log/nrf_log.h>
#include "sysinit/sysinit.h" #include "sysinit/sysinit.h"
#include "syscfg/syscfg.h" #include "syscfg/syscfg.h"
#include "os/os.h" #include "os/os.h"

View file

@ -20,7 +20,6 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <sdk/components/libraries/log/nrf_log.h>
#include "syscfg/syscfg.h" #include "syscfg/syscfg.h"
#include "os/os.h" #include "os/os.h"
#include "ble/xcvr.h" #include "ble/xcvr.h"

View file

@ -37,7 +37,7 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn)
* provided by NimBLE and in case of FreeRTOS it does not need to be wrapped * provided by NimBLE and in case of FreeRTOS it does not need to be wrapped
* since it has compatible prototype. * since it has compatible prototype.
*/ */
xTaskCreate(nimble_port_ll_task_func, "ll", configMINIMAL_STACK_SIZE + 400, xTaskCreate(nimble_port_ll_task_func, "ll", configMINIMAL_STACK_SIZE + 100,
NULL, configMAX_PRIORITIES - 1, &ll_task_h); NULL, configMAX_PRIORITIES - 1, &ll_task_h);
#endif #endif
@ -46,6 +46,6 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn)
* have separate task for NimBLE host, but since something needs to handle * have separate task for NimBLE host, but since something needs to handle
* default queue it is just easier to make separate task which does this. * default queue it is just easier to make separate task which does this.
*/ */
xTaskCreate(host_task_fn, "ble", configMINIMAL_STACK_SIZE + 400, xTaskCreate(host_task_fn, "ble", configMINIMAL_STACK_SIZE + 200,
NULL, tskIDLE_PRIORITY + 1, &host_task_h); NULL, tskIDLE_PRIORITY + 1, &host_task_h);
} }

View file

@ -20,7 +20,6 @@
#include <assert.h> #include <assert.h>
#include <stddef.h> #include <stddef.h>
#include <string.h> #include <string.h>
#include <sdk/components/libraries/log/nrf_log.h>
#include "nimble/nimble_npl.h" #include "nimble/nimble_npl.h"
static inline bool static inline bool
@ -269,10 +268,16 @@ void
npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq, npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq,
ble_npl_event_fn *ev_cb, void *ev_arg) ble_npl_event_fn *ev_cb, void *ev_arg)
{ {
// I added this 'if' because nimble seems to never delete the timers. I assume it wants to recycle them.
// This condition ensure that a new timer is created only if 'co' points to an uninitialized structure.
// If the struct contains an existing timer, no new timer is created, which prevent a significant memory leak.
// TODO Ensure that this workaround is valid and does not generate bad side-effect.
if(co->handle == NULL) {
memset(co, 0, sizeof(*co)); memset(co, 0, sizeof(*co));
co->handle = xTimerCreate("co", 1, pdFALSE, co, os_callout_timer_cb); co->handle = xTimerCreate("co", 1, pdFALSE, co, os_callout_timer_cb);
co->evq = evq; co->evq = evq;
ble_npl_event_init(&co->ev, ev_cb, ev_arg); ble_npl_event_init(&co->ev, ev_cb, ev_arg);
}
} }
ble_npl_error_t ble_npl_error_t