[modules][nav] return void for setup routines

This commit is contained in:
Felix Ruess
2016-12-15 00:38:34 +01:00
parent 6bbe7d7f29
commit 817062db58
30 changed files with 46 additions and 70 deletions
+1 -3
View File
@@ -142,7 +142,7 @@ static void compute_points_from_bungee(void)
VECT2_SUM(throttle_point, bungee_point, throttle_point);
}
bool nav_bungee_takeoff_setup(uint8_t bungee_wp)
void nav_bungee_takeoff_setup(uint8_t bungee_wp)
{
// Store bungee point (from WP id, altitude should be ground alt)
// FIXME use current alt instead ?
@@ -154,8 +154,6 @@ bool nav_bungee_takeoff_setup(uint8_t bungee_wp)
// Enable Launch Status and turn kill throttle on
CTakeoffStatus = Launch;
kill_throttle = 1;
return false;
}
bool nav_bungee_takeoff_run(void)
+1 -2
View File
@@ -67,9 +67,8 @@
* called in the flight plan before the 'run' function
*
* @param[in] bungee_wp Waypoint ID correcponding to the bungee location
* @return always false, since called only once by the flight plan
*/
extern bool nav_bungee_takeoff_setup(uint8_t bungee_wp);
extern void nav_bungee_takeoff_setup(uint8_t bungee_wp);
/** Bungee takeoff run function
*
+1 -3
View File
@@ -36,7 +36,7 @@
struct NavCube nav_cube;
bool nav_cube_setup(uint8_t center, uint8_t tb, uint8_t te)
void nav_cube_setup(uint8_t center, uint8_t tb, uint8_t te)
{
int32_t j, start_bx, start_by, start_bz, start_ex, start_ey, start_ez;
@@ -137,8 +137,6 @@ bool nav_cube_setup(uint8_t center, uint8_t tb, uint8_t te)
/* bug in <for from="" to=""> ? */
nav_cube.nline_x--;
nav_cube.nline_z--;
return false;
}
bool nav_cube_run(int8_t j, int8_t i,
+4 -4
View File
@@ -122,10 +122,10 @@ struct NavCube {
extern struct NavCube nav_cube;
extern bool nav_cube_setup(uint8_t turb, uint8_t tb, uint8_t te);
bool nav_cube_run(int8_t j, int8_t i,
uint8_t dest_b, uint8_t dest_e,
uint8_t src_b, uint8_t src_e);
extern void nav_cube_setup(uint8_t turb, uint8_t tb, uint8_t te);
extern bool nav_cube_run(int8_t j, int8_t i,
uint8_t dest_b, uint8_t dest_e,
uint8_t src_b, uint8_t src_e);
#define nav_cube_SetAlpha(i) { nav_cube.alpha=i; }
#define nav_cube_SetSect(i) { nav_cube.sect=i; }
+1 -2
View File
@@ -57,7 +57,7 @@ static float Flowerradius;
static uint8_t Center;
static uint8_t Edge;
bool nav_flower_setup(uint8_t CenterWP, uint8_t EdgeWP)
void nav_flower_setup(uint8_t CenterWP, uint8_t EdgeWP)
{
Center = CenterWP;
Edge = EdgeWP;
@@ -85,7 +85,6 @@ bool nav_flower_setup(uint8_t CenterWP, uint8_t EdgeWP)
CircleX = 0;
CircleY = 0;
return false;
}
bool nav_flower_run(void)
+1 -1
View File
@@ -30,6 +30,6 @@
#include "std.h"
extern bool nav_flower_run(void);
extern bool nav_flower_setup(uint8_t CenterWP, uint8_t EdgeWP);
extern void nav_flower_setup(uint8_t CenterWP, uint8_t EdgeWP);
#endif
+1 -3
View File
@@ -108,7 +108,7 @@ static float launch_circle_alt;
static float launch_line_x;
static float launch_line_y;
bool nav_launcher_setup(void)
void nav_launcher_setup(void)
{
launch_x = stateGetPositionEnu_f()->x;
launch_y = stateGetPositionEnu_f()->y;
@@ -121,8 +121,6 @@ bool nav_launcher_setup(void)
CLaunch_Status = L_Pitch_Nav;
kill_throttle = 0;
return FALSE;
}
bool nav_launcher_run(void)
+1 -1
View File
@@ -50,7 +50,7 @@
#include "std.h"
#include "paparazzi.h"
extern bool nav_launcher_setup(void);
extern void nav_launcher_setup(void);
extern bool nav_launcher_run(void);
#endif /* NAV_LAUNCHER_H */
+1 -2
View File
@@ -33,10 +33,9 @@
enum line_status { LR12, LQC21, LTC2, LQC22, LR21, LQC12, LTC1, LQC11 };
static enum line_status line_status;
bool nav_line_setup(void)
void nav_line_setup(void)
{
line_status = LR12;
return false;
}
bool nav_line_run(uint8_t l1, uint8_t l2, float radius)
+1 -1
View File
@@ -30,7 +30,7 @@
#include "std.h"
extern bool nav_line_setup(void);
extern void nav_line_setup(void);
extern bool nav_line_run(uint8_t wp1, uint8_t wp2, float radius);
#endif /* NAV_LINE_H */
+1 -2
View File
@@ -37,10 +37,9 @@
enum line_border_status { LR12, LQC21, LTC2, LQC22, LR21, LQC12, LTC1, LQC11 };
static enum line_border_status line_border_status;
bool nav_line_border_setup(void)
void nav_line_border_setup(void)
{
line_border_status = LR12;
return false;
}
bool nav_line_border_run(uint8_t l1, uint8_t l2, float radius)
+1 -1
View File
@@ -29,7 +29,7 @@
#include "std.h"
extern bool nav_line_border_setup(void);
extern void nav_line_border_setup(void);
extern bool nav_line_border_run(uint8_t wp1, uint8_t wp2, float radius);
#endif /* NAV_LINE_BORDER_H */
+1 -3
View File
@@ -91,7 +91,7 @@ static inline float distance_equation(struct FloatVect2 p1,struct FloatVect2 p2)
return sqrtf((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));
}
bool nav_skid_landing_setup(uint8_t afwp, uint8_t tdwp, float radius)
void nav_skid_landing_setup(uint8_t afwp, uint8_t tdwp, float radius)
{
aw_waypoint = afwp;
td_waypoint = tdwp;
@@ -122,8 +122,6 @@ bool nav_skid_landing_setup(uint8_t afwp, uint8_t tdwp, float radius)
approach_quadrant = land_circle_quadrant + RadOfDeg(90);
land_circle_quadrant = land_circle_quadrant + RadOfDeg(45);
}
return FALSE;
}
bool nav_skid_landing_run(void)
+1 -1
View File
@@ -60,7 +60,7 @@
#include "std.h"
#include "paparazzi.h"
extern bool nav_skid_landing_setup(uint8_t afwp, uint8_t tdwp, float radius);
extern void nav_skid_landing_setup(uint8_t afwp, uint8_t tdwp, float radius);
extern bool nav_skid_landing_run(void);
void nav_skid_landing_glide(uint8_t from_wp, uint8_t to_wp);
+1 -2
View File
@@ -47,7 +47,7 @@
struct NavSpiral nav_spiral;
bool nav_spiral_setup(uint8_t center_wp, uint8_t edge_wp, float radius_start, float radius_inc, float segments)
void nav_spiral_setup(uint8_t center_wp, uint8_t edge_wp, float radius_start, float radius_inc, float segments)
{
VECT2_COPY(nav_spiral.center, waypoints[center_wp]); // center of the helix
nav_spiral.center.z = waypoints[center_wp].a;
@@ -81,7 +81,6 @@ bool nav_spiral_setup(uint8_t center_wp, uint8_t edge_wp, float radius_start, fl
if (nav_spiral.dist_from_center > nav_spiral.radius) {
nav_spiral.status = SpiralOutside;
}
return false;
}
bool nav_spiral_run(void)
+2 -2
View File
@@ -52,7 +52,7 @@ struct NavSpiral {
extern struct NavSpiral nav_spiral;
extern bool nav_spiral_run(void);
extern bool nav_spiral_setup(uint8_t center_wp, uint8_t edge_wp, float radius_start,
float radius_inc, float segments);
extern void nav_spiral_setup(uint8_t center_wp, uint8_t edge_wp, float radius_start,
float radius_inc, float segments);
#endif // NAV_SPIRAL_H
+1 -2
View File
@@ -46,14 +46,13 @@ struct DiscSurvey {
static struct DiscSurvey disc_survey;
bool nav_survey_disc_setup(float grid)
void nav_survey_disc_setup(float grid)
{
nav_survey_shift = grid;
disc_survey.status = DOWNWIND;
disc_survey.sign = 1;
disc_survey.c1.x = stateGetPositionEnu_f()->x;
disc_survey.c1.y = stateGetPositionEnu_f()->y;
return false;
}
bool nav_survey_disc_run(uint8_t center_wp, float radius)
+1 -1
View File
@@ -29,7 +29,7 @@
#include "std.h"
extern bool nav_survey_disc_setup(float grid);
extern void nav_survey_disc_setup(float grid);
extern bool nav_survey_disc_run(uint8_t c, float radius);
#endif /* NAV_SURVEY_DISC_H */
@@ -78,7 +78,7 @@ bool use_full_circle = POLY_OSAM_USE_FULL_CIRCLE;
bool Half_Sweep_Enabled = POLY_OSAM_HALF_SWEEP_ENABLED;
bool Reset_Sweep = FALSE;
bool nav_survey_poly_osam_setup_towards(uint8_t FirstWP, uint8_t Size, float Sweep, int SecondWP)
void nav_survey_poly_osam_setup_towards(uint8_t FirstWP, uint8_t Size, float Sweep, int SecondWP)
{
float dx = waypoints[SecondWP].x - waypoints[FirstWP].x;
float dy = waypoints[SecondWP].y - waypoints[FirstWP].y;
@@ -87,7 +87,7 @@ bool nav_survey_poly_osam_setup_towards(uint8_t FirstWP, uint8_t Size, float Swe
//if values passed, use it.
if (Size == 0) {Size = Poly_Size;}
if (Sweep == 0) {Sweep = Poly_Sweep;}
return nav_survey_poly_osam_setup(FirstWP, Size, Sweep, DegOfRad(ang));
nav_survey_poly_osam_setup(FirstWP, Size, Sweep, DegOfRad(ang));
}
struct Point2D {float x; float y;};
@@ -142,7 +142,7 @@ uint16_t PolySurveySweepNum;
uint16_t PolySurveySweepBackNum;
float EntryRadius;
bool nav_survey_poly_osam_setup(uint8_t EntryWP, uint8_t Size, float sw, float Orientation)
void nav_survey_poly_osam_setup(uint8_t EntryWP, uint8_t Size, float sw, float Orientation)
{
SmallestCorner.x = 0;
SmallestCorner.y = 0;
@@ -183,7 +183,7 @@ bool nav_survey_poly_osam_setup(uint8_t EntryWP, uint8_t Size, float sw, float O
CSurveyStatus = Init;
if (Size == 0) {
return true;
return;
}
//Don't initialize if Polygon is too big or if the orientation is not between 0 and 90
@@ -342,8 +342,6 @@ bool nav_survey_poly_osam_setup(uint8_t EntryWP, uint8_t Size, float sw, float O
CSurveyStatus = Entry;
LINE_STOP_FUNCTION;
}
return false;
}
bool nav_survey_poly_osam_run(void)
@@ -43,7 +43,7 @@ extern bool Reset_Sweep;
* @param Sweep distance between scan lines
* @param Orientation angle of scan lines in degrees (CCW, east)
*/
extern bool nav_survey_poly_osam_setup(uint8_t FirstWP, uint8_t Size, float Sweep, float Orientation);
extern void nav_survey_poly_osam_setup(uint8_t FirstWP, uint8_t Size, float Sweep, float Orientation);
/**
* Setup "dynamic" polygon survey with sweep orientation towards a waypoint.
@@ -56,7 +56,7 @@ extern bool nav_survey_poly_osam_setup(uint8_t FirstWP, uint8_t Size, float Swee
* @param Sweep distance between scan lines, if zero uses Poly_Sweep
* @param SecondWP second waypoint towards which the sweep orientation is computed
*/
extern bool nav_survey_poly_osam_setup_towards(uint8_t FirstWP, uint8_t Size, float Sweep, int SecondWP);
extern void nav_survey_poly_osam_setup_towards(uint8_t FirstWP, uint8_t Size, float Sweep, int SecondWP);
/** Run polygon survey */
extern bool nav_survey_poly_osam_run(void);
@@ -61,7 +61,7 @@ uint8_t Poly_Size = POLYSURVEY_DEFAULT_SIZE;
float Poly_Distance = POLYSURVEY_DEFAULT_DISTANCE;
bool nav_survey_poly_setup_towards(uint8_t FirstWP, uint8_t Size, float Sweep, int SecondWP)
void nav_survey_poly_setup_towards(uint8_t FirstWP, uint8_t Size, float Sweep, int SecondWP)
{
float dx = waypoints[SecondWP].enu_f.x - waypoints[FirstWP].enu_f.x;
float dy = waypoints[SecondWP].enu_f.y - waypoints[FirstWP].enu_f.y;
@@ -72,7 +72,7 @@ bool nav_survey_poly_setup_towards(uint8_t FirstWP, uint8_t Size, float Sweep, i
//if values passed, use it.
if (Size == 0) {Size = Poly_Size;}
if (Sweep == 0) {Sweep = Poly_Distance;}
return nav_survey_poly_setup(FirstWP, Size, Sweep, ang);
nav_survey_poly_setup(FirstWP, Size, Sweep, ang);
}
struct Point2D {float x; float y;};
@@ -121,7 +121,7 @@ float EntryRadius;
bool Half_Sweep_Enabled = POLY_OSAM_HALF_SWEEP_ENABLED;
//=========================================================================================================================
bool nav_survey_poly_setup(uint8_t EntryWP, uint8_t Size, float sw, float Orientation)
void nav_survey_poly_setup(uint8_t EntryWP, uint8_t Size, float sw, float Orientation)
{
SmallestCorner.x = 0;
SmallestCorner.y = 0;
@@ -155,7 +155,7 @@ bool nav_survey_poly_setup(uint8_t EntryWP, uint8_t Size, float sw, float Orient
CSurveyStatus = Init;
if (Size == 0) {
return true;
return;
}
//Don't initialize if Polygon is too big or if the orientation is not between 0 and 90
@@ -301,8 +301,6 @@ bool nav_survey_poly_setup(uint8_t EntryWP, uint8_t Size, float sw, float Orient
nav_set_heading_deg(-Orientation + 90.);
}
return false;
}
//=========================================================================================================================
@@ -42,7 +42,7 @@ extern bool Half_Sweep_Enabled;
* @param Sweep distance between scan lines
* @param Orientation angle of scan lines in degrees (CCW, east)
*/
extern bool nav_survey_poly_setup(uint8_t FirstWP, uint8_t Size, float Sweep, float Orientation);
extern void nav_survey_poly_setup(uint8_t FirstWP, uint8_t Size, float Sweep, float Orientation);
/**
* Setup "dynamic" polygon survey with sweep orientation towards a waypoint.
@@ -55,7 +55,7 @@ extern bool nav_survey_poly_setup(uint8_t FirstWP, uint8_t Size, float Sweep, fl
* @param Sweep distance between scan lines, if zero uses Poly_Distance
* @param SecondWP second waypoint towards which the sweep orientation is computed
*/
extern bool nav_survey_poly_setup_towards(uint8_t FirstWP, uint8_t Size, float Sweep, int SecondWP);
extern void nav_survey_poly_setup_towards(uint8_t FirstWP, uint8_t Size, float Sweep, int SecondWP);
/** Run polygon survey */
extern bool nav_survey_poly_run(void);
+3 -5
View File
@@ -132,8 +132,8 @@ static bool get_two_intersects(struct FloatVect2 *x, struct FloatVect2 *y, struc
* @param min_rad minimal radius when navigating
* @param altitude the altitude that must be reached before the flyover starts
**/
bool nav_survey_polygon_setup(uint8_t first_wp, uint8_t size, float angle, float sweep_width, float shot_dist,
float min_rad, float altitude)
void nav_survey_polygon_setup(uint8_t first_wp, uint8_t size, float angle, float sweep_width, float shot_dist,
float min_rad, float altitude)
{
int i;
struct FloatVect2 small, sweep;
@@ -212,7 +212,7 @@ bool nav_survey_polygon_setup(uint8_t first_wp, uint8_t size, float angle, float
if (!get_two_intersects(&survey.seg_start, &survey.seg_end, survey.seg_start, survey.seg_end)) {
survey.stage = ERR;
return false;
return;
}
//center of the entry circle
@@ -223,8 +223,6 @@ bool nav_survey_polygon_setup(uint8_t first_wp, uint8_t size, float angle, float
NavVerticalAltitudeMode(survey.psa_altitude, 0.0);
survey.stage = ENTRY;
return false;
}
/**
+2 -2
View File
@@ -82,8 +82,8 @@ struct SurveyPolyAdv {
struct FloatVect2 ret_end;
};
extern bool nav_survey_polygon_setup(uint8_t first_wp, uint8_t size, float angle, float sweep_width, float shot_dist,
float min_rad, float altitude);
extern void nav_survey_polygon_setup(uint8_t first_wp, uint8_t size, float angle, float sweep_width, float shot_dist,
float min_rad, float altitude);
extern bool nav_survey_polygon_run(void);
#endif
@@ -96,7 +96,7 @@ void nav_survey_rectangle_rotorcraft_init(void)
#endif
}
bool nav_survey_rectangle_rotorcraft_setup(uint8_t wp1, uint8_t wp2, float grid, survey_orientation_t so)
void nav_survey_rectangle_rotorcraft_setup(uint8_t wp1, uint8_t wp2, float grid, survey_orientation_t so)
{
rectangle_survey_sweep_num = 0;
nav_survey_west = Min(WaypointX(wp1), WaypointX(wp2));
@@ -151,7 +151,6 @@ bool nav_survey_rectangle_rotorcraft_setup(uint8_t wp1, uint8_t wp2, float grid,
} else {
nav_set_heading_deg(90);
}
return false;
}
@@ -41,7 +41,7 @@ extern bool interleave;
extern void nav_survey_rectangle_rotorcraft_init(void);
extern bool nav_survey_rectangle_rotorcraft_setup(uint8_t wp1, uint8_t wp2, float grid1, survey_orientation_t so);
extern void nav_survey_rectangle_rotorcraft_setup(uint8_t wp1, uint8_t wp2, float grid1, survey_orientation_t so);
extern bool nav_survey_rectangle_rotorcraft_run(uint8_t wp1, uint8_t wp2);
#define NavSurveyRectangleInit(_wp1, _wp2, _grid, _orientation) nav_survey_rectangle_rotorcraft_setup(_wp1, _wp2, _grid, _orientation)
+2 -4
View File
@@ -54,8 +54,8 @@ struct ZamboniSurvey zs;
* @param sweep_lines number of sweep_lines to fly
* @param altitude the altitude that must be reached before the flyover starts
*/
bool nav_survey_zamboni_setup(uint8_t center_wp, uint8_t dir_wp, float sweep_length, float sweep_spacing,
int sweep_lines, float altitude)
void nav_survey_zamboni_setup(uint8_t center_wp, uint8_t dir_wp, float sweep_length, float sweep_spacing,
int sweep_lines, float altitude)
{
zs.current_laps = 0;
zs.pre_leave_angle = 2;
@@ -117,8 +117,6 @@ bool nav_survey_zamboni_setup(uint8_t center_wp, uint8_t dir_wp, float sweep_len
NavVerticalAltitudeMode(zs.altitude, 0.0);
zs.stage = Z_ENTRY;
return false;
}
/**
+1 -1
View File
@@ -70,7 +70,7 @@ struct ZamboniSurvey {
};
extern bool nav_survey_zamboni_setup(uint8_t center_wp, uint8_t dir_wp, float sweep_length, float sweep_spacing,
extern void nav_survey_zamboni_setup(uint8_t center_wp, uint8_t dir_wp, float sweep_length, float sweep_spacing,
int sweep_lines, float altitude);
extern bool nav_survey_zamboni_run(void);
@@ -40,10 +40,9 @@
enum line_status { LR12, LQC21, LTC2, LQC22, LR21, LQC12, LTC1, LQC11 };
static enum line_status line_status;
bool nav_vertical_raster_setup(void)
void nav_vertical_raster_setup(void)
{
line_status = LR12;
return false;
}
bool nav_vertical_raster_run(uint8_t l1, uint8_t l2, float radius, float AltSweep)
@@ -29,7 +29,7 @@
#include "std.h"
extern bool nav_vertical_raster_setup(void);
extern void nav_vertical_raster_setup(void);
extern bool nav_vertical_raster_run(uint8_t wp1, uint8_t wp2, float radius, float AltSweep);
#endif