aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/poser_charlesslow.c8
-rw-r--r--src/poser_daveortho.c2
-rwxr-xr-xsrc/survive.c8
-rwxr-xr-xsrc/survive_cal.c6
-rw-r--r--src/survive_config.c16
-rw-r--r--src/survive_config.h4
-rw-r--r--src/survive_data.c3
-rw-r--r--src/survive_driverman.c2
-rwxr-xr-xsrc/survive_vive.c9
9 files changed, 36 insertions, 22 deletions
diff --git a/src/poser_charlesslow.c b/src/poser_charlesslow.c
index def8323..080ad6a 100644
--- a/src/poser_charlesslow.c
+++ b/src/poser_charlesslow.c
@@ -123,9 +123,9 @@ int PoserCharlesSlow( SurviveObject * so, PoserData * pd )
ft = RunOpti(so, fs, lh, 0, LighthousePos, LighthouseQuat);
if( cycle == 0 )
{
- float sk = ft*10.;
+ FLT sk = ft*10.;
if( sk > 1 ) sk = 1;
- uint8_t cell = (1.0 - sk) * 255;
+ uint8_t cell = (uint8_t)((1.0 - sk) * 255);
FLT epsilon = 0.1;
if( dz == 0 ) { /* Why is dz special? ? */
@@ -231,7 +231,7 @@ static FLT RunOpti( SurviveObject * hmd, PoserDataFullScene * fs, int lh, int pr
if( fs->lengths[p][lh][0] < 0 || fs->lengths[p][lh][1] < 0 ) continue;
FLT me_to_dot[3];
sub3d( me_to_dot, LighthousePos, &hmd_points[p*3] );
- float dot = dot3d( &hmd_normals[p*3], me_to_dot );
+ FLT dot = dot3d( &hmd_normals[p*3], me_to_dot );
if( dot < -.01 ) { return 1000; }
}
int iters = 6;
@@ -321,7 +321,7 @@ static FLT RunOpti( SurviveObject * hmd, PoserDataFullScene * fs, int lh, int pr
}
//Step 2: Determine error.
- float errorsq = 0.0;
+ FLT errorsq = 0.0;
int count = 0;
for( p = 0; p < dpts; p++ )
{
diff --git a/src/poser_daveortho.c b/src/poser_daveortho.c
index 9f3b55a..e81e154 100644
--- a/src/poser_daveortho.c
+++ b/src/poser_daveortho.c
@@ -120,7 +120,7 @@ int PoserDaveOrtho( SurviveObject * so, PoserData * pd )
break;
}
}
-
+ return 0;
}
diff --git a/src/survive.c b/src/survive.c
index 81c45c3..f637bd8 100755
--- a/src/survive.c
+++ b/src/survive.c
@@ -9,6 +9,10 @@
#include "survive_config.h"
+#ifdef __APPLE__
+#define z_const const
+#endif
+
#ifdef RUNTIME_SYMNUM
#include <symbol_enumerator.h>
static int did_runtime_symnum;
@@ -161,6 +165,7 @@ int survive_add_object( SurviveContext * ctx, SurviveObject * obj )
ctx->objs = realloc( ctx->objs, sizeof( SurviveObject * ) * (oldct+1) );
ctx->objs[oldct] = obj;
ctx->objs_ct = oldct+1;
+ return 0;
}
void survive_add_driver( SurviveContext * ctx, void * payload, DeviceDriverCb poll, DeviceDriverCb close, DeviceDriverMagicCb magic )
@@ -184,7 +189,8 @@ int survive_send_magic( SurviveContext * ctx, int magic_code, void * data, int d
for( i = 0; i < oldct; i++ )
{
ctx->drivermagics[i]( ctx, ctx->drivers[i], magic_code, data, datalen );
- }
+ }
+ return 0;
}
void survive_close( SurviveContext * ctx )
diff --git a/src/survive_cal.c b/src/survive_cal.c
index 985ab24..0eb9446 100755
--- a/src/survive_cal.c
+++ b/src/survive_cal.c
@@ -18,6 +18,10 @@
#include "survive_config.h"
+#ifdef WINDOWS
+int mkdir(const char *);
+#endif
+
#define PTS_BEFORE_COMMON 32
#define NEEDED_COMMON_POINTS 10
#define MIN_SENSORS_VISIBLE_PER_LH_FOR_CAL 4
@@ -455,7 +459,7 @@ static void handle_calibration( struct SurviveCalData *cd )
stddevang += Sdiff2;
stddevlen += Ldiff2;
- int llm = Sdiff / HISTOGRAMBINANG + (HISTOGRAMSIZE/2.0);
+ int llm = (int)( Sdiff / HISTOGRAMBINANG + (HISTOGRAMSIZE/2.0) );
if( llm < 0 ) llm = 0;
if( llm >= HISTOGRAMSIZE ) llm = HISTOGRAMSIZE-1;
diff --git a/src/survive_config.c b/src/survive_config.c
index 07b9326..0810280 100644
--- a/src/survive_config.c
+++ b/src/survive_config.c
@@ -3,7 +3,7 @@
#include <assert.h>
#include "survive_config.h"
#include <json_helpers.h>
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__APPLE__)
#include <stdlib.h>
#else
#include <malloc.h> //for alloca
@@ -33,7 +33,7 @@ void destroy_config_entry(config_entry* ce) {
if (ce->data!=NULL) { free(ce->data); ce->data=NULL; }
}
-void init_config_group(config_group *cg, uint16_t count) {
+void init_config_group(config_group *cg, uint8_t count) {
uint16_t i = 0;
cg->used_entries = 0;
cg->max_entries = count;
@@ -99,7 +99,7 @@ void config_set_lighthouse(config_group* lh_config, BaseStationData* bsd, uint8_
}
void sstrcpy(char** dest, const char *src) {
- uint32_t len = strlen(src)+1;
+ uint32_t len = (uint32_t)strlen(src)+1;
assert(dest!=NULL);
char* ptr = (char*)realloc(*dest, len); //acts like malloc if dest==NULL
@@ -143,7 +143,7 @@ FLT config_read_float(config_group *cg, const char *tag, const FLT def) {
return config_set_float(cg, tag, def);
}
-uint16_t config_read_float_array(config_group *cg, const char *tag, const FLT** values, const FLT* def, uint16_t count) {
+uint16_t config_read_float_array(config_group *cg, const char *tag, const FLT** values, const FLT* def, uint8_t count) {
config_entry *cv = find_config_entry(cg, tag);
if (cv != NULL) {
@@ -237,7 +237,7 @@ void write_config_group(FILE* f, config_group *cg, char *tag) {
for (i=0;i < cg->used_entries;++i) {
if (cg->config_entries[i].type == CONFIG_FLOAT) {
- json_write_float(f, cg->config_entries[i].tag, cg->config_entries[i].numeric.f);
+ json_write_float(f, cg->config_entries[i].tag, (float)cg->config_entries[i].numeric.f);
} else if (cg->config_entries[i].type == CONFIG_UINT32) {
json_write_uint32(f, cg->config_entries[i].tag, cg->config_entries[i].numeric.i);
} else if (cg->config_entries[i].type == CONFIG_STRING) {
@@ -295,7 +295,7 @@ void pop_config_group() {
}
-int parse_floats(char* tag, char** values, uint16_t count) {
+int parse_floats(char* tag, char** values, uint8_t count) {
uint16_t i = 0;
FLT *f;
f = alloca(sizeof(FLT) * count);
@@ -348,12 +348,12 @@ int parse_uint32(char* tag, char** values, uint16_t count) {
// if (count>1)
// config_set_uint32_array(cg, tag, f, count);
// else
- config_set_uint32(cg, tag, l[0]);
+ config_set_uint32(cg, tag, (uint32_t)l[0]);
return 1;
}
-void handle_tag_value(char* tag, char** values, uint16_t count) {
+void handle_tag_value(char* tag, char** values, uint8_t count) {
print_json_value(tag,values,count);
config_group* cg = cg_stack[cg_stack_head];
diff --git a/src/survive_config.h b/src/survive_config.h
index c8c7762..83db624 100644
--- a/src/survive_config.h
+++ b/src/survive_config.h
@@ -35,7 +35,7 @@ typedef struct config_group {
//extern config_group global_config_values;
//extern config_group lh_config[2]; //lighthouse configs
-void init_config_group(config_group *cg, uint16_t count);
+void init_config_group(config_group *cg, uint8_t count);
void destroy_config_group(config_group* cg);
//void config_init();
@@ -52,7 +52,7 @@ const uint32_t config_set_uint32(config_group *cg, const char *tag, const uint32
const char* config_set_str(config_group *cg, const char *tag, const char* value);
FLT config_read_float(config_group *cg, const char *tag, const FLT def);
-uint16_t config_read_float_array(config_group *cg, const char *tag, const FLT** values, const FLT* def, uint16_t count);
+uint16_t config_read_float_array(config_group *cg, const char *tag, const FLT** values, const FLT* def, uint8_t count);
uint32_t config_read_uint32(config_group *cg, const char *tag, const uint32_t def);
const char* config_read_str(config_group *cg, const char *tag, const char *def);
diff --git a/src/survive_data.c b/src/survive_data.c
index 60849e2..b9099ac 100644
--- a/src/survive_data.c
+++ b/src/survive_data.c
@@ -39,12 +39,13 @@ void handle_lightcap( SurviveObject * so, LightcapElement * le )
// return; //if we don't know what lighthouse this is we don't care to do much else
}
+ printf("m sync %d %d %d %d\n", le->sensor_id, so->last_sync_time[ssn], le->timestamp, delta);
if( le->length > so->pulselength_min_sync ) //Pulse longer indicates a sync pulse.
{
int is_new_pulse = delta > so->pulselength_min_sync /*1500*/ + last_sync_length;
- printf("m sync %d %d %d %d\n", le->sensor_id, so->last_sync_time[ssn], le->timestamp, delta);
+ //printf("m sync %d %d %d %d\n", le->sensor_id, so->last_sync_time[ssn], le->timestamp, delta);
so->did_handle_ootx = 0;
diff --git a/src/survive_driverman.c b/src/survive_driverman.c
index d694e64..2afaf65 100644
--- a/src/survive_driverman.c
+++ b/src/survive_driverman.c
@@ -31,7 +31,7 @@ void * GetDriver( const char * element )
const char * GetDriverNameMatching( const char * prefix, int place )
{
int i;
- int prefixlen = strlen( prefix );
+ int prefixlen = (int)strlen( prefix );
for( i = 0; i < NrDrivers; i++ )
{
diff --git a/src/survive_vive.c b/src/survive_vive.c
index d4a853d..a9b295f 100755
--- a/src/survive_vive.c
+++ b/src/survive_vive.c
@@ -18,7 +18,7 @@
#include <string.h>
#include <sys/stat.h>
#include <os_generic.h>
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__APPLE__)
#include <malloc.h> // for alloca
#endif
@@ -625,6 +625,7 @@ int survive_vive_usb_poll( struct SurviveContext * ctx, void * v )
}
return r;
#endif
+ return 0;
}
@@ -1113,9 +1114,12 @@ void survive_data_cb( SurviveUSBInterface * si )
}
case USB_IF_W_WATCHMAN1_LIGHTCAP:
{
- int i;
+ int i=0;
for( i = 0; i < 7; i++ )
{
+ unsigned short *sensorId = (unsigned short *)readdata;
+ unsigned short *length = (unsigned short *)(&(readdata[2]));
+ unsigned long *time = (unsigned long *)(&(readdata[4]));
LightcapElement le;
le.sensor_id = POP2;
le.length = POP2;
@@ -1282,7 +1286,6 @@ int survive_vive_close( SurviveContext * ctx, void * driver )
SurviveViveData * sv = driver;
survive_vive_usb_close( sv );
-
return 0;
}