Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
use connectivity value in percent
Browse files Browse the repository at this point in the history
  • Loading branch information
mwarning committed Feb 7, 2019
1 parent 2589cc6 commit 97f6154
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion files/usr/sbin/print_map.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ print_basic() {
echo -n "\"model\" : \"$(cat /tmp/sysinfo/model)\", "
echo -n "\"links\" : ["

printLink() { echo -n "{ \"smac\" : \"$(cat /sys/class/net/$3/address)\", \"dmac\" : \"$1\", \"qual\" : $2 }"; }
# Calculate bandwidth as percent value
calcQual() { echo "$1" "40" | awk '{ printf("%.1f", ($1 > $2) ? 100 : (100 * $1 / $2)) }'; }
printLink() { echo -n "{ \"smac\" : \"$(cat /sys/class/net/$3/address)\", \"dmac\" : \"$1\", \"qual\" : $(calcQual $2) }"; }
IFS="
"
nd=0
Expand Down
2 changes: 1 addition & 1 deletion files/www/freifunk/cgi-bin/status
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Array.prototype.forEach.call(neighbors, function(el) {
}

if (qual >= 0) {
var e = document.createTextNode(" (" + (100. * qual / 255.).toFixed(0) + "%)");
var e = document.createTextNode(" (" + qual.toFixed(0) + "%)");
el.parentNode.appendChild(e);
}
};
Expand Down

0 comments on commit 97f6154

Please sign in to comment.