Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 2208 → Rev 2209

/Transportables_Koptertool/PKT/branches/branch_FollowMeStep2/followme/followme.c
36,6 → 36,14
//############################################################################
//# HISTORY followme.c
//#
//#
//#
//#
//#
//# 22.09.2015 Starter
//# - FollowMeStep2 erweitert mit Kreisberechnung und test auf PKT
//# - PKT-Pos von lat lon auf latitude und longitude umbenannt
//#
//# 20.09.2015 Starter
//# FollowMeStep2 erweitert auf aktuelle GPS-Daten und followme_calculate_offset(...)
//#
262,7 → 270,10
//-----------------------------------------
if( redraw )
{
lcd_cls();
#ifdef USE_FOLLOWME_STEP2
printFollowMeStatic();
#else
lcd_cls();
 
lcdx_printf_center_P( 0, MNORMAL, 1,0, PSTR("FollowMe") ); // Titel: oben, mitte
 
281,6 → 292,7
draw_icon_target_round( 1, 50);
 
redraw = false;
#endif
}
 
 
344,8 → 356,10
// MK: Sat Anzahl
//-----------------
yoffs = -27;
if( naviData->SatsInUse > 5 ) drawmode = MNORMALX;
else drawmode = MINVERSX;
if( naviData->SatsInUse > 5 )
drawmode = MNORMALX;
else
drawmode = MINVERSX;
writex_ndigit_number_u( 17, 5, naviData->SatsInUse, 2, 0,drawmode, 3,2+yoffs);
draw_icon_satmini( 116+3, 42+yoffs);
 
622,20 → 636,42
 
 
 
void printFollowMeStatic(void)
{
lcdx_printf_center_P( 0, MNORMAL, 1,0, PSTR("FollowMe") ); // Titel: oben, mitte
 
lcd_line( 6*6-3, 0, 6*6-3, 11, 1); // Linie Vertikal links
lcd_line( 15*6+5, 0, 15*6+5, 11, 1); // Linie Vertikal rechts
lcd_line( 0, 12, 127, 12, 1); // Linie Horizontal
lcd_line( 66, 39, 127, 39, 1); // Linie Horizontal Mitte
 
lcd_rect_round( 0, 33, 66, 12, 1, R1); // Rahmen fuer "Di" (Distance)
 
lcdx_printf_at_P( 3, 2, MNORMAL, 3,-1, PSTR("Al:") ); // Label: "Al:"
 
draw_icon_mk( 1, 18);
draw_icon_target_round( 1, 50);
}
 
 
 
 
// FollowMeStep2:
#define ONLINE
#define DEBUG
 
#ifdef USE_FOLLOWME_STEP2
void Debug_GPS (void)
{
uint8_t redraw;
uint8_t redraw = true;
nmeaPOS NMEApos;
nmeaPOS NMEATarget;
 
set_beep( 25, 0xffff, BeepNormal ); // kurzer Bestaetigungs-Beep
redraw = true;
 
//#define OFFLINE
#ifndef OFFLINE
int retcode = GPSMouse_Connect(); // Abfrage der GPS-Daten zum testen Quick an Dirty ;-)
 
#ifdef ONLINE
int retcode = GPSMouse_Connect(); // Abfrage der GPS-Daten zum testen -> Quick an Dirty ;-)
if( retcode <= 0 )
{
return;
642,23 → 678,23
}
#endif
 
/* // DEBUG
NMEApos.lat = 520000000;
NMEApos.lon = 0;
Config.FM_Azimuth = 90;
Config.FM_Distance = 10000;
*/
#ifdef DEBUG
// NMEApos.lat = 520000000;
// NMEApos.lon = 0;
// Config.FM_Azimuth = 90;
// Config.FM_Distance = 10000;
#endif
 
while( true )
{
NMEApos.lat = NMEA.Latitude;
NMEApos.lon = NMEA.Longitude;
NMEApos.latitude = NMEA.Latitude;
NMEApos.longitude = NMEA.Longitude;
 
if( redraw )
{
lcd_cls();
 
lcdx_printf_center_P( 0, MNORMAL, 1,0, PSTR("FollowMeStep2") ); // Titel: oben, mitte
lcdx_printf_center_P( 0, MNORMAL, 1,0, PSTR("FollowMeStep2") );
lcdx_printf_center_P( 1, MNORMAL, 1,0, PSTR(" Source Lat/Lon") );
lcdx_printf_center_P( 3, MNORMAL, 1,0, PSTR(" Target Lat/Lon") );
 
665,36 → 701,38
redraw = false;
}
 
writex_gpspos( 1, 2, NMEApos.lat, MNORMAL, 0,0 ); // GPS-Maus: Latitude
writex_gpspos(10, 2, NMEApos.lon, MNORMAL, 0,0 ); // GPS-Maus: Longitude
writex_gpspos( 1, 2, NMEApos.latitude, MNORMAL, 0,0 ); // GPS-Maus: Latitude
writex_gpspos(10, 2, NMEApos.longitude, MNORMAL, 0,0 ); // GPS-Maus: Longitude
 
followme_calculate_offset(Config.FM_Distance, Config.FM_Azimuth, &followMeOffset);
 
// DEBUG
writex_gpspos( 1, 6, (int32_t)Config.FM_Azimuth*100 , MNORMAL, 0, 0 );
writex_gpspos( 10, 6, (int32_t)Config.FM_Distance*100 , MNORMAL, 0, 0 );
writex_gpspos( 1, 7, (int32_t)followMeOffset.offset_lat*100 , MNORMAL, 0, 0 );
writex_gpspos( 10, 7, (int32_t)followMeOffset.offset_long*100 , MNORMAL, 0, 0 );
#ifdef DEBUG
writex_gpspos( 1, 6, (int32_t)Config.FM_Azimuth*100, MNORMAL, 0, 0 );
writex_gpspos( 10, 6, (int32_t)Config.FM_Distance*100, MNORMAL, 0, 0 );
writex_gpspos( 1, 7, (int32_t)followMeOffset.latitude*100, MNORMAL, 0, 0 );
writex_gpspos( 10, 7, (int32_t)followMeOffset.longitude*100, MNORMAL, 0, 0 );
#endif
 
followme_add_offset(&NMEApos, &NMEATarget, &followMeOffset);
 
writex_gpspos( 1, 4, (int32_t)NMEATarget.lat , MNORMAL, 0, 0 ); // Ziel Latitude
writex_gpspos(10, 4, (int32_t)NMEATarget.lon , MNORMAL, 0, 0 ); // Ziel Longitude
writex_gpspos( 1, 4, (int32_t)NMEATarget.latitude, MNORMAL, 0, 0 ); // Ziel Latitude
writex_gpspos(10, 4, (int32_t)NMEATarget.longitude, MNORMAL, 0, 0 ); // Ziel Longitude
 
 
 
 
// Tasten
if( get_key_press(1 << KEY_ESC) )
{
#ifndef OFFLINE
#ifdef ONLINE
GPSMouse_Disconnect();
#endif
break;
}
 
 
if( get_key_press(1 << KEY_ENTER) )
{
redraw = true;
// break;
}
 
if( get_key_press(1 << KEY_MINUS) )
707,15 → 745,12
Config.FM_Azimuth += 10;
redraw = true;
}
}
}
}
 
 
 
 
 
#endif // FOLLOW_ME_STEP2
 
#endif // #ifdef USE_FOLLOWME
 
 
/Transportables_Koptertool/PKT/branches/branch_FollowMeStep2/followme/followme.h
14,5 → 14,7
void FollowMe (void);
void Debug_GPS (void);
void sendFollowMeData(Point_t *tFollowMe, uint32_t *tsend_followme_counter, uint32_t *tNMEA_GPGGA_counter_old);
void printFollowMeStatic(void);
 
 
#endif /* FOLLOWME_H_ */