Subversion Repositories Projects

Rev

Rev 2205 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2205 Rev 2209
Line 34... Line 34...
34
 *   Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility*
34
 *   Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility*
35
 *****************************************************************************/
35
 *****************************************************************************/
36
//############################################################################
36
//############################################################################
37
//# HISTORY  followme.c
37
//# HISTORY  followme.c
38
//#
38
//#
-
 
39
//#
-
 
40
//#
-
 
41
//#
-
 
42
//#
-
 
43
//# 22.09.2015 Starter
-
 
44
//# - FollowMeStep2 erweitert mit Kreisberechnung und test auf PKT
-
 
45
//# - PKT-Pos von lat lon auf latitude und longitude umbenannt
-
 
46
//#
39
//# 20.09.2015 Starter
47
//# 20.09.2015 Starter
40
//# FollowMeStep2 erweitert auf aktuelle GPS-Daten und followme_calculate_offset(...)
48
//# FollowMeStep2 erweitert auf aktuelle GPS-Daten und followme_calculate_offset(...)
41
//#
49
//#
42
//# 03.08.2015 Cebra
50
//# 03.08.2015 Cebra
43
//# - add: void Debug_GPS (void) hinzugefügt zur Test der GPS Berechnung FollowMe
51
//# - add: void Debug_GPS (void) hinzugefügt zur Test der GPS Berechnung FollowMe
Line 260... Line 268...
260
        //-----------------------------------------
268
        //-----------------------------------------
261
        // Screen redraw
269
        // Screen redraw
262
        //-----------------------------------------
270
        //-----------------------------------------
263
        if( redraw )
271
        if( redraw )
264
        {
272
        {
-
 
273
#ifdef USE_FOLLOWME_STEP2
-
 
274
                printFollowMeStatic();
-
 
275
#else
265
            lcd_cls();
276
                lcd_cls();
Line 266... Line 277...
266
 
277
 
Line 267... Line 278...
267
            lcdx_printf_center_P( 0, MNORMAL, 1,0, PSTR("FollowMe") );  // Titel: oben, mitte
278
            lcdx_printf_center_P( 0, MNORMAL, 1,0, PSTR("FollowMe") );  // Titel: oben, mitte
268
 
279
 
Line 279... Line 290...
279
 
290
 
280
            draw_icon_mk( 1, 18);
291
            draw_icon_mk( 1, 18);
Line 281... Line 292...
281
            draw_icon_target_round( 1, 50);
292
            draw_icon_target_round( 1, 50);
-
 
293
 
282
 
294
            redraw = false;
Line 283... Line 295...
283
            redraw = false;
295
#endif
Line 342... Line 354...
342
 
354
 
343
            //-----------------
355
            //-----------------
344
            // MK: Sat Anzahl
356
            // MK: Sat Anzahl
345
            //-----------------
357
            //-----------------
346
            yoffs = -27;
358
            yoffs = -27;
-
 
359
            if( naviData->SatsInUse > 5 )
-
 
360
                drawmode = MNORMALX;
347
            if( naviData->SatsInUse > 5 )   drawmode = MNORMALX;
361
            else
348
            else                            drawmode = MINVERSX;
362
                drawmode = MINVERSX;
349
            writex_ndigit_number_u( 17, 5, naviData->SatsInUse, 2, 0,drawmode,  3,2+yoffs);
363
            writex_ndigit_number_u( 17, 5, naviData->SatsInUse, 2, 0,drawmode,  3,2+yoffs);
Line 350... Line 364...
350
            draw_icon_satmini( 116+3, 42+yoffs);
364
            draw_icon_satmini( 116+3, 42+yoffs);
Line 620... Line 634...
620
        }
634
        }
621
}
635
}
Line -... Line 636...
-
 
636
 
-
 
637
 
-
 
638
 
-
 
639
void printFollowMeStatic(void)
-
 
640
{
-
 
641
    lcdx_printf_center_P( 0, MNORMAL, 1,0, PSTR("FollowMe") );  // Titel: oben, mitte
-
 
642
 
-
 
643
    lcd_line(  6*6-3,  0,  6*6-3, 11, 1);                       // Linie Vertikal links
-
 
644
    lcd_line( 15*6+5,  0, 15*6+5, 11, 1);                       // Linie Vertikal rechts
-
 
645
    lcd_line(      0, 12,    127, 12, 1);                       // Linie Horizontal
-
 
646
    lcd_line(        66, 39,      127, 39, 1);                  // Linie Horizontal Mitte
-
 
647
 
-
 
648
    lcd_rect_round( 0, 33, 66, 12, 1, R1);                      // Rahmen fuer "Di" (Distance)
-
 
649
 
-
 
650
    lcdx_printf_at_P( 3, 2, MNORMAL, 3,-1, PSTR("Al:")  );      // Label: "Al:"
-
 
651
 
-
 
652
    draw_icon_mk( 1, 18);
-
 
653
    draw_icon_target_round( 1, 50);
-
 
654
}
Line 622... Line 655...
622
 
655
 
-
 
656
 
-
 
657
 
Line 623... Line 658...
623
 
658
 
624
 
659
// FollowMeStep2:
625
 
660
#define ONLINE
626
// FollowMeStep2:
661
#define DEBUG
-
 
662
 
-
 
663
#ifdef USE_FOLLOWME_STEP2
Line 627... Line 664...
627
 
664
void Debug_GPS (void)
628
#ifdef USE_FOLLOWME_STEP2
-
 
Line 629... Line -...
629
void Debug_GPS (void)
-
 
-
 
