Commit 27ae36e4 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

Format logging and stop manual control

See merge request !7
parents 6dd2502f ba7bc987
CFLAGS=-std=c99 -D_POSIX_C_SOURCE=200809L -pipe -Wall -Wextra -Wpedantic -Werror -Wno-overlength-strings -Wno-unused-parameter -Wc++-compat -Wformat -Wformat-security -Wformat-nonliteral -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wuninitialized -Winit-self -Wcast-qual -Wstrict-overflow -Wnested-externs -Wmultichar -Wundef -fno-strict-aliasing -fexceptions -fPIC -fstack-protector-strong -fstack-clash-protection -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-math-errno -O3 -flto -fno-fat-lto-objects -Wshadow -Wconversion -fvisibility=hidden -fPIC CFLAGS=-std=c99 -D_POSIX_C_SOURCE=200809L -pipe -Wall -Wextra -Wpedantic -Werror -Wno-overlength-strings -Wno-unused-parameter -Wc++-compat -Wformat -Wformat-security -Wformat-nonliteral -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wuninitialized -Winit-self -Wcast-qual -Wstrict-overflow -Wnested-externs -Wmultichar -Wundef -fno-strict-aliasing -fexceptions -fPIC -fstack-protector-strong -fstack-clash-protection -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-math-errno -O3 -flto -fno-fat-lto-objects -Wshadow -Wconversion -fvisibility=hidden -fPIC
CXXFLAGS=-pipe -Wall -Wextra -Wpedantic -Werror -Wno-overlength-strings -Wno-unused-parameter -Wformat -Wformat-security -Wformat-nonliteral -Wredundant-decls -Wuninitialized -Winit-self -Wcast-qual -Wstrict-overflow -Wmultichar -Wundef -fno-strict-aliasing -fexceptions -fPIC -fstack-protector-strong -fstack-clash-protection -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-math-errno -O3 -flto -fno-fat-lto-objects -Wshadow -Wconversion -fvisibility=hidden -fPIC CXXFLAGS=-pipe -Wall -Wextra -Wpedantic -Werror -Wno-overlength-strings -Wno-unused-parameter -Wformat -Wformat-security -Wformat-nonliteral -Wredundant-decls -Wuninitialized -Winit-self -Wcast-qual -Wstrict-overflow -Wmultichar -Wundef -fno-strict-aliasing -fexceptions -fPIC -fstack-protector-strong -fstack-clash-protection -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-math-errno -O3 -flto -fno-fat-lto-objects -Wshadow -Wconversion -fvisibility=hidden -fPIC
LDFLAGS+= -std=c99 -D_POSIX_C_SOURCE=200809L -pipe -Wall -Wextra -Wpedantic -Werror -Wno-static-in-inline -Wno-overlength-strings -Wno-unused-parameter -Wc++-compat -Wformat -Wformat-security -Wformat-nonliteral -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wuninitialized -Winit-self -Wcast-qual -Wstrict-overflow -Wnested-externs -Wmultichar -Wundef -fno-strict-aliasing -fexceptions -fPIC -fstack-protector-strong -fstack-clash-protection -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-math-errno -O3 -flto -fno-fat-lto-objects -Wshadow -Wconversion -fvisibility=hidden -fPIC LDFLAGS+= -std=c99 -D_POSIX_C_SOURCE=200809L -pipe -Wall -Wextra -Wpedantic -Werror -Wno-static-in-inline -Wno-overlength-strings -Wno-unused-parameter -Wc++-compat -Wformat -Wformat-security -Wformat-nonliteral -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wuninitialized -Winit-self -Wcast-qual -Wstrict-overflow -Wnested-externs -Wmultichar -Wundef -fno-strict-aliasing -fexceptions -fPIC -fstack-protector-strong -fstack-clash-protection -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-math-errno -O3 -flto -fno-fat-lto-objects -Wshadow -Wconversion -fvisibility=hidden -fPIC
LIBS=-lstdc++ -lmavsdk -lmavsdk_action -lmavsdk_manual_control -lmavsdk_mavlink_passthrough -lmavsdk_telemetry -lopen62541 LIBS=-lstdc++ -lmavsdk -lmavsdk_action -lmavsdk_mavlink_passthrough -lmavsdk_telemetry -lopen62541
LIB_NAME := libqjswrapper.so LIB_NAME := libqjswrapper.so
......
...@@ -20,13 +20,12 @@ extern "C" { ...@@ -20,13 +20,12 @@ extern "C" {
#endif #endif
#include <stdint.h> #include <stdint.h>
// Connexion management functions // Connexion management functions
int mavsdk_start(const char * url, const char * log_file, int timeout); int mavsdk_start(const char * ip, int port, const char * log_file, int timeout);
int mavsdk_stop(void); int mavsdk_stop(void);
int mavsdk_reboot(void); int mavsdk_reboot(void);
// Flight state management functions // Flight state management functions
int mavsdk_arm(void); int mavsdk_arm(void);
int mavsdk_land(void);
int mavsdk_takeOff(void); int mavsdk_takeOff(void);
int mavsdk_takeOffAndWait(void); int mavsdk_takeOffAndWait(void);
int mavsdk_triggerParachute(void); int mavsdk_triggerParachute(void);
...@@ -34,9 +33,7 @@ int mavsdk_triggerParachute(void); ...@@ -34,9 +33,7 @@ int mavsdk_triggerParachute(void);
// Flight management functions // Flight management functions
int mavsdk_loiter(float radius); int mavsdk_loiter(float radius);
int mavsdk_setAirspeed(float airspeed); int mavsdk_setAirspeed(float airspeed);
int mavsdk_setAltitude(float altitude);
int mavsdk_setTargetCoordinates(double la, double lo, float a); int mavsdk_setTargetCoordinates(double la, double lo, float a);
int mavsdk_setManualControlInput(void);
// Information functions // Information functions
float mavsdk_getAltitude(void); float mavsdk_getAltitude(void);
...@@ -53,7 +50,6 @@ float mavsdk_getYaw(void); ...@@ -53,7 +50,6 @@ float mavsdk_getYaw(void);
float mavsdk_getSpeed(void); float mavsdk_getSpeed(void);
float mavsdk_getClimbRate(void); float mavsdk_getClimbRate(void);
int mavsdk_healthAllOk(void); int mavsdk_healthAllOk(void);
bool mavsdk_isInManualMode(void);
int mavsdk_landed(void); int mavsdk_landed(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
This diff is collapsed.
...@@ -405,18 +405,21 @@ static JSValue js_stop_pubsub(JSContext *ctx, JSValueConst thisVal, ...@@ -405,18 +405,21 @@ static JSValue js_stop_pubsub(JSContext *ctx, JSValueConst thisVal,
static JSValue js_mavsdk_start(JSContext *ctx, JSValueConst thisVal, static JSValue js_mavsdk_start(JSContext *ctx, JSValueConst thisVal,
int argc, JSValueConst *argv) int argc, JSValueConst *argv)
{ {
const char *url; const char *ip;
const char *log_file; const char *log_file;
int port;
int timeout; int timeout;
int res; int res;
url = JS_ToCString(ctx, argv[0]); ip = JS_ToCString(ctx, argv[0]);
log_file = JS_ToCString(ctx, argv[1]); if (JS_ToInt32(ctx, &port, argv[1]))
if (JS_ToInt32(ctx, &timeout, argv[2])) return JS_EXCEPTION;
log_file = JS_ToCString(ctx, argv[2]);
if (JS_ToInt32(ctx, &timeout, argv[3]))
return JS_EXCEPTION; return JS_EXCEPTION;
res = mavsdk_start(url, log_file, timeout); res = mavsdk_start(ip, port, log_file, timeout);
JS_FreeCString(ctx, url); JS_FreeCString(ctx, ip);
JS_FreeCString(ctx, log_file); JS_FreeCString(ctx, log_file);
return JS_NewInt32(ctx, res); return JS_NewInt32(ctx, res);
...@@ -442,12 +445,6 @@ static JSValue js_mavsdk_arm(JSContext *ctx, JSValueConst this_val, ...@@ -442,12 +445,6 @@ static JSValue js_mavsdk_arm(JSContext *ctx, JSValueConst this_val,
return JS_NewInt32(ctx, mavsdk_arm()); return JS_NewInt32(ctx, mavsdk_arm());
} }
static JSValue js_mavsdk_land(JSContext *ctx, JSValueConst thisVal,
int argc, JSValueConst *argv)
{
return JS_NewInt32(ctx, mavsdk_land());
}
static JSValue js_mavsdk_takeOff(JSContext *ctx, JSValueConst thisVal, static JSValue js_mavsdk_takeOff(JSContext *ctx, JSValueConst thisVal,
int argc, JSValueConst *argv) int argc, JSValueConst *argv)
{ {
...@@ -489,17 +486,6 @@ static JSValue js_mavsdk_setAirspeed(JSContext *ctx, JSValueConst thisVal, ...@@ -489,17 +486,6 @@ static JSValue js_mavsdk_setAirspeed(JSContext *ctx, JSValueConst thisVal,
return JS_NewInt32(ctx, mavsdk_setAirspeed((float)altitude)); return JS_NewInt32(ctx, mavsdk_setAirspeed((float)altitude));
} }
static JSValue js_mavsdk_setAltitude(JSContext *ctx, JSValueConst thisVal,
int argc, JSValueConst *argv)
{
double altitude;
if (JS_ToFloat64(ctx, &altitude, argv[0]))
return JS_EXCEPTION;
return JS_NewInt32(ctx, mavsdk_setAltitude((float)altitude));
}
static JSValue js_mavsdk_setTargetCoordinates(JSContext *ctx, static JSValue js_mavsdk_setTargetCoordinates(JSContext *ctx,
JSValueConst thisVal, JSValueConst thisVal,
int argc, JSValueConst *argv) int argc, JSValueConst *argv)
...@@ -520,13 +506,6 @@ static JSValue js_mavsdk_setTargetCoordinates(JSContext *ctx, ...@@ -520,13 +506,6 @@ static JSValue js_mavsdk_setTargetCoordinates(JSContext *ctx,
(float)a_arg_double)); (float)a_arg_double));
} }
static JSValue js_mavsdk_setManualControlInput(JSContext *ctx,
JSValueConst thisVal,
int argc, JSValueConst *argv)
{
return JS_NewInt32(ctx, mavsdk_setManualControlInput());
}
// Information functions // Information functions
static JSValue js_mavsdk_getAltitude(JSContext *ctx, JSValueConst thisVal, static JSValue js_mavsdk_getAltitude(JSContext *ctx, JSValueConst thisVal,
...@@ -605,12 +584,6 @@ static JSValue js_mavsdk_healthAllOk(JSContext *ctx, JSValueConst this_val, ...@@ -605,12 +584,6 @@ static JSValue js_mavsdk_healthAllOk(JSContext *ctx, JSValueConst this_val,
return JS_NewBool(ctx, mavsdk_healthAllOk()); return JS_NewBool(ctx, mavsdk_healthAllOk());
} }
static JSValue js_mavsdk_isInManualMode(JSContext *ctx, JSValueConst thisVal,
int argc, JSValueConst *argv)
{
return JS_NewBool(ctx, mavsdk_isInManualMode());
}
static JSValue js_mavsdk_landed(JSContext *ctx, JSValueConst this_val, static JSValue js_mavsdk_landed(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv) int argc, JSValueConst *argv)
{ {
...@@ -621,19 +594,16 @@ static const JSCFunctionListEntry js_mavsdk_funcs[] = { ...@@ -621,19 +594,16 @@ static const JSCFunctionListEntry js_mavsdk_funcs[] = {
JS_CFUNC_DEF("setMessage", 1, js_drone_set_message ), JS_CFUNC_DEF("setMessage", 1, js_drone_set_message ),
JS_CFUNC_DEF("runPubsub", 6, js_run_pubsub ), JS_CFUNC_DEF("runPubsub", 6, js_run_pubsub ),
JS_CFUNC_DEF("stopPubsub", 0, js_stop_pubsub ), JS_CFUNC_DEF("stopPubsub", 0, js_stop_pubsub ),
JS_CFUNC_DEF("start", 3, js_mavsdk_start ), JS_CFUNC_DEF("start", 4, js_mavsdk_start ),
JS_CFUNC_DEF("stop", 0, js_mavsdk_stop ), JS_CFUNC_DEF("stop", 0, js_mavsdk_stop ),
JS_CFUNC_DEF("reboot", 0, js_mavsdk_reboot ), JS_CFUNC_DEF("reboot", 0, js_mavsdk_reboot ),
JS_CFUNC_DEF("arm", 0, js_mavsdk_arm ), JS_CFUNC_DEF("arm", 0, js_mavsdk_arm ),
JS_CFUNC_DEF("land", 0, js_mavsdk_land ),
JS_CFUNC_DEF("takeOff", 0, js_mavsdk_takeOff ), JS_CFUNC_DEF("takeOff", 0, js_mavsdk_takeOff ),
JS_CFUNC_DEF("takeOffAndWait", 0, js_mavsdk_takeOffAndWait ), JS_CFUNC_DEF("takeOffAndWait", 0, js_mavsdk_takeOffAndWait ),
JS_CFUNC_DEF("triggerParachute", 0, js_mavsdk_triggerParachute ), JS_CFUNC_DEF("triggerParachute", 0, js_mavsdk_triggerParachute ),
JS_CFUNC_DEF("loiter", 1, js_mavsdk_loiter ), JS_CFUNC_DEF("loiter", 1, js_mavsdk_loiter ),
JS_CFUNC_DEF("setAirspeed", 1, js_mavsdk_setAirspeed ), JS_CFUNC_DEF("setAirspeed", 1, js_mavsdk_setAirspeed ),
JS_CFUNC_DEF("setAltitude", 1, js_mavsdk_setAltitude ),
JS_CFUNC_DEF("setTargetCoordinates", 3, js_mavsdk_setTargetCoordinates ), JS_CFUNC_DEF("setTargetCoordinates", 3, js_mavsdk_setTargetCoordinates ),
JS_CFUNC_DEF("setManualControlInput", 0, js_mavsdk_setManualControlInput ),
JS_CFUNC_DEF("getAltitude", 0, js_mavsdk_getAltitude ), JS_CFUNC_DEF("getAltitude", 0, js_mavsdk_getAltitude ),
JS_CFUNC_DEF("getAltitudeRel", 0, js_mavsdk_getAltitudeRel ), JS_CFUNC_DEF("getAltitudeRel", 0, js_mavsdk_getAltitudeRel ),
JS_CFUNC_DEF("getInitialAltitude", 0, js_mavsdk_getInitialAltitude ), JS_CFUNC_DEF("getInitialAltitude", 0, js_mavsdk_getInitialAltitude ),
...@@ -645,7 +615,6 @@ static const JSCFunctionListEntry js_mavsdk_funcs[] = { ...@@ -645,7 +615,6 @@ static const JSCFunctionListEntry js_mavsdk_funcs[] = {
JS_CFUNC_DEF("getYaw", 0, js_mavsdk_getYaw ), JS_CFUNC_DEF("getYaw", 0, js_mavsdk_getYaw ),
JS_CFUNC_DEF("getAirspeed", 0, js_mavsdk_getSpeed ), JS_CFUNC_DEF("getAirspeed", 0, js_mavsdk_getSpeed ),
JS_CFUNC_DEF("getClimbRate", 0, js_mavsdk_getClimbRate ), JS_CFUNC_DEF("getClimbRate", 0, js_mavsdk_getClimbRate ),
JS_CFUNC_DEF("isInManualMode", 0, js_mavsdk_isInManualMode ),
JS_CFUNC_DEF("healthAllOk", 0, js_mavsdk_healthAllOk ), JS_CFUNC_DEF("healthAllOk", 0, js_mavsdk_healthAllOk ),
JS_CFUNC_DEF("landed", 0, js_mavsdk_landed ), JS_CFUNC_DEF("landed", 0, js_mavsdk_landed ),
JS_CFUNC_DEF("initPubsub", 1, js_init_pubsub ), JS_CFUNC_DEF("initPubsub", 1, js_init_pubsub ),
......
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