@@ -160,7 +160,8 @@ export class Assets {
160
160
typeIndexes : { } ,
161
161
displayWidth : this . displayWidth ,
162
162
displayHeight : this . displayHeight ,
163
- bitmaps : [ ]
163
+ bitmaps : [ ] ,
164
+ lvglWidgetIndexes : { }
164
165
} ;
165
166
166
167
dashboardComponentClassNameToComponentIdMap : {
@@ -174,6 +175,8 @@ export class Assets {
174
175
175
176
isUsingCrypyoSha256 : boolean = false ;
176
177
178
+ lvglBuild : LVGLBuild ;
179
+
177
180
get projectStore ( ) {
178
181
return this . rootProject . _store ;
179
182
}
@@ -208,6 +211,11 @@ export class Assets {
208
211
buildConfiguration : BuildConfiguration | undefined ,
209
212
public option : "check" | "buildAssets" | "buildFiles"
210
213
) {
214
+ if ( rootProject . projectTypeTraits . isLVGL ) {
215
+ this . lvglBuild = new LVGLBuild ( this ) ;
216
+ this . lvglBuild . firtsPassStart ( ) ;
217
+ }
218
+
211
219
this . projectStore . typesStore . reset ( ) ;
212
220
213
221
this . getConstantIndex ( undefined , "undefined" ) ; // undefined has value index 0
@@ -1283,6 +1291,13 @@ export class Assets {
1283
1291
this . map . typeIndexes = this . projectStore . typesStore . typeIndexes ;
1284
1292
1285
1293
this . map . bitmaps = this . bitmaps . map ( bitmap => bitmap . name ) ;
1294
+
1295
+ if ( this . projectStore . projectTypeTraits . isLVGL ) {
1296
+ this . lvglBuild . lvglObjectIdentifiers . fromPage . identifiers . forEach (
1297
+ ( identifier , widgetIndex ) =>
1298
+ ( this . map . lvglWidgetIndexes [ identifier ] = widgetIndex )
1299
+ ) ;
1300
+ }
1286
1301
}
1287
1302
1288
1303
get displayWidth ( ) {
@@ -1515,6 +1530,10 @@ export async function buildAssets(
1515
1530
1516
1531
const assets = new Assets ( project , buildConfiguration , option ) ;
1517
1532
1533
+ if ( project . projectTypeTraits . isLVGL ) {
1534
+ await assets . lvglBuild . firstPassFinish ( ) ;
1535
+ }
1536
+
1518
1537
if ( ! project . projectTypeTraits . isLVGL ) {
1519
1538
assets . reportUnusedAssets ( ) ;
1520
1539
}
@@ -1666,144 +1685,143 @@ export async function buildAssets(
1666
1685
if ( buildAssetsData ) {
1667
1686
result . GUI_ASSETS_DATA = compressedData ;
1668
1687
}
1669
-
1670
- if ( buildAssetsDataMap ) {
1671
- assets . finalizeMap ( ) ;
1672
-
1673
- result . GUI_ASSETS_DATA_MAP = JSON . stringify (
1674
- assets . map ,
1675
- undefined ,
1676
- 2
1677
- ) ;
1678
-
1679
- result . GUI_ASSETS_DATA_MAP_JS = assets . map ;
1680
- }
1681
1688
}
1682
1689
1683
1690
if ( option != "buildAssets" ) {
1684
1691
if ( assets . projectStore . projectTypeTraits . isLVGL ) {
1685
- const lvglBuild = new LVGLBuild ( assets ) ;
1686
-
1687
- // PASS 1 (find out which LVGL objects are accessible through global objects structure)
1688
- await lvglBuild . buildScreensDef ( ) ;
1689
-
1690
- // PASS 2
1691
1692
if ( ! sectionNames || sectionNames . indexOf ( "LVGL_INCLUDE" ) !== - 1 ) {
1692
1693
result . LVGL_INCLUDE = `#include <${ assets . projectStore . project . settings . build . lvglInclude } >` ;
1693
1694
}
1694
1695
1695
1696
if (
1696
1697
! sectionNames ||
1697
- sectionNames . indexOf ( "LVGL_SCREENS_DECL " ) !== - 1
1698
+ sectionNames . indexOf ( "LVGL_STYLES_DECL " ) !== - 1
1698
1699
) {
1699
- result . LVGL_SCREENS_DECL = await lvglBuild . buildScreensDecl ( ) ;
1700
+ result . LVGL_STYLES_DECL =
1701
+ await assets . lvglBuild . buildStylesDef ( ) ;
1700
1702
}
1701
1703
1702
1704
if (
1703
1705
! sectionNames ||
1704
- sectionNames . indexOf ( "LVGL_SCREENS_DEF " ) !== - 1
1706
+ sectionNames . indexOf ( "LVGL_STYLES_DEF " ) !== - 1
1705
1707
) {
1706
- result . LVGL_SCREENS_DEF = await lvglBuild . buildScreensDef ( ) ;
1708
+ result . LVGL_STYLES_DEF =
1709
+ await assets . lvglBuild . buildStylesDecl ( ) ;
1707
1710
}
1708
1711
1709
1712
if (
1710
1713
! sectionNames ||
1711
- sectionNames . indexOf ( "LVGL_SCREENS_DECL_EXT " ) !== - 1
1714
+ sectionNames . indexOf ( "LVGL_SCREENS_DEF " ) !== - 1
1712
1715
) {
1713
- result . LVGL_SCREENS_DECL_EXT =
1714
- await lvglBuild . buildScreensDeclExt ( ) ;
1716
+ result . LVGL_SCREENS_DEF =
1717
+ await assets . lvglBuild . buildScreensDef ( ) ;
1715
1718
}
1716
1719
1717
1720
if (
1718
1721
! sectionNames ||
1719
1722
sectionNames . indexOf ( "LVGL_SCREENS_DEF_EXT" ) !== - 1
1720
1723
) {
1721
1724
result . LVGL_SCREENS_DEF_EXT =
1722
- await lvglBuild . buildScreensDefExt ( ) ;
1725
+ await assets . lvglBuild . buildScreensDefExt ( ) ;
1723
1726
}
1724
1727
1725
1728
if (
1726
1729
! sectionNames ||
1727
- sectionNames . indexOf ( "LVGL_IMAGES_DECL " ) !== - 1
1730
+ sectionNames . indexOf ( "LVGL_SCREENS_DECL " ) !== - 1
1728
1731
) {
1729
- result . LVGL_IMAGES_DECL = await lvglBuild . buildImagesDecl ( ) ;
1732
+ result . LVGL_SCREENS_DECL =
1733
+ await assets . lvglBuild . buildScreensDecl ( ) ;
1730
1734
}
1731
1735
1732
1736
if (
1733
1737
! sectionNames ||
1734
- sectionNames . indexOf ( "LVGL_IMAGES_DEF " ) !== - 1
1738
+ sectionNames . indexOf ( "LVGL_SCREENS_DECL_EXT " ) !== - 1
1735
1739
) {
1736
- result . LVGL_IMAGES_DEF = await lvglBuild . buildImagesDef ( ) ;
1740
+ result . LVGL_SCREENS_DECL_EXT =
1741
+ await assets . lvglBuild . buildScreensDeclExt ( ) ;
1737
1742
}
1738
1743
1739
1744
if (
1740
1745
! sectionNames ||
1741
- sectionNames . indexOf ( "LVGL_FONTS_DECL " ) !== - 1
1746
+ sectionNames . indexOf ( "LVGL_IMAGES_DECL " ) !== - 1
1742
1747
) {
1743
- result . LVGL_FONTS_DECL = await lvglBuild . buildFontsDecl ( ) ;
1748
+ result . LVGL_IMAGES_DECL =
1749
+ await assets . lvglBuild . buildImagesDecl ( ) ;
1744
1750
}
1745
1751
1746
1752
if (
1747
1753
! sectionNames ||
1748
- sectionNames . indexOf ( "LVGL_ACTIONS_DECL " ) !== - 1
1754
+ sectionNames . indexOf ( "LVGL_IMAGES_DEF " ) !== - 1
1749
1755
) {
1750
- result . LVGL_ACTIONS_DECL = await lvglBuild . buildActionsDecl ( ) ;
1756
+ result . LVGL_IMAGES_DEF =
1757
+ await assets . lvglBuild . buildImagesDef ( ) ;
1751
1758
}
1752
1759
1753
1760
if (
1754
1761
! sectionNames ||
1755
- sectionNames . indexOf ( "LVGL_ACTIONS_ARRAY_DEF " ) !== - 1
1762
+ sectionNames . indexOf ( "LVGL_FONTS_DECL " ) !== - 1
1756
1763
) {
1757
- result . LVGL_ACTIONS_ARRAY_DEF =
1758
- await lvglBuild . buildActionsArrayDef ( ) ;
1764
+ result . LVGL_FONTS_DECL =
1765
+ await assets . lvglBuild . buildFontsDecl ( ) ;
1759
1766
}
1760
1767
1761
1768
if (
1762
1769
! sectionNames ||
1763
- sectionNames . indexOf ( "LVGL_VARS_DECL " ) !== - 1
1770
+ sectionNames . indexOf ( "LVGL_ACTIONS_DECL " ) !== - 1
1764
1771
) {
1765
- result . LVGL_VARS_DECL = await lvglBuild . buildVariablesDecl ( ) ;
1772
+ result . LVGL_ACTIONS_DECL =
1773
+ await assets . lvglBuild . buildActionsDecl ( ) ;
1766
1774
}
1767
1775
1768
1776
if (
1769
1777
! sectionNames ||
1770
- sectionNames . indexOf ( "LVGL_NATIVE_VARS_TABLE_DEF " ) !== - 1
1778
+ sectionNames . indexOf ( "LVGL_ACTIONS_ARRAY_DEF " ) !== - 1
1771
1779
) {
1772
- result . LVGL_NATIVE_VARS_TABLE_DEF =
1773
- await lvglBuild . buildNativeVarsTableDef ( ) ;
1780
+ result . LVGL_ACTIONS_ARRAY_DEF =
1781
+ await assets . lvglBuild . buildActionsArrayDef ( ) ;
1774
1782
}
1775
1783
1776
1784
if (
1777
1785
! sectionNames ||
1778
- sectionNames . indexOf ( "LVGL_STYLES_DECL " ) !== - 1
1786
+ sectionNames . indexOf ( "LVGL_VARS_DECL " ) !== - 1
1779
1787
) {
1780
- result . LVGL_STYLES_DECL = await lvglBuild . buildStylesDef ( ) ;
1788
+ result . LVGL_VARS_DECL =
1789
+ await assets . lvglBuild . buildVariablesDecl ( ) ;
1781
1790
}
1782
1791
1783
1792
if (
1784
1793
! sectionNames ||
1785
- sectionNames . indexOf ( "LVGL_STYLES_DEF " ) !== - 1
1794
+ sectionNames . indexOf ( "LVGL_NATIVE_VARS_TABLE_DEF " ) !== - 1
1786
1795
) {
1787
- result . LVGL_STYLES_DEF = await lvglBuild . buildStylesDecl ( ) ;
1796
+ result . LVGL_NATIVE_VARS_TABLE_DEF =
1797
+ await assets . lvglBuild . buildNativeVarsTableDef ( ) ;
1788
1798
}
1789
1799
1790
1800
if (
1791
1801
! sectionNames ||
1792
1802
sectionNames . indexOf ( "EEZ_FOR_LVGL_CHECK" ) !== - 1
1793
1803
) {
1794
1804
result . EEZ_FOR_LVGL_CHECK =
1795
- await lvglBuild . buildEezForLvglCheck ( ) ;
1805
+ await assets . lvglBuild . buildEezForLvglCheck ( ) ;
1796
1806
}
1797
1807
1798
1808
if ( option == "buildFiles" ) {
1799
- await lvglBuild . copyBitmapFiles ( ) ;
1800
- await lvglBuild . copyFontFiles ( ) ;
1809
+ await assets . lvglBuild . copyBitmapFiles ( ) ;
1810
+ await assets . lvglBuild . copyFontFiles ( ) ;
1801
1811
}
1802
1812
}
1803
1813
1804
1814
assets . reportUnusedAssets ( ) ;
1805
1815
}
1806
1816
1817
+ if ( buildAssetsDataMap ) {
1818
+ assets . finalizeMap ( ) ;
1819
+
1820
+ result . GUI_ASSETS_DATA_MAP = JSON . stringify ( assets . map , undefined , 2 ) ;
1821
+
1822
+ result . GUI_ASSETS_DATA_MAP_JS = assets . map ;
1823
+ }
1824
+
1807
1825
if ( option == "buildAssets" ) {
1808
1826
return result ;
1809
1827
}
0 commit comments