aboutsummaryrefslogtreecommitdiff
path: root/src/survive.c
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2018-03-10 23:57:58 -0500
committercnlohr <lohr85@gmail.com>2018-03-10 23:57:58 -0500
commita2ba45f43ae02b1e39b1816fe9c1c70c54a7f046 (patch)
treeb0a916dad0fb979e997d069a0f6c3184279e479a /src/survive.c
parent5ae3acb6d63301ac14beaebe692f5af680e65c26 (diff)
downloadlibsurvive-a2ba45f43ae02b1e39b1816fe9c1c70c54a7f046.tar.gz
libsurvive-a2ba45f43ae02b1e39b1816fe9c1c70c54a7f046.tar.bz2
Switch from pos,quat to pose. Also change initialization order.
Diffstat (limited to 'src/survive.c')
-rwxr-xr-xsrc/survive.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/src/survive.c b/src/survive.c
index 76bf8e4..21e1f0e 100755
--- a/src/survive.c
+++ b/src/survive.c
@@ -138,7 +138,6 @@ SurviveContext * survive_init_internal( int headless )
init_config_group(&ctx->lh_config[1],10);
config_read(ctx, "config.json");
-
ctx->activeLighthouses = config_read_uint32(ctx->global_config_values, "LighthouseCount", 2);
config_read_lighthouse(ctx->lh_config, &(ctx->bsd[0]), 0);
config_read_lighthouse(ctx->lh_config, &(ctx->bsd[1]), 1);
@@ -150,16 +149,19 @@ SurviveContext * survive_init_internal( int headless )
ctx->imuproc = survive_default_imu_process;
ctx->angleproc = survive_default_angle_process;
- const char * DriverName;
- while( ( DriverName = GetDriverNameMatching( "DriverReg", i++ ) ) )
- {
- DeviceDriver dd = GetDriver( DriverName );
- printf( "Loading driver %s (%p) (%d)\n", DriverName, dd, i );
- r = dd( ctx );
- printf( "Driver %s reports status %d\n", DriverName, r );
- }
+
+ // initialize the button queue
+ memset(&(ctx->buttonQueue), 0, sizeof(ctx->buttonQueue));
+ ctx->buttonQueue.buttonservicesem = OGCreateSema();
+
+ // start the thread to process button data
+ ctx->buttonservicethread = OGCreateThread(button_servicer, ctx);
+ survive_install_button_fn(ctx, NULL);
+ survive_install_raw_pose_fn(ctx, NULL);
i = 0;
+ const char * DriverName;
+
//const char * PreferredPoser = config_read_str(ctx->global_config_values, "DefaultPoser", "PoserDummy");
const char * PreferredPoser = config_read_str(ctx->global_config_values, "DefaultPoser", "PoserTurveyTori");
PoserCB PreferredPoserCB = 0;
@@ -179,6 +181,17 @@ SurviveContext * survive_init_internal( int headless )
SV_ERROR( "Error. Cannot find any valid poser." );
}
+ i = 0;
+ while( ( DriverName = GetDriverNameMatching( "DriverReg", i++ ) ) )
+ {
+ DeviceDriver dd = GetDriver( DriverName );
+ printf( "Loading driver %s (%p) (%d)\n", DriverName, dd, i );
+ r = dd( ctx );
+ printf( "Driver %s reports status %d\n", DriverName, r );
+ }
+printf( "REGISTERING DRIVERS\n" );
+
+ //Apply poser to objects.
for( i = 0; i < ctx->objs_ct; i++ )
{
ctx->objs[i]->PoserFn = PreferredPoserCB;
@@ -187,15 +200,6 @@ SurviveContext * survive_init_internal( int headless )
// saving the config extra to make sure that the user has a config file they can change.
config_save(ctx, "config.json");
- // initialize the button queue
- memset(&(ctx->buttonQueue), 0, sizeof(ctx->buttonQueue));
-
- ctx->buttonQueue.buttonservicesem = OGCreateSema();
-
- // start the thread to process button data
- ctx->buttonservicethread = OGCreateThread(button_servicer, ctx);
- survive_install_button_fn(ctx, NULL);
- survive_install_raw_pose_fn(ctx, NULL);
return ctx;
}