Speed module gives zero readings

I got all parts of my PICAR-4WD working EXCEPT the speed sensor. When I try reading from it (while wheels are spinning) I get zeros only. I tried swapping for another board - to no avail. I tried flipping the white and yellow wire - no difference (and in my understanding flipping these two should only swap left and right sensor, correct?). I’ll be attaching a picture in a moment.
The code I am using to read from the speed interruptor is

from speed import Speed
from filedb import FileDB
from motor import Motor
from pwm import PWM
from pin import Pin
import time

# Config File:
config = FileDB("config")
left_front_reverse = config.get('left_front_reverse', default_value = False)
right_front_reverse = config.get('right_front_reverse', default_value = False)
left_rear_reverse = config.get('left_rear_reverse', default_value = False)
right_rear_reverse = config.get('right_rear_reverse', default_value = False)    

# Init motors
left_front = Motor(PWM("P13"), Pin("D4"), is_reversed=left_front_reverse) # motor 1
right_front = Motor(PWM("P12"), Pin("D5"), is_reversed=right_front_reverse) # motor 2
left_rear = Motor(PWM("P8"), Pin("D11"), is_reversed=left_rear_reverse) # motor 3
right_rear = Motor(PWM("P9"), Pin("D15"), is_reversed=right_rear_reverse) # motor 4



left_rear_speed = Speed(25)
right_rear_speed = Speed(4)  



def set_motor_power(motor, power):
    if motor == 1:
        left_front.set_power(power)
    elif motor == 2:
        right_front.set_power(power)
    elif motor == 3:
        left_rear.set_power(power)
    elif motor == 4:
        right_rear.set_power(power)
        
def start_speed_thread():
    left_rear_speed.start()
    right_rear_speed.start()
    
def speed_val():
    return (left_rear_speed() + right_rear_speed()) / 2.0

def forward(power):
    left_front.set_power(power)
    left_rear.set_power(power)
    right_front.set_power(power)
    right_rear.set_power(power)
    
def full_stop():
    left_front.set_power(0)
    left_rear.set_power(0)
    right_front.set_power(0)
    right_rear.set_power(0) 

######################################################## 
if __name__ == '__main__':
    start_speed_thread()
    try:
        while 1:
            forward(1)
            time.sleep(0.1)
            print(speed_val())
    finally:
        full_stop()

What other ideas do you have what might be going wrong?

I solved it, partially: I replaced the cable and all of a sudden it started working, albeit only one side. I can probably get by with that, but it is still not nice. I expected to get both sides working. I tried moving the shutter wheel on the left hand side closer to the motor, but that didn’t help either.
So, I’ll probably move on with one-sided speed measurements.

Yes, flipping these two wires swaps the left and right sensors.
Only one side of the speed module works?
Please confirm that if the right side works, the left side does not work. After swapping the two wires, is the left side still not working?
After exchanging the wiring, if the left side still does not work, it may be that the speed measurement module is broken.
If after swapping the wiring, the left side works but the right side does not, there may be a problem with the cap connector.

Swapping the wires swaps sides. So, I assume the speed module is faulty. I had taken it fresh from the box and assembled carefully. Is it possible to get a spare part?

If the module is faulty, we will reissue a new module to you.
But the most important thing now is to analyze whether there is a problem with the robot hat pin or the module is broken.
After you swap the wires, what is the working status of the left and right speed sensors?
Still, only one side speed sensor works? Or does it work on both sides?

So, when I swap cables it swaps sides. In one config the left side works, in another the right side. So, actually, it might be the hat module then, correct? Because if it was the speed sensor it should stop working entirely in one configuration. So, my situation is as described above.

According to the analysis of our technical department, the 4WD hat may be broken. It is recommended to contact our customer service(service@sunfounder.com) to replace the HAT.