Esempio n. 1
0
void LogPoint(double Latitude, double Longitude, double Altitude,
              double BaroAltitude) {
  if (!LoggerActive) {
    if (!GPS_INFO.NAVWarning) {
      #if LOGFRECORD
      LogPointToBuffer(Latitude, Longitude, Altitude, BaroAltitude,
                       GPS_INFO.Hour, GPS_INFO.Minute, GPS_INFO.Second,
                       GPS_INFO.SatelliteIDs);
      #else
      LogPointToBuffer(Latitude, Longitude, Altitude, BaroAltitude, GPS_INFO.Hour, GPS_INFO.Minute, GPS_INFO.Second);
      #endif
    }
  } else if (NumLoggerBuffered && !GPS_INFO.NAVWarning) { 

    #if LOGFRECORD
    LogFRecordToFile(LoggerBuffer[0].SatelliteIDs,  // write FRec before cached BRecs
                   LoggerBuffer[0].Hour,
                   LoggerBuffer[0].Minute,
                   LoggerBuffer[0].Second,
                   true);
    #endif

    LKASSERT(NumLoggerBuffered<=MAX_LOGGER_BUFFER); // because we check i<
    for (int i=0; i<NumLoggerBuffered; i++) {
      LogPointToFile(LoggerBuffer[i].Latitude,
                     LoggerBuffer[i].Longitude,
                     LoggerBuffer[i].Altitude,
                     LoggerBuffer[i].BaroAltitude,
                     LoggerBuffer[i].Hour,
                     LoggerBuffer[i].Minute,
                     LoggerBuffer[i].Second);
    }
    NumLoggerBuffered = 0;
  } 
  if (LoggerActive && !GPS_INFO.NAVWarning) {
    LogPointToFile(Latitude, Longitude, Altitude, BaroAltitude,
                   GPS_INFO.Hour, GPS_INFO.Minute, GPS_INFO.Second);
  }
}
Esempio n. 2
0
void
LoggerImpl::LogPoint(const NMEA_INFO& gps_info)
{
  if (!LoggerActive) {
    if (!gps_info.NAVWarning) {
      LogPointToBuffer(gps_info);
    }
  } else if (NumLoggerBuffered) {

    LogFRecordToFile(LoggerBuffer[0].SatelliteIDs,  // write FRec before cached BRecs
                   LoggerBuffer[0].Hour,
                   LoggerBuffer[0].Minute,
                   LoggerBuffer[0].Second,
                   true);

    for (int i=0; i<NumLoggerBuffered; i++) {
      NMEA_INFO tmp_info;
      tmp_info.Location.Latitude = LoggerBuffer[i].Latitude;
      tmp_info.Location.Longitude = LoggerBuffer[i].Longitude;
      tmp_info.Altitude = LoggerBuffer[i].Altitude;
      tmp_info.BaroAltitude = LoggerBuffer[i].BaroAltitude;
      tmp_info.Hour = LoggerBuffer[i].Hour;
      tmp_info.Minute = LoggerBuffer[i].Minute;
      tmp_info.Second = LoggerBuffer[i].Second;
      tmp_info.Year = LoggerBuffer[i].Year;
      tmp_info.Month = LoggerBuffer[i].Month;
      tmp_info.Day = LoggerBuffer[i].Day;

      for (int iSat=0; iSat < MAXSATELLITES; iSat++)
	tmp_info.SatelliteIDs[iSat] = LoggerBuffer[i].SatelliteIDs[iSat];

      LogPointToFile(tmp_info);
    }
    NumLoggerBuffered = 0;
  }
  if (LoggerActive) {
    LogPointToFile(gps_info);
  }
}