You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The TTF font used by the navigation app is ~20KB and is stored in internal flash memory.
To free this space, the TTF font is now converted in 2 "atlas pictures" (pictures that contain multiple concatenated images) stored in the external flash memory. The navigation app now accesses one of those 2 files and apply an offset to display the desired picture.
The corresponding documentation has also been updated.
Add comments about the layout of the pictures that contain the icon and about the indexing of those icons.
In documentation (buildAndProgram.md), edit the section about the debug compilation mode. Remove the part about removing the Navigation app to free some memory (since it's not relevant anymore) and explain how to selectively build parts of the firmware in Debug mode.
Copy file name to clipboardExpand all lines: doc/buildAndProgram.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,17 @@ CMake configures the project according to variables you specify the command line
48
48
#### (\*) Note about **CMAKE_BUILD_TYPE**
49
49
By default, this variable is set to *Release*. It compiles the code with size and speed optimizations. We use this value for all the binaries we publish when we [release](https://github.com/InfiniTimeOrg/InfiniTime/releases) new versions of InfiniTime.
50
50
51
-
The *Debug* mode disables all optimizations, which makes the code easier to debug. However, the binary size will likely be too big to fit in the internal flash memory. If you want to build and debug a *Debug* binary, you'll need to disable some parts of the code. For example, the icons forthe **Navigation** app use a lot of memory space. You can comment the content of `m_iconMap`in the [Navigation](https://github.com/InfiniTimeOrg/InfiniTime/blob/main/src/displayapp/screens/Navigation.h#L148) application to free some memory.
51
+
The *Debug* mode disables all optimizations, which makes the code easier to debug. However, the binary size will likely be too big to fit in the internal flash memory. If you want to build and debug a *Debug* binary, you can disable some parts of the code that are not needed for the test you want to achieve. You can also apply the *Debug* mode selectively on parts of the application by applying the `DEBUG_FLAGS` only for the part (CMake target) you want to debug. For example, let's say you want to debug code related to LittleFS, simply set the compilation options forthe RELEASE configuration of the target to `DEBUG_FLAGS` (in `src/CMakeLists.txt`). This will force the compilation of that targetin*Debug* mode while the rest of the project will be built in*Release* mode. Example:
52
+
53
+
```
54
+
target_compile_options(littlefs PRIVATE
55
+
${COMMON_FLAGS}
56
+
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
57
+
$<$<CONFIG:RELEASE>: ${DEBUG_FLAGS}># Change from RELEASE_FLAGS to DEBUG_FLAGS
58
+
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
59
+
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
60
+
)
61
+
```
52
62
53
63
#### (\*\*) Note about **BUILD_DFU**
54
64
DFU files are the files you'll need to install your build of InfiniTime using OTA (over-the-air) mechanism. To generate the DFU file, the Python tool [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil) is needed on your system. Check that this tool is properly installed before enabling this option.
Copy file name to clipboardExpand all lines: src/displayapp/fonts/README.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,3 +33,17 @@ and for each font there is:
33
33
### Navigation font
34
34
35
35
`navigtion.ttf` is created with the web app [icomoon](https://icomoon.io/app) by importing the svg files from `src/displayapp/icons/navigation/unique` and generating the font. `lv_font_navi_80.json` is a project file for the site, which you can import to add or remove icons.
36
+
37
+
To save space in the internal flash memory, the navigation icons are now moved into the external flash memory. To do this, the TTF font is converted into pictures (1 for each symbol). Those pictures are then concatenated into 2 big pictures (we need two files since LVGL supports maximum 2048px width/height). At runtime, a map is used to locate the desired icon in the corresponding file at a specific offset.
38
+
39
+
Here is the command to convert the TTF font in PNG picture:
40
+
41
+
```shell
42
+
convert -background none -fill white -font navigation.ttf -pointsize 80 -gravity center label:"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" navigation0.png
43
+
44
+
convert -background none -fill white -font navigation.ttf -pointsize 80 -gravity center label:"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" navigation1.png
45
+
```
46
+
47
+
*Please note that the characters after `label:` are UTF-8 characters and might not be displayed correctly in this document.*
48
+
49
+
The characters in the TTF font range from `0xEEA480` to `0xEEA4A9`. Characters from `0xEEA480` to `0xEEA498` are stored in `navigation0.png` and the others in `navigation1.png`. Each character is 80px height so displaying a specific character consists in multiplying its index in the file by -80 and use this value as the offset when calling `lv_img_set_offset_y()`.
0 commit comments