NeoGPS latitude und longitude

Hey Leute, ich habe mal wieder ein Problem..

Ich habe den neo m8n GPS empfänger gekauft, dieser funktioniert jedoch nicht mit der TinyGPS++-Library. Deshalb benutze ich die NeoGPS-Library. Mit der funktioniert es auch fast gut. Jedoch kriege ich die latitude und longitude nur ohne Komma ausgegeben und damit kann ich dann nichts anfangen...

Als Code benutze ich das beigelegte Beispiel aus der Library:

#include <NMEAGPS.h>

//======================================================================
//  Program: NMEA.ino
//
//  Description:  This program uses the fix-oriented methods available() and
//    read() to handle complete fix structures.
//
//    When the last character of the LAST_SENTENCE_IN_INTERVAL (see NMEAGPS_cfg.h)
//    is decoded, a completed fix structure becomes available and is returned
//    from read().  The new fix is saved the 'fix' structure, and can be used
//    anywhere, at any time.
//
//    If no messages are enabled in NMEAGPS_cfg.h, or
//    no 'gps_fix' members are enabled in GPSfix_cfg.h, no information will be
//    parsed, copied or printed.
//
//  Prerequisites:
//     1) Your GPS device has been correctly powered.
//          Be careful when connecting 3.3V devices.
//     2) Your GPS device is correctly connected to an Arduino serial port.
//          See GPSport.h for the default connections.
//     3) You know the default baud rate of your GPS device.
//          If 9600 does not work, use NMEAdiagnostic.ino to
//          scan for the correct baud rate.
//     4) LAST_SENTENCE_IN_INTERVAL is defined to be the sentence that is
//          sent *last* in each update interval (usually once per second).
//          The default is NMEAGPS::NMEA_RMC (see NMEAGPS_cfg.h).  Other
//          programs may need to use the sentence identified by NMEAorder.ino.
//     5) NMEAGPS_RECOGNIZE_ALL is defined in NMEAGPS_cfg.h
//
//  'Serial' is for debug output to the Serial Monitor window.
//
//  License:
//    Copyright (C) 2014-2017, SlashDevin
//
//    This file is part of NeoGPS
//
//    NeoGPS is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    NeoGPS is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with NeoGPS.  If not, see <http://www.gnu.org/licenses/>.
//
//======================================================================

//-------------------------------------------------------------------------
//  The GPSport.h include file tries to choose a default serial port
//  for the GPS device.  If you know which serial port you want to use,
//  edit the GPSport.h file.

#include <GPSport.h>

//------------------------------------------------------------
// For the NeoGPS example programs, "Streamers" is common set
//   of printing and formatting routines for GPS data, in a
//   Comma-Separated Values text format (aka CSV).  The CSV
//   data will be printed to the "debug output device".
// If you don't need these formatters, simply delete this section.

#include <Streamers.h>

//------------------------------------------------------------
// This object parses received characters
//   into the gps.fix() data structure

static NMEAGPS  gps;

//------------------------------------------------------------
//  Define a set of GPS fix information.  It will
//  hold on to the various pieces as they are received from
//  an RMC sentence.  It can be used anywhere in your sketch.

static gps_fix  fix;

//----------------------------------------------------------------
//  This function gets called about once per second, during the GPS
//  quiet time.  It's the best place to do anything that might take
//  a while: print a bunch of things, write to SD, send an SMS, etc.
//
//  By doing the "hard" work during the quiet time, the CPU can get back to
//  reading the GPS chars as they come in, so that no chars are lost.

static void doSomeWork()
{
  // Print all the things!

  trace_all( DEBUG_PORT, gps, fix );

} // doSomeWork

//------------------------------------
//  This is the main GPS parsing loop.

static void GPSloop()
{
  while (gps.available( gpsPort )) {
    fix = gps.read();
    doSomeWork();
  }

} // GPSloop

//--------------------------

void setup()
{
  DEBUG_PORT.begin(9600);
  while (!DEBUG_PORT)
    ;

  DEBUG_PORT.print( F("NMEA.INO: started\n") );
  DEBUG_PORT.print( F("  fix object size = ") );
  DEBUG_PORT.println( sizeof(gps.fix()) );
  DEBUG_PORT.print( F("  gps object size = ") );
  DEBUG_PORT.println( sizeof(gps) );
  DEBUG_PORT.println( F("Looking for GPS device on " GPS_PORT_NAME) );

  #ifndef NMEAGPS_RECOGNIZE_ALL
    #error You must define NMEAGPS_RECOGNIZE_ALL in NMEAGPS_cfg.h!
  #endif

  #ifdef NMEAGPS_INTERRUPT_PROCESSING
    #error You must *NOT* define NMEAGPS_INTERRUPT_PROCESSING in NMEAGPS_cfg.h!
  #endif

  #if !defined( NMEAGPS_PARSE_GGA ) & !defined( NMEAGPS_PARSE_GLL ) & \
      !defined( NMEAGPS_PARSE_GSA ) & !defined( NMEAGPS_PARSE_GSV ) & \
      !defined( NMEAGPS_PARSE_RMC ) & !defined( NMEAGPS_PARSE_VTG ) & \
      !defined( NMEAGPS_PARSE_ZDA ) & !defined( NMEAGPS_PARSE_GST )

    DEBUG_PORT.println( F("\nWARNING: No NMEA sentences are enabled: no fix data will be displayed.") );

  #else
    if (gps.merging == NMEAGPS::NO_MERGING) {
      DEBUG_PORT.print  ( F("\nWARNING: displaying data from ") );
      DEBUG_PORT.print  ( gps.string_for( LAST_SENTENCE_IN_INTERVAL ) );
      DEBUG_PORT.print  ( F(" sentences ONLY, and only if ") );
      DEBUG_PORT.print  ( gps.string_for( LAST_SENTENCE_IN_INTERVAL ) );
      DEBUG_PORT.println( F(" is enabled.\n"
                            "  Other sentences may be parsed, but their data will not be displayed.") );
    }
  #endif

  DEBUG_PORT.print  ( F("\nGPS quiet time is assumed to begin after a ") );
  DEBUG_PORT.print  ( gps.string_for( LAST_SENTENCE_IN_INTERVAL ) );
  DEBUG_PORT.println( F(" sentence is received.\n"
                        "  You should confirm this with NMEAorder.ino\n") );

  trace_header( DEBUG_PORT );
  DEBUG_PORT.flush();

  gpsPort.begin( 38400 );
}

//--------------------------

void loop()
{
  GPSloop();
}

Als Ausgabe kommen dann die ganzen Daten, die an sich eben richtig sind, nur eben ohne Komma. Was muss ich hier ändern, damit es dann komplett richtig funktioniert?

LG. Suchtaaa

Naja, also ich kenne mich mit den Breitengraden nicht wirklich aus, aber das Komma muss ja nicht immer nach der zweiten folgen, sondern kann auch schon nach der ersten folgen. Oder?

Jedoch kriege ich die latitude und longitude nur ohne Komma ausgegeben und damit kann ich dann nichts anfangen...

Wieso sehe ich das nicht in deinem Code?

Ich muss ehrlich sagen, dass ich mir nicht sicher bin wie die Ausgabe genau funktioniert.

Der Befehl "trace_all" ist in der Streamer.cpp Datei, die sieht so aus:

void trace_all( Print & outs, const NMEAGPS &gps, const gps_fix &fix )
{
  outs << fix;

  #if defined(NMEAGPS_TIMESTAMP_FROM_INTERVAL) | defined(NMEAGPS_TIMESTAMP_FROM_PPS)
    outs << gps.UTCsecondStart();
    outs << ',';
  #endif

  #if defined(NMEAGPS_PARSE_SATELLITES)
    outs << '[';

    for (uint8_t i=0; i < gps.sat_count; i++) {
      outs << gps.satellites[i].id;

      #if defined(NMEAGPS_PARSE_SATELLITE_INFO)
        outs << ' ' << 
          gps.satellites[i].elevation << '/' << gps.satellites[i].azimuth;
        outs << '@';
        if (gps.satellites[i].tracked)
          outs << gps.satellites[i].snr;
        else
          outs << '-';
      #endif

      outs << ',';
    }

    outs << F("],");
  #endif

  #ifdef NMEAGPS_STATS
    outs << gps.statistics.ok     << ','
         << gps.statistics.errors << ','
         << gps.statistics.chars  << ',';
  #endif

  outs << '\n';

} // trace_all

Die Datei ist eigentlich 450 Zeilen lang, aber hier gibt er die Sachen eben aus, nur das verstehe ich nicht. ..

nur das verstehe ich nicht. ..

Ich auch nicht....
Und testen kann ich auch nicht.

Nirgendwo sehe ich da eine Ausgabe von "latitude und longitude"

Mittlerweile glaube ich, dass du etwas verwirrt bist.

Ich vermute, dass dir einfach die Umrechnung von Bruchzahlen zu Minuten/Sekunden fehlt.
Aber du hältst ja auch geheim, was du siehst, und was du erwartest.

angenommen du bekommst so etwas wie

48123456

Die "latitude und longitude" Werte werden als Float geliefert.
Im Bereich +/- 180°

So geht es aus der Klassendefinition hervor.

Darum sage ich ja auch:

Ich vermute, dass dir einfach die Umrechnung von Bruchzahlen zu Minuten/Sekunden fehlt.