diff options
| author | Diego Roversi <diego.roversi@gmail.com> | 2016-08-21 21:08:26 +0100 | 
|---|---|---|
| committer | Diego Roversi <diego.roversi@gmail.com> | 2016-08-21 21:08:26 +0100 | 
| commit | 8e15784c28f45b9944af57e044bf2c612c1c65e1 (patch) | |
| tree | ec5aef3626237efb1af379c25766cb118b85d81a | |
| parent | 3b512d551f7a67351b2566cbbdfaadaddb298362 (diff) | |
Correct bug: firstInt not reinitialized
| -rw-r--r-- | rotor/rotor.c | 5 | 
1 files changed, 3 insertions, 2 deletions
diff --git a/rotor/rotor.c b/rotor/rotor.c index f6121f4..d231b21 100644 --- a/rotor/rotor.c +++ b/rotor/rotor.c @@ -39,7 +39,7 @@ int main( int argc, char** argv )      gpio_fd = open( "/sys/class/gpio/gpio15_pb2/value", O_RDONLY | O_NONBLOCK ); -    timeout = 500; +    timeout = 500; //ms      clock_gettime(CLOCK_MONOTONIC, &then_ts); @@ -71,6 +71,7 @@ int main( int argc, char** argv )          		printf("%d\n\n", number % 10);          		number=0;                  } +                firstInt=true;  	}  	if (fdset[1].revents & POLLPRI) { @@ -87,7 +88,7 @@ int main( int argc, char** argv )                  float msec=diff_ts.tv_nsec/1000000.0; -                printf("value [%s] sec %d msec %f\n",buf,sec,msec); +//                printf("value [%s] sec %d msec %f number pre %d\n",buf,sec,msec, number);                  if (firstInt || msec > 90) number++;                  firstInt=false;  | 
