diff --git a/applications/luci-olsr/luasrc/controller/olsr.lua b/applications/luci-olsr/luasrc/controller/olsr.lua
index bef7e52eb1..daedcf54d9 100644
--- a/applications/luci-olsr/luasrc/controller/olsr.lua
+++ b/applications/luci-olsr/luasrc/controller/olsr.lua
@@ -227,9 +227,9 @@ function action_neigh(json)
for assocmac, assot in pairs(val.list) do
assocmac = string.lower(assocmac or "")
if rmac == assocmac then
- signal = tonumber(assot.signal)
- noise = tonumber(assot.noise)
- snr = signal/noise
+ signal = tonumber(assot.signal)*-1
+ noise = tonumber(assot.noise)*-1
+ snr = noise - signal
end
end
end
diff --git a/applications/luci-olsr/luasrc/tools/olsr.lua b/applications/luci-olsr/luasrc/tools/olsr.lua
index 425d09a31e..dfd8262f0d 100644
--- a/applications/luci-olsr/luasrc/tools/olsr.lua
+++ b/applications/luci-olsr/luasrc/tools/olsr.lua
@@ -26,3 +26,17 @@ function etx_color(etx)
return color
end
+function snr_color(snr)
+ local color = "#bb3333"
+ if snr == 0 then
+ color = "#bb3333"
+ elseif snr > 30 then
+ color = "#00cc00"
+ elseif snr > 20 then
+ color = "#ffcb05"
+ elseif snr > 5 then
+ color = "#ff6600"
+ end
+ return color
+end
+
diff --git a/applications/luci-olsr/luasrc/view/status-olsr/legend.htm b/applications/luci-olsr/luasrc/view/status-olsr/legend.htm
index 55b839f52f..7575c122f3 100644
--- a/applications/luci-olsr/luasrc/view/status-olsr/legend.htm
+++ b/applications/luci-olsr/luasrc/view/status-olsr/legend.htm
@@ -3,9 +3,18 @@
LQ: <%:Success rate of packages received from the neighbour%>
NLQ: <%:Success rate of packages sent to the neighbour%>
ETX: <%:Expected retransmission count%>
- <%:Green%>:<%:Very good (ETX < 2)%>
- <%:Yellow%>:<%:Good (2 < ETX < 4)%>
- <%:Orange%>:<%:Still usable (4 < ETX < 10)%>
- <%:Red%>:<%:Bad (ETX > 10)%>
+
+ - <%:Green%>:<%:Very good (ETX < 2)%>
+ - <%:Yellow%>:<%:Good (2 < ETX < 4)%>
+ - <%:Orange%>:<%:Still usable (4 < ETX < 10)%>
+ - <%:Red%>:<%:Bad (ETX > 10)%>
+
+ SNR: <%:Signal Noise Ratio%>
+
+ - <%:Green%>:<%:Very good (SNR > 30)%>
+ - <%:Yellow%>:<%:Good (30 > SNR > 20)%>
+ - <%:Orange%>:<%:Still usable (20 > SNR > 5)%>
+ - <%:Red%>:<%:Bad (SNR < 5)%>
+
diff --git a/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm b/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm
index 0fb9bc0a3c..f3b374536e 100644
--- a/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm
+++ b/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm
@@ -24,6 +24,7 @@ if luci.http.formvalue("status") == "1" then
link.linkCost = 0
end
local color = olsrtools.etx_color(link.linkCost)
+ local snr_color = olsrtools.snr_color(link.snr)
defaultgw_color = ""
if link.defaultgw == 1 then
defaultgw_color = "#ffff99"
@@ -43,6 +44,7 @@ if luci.http.formvalue("status") == "1" then
signal = string.format("%.3f", link.signal),
noise = string.format("%.3f", link.noise),
color = color,
+ snr_color = snr_color,
dfgcolor = defaultgw_color,
proto = link.proto
}
@@ -100,7 +102,7 @@ end
'%s | ' +
'%s | ' +
'',
- neigh.dfgcolor, neigh.ifn, neigh.lip, neigh.lmac, neigh.dfgcolor, neigh.lq, neigh.dfgcolor, neigh.nlq, neigh.color, neigh.cost, neigh.color, neigh.signal, neigh.noise, neigh.snr || '?'
+ neigh.dfgcolor, neigh.ifn, neigh.lip, neigh.lmac, neigh.dfgcolor, neigh.lq, neigh.dfgcolor, neigh.nlq, neigh.color, neigh.cost, neigh.snr_color, neigh.signal, neigh.noise, neigh.snr || '?'
);
}
@@ -140,6 +142,7 @@ end
end
color = olsrtools.etx_color(link.linkCost)
+ snr_color = olsrtools.snr_color(link.snr)
defaultgw_color = ""
if link.defaultgw == 1 then
@@ -158,7 +161,7 @@ end
<%=string.format("%.3f", link.linkQuality)%> |
<%=string.format("%.3f", link.neighborLinkQuality)%> |
<%=string.format("%.3f", link.linkCost)%> |
- Noise: <%=string.format("%.3f", link.noise)%>"><%=string.format("%.3f", link.snr)%> |
+ Noise: <%=string.format("%.3f", link.noise)%>"><%=string.format("%.3f", link.snr)%> |
<%
i = ((i % 2) + 1)