diff options
author | cnlohr <lohr85@gmail.com> | 2017-03-18 13:21:13 -0400 |
---|---|---|
committer | cnlohr <lohr85@gmail.com> | 2017-03-18 13:21:13 -0400 |
commit | f976a532970afecce640ddfba88a6f1b04ab34b8 (patch) | |
tree | f1080e4809233f350c72e9b4cd466019a4f0f8c3 | |
parent | af81a4dbe0e58e94b61b11c14b21a2decc15d823 (diff) | |
download | libsurvive-f976a532970afecce640ddfba88a6f1b04ab34b8.tar.gz libsurvive-f976a532970afecce640ddfba88a6f1b04ab34b8.tar.bz2 |
Wow... Actually initilize to right size.
-rwxr-xr-x | src/survive_vive.c | 16 |
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++]; |