Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ESP32 Based GPS Navigator (LVGL - LovyanGFX).

|<img src="images/dev/splash.png">|<img src="images/dev/searchsat.jpg">|<img src="images/dev/compass.jpg">|<img src="images/dev/options.jpg">|<img src="images/dev/wptopt.jpg">|
|:-:|:-:|:-:|:-:|:-:|
| Splash Screen | Search Satellite | Compass | Main Options | Waypoint Options |
| Splash Screen | Search Satellite | Compass | Main Options | Wpt/Track Options |

|<img src="images/dev/rendermap.jpg">|<img src="images/dev/vectormap.jpg">|<img src="images/dev/navscreen.jpg">|<img src="images/dev/navscreen2.jpg">|<img src="images/dev/satelliteinfo.jpg">|
|:-:|:-:|:-:|:-:|:-:|
Expand Down
Binary file modified images/dev/options.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/dev/rendermap.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/dev/vectormap.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/dev/wptopt.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
119 changes: 99 additions & 20 deletions lib/gui/src/mainScr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
bool isMainScreen = false; // Flag to indicate main screen is selected
bool isScrolled = true; // Flag to indicate when tileview was scrolled
bool isReady = false; // Flag to indicate when tileview scroll was finished
bool isScrollingMap = false; // Flag to indicate if map is scrolling
bool canScrollMap = false; // Flag to indicate whet can scroll map
uint8_t activeTile = 0; // Current active tile
uint8_t gpxAction = WPT_NONE; // Current Waypoint Action
int heading = 0; // Heading value (Compass or GPS)
extern uint32_t DOUBLE_TOUCH_EVENT;

extern Compass compass;
extern Gps gps;
Expand Down Expand Up @@ -197,20 +200,32 @@ void updateMainScreen(lv_timer_t *t)
*/
void gestureEvent(lv_event_t *event)
{
lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_get_act());
if (activeTile == MAP && isMainScreen)
lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_active());

if (showMapToolBar)
{
switch (dir)
{
case LV_DIR_LEFT:
break;
case LV_DIR_RIGHT:
break;
case LV_DIR_TOP:
break;
case LV_DIR_BOTTOM:
break;
}
// if (activeTile == MAP && isMainScreen)
// {
// switch (dir)
// {
// case LV_DIR_LEFT:
// // mapView.panMap(1,0);
// mapView.scrollMap(30,0);
// break;
// case LV_DIR_RIGHT:
// // mapView.panMap(-1,0);
// mapView.scrollMap(-30,0);
// break;
// case LV_DIR_TOP:
// //mapView.panMap(0,1);
// mapView.scrollMap(0,30);
// break;
// case LV_DIR_BOTTOM:
// // mapView.panMap(0,-1);
// mapView.scrollMap(0,-30);
// break;
// }
// }
}
}

Expand Down Expand Up @@ -252,13 +267,16 @@ void updateSatTrack(lv_event_t *event)
}

/**
* @brief Tool Bar Event
* @brief Map Tool Bar Event
*
* @param event
*/
void toolBarEvent(lv_event_t *event)
void mapToolBarEvent(lv_event_t *event)
{
showToolBar = !showToolBar;
lv_event_code_t code = lv_event_get_code(event);

showMapToolBar = !showMapToolBar;
canScrollMap = !canScrollMap;

if (!mapSet.mapFullScreen)
{
Expand All @@ -273,20 +291,79 @@ void toolBarEvent(lv_event_t *event)
lv_obj_set_pos(btnZoomIn, 10, mapView.mapScrFull - (toolBarOffset + (2 * toolBarSpace) + 24));
}

if (!showToolBar)
if (!showMapToolBar)
{
lv_obj_clear_flag(btnFullScreen, LV_OBJ_FLAG_CLICKABLE);
lv_obj_clear_flag(btnZoomOut, LV_OBJ_FLAG_CLICKABLE);
lv_obj_clear_flag(btnZoomIn, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_flag(tilesScreen, LV_OBJ_FLAG_SCROLLABLE);
mapView.centerOnGps(gps.gpsData.latitude, gps.gpsData.longitude);
}
else
{
lv_obj_add_flag(btnFullScreen, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_flag(btnZoomOut, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_flag(btnZoomIn, LV_OBJ_FLAG_CLICKABLE);
lv_obj_clear_flag(tilesScreen, LV_OBJ_FLAG_SCROLLABLE);
}
}

/**
* @brief Scrool Map Event
*
* @param event
*/
void scrollMapEvent(lv_event_t *event)
{
if (canScrollMap)
{
lv_event_code_t code = lv_event_get_code(event);
lv_indev_t * indev = lv_event_get_indev(event);
static int last_x = 0, last_y = 0;
static int dx = 0, dy = 0;
lv_point_t p;


switch (code)
{
case LV_EVENT_PRESSED:
{
lv_indev_get_point(indev, &p);
last_x = p.x;
last_y = p.y;
isScrollingMap = true;
break;
}

case LV_EVENT_PRESSING:
{
lv_indev_get_point(indev, &p);

int dx = p.x - last_x;
int dy = p.y - last_y;

const int SCROLL_THRESHOLD = 5;

if (abs(dx) > SCROLL_THRESHOLD || abs(dy) > SCROLL_THRESHOLD)
{
mapView.scrollMap(-dx, -dy);
last_x = p.x;
last_y = p.y;
}
break;
}

case LV_EVENT_PRESS_LOST:
{
isScrollingMap = false;
break;
}
}
}
}



/**
* @brief Full Screen Event Toolbar
*
Expand Down Expand Up @@ -486,7 +563,7 @@ void createMainScr()
lv_obj_set_pos(btnZoomIn, 10, mapView.mapScrFull - (toolBarOffset + (2 * toolBarSpace) + 24));
}

if (!showToolBar)
if (!showMapToolBar)
{
lv_obj_clear_flag(btnFullScreen, LV_OBJ_FLAG_CLICKABLE);
lv_obj_clear_flag(btnZoomOut, LV_OBJ_FLAG_CLICKABLE);
Expand All @@ -501,8 +578,10 @@ void createMainScr()

// Map Tile Events
lv_obj_add_event_cb(mapTile, updateMap, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_add_event_cb(mapTile, gestureEvent, LV_EVENT_GESTURE, NULL);
lv_obj_add_event_cb(mapTile, toolBarEvent, LV_EVENT_LONG_PRESSED, NULL);
lv_obj_add_event_cb(mainScreen, gestureEvent, LV_EVENT_GESTURE, NULL);
DOUBLE_TOUCH_EVENT = lv_event_register_id();
lv_obj_add_event_cb(mapTile, mapToolBarEvent, (lv_event_code_t)DOUBLE_TOUCH_EVENT, NULL);
lv_obj_add_event_cb(mapTile, scrollMapEvent, LV_EVENT_ALL, NULL);

// Navigation Tile
navigationScr(navTile);
Expand Down
5 changes: 4 additions & 1 deletion lib/gui/src/mainScr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ extern lv_timer_t *mainTimer; // Main Screen Timer
extern bool isScrolled; // Flag to indicate when tileview was scrolled
extern bool isMainScreen; // Flag to indicate main screen is selected
extern bool isReady; // Flag to indicate when tileview scroll was finished
extern bool canScrollMap; // Flag to indicate whet can scroll map
extern bool isScrollingMap; // Flag to indicate if map is scrolling
static TFT_eSprite zoomSprite = TFT_eSprite(&tft); // Zoom sprite

extern uint8_t activeTile; // Active Tile in TileView control
Expand Down Expand Up @@ -66,7 +68,8 @@ void gestureEvent(lv_event_t *event);

void updateMap(lv_event_t *event);
void updateSatTrack(lv_event_t *event);
void toolBarEvent(lv_event_t *event);
void mapToolBarEvent(lv_event_t *event);
void scrollMapEvent(lv_event_t *event);
void fullScreenEvent(lv_event_t *event);
void zoomOutEvent(lv_event_t *event);
void zoomInEvent(lv_event_t *event);
Expand Down
4 changes: 4 additions & 0 deletions lib/gui/src/splashScr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

static unsigned long millisActual = 0;
extern Maps mapView;
extern Gps gps;

/**
* @brief Splash screen
Expand All @@ -24,7 +25,10 @@ void splashScreen()
mapView.generateVectorMap(zoom);
}
else
{
mapView.currentMapTile = mapView.getMapTile(gps.gpsData.longitude, gps.gpsData.latitude, zoom, 0, 0);
mapView.generateRenderMap(zoom);
}

setTime = false;

Expand Down
Loading