RSSI to distance moving average
Just "RSSI" is usually a logarithmic signal.  As such, it is not appropriate for averaging.  I think the most appropriate space for averaging is linear fields strength, proportional to volts/meter.  That would be some constant to the power of RSSI.

So for each RSSI reading, do KRSSI, low pass filter those, then invert the low pass filtered value to get a rough idea of distance.  Keep in mind that a lot of things effect signal strength than just distance.  These include orientation of both the transmitting and receiving antennas, multi-path destructive or constructive interference, and absorption and blocking of things in the environment.  You will get only a rough idea of distance at best.  If you get within a factor of 2, then consider yourself lucky.