Created
March 15, 2017 19:19
-
-
Save DrewDahlman/faedbbdb296d93b3a3a8902d0bd17e27 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
------------------------------------------ | |
| setSignalRateLimit:bool (-) | |
| | |
| Set the return signal rate limit check value in units of MCPS (mega counts | |
| per second). "This represents the amplitude of the signal reflected from the | |
| target and detected by the device"; setting this limit presumably determines | |
| the minimum measurement necessary for the sensor to report a valid reading. | |
| | |
| Setting a lower limit increases the potential range of the sensor but also | |
| seems to increase the likelihood of getting an inaccurate reading because of | |
| unwanted reflections from objects other than the intended target. | |
| Defaults to 0.25 MCPS as initialized by the ST API and this library. | |
------------------------------------------ */ | |
setSignalRateLimit( limit_Mcps, callback ){ | |
if (limit_Mcps < 0 || limit_Mcps > 511.99) { return false; } | |
let _data = (limit_Mcps * (1 << 7)).toFixed(7); | |
// Q9.7 fixed point format (9 integer bits, 7 fractional bits) | |
this._writeRegisters( REGISTRY.FINAL_RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT, _data, (err, data) => { | |
console.log("SIGNAL SET: " + data); | |
if( callback ){ | |
callback() | |
} | |
}); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment