jgauchia / IceNav-v3

ESP32 Based GPS Navigator with OSM offline maps. (Under development)
GNU General Public License v3.0
49 stars 11 forks source link

how can i show tow navigation on the tft? #139

Closed zhjygit closed 1 month ago

zhjygit commented 1 month ago

if i have two gps data, one is local gps, like 110.2800, 25.2300;another is outside data from another gps device,like 110.1000, 25.0000. i want to show these two location on the tft display. Here is my try on the map.h file: /**

/**

/**

static const char *map_scale[] = {"5000 Km","2500 Km","1500 Km","700 Km","350 Km", "150 Km","100 Km","40 Km","20 Km","10 Km","5 Km", "2,5 Km","1,5 Km","700 m","350 m","150 m","80 m", "40 m","20 m","10 m"};

/**

define DEFAULT_LON 110.2800

define DEFAULT_LAT 25.2300

static double getLat() { if (GPS.location.isValid()) return GPS.location.lat(); else {

ifdef DEFAULT_LAT

return DEFAULT_LAT;

else

return 0.0;

endif

} }

/**

double gpsA[2];//定义外部设备A,存放经度和纬度 //gpsA[0]=getLon();//使用和本地设备同样的经度; //gpsA[1]=getLat();

/**

/**

/**

/**

ifdef ENABLE_COMPASS

heading = get_heading();
//map_spr.pushRotated(&map_rot, 360 - heading, TFT_TRANSPARENT);
map_spr.pushRotated(&map_rot, 0, TFT_TRANSPARENT);//保持地图不变
map_rot.fillRectAlpha(TFT_WIDTH - 48, 0, 48, 48, 95, TFT_BLACK);
map_rot.pushImageRotateZoom(TFT_WIDTH - 24, 24, 24, 24, 360 - heading, 1, 1, 48, 48, (uint16_t *)mini_compass, TFT_BLACK); 

else

map_spr.pushRotated(&map_rot, 0, TFT_TRANSPARENT);

endif

map_rot.setTextColor(TFT_WHITE, TFT_WHITE);

map_rot.fillRectAlpha(0, 0, 50, 32, 95, TFT_BLACK);
map_rot.pushImage(0, 4, 24, 24, (uint16_t *)zoom_ico, TFT_BLACK);
map_rot.drawNumber(zoom, 26, 8, &fonts::FreeSansBold9pt7b);

map_rot.fillRectAlpha(0, 342, 70, 32, 95, TFT_BLACK);
map_rot.pushImage(0, 346, 24, 24, (uint16_t *)speed_ico, TFT_BLACK);
map_rot.drawNumber((uint16_t)GPS.speed.kmph(), 26, 350, &fonts::FreeSansBold9pt7b);

map_rot.fillRectAlpha(250, 342, 70, TFT_WIDTH - 245, 95, TFT_BLACK);
map_rot.setTextSize(1);
map_rot.drawFastHLine(255,360,60);
map_rot.drawFastVLine(255,355,10);
map_rot.drawFastVLine(315,355,10);
map_rot.drawCenterString(map_scale[zoom], 285, 350);

//sprArrow.pushRotated(&map_rot, 0, TFT_BLACK);
sprArrow.pushRotated(&map_rot, heading, TFT_BLACK);//导航箭头动起来
sprArrowA.pushRotated(&map_rot, heading, TFT_BLACK);//导航箭头动起来

} }

as above shown, i give the static maps,and these two gps data can be shown on one map tile theoretically。 however, two icons related to two gps location datas are displayed on the same location on the tft finally. how can i change the code to display two gps datas on the same map tile?

jgauchia commented 1 month ago

Hi, Actually only one position is displayed on TFT, current position of the GPS.

Remember, this project can't include external info (GPS, etc etc) from another devices , and this feature isn't planned to do in future.