Fix the Cellular strength indicator, rssi was always reporting 8 because we didn't use the variable.

The dBm values array was reversed, corrected
This commit is contained in:
smos 2013-03-19 13:47:18 +01:00
parent 7fd67662b4
commit 145cc5181c

View File

@ -2601,13 +2601,13 @@ function calculate_ipv6_delegation_length($if) {
function huawei_rssi_to_string($rssi) {
$dbm = array();
$i = 0;
$dbstart = -51;
while($i < 31) {
$dbm[$i] = $dbstart - ($i * 2);
$dbstart = -113;
while($i < 32) {
$dbm[$i] = $dbstart + ($i * 2);
$i++;
}
$percent = round(($rssi / 31) * 100);
$string = "rssi:8 level:{$dbm[$rssi]}dBm percent:{$percent}%";
$string = "rssi:{$rssi} level:{$dbm[$rssi]}dBm percent:{$percent}%";
return $string;
}