665
{
630
{
666
        uint8_t redraw = true;
631
        uint8_t   redraw;
667
        nmeaPOS NMEApos;
632
 
668
        nmeaPOS NMEATarget;
633
        set_beep( 25, 0xffff, BeepNormal );                                 // kurzer Bestaetigungs-Beep
669
 
634
        redraw = true;
670
        set_beep( 25, 0xffff, BeepNormal );                                 // kurzer Bestaetigungs-Beep
635
 
671
 
636
//#define OFFLINE
672
 
Line 637... Line 673...
637
#ifndef OFFLINE
673
#ifdef ONLINE
638
    int retcode = GPSMouse_Connect();                                   // Abfrage der GPS-Daten zum testen Quick an Dirty ;-)
674
    int retcode = GPSMouse_Connect();                                   // Abfrage der GPS-Daten zum testen -> Quick an Dirty ;-)
639
    if( retcode <= 0 )
675
    if( retcode <= 0 )
640
    {
676
    {
641
        return;
677
        return;
642
    }
678
    }
Line 643... Line 679...
643
#endif
679
#endif
644
 
680
 
645
/*  // DEBUG
681
#ifdef DEBUG
646
        NMEApos.lat = 520000000;
682
//      NMEApos.lat = 520000000;
Line 647... Line 683...
647
        NMEApos.lon = 0;
683
//      NMEApos.lon = 0;
648
        Config.FM_Azimuth = 90;
684
//      Config.FM_Azimuth = 90;
649
        Config.FM_Distance = 10000;
685
//      Config.FM_Distance = 10000;
Line 650... Line 686...
650
*/
686
#endif
651
 
687
 
652
        while( true )
688
        while( true )
Line 653... Line 689...
653
        {
689
        {
654
                NMEApos.lat = NMEA.Latitude;
690
                NMEApos.latitude = NMEA.Latitude;
Line 655... Line 691...
655
                NMEApos.lon = NMEA.Longitude;
691
                NMEApos.longitude = NMEA.Longitude;
656
 
692
 
Line 657... Line 693...
657
                if( redraw )
693
                if( redraw )
Line 658... Line 694...
658
                {
694
                {
659
                        lcd_cls();
695
                        lcd_cls();
660
 
696
 
661
                        lcdx_printf_center_P( 0, MNORMAL, 1,0, PSTR("FollowMeStep2") );  // Titel: oben, mitte
697
                        lcdx_printf_center_P( 0, MNORMAL, 1,0, PSTR("FollowMeStep2") );
662
                        lcdx_printf_center_P( 1, MNORMAL, 1,0, PSTR(" Source Lat/Lon") );
698
                        lcdx_printf_center_P( 1, MNORMAL, 1,0, PSTR(" Source Lat/Lon") );
-
 
699
                        lcdx_printf_center_P( 3, MNORMAL, 1,0, PSTR(" Target Lat/Lon") );
Line 663... Line 700...
663
                        lcdx_printf_center_P( 3, MNORMAL, 1,0, PSTR(" Target Lat/Lon") );
700
 
Line 664... Line 701...
664
 
701
                        redraw = false;
665
                        redraw = false;
702
                }
-
 
703
 
Line -... Line 704...
-
 
704
                writex_gpspos( 1, 2, NMEApos.latitude, MNORMAL, 0,0 );                 // GPS-Maus: Latitude
-
 
705
                writex_gpspos(10, 2, NMEApos.longitude, MNORMAL, 0,0 );                // GPS-Maus: Longitude
666
                }
706
 
667
 
707
                followme_calculate_offset(Config.FM_Distance, Config.FM_Azimuth, &followMeOffset);
668
                writex_gpspos( 1, 2, NMEApos.lat, MNORMAL, 0,0 );                // GPS-Maus: Latitude
708
 
669
                writex_gpspos(10, 2, NMEApos.lon, MNORMAL, 0,0 );                // GPS-Maus: Longitude
709
#ifdef DEBUG
670
 
710
                writex_gpspos(  1, 6, (int32_t)Config.FM_Azimuth*100, MNORMAL, 0, 0 );
671
                followme_calculate_offset(Config.FM_Distance, Config.FM_Azimuth, &followMeOffset);
711
                writex_gpspos( 10, 6, (int32_t)Config.FM_Distance*100, MNORMAL, 0, 0 );
672
 
712
                writex_gpspos(  1, 7, (int32_t)followMeOffset.latitude*100, MNORMAL, 0, 0 );
Line 673... Line -...
673
                // DEBUG
-
 
674
                writex_gpspos(  1, 6, (int32_t)Config.FM_Azimuth*100 , MNORMAL, 0, 0 );
713
                writex_gpspos( 10, 7, (int32_t)followMeOffset.longitude*100, MNORMAL, 0, 0 );
675
                writex_gpspos( 10, 6, (int32_t)Config.FM_Distance*100 , MNORMAL, 0, 0 );
714
#endif
676
                writex_gpspos(  1, 7, (int32_t)followMeOffset.offset_lat*100 , MNORMAL, 0, 0 );
715
 
677
                writex_gpspos( 10, 7, (int32_t)followMeOffset.offset_long*100 , MNORMAL, 0, 0 );
-
 
678
 
716
                followme_add_offset(&NMEApos, &NMEATarget, &followMeOffset);
Line 679... Line 717...
679
                followme_add_offset(&NMEApos, &NMEATarget, &followMeOffset);
717
 
680
 
718
                writex_gpspos( 1, 4, (int32_t)NMEATarget.latitude, MNORMAL, 0, 0 );        // Ziel Latitude
681
                writex_gpspos( 1, 4, (int32_t)NMEATarget.lat , MNORMAL, 0, 0 );       // Ziel Latitude
719
                writex_gpspos(10, 4, (int32_t)NMEATarget.longitude, MNORMAL, 0, 0 );       // Ziel Longitude
Line 705... Line 743...
705
                if( get_key_press(1 << KEY_PLUS) )
743
                if( get_key_press(1 << KEY_PLUS) )
706
                {
744
                {
707
                        Config.FM_Azimuth += 10;
745
                        Config.FM_Azimuth += 10;
708
                        redraw = true;
746
                        redraw = true;
709
                }
747
                }
710
}
748
        }
711
}
749
}
Line 712... Line -...
712
 
-
 
713
 
-
 
714
 
750
 
715
 
-
 
716
 
751