Skip to content

Instantly share code, notes, and snippets.

@zarya
Created January 6, 2017 17:52
Show Gist options
  • Save zarya/325d736e6ac7d51e68ed62ce568f0779 to your computer and use it in GitHub Desktop.
Save zarya/325d736e6ac7d51e68ed62ce568f0779 to your computer and use it in GitHub Desktop.
function sMeter(rssi,ber) {
var value
var value2
if (ber == -1 || ber == "-1" || ber == undefined || ber == "undefined") value2 = "";
else if (ber > -1) value2 = "<span title=\"BER 100%\" class=\"icon-star\" style=\"color: green\"> </span>";
else if (ber > 0.33) value2 = "<span title=\"BER 33% - 99%\" class=\"icon-star-empty\" style=\"color: yellow\"> </span>";
else value2 = "<span title=\"BER 0% - 33%\" class=\"icon-star-half\" style=\"color: red\"> </span>";
if (rssi == 0 || rssi == "0" || rssi == undefined) value = "";
else if (rssi > -63) value = '<img src="dist/img/indicator/4.png" \> S9+10dB';
else if (rssi > -73) value = '<img src="dist/img/indicator/4.png" \> S9';
else if (rssi > -79) value = '<img src="dist/img/indicator/3.png" \> S8';
else if (rssi > -85) value = '<img src="dist/img/indicator/3.png" \> S7';
else if (rssi > -91) value = '<img src="dist/img/indicator/2.png" \> S6';
else if (rssi > -97) value = '<img src="dist/img/indicator/2.png" \> S5';
else if (rssi > -103) value = '<img src="dist/img/indicator/1.png" \> S4';
else if (rssi > -109) value = '<img src="dist/img/indicator/1.png" \> S3';
else if (rssi > -115) value = '<img src="dist/img/indicator/0.png" \> S2';
else if (rssi > -121) value = '<img src="dist/img/indicator/0.png" \> S1';
else value = '<img src="dist/img/indicator/0.png" \> S0';
return value2 + " " + value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment