aboutsummaryrefslogtreecommitdiff
path: root/src/survive_vive.c
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2017-03-18 13:21:13 -0400
committercnlohr <lohr85@gmail.com>2017-03-18 13:21:13 -0400
commitf976a532970afecce640ddfba88a6f1b04ab34b8 (patch)
treef1080e4809233f350c72e9b4cd466019a4f0f8c3 /src/survive_vive.c
parentaf81a4dbe0e58e94b61b11c14b21a2decc15d823 (diff)
downloadlibsurvive-f976a532970afecce640ddfba88a6f1b04ab34b8.tar.gz
libsurvive-f976a532970afecce640ddfba88a6f1b04ab34b8.tar.bz2
Wow... Actually initilize to right size.
Diffstat (limited to 'src/survive_vive.c')
-rwxr-xr-xsrc/survive_vive.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/survive_vive.c b/src/survive_vive.c
index c8e2b55..f6465b2 100755
--- a/src/survive_vive.c
+++ b/src/survive_vive.c
@@ -771,7 +771,7 @@ static void handle_watchman( SurviveObject * w, uint8_t * readdata )
qty-=2;
int propset = 0;
int doimu = 0;
-
+ int i;
if( (type & 0xf0) == 0xf0 )
{
@@ -916,11 +916,12 @@ static void handle_watchman( SurviveObject * w, uint8_t * readdata )
LightcapElement les[10];
int lese = 0; //les's end
+
//Second, go through all LEDs and extract the lightevent from them.
{
uint8_t *marked;
marked = alloca(nrtime);
- memset( marked, 0, sizeof( nrtime ) );
+ memset( marked, 0, nrtime );
int i, parpl = 0;
timecount--;
int timepl = 0;
@@ -933,6 +934,17 @@ static void handle_watchman( SurviveObject * w, uint8_t * readdata )
led >>= 3;
while( marked[timepl] ) timepl++;
+
+#ifdef DEBUG_WATCHMAN
+ int i;
+ printf( "TP %d TC: %d : ", timepl, timecount );
+ for( i = 0; i < nrtime; i++ )
+ {
+ printf( "%d", marked[i] );
+ }
+ printf( "\n" );
+#endif
+
if( timepl > timecount ) { fault = 3; goto end; } //Ran off max of list.
uint32_t endtime = times[timepl++];