- // skip until samples begin to change
- if (startFound || sample < firstSample - T55xx_READ_TOL){
- if (!startFound)
- dest[i++] = firstSample;
- startFound = TRUE;
- dest[i++] = sample;
-
- // exit condition.
- if (i >= bufsize) break;
+ // skip until first high samples begin to change
+ if (startFound || curSample > T55xx_READ_LOWER_THRESHOLD+T55xx_READ_TOL){
+ // if just found start - recover last sample
+ if (!startFound) {
+ dest[i++] = lastSample;
+ startFound = true;
+ }
+ // collect samples
+ dest[i++] = curSample;
+ if (i >= bufsize-1) break;