luci-olsr: fix snr calc olsr neighbours and unit in Legend
authorPatrick Grimm <patrick@lunatiki.de>
Wed, 10 Jul 2013 18:11:09 +0000 (18:11 +0000)
committerPatrick Grimm <patrick@lunatiki.de>
Wed, 10 Jul 2013 18:11:09 +0000 (18:11 +0000)
applications/luci-olsr/luasrc/controller/olsr.lua
applications/luci-olsr/luasrc/view/status-olsr/legend.htm
applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm

index daedcf54d94ad08e8ecd26a7c9abf6bf8ac07c91..cdd5645b6eeae45c0569345bed81c39b5be4c139 100644 (file)
@@ -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)*-1
-                                               noise = tonumber(assot.noise)*-1
-                                               snr = noise - signal
+                                               signal = tonumber(assot.signal)
+                                               noise = tonumber(assot.noise)
+                                               snr = (noise*-1) - (signal*-1)
                                        end
                                end
                        end
index 7575c122f36a6ced0eec42742cf5287ec6bfc8e2..e70cf2c48acf776caa34f30d6ad1736de6cda6ef 100644 (file)
@@ -9,7 +9,7 @@
                <li><strong><span style="color:#ff6600"><%:Orange%></span></strong>:<%:Still usable (4 < ETX < 10)%></li>
                <li><strong><span style="color:#bb3333"><%:Red%></span></strong>:<%:Bad (ETX > 10)%></li>
        </ul>
-       <li><strong>SNR: </strong><%:Signal Noise Ratio%></li>
+       <li><strong>SNR: </strong><%:Signal Noise Ratio in dB%></li>
        <ul>
                <li><strong><span style="color:#00cc00"><%:Green%></span></strong>:<%:Very good (SNR > 30)%></li>
                <li><strong><span style="color:#ffcb05"><%:Yellow%></span></strong>:<%:Good (30 > SNR > 20)%></li>
index f3b374536e77ecd0a3a532232214fa83bfb8ba9d..176457d71c69ba207f02428feb70ecf03f9a8a2f 100644 (file)
@@ -40,9 +40,9 @@ if luci.http.formvalue("status") == "1" then
                        lq = string.format("%.3f", link.linkQuality),
                        nlq = string.format("%.3f",link.neighborLinkQuality),
                        cost = string.format("%.3f", link.linkCost),
-                       snr = string.format("%.3f", link.snr),
-                       signal = string.format("%.3f", link.signal),
-                       noise = string.format("%.3f", link.noise),
+                       snr = link.snr,
+                       signal = link.signal,
+                       noise = link.noise,
                        color = color,
                        snr_color = snr_color,
                        dfgcolor = defaultgw_color,
@@ -161,7 +161,7 @@ end
                        <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.linkQuality)%></td>
                        <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.neighborLinkQuality)%></td>
                        <td class="cbi-section-table-titles" style="background-color:<%=color%>"><%=string.format("%.3f", link.linkCost)%></td>
-                       <td class="cbi-section-table-titles" style="background-color:<%=snr_color%>" title="Signal: <%=string.format("%.3f", link.signal)%> Noise: <%=string.format("%.3f", link.noise)%>"><%=string.format("%.3f", link.snr)%></td>
+                       <td class="cbi-section-table-titles" style="background-color:<%=snr_color%>" title="Signal: <%=link.signal%> Noise: <%=link.noise%>"><%=link.snr%></td>
                </tr>
                <% 
                        i = ((i % 2) + 1)