Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void podometro(int Axl, int Axh){
- int Ax = Axl+ 255*Axh;
- AverageSampleBuffer[ AverageSampleBufferPointer] = Ax;
- if ( AverageSampleBufferPointer==7)
- {
- AverageSampleBufferPointer = 0;
- } else
- AverageSampleBufferPointer++;
- MovingAverage = MovingAverage + Ax - AverageSampleBuffer[ AverageSampleBufferPointer]/AverageWindow;
- MaxAx = 0
- MinAx = 65536;
- Precision = 1250
- npassi = 0
- index = 0
- sampleNew = 0
- sampleOld = 0
- DynamicTresholdLevel=0
- if( index==50){
- index =0;
- }
- sampleOld = sampleNew;
- if(abs(MovingAverage- sampleNew)> Precision) sampleNew = Precision;
- else sampleNew = sampleNew;
- if (( sampleNew< DynamicTresholdLevel) && ( sampleOld> DynamicTresholdLevel)){
- npassi +=1;
- }
- if(i > MaxAx)
- MaxAx = i;
- if(i < MinAx)
- MinAx = i;
- if( index==49){
- tmp = MaxAx
- DynamicTresholdLevel = (MaxAx+MinAx)/2
- MaxAx = MinAx
- MinAx = MaxAx
- }
- index++;
- }
- int distanceCalculator(void){
- int distance=0;
- switch( NumeroPassiEseguitii){
- case 0:
- distance = 0;
- break;
- case 1:
- case 2:
- distance = 2*( height/5);
- break;
- case 3:
- distance = 2*( height/4);
- break;
- case 4:
- distance = 2*( height/3);
- break;
- case 5:
- distance = 2*( height/2);
- break;
- case 6:
- distance = 2*(6*( height)/5);
- break;
- case 7;
- distance = 2* height;
- break:
- default:
- distance = 6* height/5;
- break
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement