Skip to content

Commit

Permalink
stabilise graph by using mdev to show signal changes
Browse files Browse the repository at this point in the history
Signed-off-by: koniu <gkusnierz@gmail.com>
  • Loading branch information
koniu committed Dec 27, 2010
1 parent beb4c62 commit 0505583
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions wassup.lua
Expand Up @@ -414,15 +414,7 @@ function update_ap(bssid)
end
-- update stats
if result then
if record then
if record.s == "g" then ap.s = "r"
elseif record.sig > result.sig then ap.s = "-"
elseif record.sig < result.sig then ap.s = "+"
elseif record.sig == result.sig then ap.s = "="
end
else
record = {}
end
record = record or {}
ap.last_seen_i = state.iter
ap.last_seen_t = now
ap.seen = (record.seen or 0) + 1
Expand All @@ -431,6 +423,14 @@ function update_ap(bssid)
ap.max = math.max((record.max or -100), result.sig)
ap.min = math.min((record.min or 0), result.sig)
ap.last_seen = "now"
ap.dev_sum = (record.dev_sum or 0) + math.abs(ap.avg - result.sig)
ap.mdev = ap.dev_sum / ap.seen
if record.bssid then
if record.s == "g" then ap.s = "r"
elseif result.sig > ap.avg + math.ceil(ap.mdev) then ap.s = "+"
elseif result.sig < ap.avg - math.ceil(ap.mdev) then ap.s = "-"
else ap.s = "=" end
end
end
if record then
local total = state.iter - (ap.first_seen or record.first_seen) + 1
Expand Down

0 comments on commit 0505583

Please sign in to comment.