-
-
Save artificemm/3f9121acf50ade980d0c0b38bdb78d4e to your computer and use it in GitHub Desktop.
Revisions
-
Erik Klimczak created this gist
Dec 15, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ function calculateDistance(rssi) { var txPower = -59 //hard coded power value. Usually ranges between -59 to -65 if (rssi == 0) { return -1.0; } var ratio = rssi*1.0/txPower; if (ratio < 1.0) { return Math.pow(ratio,10); } else { var distance = (0.89976)*Math.pow(ratio,7.7095) + 0.111; return distance; } }