1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Added dialog to request altitude when settings HomeLocation via the map.

Fixed bug in setHomeLocation, by which altitude was scaled inappropriately.
This commit is contained in:
Laura Sebesta 2012-09-27 14:42:57 +02:00
parent f532f3cda5
commit 9ec05d8928
3 changed files with 15 additions and 7 deletions

View File

@ -44,7 +44,7 @@ HomeLocationUtil::HomeLocationUtil()
} }
/* /*
/*Get world magnetic model /*Get local magnetic field
* input params: LLA * input params: LLA
* output params: Be * output params: Be
*/ */

View File

@ -941,11 +941,11 @@ void OPMapGadgetWidget::setHome(internals::PointLatLng pos_lat_lon,double altitu
if (longitude > 180) longitude = 180; if (longitude > 180) longitude = 180;
else else
if (longitude < -180) longitude = -180; if (longitude < -180) longitude = -180;
else if(altitude != altitude) altitude=0;
// ********* // *********
m_home_position.coord = internals::PointLatLng(latitude, longitude); m_home_position.coord = internals::PointLatLng(latitude, longitude);
m_home_position.altitude = altitude;
m_map->Home->SetCoord(m_home_position.coord); m_map->Home->SetCoord(m_home_position.coord);
m_map->Home->SetAltitude(altitude); m_map->Home->SetAltitude(altitude);
@ -1659,7 +1659,15 @@ void OPMapGadgetWidget::onSetHomeAct_triggered()
if (!m_widget || !m_map) if (!m_widget || !m_map)
return; return;
setHome(m_context_menu_lat_lon,0); float altitude=0;
bool ok;
//Get desired HomeLocation altitude from dialog box.
//TODO: Populate box with altitude already in HomeLocation UAVO
altitude = QInputDialog::getDouble(this, tr("Set home altitude"),
tr("In [m], referenced to WGS84:"), altitude, -100, 100000, 2, &ok);
setHome(m_context_menu_lat_lon, altitude);
setHomeLocationObject(); // update the HomeLocation UAVObject setHomeLocationObject(); // update the HomeLocation UAVObject
} }

View File

@ -323,7 +323,7 @@ int UAVObjectUtilManager::setHomeLocation(double LLA[3], bool save_to_sdcard)
HomeLocation::DataFields homeLocationData = homeLocation->getData(); HomeLocation::DataFields homeLocationData = homeLocation->getData();
homeLocationData.Latitude = LLA[0] * 1e7; homeLocationData.Latitude = LLA[0] * 1e7;
homeLocationData.Longitude = LLA[1] * 1e7; homeLocationData.Longitude = LLA[1] * 1e7;
homeLocationData.Altitude = LLA[2] * 1e7; homeLocationData.Altitude = LLA[2];
homeLocationData.Be[0] = Be[0]; homeLocationData.Be[0] = Be[0];
homeLocationData.Be[1] = Be[1]; homeLocationData.Be[1] = Be[1];