Skip to content

Commit 31137fc

Browse files
authored
Merge pull request #310 from jgauchia/devel_features
Fix vector maps rendering Fix mass file copy script Update libraries
2 parents e335400 + 07c29b6 commit 31137fc

File tree

15 files changed

+592
-440
lines changed

15 files changed

+592
-440
lines changed

data/LOGO_NEW.png

204 KB
Loading

lib/gui/src/mapSettingsScr.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void createMapSettingsScr()
204204
checkCompass = lv_checkbox_create(list);
205205
lv_obj_align_to(checkCompass, list, LV_ALIGN_RIGHT_MID, 0, 0);
206206
lv_checkbox_set_text(checkCompass, " ");
207-
lv_obj_add_state(checkCompass, mapSet.showMapCompass);
207+
lv_obj_add_state(checkCompass, (lv_state_t)mapSet.showMapCompass);
208208
lv_obj_add_event_cb(checkCompass, mapSettingsEvents, LV_EVENT_VALUE_CHANGED, NULL);
209209

210210
// Compass Rotation
@@ -215,7 +215,7 @@ void createMapSettingsScr()
215215
checkCompassRot = lv_checkbox_create(list);
216216
lv_obj_align_to(checkCompassRot, list, LV_ALIGN_RIGHT_MID, 0, 0);
217217
lv_checkbox_set_text(checkCompassRot, " ");
218-
lv_obj_add_state(checkCompassRot, mapSet.compassRotation);
218+
lv_obj_add_state(checkCompassRot, (lv_state_t)mapSet.compassRotation);
219219
lv_obj_add_event_cb(checkCompassRot, mapSettingsEvents, LV_EVENT_VALUE_CHANGED, NULL);
220220

221221
// Show Speed
@@ -226,7 +226,7 @@ void createMapSettingsScr()
226226
checkSpeed = lv_checkbox_create(list);
227227
lv_obj_align_to(checkSpeed, list, LV_ALIGN_RIGHT_MID, 0, 0);
228228
lv_checkbox_set_text(checkSpeed, " ");
229-
lv_obj_add_state(checkSpeed, mapSet.showMapSpeed);
229+
lv_obj_add_state(checkSpeed, (lv_state_t)mapSet.showMapSpeed);
230230
lv_obj_add_event_cb(checkSpeed, mapSettingsEvents, LV_EVENT_VALUE_CHANGED, NULL);
231231

232232
// Show Map Scale
@@ -237,7 +237,7 @@ void createMapSettingsScr()
237237
checkScale = lv_checkbox_create(list);
238238
lv_obj_align_to(checkScale, list, LV_ALIGN_RIGHT_MID, 0, 0);
239239
lv_checkbox_set_text(checkScale, " ");
240-
lv_obj_add_state(checkScale, mapSet.showMapScale);
240+
lv_obj_add_state(checkScale, (lv_state_t)mapSet.showMapScale);
241241
lv_obj_add_event_cb(checkScale, mapSettingsEvents, LV_EVENT_VALUE_CHANGED, NULL);
242242

243243
// Back button

