Skip to content

Commit

Permalink
Merged in f5soh/librepilot/LP-601_WP_output_file_locale (pull request…
Browse files Browse the repository at this point in the history
… #517)

LP-601 Waypoint fixes

Approved-by: Lalanne Laurent <f5soh@free.fr>
Approved-by: Eric Price <corvuscorax@cybertrench.com>
  • Loading branch information
f5soh committed Feb 21, 2019
2 parents 1ea6a3d + 62f48ac commit 62e72db
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
5 changes: 2 additions & 3 deletions flight/modules/PathPlanner/pathplanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,16 +604,15 @@ static uint8_t conditionBelowError()
/**
* the AboveAltitude measures the flight altitude relative to home position
* returns true if above critical altitude
* WARNING! Altitudes are always negative (down coordinate)
* Parameter 0: altitude in meters (negative!)
* Parameter 0: altitude in meters
*/
static uint8_t conditionAboveAltitude()
{
PositionStateData positionState;

PositionStateGet(&positionState);

if (positionState.Down <= pathAction.ConditionParameters[0]) {
if (-positionState.Down >= pathAction.ConditionParameters[0]) {
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ProviderStrings::ProviderStrings()
{
// Google version strings
VersionGoogleMap = "m@301";
QString version = "810";
QString version = "823";
QString envVersion = qgetenv("GCS_GOOGLE_SAT_VERSION").constData();
VersionGoogleSatellite = (envVersion.toInt() > version.toInt()) ? envVersion : version;
VersionGoogleLabels = "h@301";
Expand Down
10 changes: 5 additions & 5 deletions ground/gcs/src/plugins/opmap/flightdatamodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,27 +453,27 @@ bool flightDataModel::writeToFile(QString fileName)
waypoint.appendChild(field);

field = doc.createElement("field");
field.setAttribute("value", obj->latPosition);
field.setAttribute("value", QString::number(obj->latPosition, 'f', 16));
field.setAttribute("name", "latitude");
waypoint.appendChild(field);

field = doc.createElement("field");
field.setAttribute("value", obj->lngPosition);
field.setAttribute("value", QString::number(obj->lngPosition, 'f', 16));
field.setAttribute("name", "longitude");
waypoint.appendChild(field);

field = doc.createElement("field");
field.setAttribute("value", obj->disRelative);
field.setAttribute("value", QString::number(obj->disRelative, 'f', 16));
field.setAttribute("name", "distance_to_home");
waypoint.appendChild(field);

field = doc.createElement("field");
field.setAttribute("value", obj->beaRelative);
field.setAttribute("value", QString::number(obj->beaRelative, 'f', 16));
field.setAttribute("name", "bearing_from_home");
waypoint.appendChild(field);

field = doc.createElement("field");
field.setAttribute("value", obj->altitudeRelative);
field.setAttribute("value", QString::number(obj->altitudeRelative, 'f', 16));
field.setAttribute("name", "altitude_above_home");
waypoint.appendChild(field);

Expand Down
7 changes: 6 additions & 1 deletion ground/gcs/src/plugins/opmap/modelmapproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ modelMapProxy::overlayType modelMapProxy::overlayTranslate(int type)
case MapDataDelegate::MODE_GOTOENDPOINT:
case MapDataDelegate::MODE_FOLLOWVECTOR:
case MapDataDelegate::MODE_VELOCITY:
case MapDataDelegate::MODE_FIXEDATTITUDE:
case MapDataDelegate::MODE_LAND:
case MapDataDelegate::MODE_AUTOTAKEOFF:
case MapDataDelegate::MODE_BRAKE:
Expand All @@ -98,8 +99,12 @@ modelMapProxy::overlayType modelMapProxy::overlayTranslate(int type)
return OVERLAY_CIRCLE_RIGHT;

case MapDataDelegate::MODE_CIRCLELEFT:
default:
return OVERLAY_CIRCLE_LEFT;

case MapDataDelegate::MODE_SETACCESSORY:
case MapDataDelegate::MODE_DISARMALARM:
default:
return OVERLAY_NOLINE;
}
}

Expand Down
2 changes: 1 addition & 1 deletion ground/gcs/src/plugins/opmap/modelmapproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

using namespace mapcontrol;
class modelMapProxy : public QObject {
typedef enum { OVERLAY_LINE, OVERLAY_CIRCLE_RIGHT, OVERLAY_CIRCLE_LEFT } overlayType;
typedef enum { OVERLAY_LINE, OVERLAY_CIRCLE_RIGHT, OVERLAY_CIRCLE_LEFT, OVERLAY_NOLINE } overlayType;
Q_OBJECT
public:
explicit modelMapProxy(QObject *parent, OPMapWidget *map, flightDataModel *model, QItemSelectionModel *selectionModel);
Expand Down
5 changes: 2 additions & 3 deletions ground/gcs/src/plugins/opmap/opmap_edit_waypoint_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ opmap_edit_waypoint_dialog::opmap_edit_waypoint_dialog(QWidget *parent, QAbstrac
mapper->addMapping(ui->dsb_condParam1, flightDataModel::CONDITION_PARAMS0);
mapper->addMapping(ui->dsb_condParam2, flightDataModel::CONDITION_PARAMS1);
mapper->addMapping(ui->dsb_condParam3, flightDataModel::CONDITION_PARAMS2);
mapper->addMapping(ui->dsb_condParam4, flightDataModel::CONDITION_PARAMS0);
mapper->addMapping(ui->dsb_condParam4, flightDataModel::CONDITION_PARAMS3);

mapper->addMapping(ui->cbCommand, flightDataModel::COMMAND);
mapper->addMapping(ui->sbJump, flightDataModel::JUMPDESTINATION);
Expand Down Expand Up @@ -290,8 +290,7 @@ void opmap_edit_waypoint_dialog::setupConditionWidgets()
ui->condParam1->setEnabled(true);
ui->dsb_condParam1->setEnabled(true);
ui->condParam1->setText("Altitude (m):");
ui->descriptionConditionLabel->setText(tr("<p>The AboveAltitude condition measures the flight altitude relative to home position, returns true if "
"above critical altitude.</p><p><b>WARNING!</b> altitudes set here are always <b>negative</b> if above Home. (down coordinate)</p>"));
ui->descriptionConditionLabel->setText(tr("<p>The AboveAltitude condition measures the flight altitude relative to home position, returns true if above critical altitude.</p>"));
break;
case MapDataDelegate::ENDCONDITION_ABOVESPEED:
ui->condParam1->setEnabled(true);
Expand Down

0 comments on commit 62e72db

Please sign in to comment.