DataFlash: correct nanf log output

This commit is contained in:
Peter Barker 2017-07-22 12:27:45 +10:00 committed by Peter Barker
parent c8b6be6736
commit 466d6e619e
3 changed files with 7 additions and 1 deletions

View File

@ -210,6 +210,9 @@ public:
void handle_log_send(class GCS_MAVLINK &);
bool in_log_download() const { return _in_log_download; }
float quiet_nanf() const { return nanf("0x4152"); } // "AR"
double quiet_nan() const { return nan("0x4152445550490a"); } // "ARDUPI"
protected:
const struct LogStructure *_structures;

View File

@ -594,7 +594,7 @@ void DataFlash_Class::Log_Write_POS(AP_AHRS &ahrs)
lng : loc.lng,
alt : loc.alt*1.0e-2f,
rel_home_alt : -home,
rel_origin_alt : ahrs.get_relative_position_D_origin(origin) ? -origin : nanf("ARDUPILOT")
rel_origin_alt : ahrs.get_relative_position_D_origin(origin) ? -origin : quiet_nanf(),
};
WriteBlock(&pkt, sizeof(pkt));
}

View File

@ -175,6 +175,9 @@ void DataFlashTest_AllTypes::Log_Write_TypeMessages_Log_Write()
3432345232233432 // uint64_t
);
// emit a message which contains NaNs:
dataflash.Log_Write("NANS", "f,d,bf,bd", "fdfd", dataflash.quiet_nanf(), dataflash.quiet_nan(), NAN, NAN);
flush_dataflash(dataflash);
dataflash.StopLogging();