diff --git a/libraries/DataFlash/DataFlash.h b/libraries/DataFlash/DataFlash.h index 5cdd7d782a..26ab12baaa 100644 --- a/libraries/DataFlash/DataFlash.h +++ b/libraries/DataFlash/DataFlash.h @@ -169,6 +169,7 @@ struct PACKED log_Parameter { struct PACKED log_GPS { LOG_PACKET_HEADER; + uint64_t time_us; uint8_t status; uint32_t gps_week_ms; uint16_t gps_week; @@ -181,11 +182,11 @@ struct PACKED log_GPS { uint32_t ground_speed; int32_t ground_course; float vel_z; - uint32_t apm_time; }; struct PACKED log_GPS2 { LOG_PACKET_HEADER; + uint64_t time_us; uint8_t status; uint32_t gps_week_ms; uint16_t gps_week; @@ -197,7 +198,6 @@ struct PACKED log_GPS2 { uint32_t ground_speed; int32_t ground_course; float vel_z; - uint32_t apm_time; uint8_t dgps_numch; uint32_t dgps_age; }; @@ -399,6 +399,7 @@ struct PACKED log_Radio { struct PACKED log_Camera { LOG_PACKET_HEADER; + uint64_t time_us; uint32_t gps_time; uint16_t gps_week; int32_t latitude; @@ -582,7 +583,7 @@ Format characters in the format string for binary log messages { LOG_PARAMETER_MSG, sizeof(log_Parameter), \ "PARM", "QNf", "TimeUS,Name,Value" }, \ { LOG_GPS_MSG, sizeof(log_GPS), \ - "GPS", "BIHBcLLeeEefI", "Status,TimeMS,Week,NSats,HDop,Lat,Lng,RelAlt,Alt,Spd,GCrs,VZ,T" }, \ + "GPS", "QBIHBcLLeeEef", "TimeUS,Status,GMS,GWk,NSats,HDop,Lat,Lng,RAlt,Alt,Spd,GCrs,VZ" }, \ { LOG_IMU_MSG, sizeof(log_IMU), \ "IMU", "QffffffIIfBB", "TimeUS,GyrX,GyrY,GyrZ,AccX,AccY,AccZ,ErrG,ErrA,Temp,GyHlt,AcHlt" }, \ { LOG_MESSAGE_MSG, sizeof(log_Message), \ @@ -602,7 +603,7 @@ Format characters in the format string for binary log messages { LOG_RADIO_MSG, sizeof(log_Radio), \ "RAD", "QBBBBBHH", "TimeUS,RSSI,RemRSSI,TxBuf,Noise,RemNoise,RxErrors,Fixed" }, \ { LOG_CAMERA_MSG, sizeof(log_Camera), \ - "CAM", "IHLLeeccC","GPSTime,GPSWeek,Lat,Lng,Alt,RelAlt,Roll,Pitch,Yaw" }, \ + "CAM", "QHLLeeccC","TimeUS,GPSTime,GPSWeek,Lat,Lng,Alt,RelAlt,Roll,Pitch,Yaw" }, \ { LOG_ARSP_MSG, sizeof(log_AIRSPEED), \ "ARSP", "Qffcff", "TimeUS,Airspeed,DiffPress,Temp,RawPress,Offset" }, \ { LOG_CURRENT_MSG, sizeof(log_Current), \ @@ -617,7 +618,7 @@ Format characters in the format string for binary log messages // messages for more advanced boards #define LOG_EXTRA_STRUCTURES \ { LOG_GPS2_MSG, sizeof(log_GPS2), \ - "GPS2", "BIHBcLLeEefIBI", "Status,TimeMS,Week,NSats,HDop,Lat,Lng,Alt,Spd,GCrs,VZ,T,DSc,DAg" }, \ + "GPS2", "QBIHBcLLeEefBI", "TimeUS,Status,GMS,GWk,NSats,HDp,Lat,Lng,Alt,Spd,GCrs,VZ,DSc,DAg" }, \ { LOG_IMU2_MSG, sizeof(log_IMU), \ "IMU2", "QffffffIIfBB", "TimeUS,GyrX,GyrY,GyrZ,AccX,AccY,AccZ,ErrG,ErrA,Temp,GyHlt,AcHlt" }, \ { LOG_IMU3_MSG, sizeof(log_IMU), \ diff --git a/libraries/DataFlash/LogFile.cpp b/libraries/DataFlash/LogFile.cpp index 1499fe9080..6a28c1b5ec 100644 --- a/libraries/DataFlash/LogFile.cpp +++ b/libraries/DataFlash/LogFile.cpp @@ -668,6 +668,7 @@ void DataFlash_Class::Log_Write_GPS(const AP_GPS &gps, uint8_t i, int32_t relati const struct Location &loc = gps.location(i); struct log_GPS pkt = { LOG_PACKET_HEADER_INIT(LOG_GPS_MSG), + time_us : hal.scheduler->micros64(), status : (uint8_t)gps.status(i), gps_week_ms : gps.time_week_ms(i), gps_week : gps.time_week(i), @@ -680,7 +681,6 @@ void DataFlash_Class::Log_Write_GPS(const AP_GPS &gps, uint8_t i, int32_t relati ground_speed : (uint32_t)(gps.ground_speed(i) * 100), ground_course : gps.ground_course_cd(i), vel_z : gps.velocity(i).z, - apm_time : hal.scheduler->millis() }; WriteBlock(&pkt, sizeof(pkt)); } @@ -689,6 +689,7 @@ void DataFlash_Class::Log_Write_GPS(const AP_GPS &gps, uint8_t i, int32_t relati const struct Location &loc2 = gps.location(i); struct log_GPS2 pkt2 = { LOG_PACKET_HEADER_INIT(LOG_GPS2_MSG), + time_us : hal.scheduler->micros64(), status : (uint8_t)gps.status(i), gps_week_ms : gps.time_week_ms(i), gps_week : gps.time_week(i), @@ -700,7 +701,6 @@ void DataFlash_Class::Log_Write_GPS(const AP_GPS &gps, uint8_t i, int32_t relati ground_speed : (uint32_t)(gps.ground_speed(i)*100), ground_course : gps.ground_course_cd(i), vel_z : gps.velocity(i).z, - apm_time : hal.scheduler->millis(), dgps_numch : 0, dgps_age : 0 }; @@ -1125,6 +1125,7 @@ void DataFlash_Class::Log_Write_Camera(const AP_AHRS &ahrs, const AP_GPS &gps, c struct log_Camera pkt = { LOG_PACKET_HEADER_INIT(LOG_CAMERA_MSG), + time_us : hal.scheduler->micros64(), gps_time : gps.time_week_ms(), gps_week : gps.time_week(), latitude : current_loc.lat,