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
2026-03-15 12:18:02 +01:00
parent 6b64534f40
commit b47a868db3
2 changed files with 30 additions and 27 deletions
+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);
}