Thank you for the information about M-codes.
Yes, the machine is equipped with a variable-speed drive that is configured with the controller. Currently, only one gear motor is connected to the outputs on the Centroid PLC. It seems there are no gear shifter sensors; instead, limit switches are used to send signals to the controller. Please refer to the picture for clarification.
The engineers from Mars have connected only one gear motor to the controller and activated M41 and M42 for gear changes. However, the spindle RPM exceeds 320 RPM on M41 and 2400 RPM on M42, while the machine's original maximum RPM is 4000. This setup does not consistently function correctly, as the gear motor sometimes misses its position. Additionally, these configured RPMs do not produce any torque; I can easily stop the spindle with my hand grip when it is set to 2400 RPM. On the other hand, 350 RPM does produce some torque, but it is not sufficient for machining operations due to RPM limitations.
M5, M6 and M7 are not CNC M codes for gear shifting. They are the names of the shifter motors, on the diagram that you posted.
M codes to shift gears might be M41-M44, or might be others, depending on how many gears are needed.
Does your machine have a variable-speed drive for the spindle motor? Or is gear shifting your only means of spindle speed control?
Do you know whether the gear-shift motors are wired to outputs on your Centroid PLC?
Do you know whether the shifter position sensors are wired to inputs on your Centroid PLC?
Do you know what Centroid control board you have? Acorn? AcornSix? Oak? Hickory? MPU11+GPIO4D?
Can you make a Report from your control, and post it here?