Handle out of range link quality multipliers (#1298)

This commit is contained in:
Tim Wilkinson 2024-08-17 13:49:07 -07:00 committed by GitHub
parent f8c01e88ec
commit a6a00cc432
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -214,8 +214,8 @@ if (tracker) {
</div>
{%
if (l && l.lossMultiplier) {
const lq = int(100 * l.linkQuality * 65536 / l.lossMultiplier);
const nlq = int(100 * l.neighborLinkQuality * 65536 / l.lossMultiplier);
const lq = min(100, int(100 * l.linkQuality * 65536 / l.lossMultiplier));
const nlq = min(100, int(100 * l.neighborLinkQuality * 65536 / l.lossMultiplier));
const etx = 10000.0 / (lq * nlq);
%}
<div class="cols">

View File

@ -108,8 +108,8 @@
const status = calcColor(tracker);
print("<div class='cols " + status + "'>");
const link = links[tracker.ip] || {};
const lq = link.lossMultiplier ? (int(100 * link.linkQuality * 65536 / link.lossMultiplier) + "%"): "-";
const nlq = link.lossMultiplier ? (int(100 * link.neighborLinkQuality * 65536 / link.lossMultiplier) + "%") : "-";
const lq = link.lossMultiplier ? (min(100, int(100 * link.linkQuality * 65536 / link.lossMultiplier) + "%")) : "-";
const nlq = link.lossMultiplier ? (min(100, int(100 * link.neighborLinkQuality * 65536 / link.lossMultiplier)) + "%") : "-";
if (tracker.hostname) {
print(`<div style='flex:0.75'><a onclick="event.stopPropagation()" title='Link status: ${status}' href='http://${tracker.hostname}.local.mesh'>${tracker.hostname}</a></div>`);
}