MKS SERVO42B is 3d printer closed loop stepper motor NEMA17 MKS SERVO42 developed by Makerbase that prevents losing steps. CPU is STM32F103C8T6 ARM 32-bit Cortex™-M3 CPU Core,72 MHz. Magnetic encoder is Allegro's A1333LLETR-T Contactless 0° to 360° angle sensor IC ,12bit .This Project open source hardware and code,support platformio build and upload firmware...
https://github.com/dzid26/MKS-SERVO42B/blob/5238b53deeac7e8d9e6819bb8fbb31df3eea47c9/firmware/src/BSP/stepper_controller.c x = a - (currentLocation & (int64_t) ANGLE_MAX); bitwise operator with signed integer