diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index e74e1b9813..5edafca5d9 100755 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -1460,7 +1460,7 @@ static void cliWaypoints(char *cmdline) if (!(validArgumentCount == 6 || validArgumentCount == 8)) { cliShowParseError(); - } else if (!(action == 0 || action == NAV_WP_ACTION_WAYPOINT || action == NAV_WP_ACTION_RTH || action == NAV_WP_ACTION_JUMP || action == NAV_WP_ACTION_HOLD_TIME || action == NAV_WP_ACTION_LAND || action == NAV_WP_ACTION_SET_POI || action == NAV_WP_ACTION_SET_HEAD) || !(flag == 0 || flag == NAV_WP_FLAG_LAST)) { + } else if (!(action == 0 || action == NAV_WP_ACTION_WAYPOINT || action == NAV_WP_ACTION_RTH || action == NAV_WP_ACTION_JUMP || action == NAV_WP_ACTION_HOLD_TIME || action == NAV_WP_ACTION_LAND || action == NAV_WP_ACTION_SET_POI || action == NAV_WP_ACTION_SET_HEAD) || !(flag == 0 || flag == NAV_WP_FLAG_LAST || flag == NAV_WP_FLAG_HOME)) { cliShowParseError(); } else { posControl.waypointList[i].action = action; @@ -2930,28 +2930,28 @@ static void printImu2Status(void) cliPrintLinef("Acc: %d", secondaryImuState.calibrationStatus.acc); cliPrintLinef("Mag: %d", secondaryImuState.calibrationStatus.mag); cliPrintLine("Calibration gains:"); - + cliPrintLinef( - "Gyro: %d %d %d", - secondaryImuConfig()->calibrationOffsetGyro[X], - secondaryImuConfig()->calibrationOffsetGyro[Y], + "Gyro: %d %d %d", + secondaryImuConfig()->calibrationOffsetGyro[X], + secondaryImuConfig()->calibrationOffsetGyro[Y], secondaryImuConfig()->calibrationOffsetGyro[Z] ); cliPrintLinef( - "Acc: %d %d %d", - secondaryImuConfig()->calibrationOffsetAcc[X], - secondaryImuConfig()->calibrationOffsetAcc[Y], + "Acc: %d %d %d", + secondaryImuConfig()->calibrationOffsetAcc[X], + secondaryImuConfig()->calibrationOffsetAcc[Y], secondaryImuConfig()->calibrationOffsetAcc[Z] ); cliPrintLinef( - "Mag: %d %d %d", - secondaryImuConfig()->calibrationOffsetMag[X], - secondaryImuConfig()->calibrationOffsetMag[Y], + "Mag: %d %d %d", + secondaryImuConfig()->calibrationOffsetMag[X], + secondaryImuConfig()->calibrationOffsetMag[Y], secondaryImuConfig()->calibrationOffsetMag[Z] ); cliPrintLinef( - "Radius: %d %d", - secondaryImuConfig()->calibrationRadiusAcc, + "Radius: %d %d", + secondaryImuConfig()->calibrationRadiusAcc, secondaryImuConfig()->calibrationRadiusMag ); } diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index 1492451b0b..ad81703e21 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -2933,8 +2933,15 @@ static void mapWaypointToLocalPosition(fpVector3_t * localPos, const navWaypoint { gpsLocation_t wpLLH; - wpLLH.lat = waypoint->lat; - wpLLH.lon = waypoint->lon; + /* Default to home position if lat & lon = 0 or HOME flag set + * Applicable to WAYPOINT, HOLD_TIME & LANDING WP types */ + if ((waypoint->lat == 0 && waypoint->lon == 0) || waypoint->flag == NAV_WP_FLAG_HOME) { + wpLLH.lat = GPS_home.lat; + wpLLH.lon = GPS_home.lon; + } else { + wpLLH.lat = waypoint->lat; + wpLLH.lon = waypoint->lon; + } wpLLH.alt = waypoint->alt; geoConvertGeodeticToLocal(localPos, &posControl.gpsOrigin, &wpLLH, altConv); diff --git a/src/main/navigation/navigation.h b/src/main/navigation/navigation.h index 6f87ce3909..a29a4485ce 100755 --- a/src/main/navigation/navigation.h +++ b/src/main/navigation/navigation.h @@ -306,6 +306,7 @@ typedef enum { } navWaypointHeadings_e; typedef enum { + NAV_WP_FLAG_HOME = 0x48, NAV_WP_FLAG_LAST = 0xA5 } navWaypointFlags_e;