From 95eab1b8938e0033a0aa0d10d6ec53d7d2782907 Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Sun, 11 Mar 2018 15:31:28 -0600 Subject: Added callback for lighthouse found; example in test.c --- src/survive_process.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/survive_process.c') diff --git a/src/survive_process.c b/src/survive_process.c index d156d9e..420e771 100644 --- a/src/survive_process.c +++ b/src/survive_process.c @@ -2,6 +2,7 @@ //All MIT/x11 Licensed Code in this file may be relicensed freely under the GPL or LGPL licenses. #include "survive_cal.h" +#include "survive_config.h" //XXX TODO: Once data is avialble in the context, use the stuff here to handle converting from time codes to //proper angles, then from there perform the rest of the solution. @@ -108,6 +109,18 @@ void survive_default_raw_pose_process(SurviveObject *so, uint8_t lighthouse, Sur } +void survive_default_lighthouse_pose_process(SurviveContext *ctx, uint8_t lighthouse, SurvivePose *pose) { + if (pose) { + ctx->bsd[lighthouse].Pose = *pose; + ctx->bsd[lighthouse].PositionSet = 1; + } else { + ctx->bsd[lighthouse].PositionSet = 0; + } + + config_set_lighthouse(ctx->lh_config, &ctx->bsd[lighthouse], lighthouse); + config_save(ctx, "config.json"); +} + void survive_default_imu_process( SurviveObject * so, int mask, FLT * accelgyromag, uint32_t timecode, int id ) { if( so->PoserFn ) -- cgit v1.2.3 From 12f864db460dc6318694ec9e6d65f7740ae85749 Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Sun, 11 Mar 2018 15:54:35 -0600 Subject: Preparing to add more to PoserData --- src/survive_process.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/survive_process.c') diff --git a/src/survive_process.c b/src/survive_process.c index 420e771..e45a979 100644 --- a/src/survive_process.c +++ b/src/survive_process.c @@ -52,7 +52,10 @@ void survive_default_angle_process( SurviveObject * so, int sensor_id, int acode if( so->PoserFn ) { PoserDataLight l = { - .pt = POSERDATA_LIGHT, + .hdr = + { + .pt = POSERDATA_LIGHT, + }, .sensor_id = sensor_id, .acode = acode, .timecode = timecode, @@ -126,11 +129,14 @@ void survive_default_imu_process( SurviveObject * so, int mask, FLT * accelgyrom if( so->PoserFn ) { PoserDataIMU imu = { - .pt = POSERDATA_IMU, + .hdr = + { + .pt = POSERDATA_IMU, + }, .datamask = mask, - .accel = { accelgyromag[0], accelgyromag[1], accelgyromag[2] }, - .gyro = { accelgyromag[3], accelgyromag[4], accelgyromag[5] }, - .mag = { accelgyromag[6], accelgyromag[7], accelgyromag[8] }, + .accel = {accelgyromag[0], accelgyromag[1], accelgyromag[2]}, + .gyro = {accelgyromag[3], accelgyromag[4], accelgyromag[5]}, + .mag = {accelgyromag[6], accelgyromag[7], accelgyromag[8]}, .timecode = timecode, }; so->PoserFn( so, (PoserData *)&imu ); -- cgit v1.2.3