diff --git a/html/main.js b/html/main.js
index 2f256ee..d58f54e 100644
--- a/html/main.js
+++ b/html/main.js
@@ -92,31 +92,47 @@ function update(callback) {
var iHTML = "
";
iHTML += "| Link speed | : | " + linkS[p.link + 1] + " |
";
if (p.isSFP) {
- pAdvertised[n] = 0;
+ pAdvertised[n] = 0;
+ const hasExtendedStatus = p.sfp_options & 0x40;
iHTML += "| Vendor | : | " + p.sfp_vendor + " |
";
iHTML += "| Model | : | " + p.sfp_model + " |
";
iHTML += "| Serial | : | " + p.sfp_serial + " |
";
- if (p.sfp_options & 0x40) {
+ if (hasExtendedStatus) {
iHTML += "| Temp | : | " + (Number(p.sfp_temp) >> 8) + "." + ((Number(p.sfp_temp) & 0xff)/256.0 * 100).toFixed(0) + " ℃ |
";
iHTML += "| Vcc | : | " + (Number(p.sfp_vcc) / 10000.0).toFixed(2) + " V |
";
+ iHTML += "| TX-Fault | : | " + (Boolean(Number(p.sfp_state) & 0x4)) + " |
";
+ iHTML += "| TX-Disabled | : | " + (Boolean(Number(p.sfp_state) & 0x80)) + " |
";
iHTML += "| TX-Bias | : | " + (Number(p.sfp_txbias) / 500.0).toFixed(1) + " mA |
";
iHTML += "| TX-Power | : | " + (Number(p.sfp_txpower) / 10.0).toFixed(0) + " mW |
";
iHTML += "| RX-Power | : | " + (Number(p.sfp_rxpower) / 10.0).toFixed(0) + " mW |
";
}
+ // Not all devices & modules have LOS pin...
+ const rx_los_pin = p.sfp_los !== null ? Boolean(Number(p.sfp_los)) : null;
+ const rx_los_module = hasExtendedStatus ? Boolean(Number(p.sfp_state) & 0x2) : null;
+ if (rx_los_module !== null || rx_los_pin !== null) {
+ iHTML += `| RX-LOS | : | ${rxLosHTML(rx_los_pin, rx_los_module)} |
`;
+ }
} else {
pAdvertised[n] = parseInt(p.adv, 2);
- }
+ };
iHTML += "
";
tt.innerHTML = iHTML;
- }
- }
- if (callback)
- callback();
- }
- };
- xhttp.open("GET", "/status.json", true);
- xhttp.timeout = 5000;
- sendXHTTP(xhttp);
+ }}
+ if (callback)
+ callback();
+ }};
+ xhttp.open("GET", "/status.json", true);
+ xhttp.timeout = 5000;
+ sendXHTTP(xhttp);
+}
+
+function rxLosHTML(pinStatus, moduleStatus) {
+ if (moduleStatus !== null && pinStatus !== null && moduleStatus !== pinStatus) {
+ return `pin=${pinStatus}