mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-30 08:24:11 +01:00
OP-834 home location related error reporting improvments and comment
cleanups
This commit is contained in:
parent
8bd3c09860
commit
ed83f282a5
@ -30,10 +30,8 @@
|
||||
#include "homelocationutil.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <QDebug>
|
||||
#include <QDateTime>
|
||||
|
||||
#include "coordinateconversions.h"
|
||||
#include "worldmagmodel.h"
|
||||
|
||||
namespace Utils {
|
||||
@ -46,7 +44,7 @@ namespace Utils {
|
||||
* @brief Get local magnetic field
|
||||
* @param[in] LLA The longitude-latitude-altitude coordinate to compute the magnetic field at
|
||||
* @param[out] Be The resulting magnetic field at that location and time in [mGau](?)
|
||||
* @returns 0 if successful, -1 otherwise.
|
||||
* @returns 0 if successful, negative otherwise.
|
||||
*/
|
||||
int HomeLocationUtil::getDetails(double LLA[3], double Be[3])
|
||||
{
|
||||
@ -64,15 +62,13 @@ namespace Utils {
|
||||
if (latitude < -90 || latitude > 90) return -4; // range checking
|
||||
if (longitude < -180 || longitude > 180) return -5; // range checking
|
||||
|
||||
// *************
|
||||
|
||||
QDateTime dt = QDateTime::currentDateTime().toUTC();
|
||||
|
||||
// Fetch world magnetic model
|
||||
int result = WorldMagModel().GetMagVector(LLA, dt.date().month(), dt.date().day(), dt.date().year(), Be);
|
||||
Q_ASSERT(result >= 0);
|
||||
Q_ASSERT(result == 0);
|
||||
|
||||
return 0; // OK
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -154,6 +154,15 @@ namespace Utils {
|
||||
Initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @param[in] LLA The longitude-latitude-altitude coordinate to compute the magnetic field at
|
||||
* @param[in] Month
|
||||
* @param[in] Day
|
||||
* @param[in] Year
|
||||
* @param[out] Be The resulting magnetic field at that location and time in [mGau](?)
|
||||
* @returns 0 if successful, negative otherwise.
|
||||
*/
|
||||
int WorldMagModel::GetMagVector(double LLA[3], int Month, int Day, int Year, double Be[3])
|
||||
{
|
||||
double Lat = LLA[0];
|
||||
|
@ -313,11 +313,9 @@ int UAVObjectUtilManager::setHomeLocation(double LLA[3], bool save_to_sdcard)
|
||||
double Be[3];
|
||||
|
||||
int result = Utils::HomeLocationUtil().getDetails(LLA, Be);
|
||||
Q_ASSERT(result >= 0);
|
||||
Q_ASSERT(result == 0);
|
||||
|
||||
// ******************
|
||||
// save the new settings
|
||||
|
||||
HomeLocation *homeLocation = HomeLocation::GetInstance(obm);
|
||||
Q_ASSERT(homeLocation != NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user