Spurious reading - bonding grounds needed this time?

I've created a fan controller which monitor the speed of several Noctua fans (only one tacho pin connected), and it works fine with one set of fans connected to D5 (yellow wires).

But when adding another fan tacho to D7 (orange), I am getting spurious reading, in the range of many tens of thousands (for a 1200rpm fan). This second fan connected to D7 (orange) is powered via a PoE splitter, which I can toggle by enabling/disabled PoE power to that port.

My question is, looking at eh Noctua datasheet, should I have bonded the ground from the second fan (orange tacho) to the main board?

I'm happy to post the code next, but it's all tabs and I'll need to reformat it. I'm using internal pullup resistors, and interrupts to measure the falling edge. It works fine with the yellow connected tacho signal.

UPDATE 08-12-2022 added code below as suggested.





Not if you zip the whole sketch folder and post it as an attachment

@UKHeliBob good point! Here is the code.
v004_Loft_server_to_share.zip (11.7 KB)
Libraries to share.zip (101.9 KB)

Also added another photo in original post showing overview of connections.

Just to note:
When originally testing this v004 code I used another 12V power adapter to power the fan, and it worked fine. But since changing that second fan to PoE powered it has messed things up.

Also I have reverted back to v003 code which worked fine previously before adding the second PoE powered fan, and that is showing spurious readings as well.