-
- // we don't care about actual value, only if it's more or less than a
- // threshold essentially we capture zero crossings for later analysis
- uint8_t threshold_value = 127;
+ uint32_t maxVal=0;
+ // // we don't care about actual value, only if it's more or less than a
+ // // threshold essentially we capture zero crossings for later analysis
+
+ // we do care about the actual value as sometimes near the center of the
+ // wave we may get static that changes direction of wave for one value
+ // if our value is too low it might affect the read. and if our tag or
+ // antenna is weak a setting too high might not see anything. [marshmellow]
+ if (size<100) return size;
+ for(idx=1; idx<100; idx++){
+ if(maxVal<dest[idx]) maxVal = dest[idx];
+ }
+ // set close to the top of the wave threshold with 13% margin for error
+ // less likely to get a false transition up there.
+ // (but have to be careful not to go too high and miss some short waves)
+ uint32_t threshold_value = (uint32_t)(maxVal*.87); idx=1;
+ //uint8_t threshold_value = 127;