Subversion Repositories Projects

Rev

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

Rev 2200 Rev 2212
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 147... Line 155...
147
uint16_t heading_home;
155
uint16_t heading_home;
Line 148... Line 156...
148
 
156
 
149
// Hier Höhenanzeigefehler Korrigieren
157
// Hier Höhenanzeigefehler Korrigieren
Line -... Line 158...
-
 
158
#define AltimeterAdjust 1.5
-
 
159
 
Line 150... Line 160...
150
#define AltimeterAdjust 1.5
160
positionOffset followMeOffset;
151
 
161
 
152
 
162
 
Line 211... Line 221...
211
    {
221
    {
212
        return;                                                         // Fehler bzgl. BT GPS-Maus -> exit
222
        return;                                                         // Fehler bzgl. BT GPS-Maus -> exit
213
    }
223
    }
Line 214... Line -...
214
 
-
 
215
 
224
 
216
 
225
 
217
    //---------------------
226
    //---------------------
218
    // 2. Follow Me
227
    // 2. Follow Me
Line 341... Line 350...
341
 
350
 
342
            //-----------------
351
            //-----------------
343
            // MK: Sat Anzahl
352
            // MK: Sat Anzahl
344
            //-----------------
353
            //-----------------
345
            yoffs = -27;
354
            yoffs = -27;
-
 
355
            if( naviData->SatsInUse > 5 )
-
 
356
                drawmode = MNORMALX;
346
            if( naviData->SatsInUse > 5 )   drawmode = MNORMALX;
357
            else
347
            else                            drawmode = MINVERSX;
358
                drawmode = MINVERSX;
348
            writex_ndigit_number_u( 17, 5, naviData->SatsInUse, 2, 0,drawmode,  3,2+yoffs);
359
            writex_ndigit_number_u( 17, 5, naviData->SatsInUse, 2, 0,drawmode,  3,2+yoffs);
Line 349... Line 360...
349
            draw_icon_satmini( 116+3, 42+yoffs);
360
            draw_icon_satmini( 116+3, 42+yoffs);
Line 413... Line 424...
413
            // Target: Lat / Long
424
            // Target: Lat / Long
414
            //-----------------
425
            //-----------------
415
            writex_gpspos( 3, 7, NMEA.Latitude , MNORMAL,-3,1 );                 // GPS-Maus: Latitude
426
            writex_gpspos( 3, 7, NMEA.Latitude , MNORMAL,-3,1 );                 // GPS-Maus: Latitude
416
            writex_gpspos(12, 7, NMEA.Longitude, MNORMAL, 1,1 );                 // GPS-Maus: Longitude
427
            writex_gpspos(12, 7, NMEA.Longitude, MNORMAL, 1,1 );                 // GPS-Maus: Longitude
Line 417... Line -...
417
 
-
 
418
 
428
 
Line 419... Line 429...
419
            rxd_buffer_locked = FALSE;
429
            rxd_buffer_locked = FALSE;
420
 
430
 
Line 430... Line 440...
430
//        {
440
//        {
431
//            NMEA_GetNewData();
441
//            NMEA_GetNewData();
432
//        }
442
//        }
Line 433... Line -...
433
 
-
 
434
 
443
 
435
 
444
 
436
// Sourcecode aus NaviCtrl/V2.10e/uart1.c
445
// Sourcecode aus NaviCtrl/V2.10e/uart1.c
437
//  FOLLOW_ME
446
//  FOLLOW_ME
438
//        else if(CheckDelay(UART1_FollowMe_Timer) && (UART1_tx_buffer.Locked == FALSE))
447
//        else if(CheckDelay(UART1_FollowMe_Timer) && (UART1_tx_buffer.Locked == FALSE))
Line 471... Line 480...
471
//
480
//
Line 472... Line -...
472
 
-
 
473
 
481
 
474
 
482
 
475
 
483
 
476
 
484
 
477
        //-----------------------------------------
485
        //-----------------------------------------
Line 483... Line 491...
483
            {
491
            {
484
                if( (NMEA.SatsInUse > 5) && (NMEA.SatFix == 1 || NMEA.SatFix == 2) )
492
                if( (NMEA.SatsInUse > 5) && (NMEA.SatFix == 1 || NMEA.SatFix == 2) )
485
                {
493
                {
486
                    //Config.FM_Refresh
494
                    //Config.FM_Refresh
Line -... Line 495...
-
 
495
 
-
 
496
                        // FollowMeStep2
-
 
497
                        followMeOffset.latitude = 2000;
-
 
498
                        followMeOffset.longitude = 2000;
-
 
499
                        followme_add_offset(&NMEA, &NMEA, &followMeOffset);
487
 
500
 
488
                    FollowMe.Position.Status    = NEWDATA;
501
                    FollowMe.Position.Status    = NEWDATA;
489
                    FollowMe.Position.Longitude = NMEA.Longitude;
502
                    FollowMe.Position.Longitude = NMEA.Longitude;
490
                    FollowMe.Position.Latitude  = NMEA.Latitude;
503
                    FollowMe.Position.Latitude  = NMEA.Latitude;
491
                    FollowMe.Position.Altitude  = 1;                    // 20.7.2015 CB
504
                    FollowMe.Position.Altitude  = 1;                    // 20.7.2015 CB
Line 534... Line 547...
534
        if( get_key_press(1 << KEY_ENTER) )
547
        if( get_key_press(1 << KEY_ENTER) )
535
        {
548
        {
536
            break;
549
            break;
537
        }
550
        }
Line 538... Line -...
538
 
-
 
539
 
551
 
540
        //-----------------------------------------
552
        //-----------------------------------------
541
        //-----------------------------------------
553
        //-----------------------------------------
542
        if( !abo_timer )
554
        if( !abo_timer )
543
        {
555
        {
Line 548... Line 560...
548
            SendOutData ( 'o', ADDRESS_NC, 1, &tmp_dat, 1);
560
            SendOutData ( 'o', ADDRESS_NC, 1, &tmp_dat, 1);
Line 549... Line 561...
549
 
561
 
550
            abo_timer = ABO_TIMEOUT;
562
            abo_timer = ABO_TIMEOUT;
Line 551... Line -...
551
        }
-
 
552
 
-
 
553
 
563
        }
554
 
564
 
555
        //--------------------------
565
        //--------------------------
556
        // Daten Timeout vom MK?
566
        // Daten Timeout vom MK?
557
        //--------------------------
567
        //--------------------------
Line 587... Line 597...
587
 
597
 
588
//
598
//
589
#ifdef USE_FOLLOWME_STEP2
599
#ifdef USE_FOLLOWME_STEP2
590
void Debug_GPS (void)
600
void Debug_GPS (void)
591
{
601
{
-
 
602
        uint8_t redraw = true;
-
 
603
        nmeaPOS NMEApos;
Line 592... Line 604...
592
        uint8_t   redraw;
604
        nmeaPOS NMEATarget;
593
 
-
 
Line -... Line 605...
-
 
605
 
594
        set_beep( 25, 0xffff, BeepNormal );                                 // kurzer Bestaetigungs-Beep
606
        set_beep( 25, 0xffff, BeepNormal );                                 // kurzer Bestaetigungs-Beep
595
        redraw = true;
607
 
596
 
608
 
597
 
609
#ifdef ONLINE
598
    int retcode = GPSMouse_Connect();                                   // Abfrage der GPS-Daten zum testen Quick an Dirty ;-)
610
    int retcode = GPSMouse_Connect();                                   // Abfrage der GPS-Daten zum testen -> Quick an Dirty ;-)
-
 
611
    if( retcode <= 0 )
Line -... Line 612...
-
 
612
    {
-
 
613
        return;
-
 
614
    }
-
 
615
#endif
-
 
616
 
-
 
617
#ifdef DEBUG
Line 599... Line 618...
599
    if( retcode <= 0 )
618
//      NMEApos.lat = 520000000;
600
    {
619
//      NMEApos.lon = 0;
-
 
620
//      Config.FM_Azimuth = 90;
-
 
621
//      Config.FM_Distance = 10000;
Line 601... Line -...
601
        return;
-
 
602
    }
-
 
603
 
-
 
604
 
-
 
605
        while( true )
-
 
606
        {
-
 
607
 
-
 
608
        //######## Quell Koordinaten ##############################
-
 
609
 
-
 
610
                NMEApos.lat = NMEA.Latitude;
-
 
611
                NMEApos.lon = NMEA.Longitude;
-
 
612
 
622
#endif
613
        //#########################################################
623
 
614
 
624
        while( true )
Line 615... Line 625...
615
 
625
        {
616
                //-----------------------------------------
626
                NMEApos.latitude = NMEA.Latitude;
617
                // Screen redraw
627
                NMEApos.longitude = NMEA.Longitude;
Line 618... Line 628...
618
                //-----------------------------------------
628
 
619
                if( redraw )
629
                if( redraw )
Line 620... Line -...
620
                {
-
 
621
                        lcd_cls();
630
                {
622
 
631
                        lcd_cls();
Line 623... Line 632...
623
                        lcdx_printf_center_P( 0, MNORMAL, 1,0, PSTR("FollowMeStep2") );  // Titel: oben, mitte
632
 
Line 624... Line 633...
624
                        lcdx_printf_center_P( 1, MNORMAL, 1,0, PSTR(" Source Lat/Lon") );
633
                        lcdx_printf_center_P( 0, MNORMAL, 1,0, PSTR("FollowMeStep2") );
625
                        lcdx_printf_center_P( 3, MNORMAL, 1,0, PSTR(" Target Lat/Lon") );
634
                        lcdx_printf_center_P( 1, MNORMAL, 1,0, PSTR(" Source Lat/Lon") );
626
 
635
                        lcdx_printf_center_P( 3, MNORMAL, 1,0, PSTR(" Target Lat/Lon") );
-
 
636
 
627
                        redraw = false;
637
                        redraw = false;
-
 
638
                }
Line -... Line 639...
-
 
639
 
Line 628... Line 640...
628
                }
640
                writex_gpspos( 1, 2, NMEApos.latitude, MNORMAL, 0,0 );                 // GPS-Maus: Latitude
629
 
641
                writex_gpspos(10, 2, NMEApos.longitude, MNORMAL, 0,0 );                // GPS-Maus: Longitude
Line 630... Line -...
630
                //#################
-
 
Line 631... Line -...
631
                //# DISTANCE TO TARGET
-
 
632
                //#################
-
 
Line -... Line 642...
-
 
642
 
633
 
643
                followme_calculate_offset(Config.FM_Distance, Config.FM_Azimuth, &followMeOffset);
634
                //lcdx_printf_at_P( 0, 1, MNORMAL,0,0, PSTR("Distance: %3d Meter"), Config.FM_Distance );
644
 
-
 
645
#ifdef DEBUG
635
 
646
                writex_gpspos(  1, 6, (int32_t)Config.FM_Azimuth*100, MNORMAL, 0, 0 );
-
 
647
                writex_gpspos( 10, 6, (int32_t)Config.FM_Distance*100, MNORMAL, 0, 0 );
636
                //#################
648
                writex_gpspos(  1, 7, (int32_t)followMeOffset.latitude*100, MNORMAL, 0, 0 );
637
                //# TARGET Azimuth
649
                writex_gpspos( 10, 7, (int32_t)followMeOffset.longitude*100, MNORMAL, 0, 0 );
Line 638... Line 650...
638
                //#################
650
#endif
639
                //lcdx_printf_at_P( 0, 2, MNORMAL, 0,0, PSTR(" Azimuth: %3d Grad"), Config.FM_Azimuth);
651
 
640
 
652
                followme_add_offset(&NMEApos, &NMEATarget, &followMeOffset);
-
 
653
 
-
 
654
                writex_gpspos( 1, 4, (int32_t)NMEATarget.latitude, MNORMAL, 0, 0 );        // Ziel Latitude
-
 
655
                writex_gpspos(10, 4, (int32_t)NMEATarget.longitude, MNORMAL, 0, 0 );       // Ziel Longitude
-
 
656
 
-
 
657
 
-
 
658
 
-
 
659
 
-
 
660
                // Tasten
-
 
661
                if( get_key_press(1 << KEY_ESC) )
-
 
662
                {
641
 
663
#ifdef ONLINE
642
                writex_gpspos( 1, 2, NMEApos.lat , MNORMAL,0,0 );                // GPS-Maus: Latitude
664
                        GPSMouse_Disconnect();
643
                writex_gpspos(10, 2, NMEApos.lon, MNORMAL, 0,0 );                // GPS-Maus: Longitude
665
#endif
644
 
666
                        break;
Line 645... Line -...
645
                followme_calculate_offset(&NMEApos, &NMEATarget, 10, 10);
-
 
646
 
-
 
647
                writex_gpspos( 1, 4, (int32_t)NMEATarget.lat , MNORMAL, 0,0 );       // Ziel Latitude
667
                }
648
                writex_gpspos(10, 4, (int32_t)NMEATarget.lon , MNORMAL, 0,0 );       // Ziel Longitude
-
 
649
 
668