Logitech F710 joystick values don't get updated when released from extreme

I’ve used the attached arduino code for various purposes. All the buttons along with the D-pad (hat) work perfectly fine except the joysticks.
Joystick gives (0, 0) at the center. Values vary between -127 and 127.
There is no issue with the joystick values. But, when the joystick is immediately released from its extreme position, the stick reaches its center but the values aren’t (0, 0). They still point towards unknown values (between range specified). The value can be anything. They never come back to (0, 0), unless the joystick is released slowly or any other input from the gamepad is given.
Please refer the code and try to solve this issue.
Suggest edits in the code, if any.

hidjoystickrptparser.cpp (3.33 KB)

hidjoystickrptparser.h (1.12 KB)

logitech.ino (1.85 KB)