Commit 20d651e2 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

Add isLanding function

Checking for landing is used for a security purpose. If landing procedure is
triggered but not by the swarm management script, it means it has been triggered
externally most probably for emergency reason.
parent 11624e4c
...@@ -51,8 +51,9 @@ DLL_PUBLIC double getTakeOffAltitude(void); ...@@ -51,8 +51,9 @@ DLL_PUBLIC double getTakeOffAltitude(void);
DLL_PUBLIC float getYaw(void); DLL_PUBLIC float getYaw(void);
DLL_PUBLIC float getSpeed(void); DLL_PUBLIC float getSpeed(void);
DLL_PUBLIC float getClimbRate(void); DLL_PUBLIC float getClimbRate(void);
DLL_PUBLIC int healthAllOk(void);
DLL_PUBLIC int gpsIsOk(void); DLL_PUBLIC int gpsIsOk(void);
DLL_PUBLIC int healthAllOk(void);
DLL_PUBLIC int isLanding(void);
DLL_PUBLIC void updateLogAndProjection(void); DLL_PUBLIC void updateLogAndProjection(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -742,16 +742,22 @@ static JSValue js_getClimbRate(JSContext *ctx, JSValueConst thisVal, ...@@ -742,16 +742,22 @@ static JSValue js_getClimbRate(JSContext *ctx, JSValueConst thisVal,
return JS_NewFloat64(ctx, getClimbRate()); return JS_NewFloat64(ctx, getClimbRate());
} }
static JSValue js_gpsIsOk(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
return JS_NewBool(ctx, gpsIsOk());
}
static JSValue js_healthAllOk(JSContext *ctx, JSValueConst this_val, static JSValue js_healthAllOk(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv) int argc, JSValueConst *argv)
{ {
return JS_NewBool(ctx, healthAllOk()); return JS_NewBool(ctx, healthAllOk());
} }
static JSValue js_gpsIsOk(JSContext *ctx, JSValueConst this_val, static JSValue js_isLanding(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv) int argc, JSValueConst *argv)
{ {
return JS_NewBool(ctx, gpsIsOk()); return JS_NewBool(ctx, isLanding());
} }
static JSValue js_updateLogAndProjection(JSContext *ctx, JSValueConst this_val, static JSValue js_updateLogAndProjection(JSContext *ctx, JSValueConst this_val,
...@@ -784,8 +790,9 @@ static const JSCFunctionListEntry js_funcs[] = { ...@@ -784,8 +790,9 @@ static const JSCFunctionListEntry js_funcs[] = {
JS_CFUNC_DEF("getYaw", 0, js_getYaw ), JS_CFUNC_DEF("getYaw", 0, js_getYaw ),
JS_CFUNC_DEF("getAirspeed", 0, js_getSpeed ), JS_CFUNC_DEF("getAirspeed", 0, js_getSpeed ),
JS_CFUNC_DEF("getClimbRate", 0, js_getClimbRate ), JS_CFUNC_DEF("getClimbRate", 0, js_getClimbRate ),
JS_CFUNC_DEF("healthAllOk", 0, js_healthAllOk ),
JS_CFUNC_DEF("gpsIsOk", 0, js_gpsIsOk ), JS_CFUNC_DEF("gpsIsOk", 0, js_gpsIsOk ),
JS_CFUNC_DEF("isLanding", 0, js_isLanding ),
JS_CFUNC_DEF("healthAllOk", 0, js_healthAllOk ),
JS_CFUNC_DEF("initPubsub", 2, js_init_pubsub ), JS_CFUNC_DEF("initPubsub", 2, js_init_pubsub ),
JS_CFUNC_DEF("getLog", 0, js_get_log ), JS_CFUNC_DEF("getLog", 0, js_get_log ),
JS_CFUNC_DEF("updateLogAndProjection", 0, js_updateLogAndProjection ), JS_CFUNC_DEF("updateLogAndProjection", 0, js_updateLogAndProjection ),
......
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