1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Merge remote-tracking branch 'origin/next' into brian/rfm22_FHSS

This commit is contained in:
Brian Webb 2013-02-24 23:11:39 +00:00
commit fff6e81e0b
6 changed files with 26 additions and 18 deletions

View File

@ -9,7 +9,7 @@ equals(copydata, 1) {
for(dir, DATACOLLECTIONS) {
exists($$GCS_SOURCE_TREE/share/openpilotgcs/$$dir) {
macx:data_copy.commands += $(COPY_DIR) $$targetPath(\"$$GCS_SOURCE_TREE/share/openpilotgcs/$$dir\") $$targetPath(\"$$GCS_DATA_PATH/\") $$addNewline()
win32:data_copy.commands += $(COPY_DIR) $$targetPath(\"$$GCS_SOURCE_TREE/share/openpilotgcs/$$dir\") $$targetPath(\"$$GCS_DATA_PATH/$$dir\") $$addNewline()
win32:data_copy.commands += $(COPY_DIR) $$targetPath(\"$$GCS_SOURCE_TREE/share/openpilotgcs/$$dir\") $$targetPath(\"$$GCS_DATA_PATH/\") $$addNewline()
unix:data_copy.commands += $(MKDIR) $$targetPath(\"$$GCS_DATA_PATH/$$dir\") $$addNewline()
unix:data_copy.commands += $(COPY_DIR) $$targetPath(\"$$GCS_SOURCE_TREE/share/openpilotgcs/$$dir\") $$targetPath(\"$$GCS_DATA_PATH/\") $$addNewline()
}

View File

@ -30,23 +30,21 @@
#include "homelocationutil.h"
#include <stdint.h>
#include <QDebug>
#include <QDateTime>
#include "coordinateconversions.h"
#include "worldmagmodel.h"
namespace Utils {
HomeLocationUtil::HomeLocationUtil()
{
}
HomeLocationUtil::HomeLocationUtil()
{
}
/**
* @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,14 +62,13 @@ HomeLocationUtil::HomeLocationUtil()
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
Q_ASSERT(WorldMagModel().GetMagVector(LLA, dt.date().month(), dt.date().day(), dt.date().year(), Be) >= 0);
// Fetch world magnetic model
int result = WorldMagModel().GetMagVector(LLA, dt.date().month(), dt.date().day(), dt.date().year(), Be);
Q_ASSERT(result == 0);
return 0; // OK
return result;
}
}

View File

@ -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];

View File

@ -49,7 +49,8 @@ PositionField::PositionField(QWidget *parent) :
setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
m_renderer = new QSvgRenderer();
Q_ASSERT( m_renderer->load(QString(":/magicwaypoint/images/positionfield.svg")) != 0 );
bool success = m_renderer->load(QString(":/magicwaypoint/images/positionfield.svg"));
Q_ASSERT(success);
m_background = new QGraphicsSvgItem();
m_background->setSharedRenderer(m_renderer);

View File

@ -225,9 +225,11 @@ bool NotifyTableModel::dropMimeData( const QMimeData * data, Qt::DropAction acti
// addiional check in case dropping of multiple rows
if(rows + direction > _list.size()) continue;
Q_ASSERT(insertRows(rows + direction, 1, QModelIndex()));
bool success = insertRows(rows + direction, 1, QModelIndex());
Q_ASSERT(success);
_list.replace(rows + direction, item);
Q_ASSERT(removeRows(dragged, 1, QModelIndex()));
success = removeRows(dragged, 1, QModelIndex());
Q_ASSERT(success);
if (direction == UP_DIRECTION)
++rows;
};

View File

@ -312,11 +312,10 @@ int UAVObjectUtilManager::setHomeLocation(double LLA[3], bool save_to_sdcard)
{
double Be[3];
Q_ASSERT (Utils::HomeLocationUtil().getDetails(LLA, Be) >= 0);
int result = Utils::HomeLocationUtil().getDetails(LLA, Be);
Q_ASSERT(result == 0);
// ******************
// save the new settings
HomeLocation *homeLocation = HomeLocation::GetInstance(obm);
Q_ASSERT(homeLocation != NULL);