Web: Handle missing LOS pin

When device has no LOS pin and module has no extended status, the
RX LOS value will not be shown. When both are present, the equality
check is performed. When only one is present, the present value
will be shown.

json from the switch, will still contain the field, but can be
null for when pin is not available.
This commit is contained in:
diijkstra committed 2026-03-15 12:18:02 +01:00
1 parent 6b64534f40
commit b47a868db3
2 files changed
+30 -27

No files matched your search

+5 -1
View File
@@ -656,7 +656,11 @@ void send_status(void)
for (register uint8_t s = 0; s < 16; s++)
outbuf[slen++] = sfp_module_serial[machine.is_sfp[i]-1][s];
slen += strtox(outbuf + slen,"\",\"sfp_los\":");
bool_to_html(sfp_pins_last & (0x2 << (((machine.is_sfp[i]-1) << 2))));
if (machine.sfp_port[machine.is_sfp[i]-1].pin_los == GPIO_NA) {
slen += strtox(outbuf + slen,"null");
} else {
bool_to_html(sfp_pins_last & (0x2 << (((machine.is_sfp[i]-1) << 2))));
}
} else {
bool_to_html(0);
}