lib/gui/src/splashScr.cpp

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,77 @@ static unsigned long millisActual = 0; /**< Current value of the system timer in
1212
extern Maps mapView;
1313
extern Gps gps;
1414

15+
/**
16+
* @brief Create LVGL Splash Screen
17+
*
18+
* @details Creates the LVGL splash screen object and canvas.
19+
*/
20+
void createLVGLSplashScreen()
21+
{
22+
splashScr = lv_obj_create(NULL);
23+
splashCanvas = lv_canvas_create(splashScr);
24+
25+
lv_obj_t *osmInfo = lv_obj_create(splashScr);
26+
lv_obj_set_width(osmInfo, tft.width());
27+
lv_obj_set_height(osmInfo,50 * scale);
28+
lv_obj_clear_flag(osmInfo, LV_OBJ_FLAG_SCROLLABLE);
29+
lv_obj_set_flex_flow(osmInfo, LV_FLEX_FLOW_COLUMN);
30+
lv_obj_set_flex_align(osmInfo, LV_FLEX_ALIGN_SPACE_AROUND, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
31+
lv_obj_set_style_bg_opa(osmInfo, 0, 0);
32+
lv_obj_set_style_border_opa(osmInfo, 0, 0);
33+
lv_obj_t *label;
34+
label = lv_label_create(osmInfo);
35+
lv_obj_set_style_text_font(label, &lv_font_montserrat_12, 0);
36+
lv_label_set_text(label, "Map data from OpenStreetMap - (c)OpenStreetMap");
37+
label = lv_label_create(osmInfo);
38+
lv_obj_set_style_text_font(label, &lv_font_montserrat_12, 0);
39+
lv_label_set_text(label, "(c)OpenStreetMap contributors");
40+
lv_obj_set_align(osmInfo, LV_ALIGN_BOTTOM_MID);
41+
label = lv_label_create(splashScr);
42+
lv_obj_set_style_text_font(label, &lv_font_montserrat_18, 0);
43+
lv_label_set_text_fmt(label,statusLine4, String(VERSION).c_str(), String(REVISION).c_str());
44+
lv_obj_set_align(label, LV_ALIGN_CENTER);
45+
lv_obj_set_y(label, -130 * scale);
46+
}
47+
1548
/**
1649
* @brief Splash screen
1750
*
1851
* @details Displays the splash screen with logo, device information, Preloads the map and initializes display settings.
1952
*/
2053
void splashScreen()
2154
{
55+
setTime = false;
56+
2257
// Preload Map
2358
mapView.currentMapTile = mapView.getMapTile(gps.gpsData.longitude, gps.gpsData.latitude, zoom, 0, 0);
2459
mapView.generateMap(zoom);
2560

26-
setTime = false;
61+
#ifdef ICENAV_BOARD
62+
millisActual = millis();
63+
64+
tft.setBrightness(defBright);
2765

66+
TFT_eSprite splashSprite = TFT_eSprite(&tft);
67+
void *splashBuffer = splashSprite.createSprite(tft.width(), tft.height());
68+
splashSprite.drawPngFile(logoFile, 0, 0);
69+
lv_canvas_set_buffer(splashCanvas, splashBuffer, tft.width(), tft.height(), LV_COLOR_FORMAT_RGB565_SWAPPED);
70+
splashSprite.deleteSprite();
71+
72+
lv_screen_load_anim(splashScr, LV_SCR_LOAD_ANIM_FADE_OUT, 2500, 0, false);
73+
for( int i=0; i < 1000; i++ )
74+
{
75+
lv_task_handler();
76+
vTaskDelay(5);
77+
}
78+
lv_obj_fade_out(splashScr, 2500,0);
79+
for( int i=0; i < 300; i++ )
80+
{
81+
lv_task_handler();
82+
vTaskDelay(5);
83+
}
84+
lv_obj_delete(splashScr);
85+
#else
2886
tft.fillScreen(TFT_BLACK);
2987
millisActual = millis();
3088
tft.setBrightness(0);
@@ -78,6 +136,7 @@ void splashScreen()
78136
}
79137

80138
millisActual = millis();
139+
81140
while (millis() < millisActual + 100);
82141

83142
for (uint8_t fadeOut = maxBrightness; fadeOut > 0; fadeOut--)
@@ -92,4 +151,5 @@ void splashScreen()
92151
while (millis() < millisActual + 100);
93152

94153
tft.setBrightness(defBright);
154+
#endif
95155
}

lib/gui/src/splashScr.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
#include "gps.hpp"
1515

1616
#ifdef LARGE_SCREEN
17-
static const char* logoFile PROGMEM = "/spiffs/LOGO_LARGE.png"; /**< Path to the large logo image for large screens */
17+
#ifdef ICENAV_BOARD
18+
static const char* logoFile PROGMEM = "/spiffs/LOGO_NEW.png"; /**< Path to the large logo image for large screens */
19+
#else
20+
static const char* logoFile PROGMEM = "/spiffs/LOGO_LARGE.png"; /**< Path to the large logo image for large screens */
21+
#endif
1822
#else
1923
static const char* logoFile PROGMEM = "/spiffs/LOGO_SMALL.png"; /**< Path to the small logo image for smaller screens */
2024
#endif
@@ -25,4 +29,8 @@ static const char* statusLine3 PROGMEM = "PSRAM: %d - Used PSRAM: %d"; /**< Form
2529
static const char* statusLine4 PROGMEM = "Firmware v.%s rev.%s"; /**< Format string for firmware version and revision */
2630
static const char* statusLine5 PROGMEM = "ENV: %s"; /**< Format string for environment information */
2731

32+
extern lv_obj_t *splashScr;
33+
static lv_obj_t *splashCanvas;
34+
35+
void createLVGLSplashScreen();
2836
void splashScreen();

lib/gui/src/widgets.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void compassWidget(lv_obj_t *screen)
172172
lv_obj_align_to(compassImg, obj, LV_ALIGN_CENTER, 0, 0);
173173
lv_img_set_pivot(compassImg, 100, 100) ;
174174
compassHeading = lv_label_create(obj);
175-
lv_obj_set_height(compassHeading,38);
175+
lv_obj_set_height(compassHeading,45);
176176
lv_obj_align(compassHeading, LV_ALIGN_CENTER, 0, 20);
177177
lv_obj_set_style_text_font(compassHeading, fontVeryLarge, 0);
178178
lv_label_set_text_static(compassHeading, "---\xC2\xB0");
@@ -420,4 +420,4 @@ void turnByTurnWidget(lv_obj_t *screen)
420420
lv_label_set_text_static(obj,"m.");
421421

422422
lv_obj_add_flag(turnByTurn,LV_OBJ_FLAG_HIDDEN);
423-
}
423+
}

lib/lvgl/lv_conf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@
412412

413413
/* Enable assertion failures if an operation fails or invalid data is found.
414414
* If LV_USE_LOG is enabled, an error message will be printed on failure. */
415-
#define LV_USE_ASSERT_NULL 1 /**< Check if the parameter is NULL. (Very fast, recommended) */
416-
#define LV_USE_ASSERT_MALLOC 1 /**< Checks is the memory is successfully allocated or no. (Very fast, recommended) */
415+
#define LV_USE_ASSERT_NULL 0 /**< Check if the parameter is NULL. (Very fast, recommended) */
416+
#define LV_USE_ASSERT_MALLOC 0 /**< Checks is the memory is successfully allocated or no. (Very fast, recommended) */
417417
#define LV_USE_ASSERT_STYLE 0 /**< Check if the styles are properly initialized. (Very fast, recommended) */
418418
#define LV_USE_ASSERT_MEM_INTEGRITY 0 /**< Check the integrity of `lv_mem` after critical operations. (Slow) */
419419
#define LV_USE_ASSERT_OBJ 0 /**< Check the object's type and existence (e.g. not deleted). (Slow) */

lib/lvgl/src/lvglSetup.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
lv_display_t *display; /**< LVGL display driver */
1212

1313
lv_obj_t *searchSatScreen; /**< Search Satellite Screen object. */
14+
lv_obj_t *splashScr; /**< Splash Screen object. */
1415
lv_style_t styleThemeBkg; /**< Main background style object. */
1516
lv_style_t styleObjectBkg; /**< Object background style. */
1617
lv_style_t styleObjectSel; /**< Object selected style. */
@@ -402,6 +403,9 @@ void initLVGL()
402403
modifyTheme();
403404

404405
// Create Screens
406+
#ifdef ICENAV_BOARD
407+
createLVGLSplashScreen();
408+
#endif
405409
createSearchSatScr();
406410
createMainScr();
407411
createNotifyBar();
@@ -411,7 +415,7 @@ void initLVGL()
411415
createButtonBarScr();
412416
createGpxDetailScreen();
413417
createGpxListScreen();
414-
418+
415419
// Create and start a periodic timer interrupt to call lv_tick_inc
416420
const esp_timer_create_args_t periodic_timer_args = { .callback = &lv_tick_task, .name = "periodic_gui" };
417421
esp_timer_handle_t periodic_timer;

0 commit comments

Comments
 (0)