Commit 29fe3da7 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

remove unused functions

Remove:
- setTargetAltitude
- setTargetCoordinatesXYZ
- setTargetLatLong
parent b5285c27
...@@ -22,10 +22,7 @@ int mavsdk_takeOffAndWait(void); ...@@ -22,10 +22,7 @@ int mavsdk_takeOffAndWait(void);
int mavsdk_doReposition(float la, float lo, float a, float y); int mavsdk_doReposition(float la, float lo, float a, float y);
int mavsdk_setAirspeed(float airspeed); int mavsdk_setAirspeed(float airspeed);
int mavsdk_setAltitude(float altitude); int mavsdk_setAltitude(float altitude);
int mavsdk_setTargetAltitude(float a);
int mavsdk_setTargetCoordinates(double la, double lo, float a, float y); int mavsdk_setTargetCoordinates(double la, double lo, float a, float y);
int mavsdk_setTargetCoordinatesXYZ(double x, double y, float z);
int mavsdk_setTargetLatLong(double la, double lo);
// Information functions // Information functions
float mavsdk_getAltitude(void); float mavsdk_getAltitude(void);
......
...@@ -330,21 +330,6 @@ int mavsdk_setAltitude(float altitude) { ...@@ -330,21 +330,6 @@ int mavsdk_setAltitude(float altitude) {
return doMavlinkCommand(command, "Setting altitude failed"); return doMavlinkCommand(command, "Setting altitude failed");
} }
int mavsdk_setTargetAltitude(float a) {
if(!mavsdk_started)
return -1;
log("Going to altitude " + std::to_string(a) + "m");
const Action::Result result = action->goto_location(position.latitude_deg,
position.longitude_deg,
a, 0);
if (result != Action::Result::Success) {
log_error_from_result("Goto location failed", result);
return -1;
}
return 0;
}
int mavsdk_setTargetCoordinates(double la, double lo, float a, float y) { int mavsdk_setTargetCoordinates(double la, double lo, float a, float y) {
if(!mavsdk_started) if(!mavsdk_started)
return -1; return -1;
...@@ -359,19 +344,6 @@ int mavsdk_setTargetCoordinates(double la, double lo, float a, float y) { ...@@ -359,19 +344,6 @@ int mavsdk_setTargetCoordinates(double la, double lo, float a, float y) {
return 0; return 0;
} }
int mavsdk_setTargetCoordinatesXYZ(double x, double y, float z) {
double la, lo;
la = ((origin.latitude_deg + y / EARTH_RADIUS) * 180.F) / M_PI;
lo = ((origin.longitude_deg + x / (EARTH_RADIUS * xy_ratio)) * 180.F) / M_PI;
return mavsdk_setTargetCoordinates(la, lo, z, 0);
}
int mavsdk_setTargetLatLong(double la, double lo) {
return mavsdk_setTargetCoordinates(la, lo, mavsdk_getAltitude(), 0);
}
// Information functions // Information functions
float mavsdk_getAltitude(void) { float mavsdk_getAltitude(void) {
......
...@@ -377,21 +377,6 @@ static JSValue js_mavsdk_setTargetCoordinates(JSContext *ctx, ...@@ -377,21 +377,6 @@ static JSValue js_mavsdk_setTargetCoordinates(JSContext *ctx,
(float)y_arg_double)); (float)y_arg_double));
} }
static JSValue js_mavsdk_setTargetLatLong(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
double la_arg_double;
double lo_arg_double;
if (JS_ToFloat64(ctx, &la_arg_double, argv[0]))
return JS_EXCEPTION;
if (JS_ToFloat64(ctx, &lo_arg_double, argv[1]))
return JS_EXCEPTION;
return JS_NewInt32(ctx, mavsdk_setTargetLatLong(la_arg_double,
lo_arg_double));
}
static JSValue js_mavsdk_setAltitude(JSContext *ctx, JSValueConst this_val, static JSValue js_mavsdk_setAltitude(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv) int argc, JSValueConst *argv)
{ {
...@@ -489,37 +474,6 @@ static JSValue js_mavsdk_doParachute(JSContext *ctx, JSValueConst this_val, ...@@ -489,37 +474,6 @@ static JSValue js_mavsdk_doParachute(JSContext *ctx, JSValueConst this_val,
return JS_NewInt32(ctx, mavsdk_doParachute((float)param)); return JS_NewInt32(ctx, mavsdk_doParachute((float)param));
} }
static JSValue js_mavsdk_setTargetCoordinatesXYZ(JSContext *ctx,
JSValueConst this_val,
int argc, JSValueConst *argv)
{
double x_arg_double;
double y_arg_double;
double z_arg_double;
if (JS_ToFloat64(ctx, &x_arg_double, argv[0]))
return JS_EXCEPTION;
if (JS_ToFloat64(ctx, &y_arg_double, argv[1]))
return JS_EXCEPTION;
if (JS_ToFloat64(ctx, &z_arg_double, argv[2]))
return JS_EXCEPTION;
return JS_NewInt32(ctx, mavsdk_setTargetCoordinatesXYZ(x_arg_double,
y_arg_double,
(float)z_arg_double));
}
static JSValue js_mavsdk_setTargetAltitude(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
double a_arg_double;
if (JS_ToFloat64(ctx, &a_arg_double, argv[0]))
return JS_EXCEPTION;
return JS_NewInt32(ctx, mavsdk_setTargetAltitude((float)a_arg_double));
}
static JSValue js_mavsdk_takeOff(JSContext *ctx, JSValueConst this_val, static JSValue js_mavsdk_takeOff(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv) int argc, JSValueConst *argv)
{ {
...@@ -546,13 +500,10 @@ static const JSCFunctionListEntry js_mavsdk_funcs[] = { ...@@ -546,13 +500,10 @@ static const JSCFunctionListEntry js_mavsdk_funcs[] = {
JS_CFUNC_DEF("landed", 0, js_mavsdk_landed ), JS_CFUNC_DEF("landed", 0, js_mavsdk_landed ),
JS_CFUNC_DEF("arm", 0, js_mavsdk_arm ), JS_CFUNC_DEF("arm", 0, js_mavsdk_arm ),
JS_CFUNC_DEF("setTargetCoordinates", 4, js_mavsdk_setTargetCoordinates ), JS_CFUNC_DEF("setTargetCoordinates", 4, js_mavsdk_setTargetCoordinates ),
JS_CFUNC_DEF("setTargetLatLong", 2, js_mavsdk_setTargetLatLong ),
JS_CFUNC_DEF("setAltitude", 1, js_mavsdk_setAltitude ), JS_CFUNC_DEF("setAltitude", 1, js_mavsdk_setAltitude ),
JS_CFUNC_DEF("setAirspeed", 1, js_mavsdk_setAirspeed ), JS_CFUNC_DEF("setAirspeed", 1, js_mavsdk_setAirspeed ),
JS_CFUNC_DEF("loiter", 0, js_mavsdk_loiter ), JS_CFUNC_DEF("loiter", 0, js_mavsdk_loiter ),
JS_CFUNC_DEF("doParachute", 1, js_mavsdk_doParachute ), JS_CFUNC_DEF("doParachute", 1, js_mavsdk_doParachute ),
JS_CFUNC_DEF("setTargetCoordinatesXYZ", 3, js_mavsdk_setTargetCoordinatesXYZ ),
JS_CFUNC_DEF("setTargetAltitude", 1, js_mavsdk_setTargetAltitude ),
JS_CFUNC_DEF("getYaw", 0, js_mavsdk_getYaw ), JS_CFUNC_DEF("getYaw", 0, js_mavsdk_getYaw ),
JS_CFUNC_DEF("getInitialLatitude", 0, js_mavsdk_getInitialLatitude ), JS_CFUNC_DEF("getInitialLatitude", 0, js_mavsdk_getInitialLatitude ),
JS_CFUNC_DEF("getLatitude", 0, js_mavsdk_getLatitude ), JS_CFUNC_DEF("getLatitude", 0, js_mavsdk_getLatitude ),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment