UMRT Arm Firmware Library
MKS_COMMANDS.hpp
Go to the documentation of this file.
1 //
2 // Created by Noah on 2025-04-23.
3 //
9 #ifndef UMRT_ARM_FIRMWARE_LIB_MKS_COMMANDS_HPP
10 #define UMRT_ARM_FIRMWARE_LIB_MKS_COMMANDS_HPP
11 
12 #include <cstdint>
13 
36 enum MksCommands : uint8_t {
49  ENCODER_SPLIT = 0x30,
50 
60 
68  MOTOR_SPEED = 0x32,
69 
75  CURRENT_POS = 0x33,
76 
87  IO_STATUS = 0x34,
88 
94  ENCODER_RAW = 0x35,
95 
103 
109 
121 
127 
134 
148  CALIBRATION = 0x80,
149 
166 
176 
195 
205 
218  SET_EN_MODE = 0x84,
219 
233  SET_DIR_MODE = 0x86,
234 
244 
256 
271 
286 
296  CAN_ID = 0x8B,
297 
319 
326 
341  SET_GROUP_ID = 0x8D,
342 
360  WRITE_IO = 0x36,
361 
382 
395  GO_HOME = 0x91,
396 
402  SET_ZERO = 0x92,
403 
420 
434 
455 
463 
469 
507 
533  READ_PARAM = 0x00,
534 
549  QUERY_STATUS = 0xF1,
550 
557  ENABLE_MOTOR = 0xF3,
558 
566 
598  SET_SPEED = 0xF6,
599 
608 
648  SEND_STEP = 0xFD,
649 
679 
711  SEND_ANGLE = 0xF4,
712 
747 };
748 
749 #endif //UMRT_ARM_FIRMWARE_LIB_MKS_COMMANDS_HPP
MksCommands
CAN commands for the MKS SERVO57D/42D/35D/28D stepper motor driver modules.
Definition: MKS_COMMANDS.hpp:36
@ CALIBRATION
Calibration status.
Definition: MKS_COMMANDS.hpp:148
@ SET_POWER_ON_SPEED
Set the driver to engage at the current speed upon startup.
Definition: MKS_COMMANDS.hpp:607
@ SET_MISC_SETTINGS
Modifies motor protection settings and allows delayed homing when using the pulse interface.
Definition: MKS_COMMANDS.hpp:506
@ SET_ZERO
Set the zero position.
Definition: MKS_COMMANDS.hpp:402
@ TARGET_ANGLE_ERROR
Difference between the target angle (mod 1 turn) and the current angle.
Definition: MKS_COMMANDS.hpp:102
@ FACTORY_RESET
Restores the default settings.
Definition: MKS_COMMANDS.hpp:462
@ POWER_ON_HOMING_MODE
Set how the motor homes upon startup.
Definition: MKS_COMMANDS.hpp:454
@ SET_MICROSTEP
Sets the microstepping division.
Definition: MKS_COMMANDS.hpp:204
@ SET_GROUP_ID
Sets the group ID of this driver.
Definition: MKS_COMMANDS.hpp:341
@ ENCODER_RAW
Encoder value, in the "raw" (?) format.
Definition: MKS_COMMANDS.hpp:94
@ IO_STATUS
Status of the IO ports.
Definition: MKS_COMMANDS.hpp:87
@ MOTOR_SPEED
Motor speed, as determined by the encoder.
Definition: MKS_COMMANDS.hpp:68
@ HOME_SETTINGS
Sets parameters for the return-to-home sequence.
Definition: MKS_COMMANDS.hpp:381
@ SET_BLIND_LIMIT
Blindly finds the axis limit by turning until the motor hits an obstacle.
Definition: MKS_COMMANDS.hpp:419
@ DISABLE_BUTTONS
Disables the buttons on the driver.
Definition: MKS_COMMANDS.hpp:325
@ ENABLE_ROTOR_LOCK
Lock/unlock the rotor.
Definition: MKS_COMMANDS.hpp:255
@ ENABLE_DISPLAY_SLEEP
Enables automatic shutoff of the driver screen after ~15 seconds.
Definition: MKS_COMMANDS.hpp:243
@ READ_PARAM
Reads the current setting for a parameter.
Definition: MKS_COMMANDS.hpp:533
@ WRITE_IO
Write values to the IO ports.
Definition: MKS_COMMANDS.hpp:360
@ CURRENT_POS
The current position of the motor, in steps As an alternative to the encoder value,...
Definition: MKS_COMMANDS.hpp:75
@ EMERGENCY_STOP
Immediately stop the motor.
Definition: MKS_COMMANDS.hpp:565
@ GO_HOME_STATUS
Whether the motor successfully went back to the zero point once powered on.
Definition: MKS_COMMANDS.hpp:120
@ SEND_ANGLE
Run the motor CW or CCW by a specific angle.
Definition: MKS_COMMANDS.hpp:711
@ CAN_BAUD_RATE
Sets the CAN bus baud rate.
Definition: MKS_COMMANDS.hpp:285
@ SET_WORK_MODE
Sets the work mode of the motor driver.
Definition: MKS_COMMANDS.hpp:165
@ SEND_STEP
Run the motor a specific number of steps.
Definition: MKS_COMMANDS.hpp:648
@ ENABLE_MICROSTEP_INTERPOLATION
Enable microstep "interpolation", which internally uses 256-microstepping for smoother movement.
Definition: MKS_COMMANDS.hpp:270
@ ENABLE_STATUS
Status of the En pin.
Definition: MKS_COMMANDS.hpp:108
@ QUERY_STATUS
Get current motor status Retrieves a status code describing the current state of the motor:
Definition: MKS_COMMANDS.hpp:549
@ SET_EN_MODE
Sets the En pin mode.
Definition: MKS_COMMANDS.hpp:218
@ SET_HOLDING_CURRENT
Sets the percentage of the working current to use for as the maximum holding current.
Definition: MKS_COMMANDS.hpp:194
@ SHAFT_LOCK_STATUS
Whether the motor is currently in the locked-rotor protection state.
Definition: MKS_COMMANDS.hpp:133
@ CAN_ID
Sets the CAN bus ID for this driver.
Definition: MKS_COMMANDS.hpp:296
@ SEEK_POS_BY_ANGLE
Run the motor to a specific angular position.
Definition: MKS_COMMANDS.hpp:746
@ RELEASE_SHAFT_LOCK
Commands the driver to release a motor from the locked-rotor protection state.
Definition: MKS_COMMANDS.hpp:126
@ ENCODER_SPLIT
Encoder value, split into number of turns and angle.
Definition: MKS_COMMANDS.hpp:49
@ ENCODER_ADDITIVE
Encoder value, with the number of turns and angle combined into a single integer.
Definition: MKS_COMMANDS.hpp:59
@ REBOOT_DRIVER
Reboots the motor driver.
Definition: MKS_COMMANDS.hpp:468
@ SET_SPEED
Run the motor at a target speed.
Definition: MKS_COMMANDS.hpp:598
@ ENABLE_MOTOR
Enable the motor Not entirely sure when this is needed.
Definition: MKS_COMMANDS.hpp:557
@ RESPONSE_MODE
Change response mode.
Definition: MKS_COMMANDS.hpp:318
@ SET_LIMIT_PORT_REMAP
Remap ports for an additional limit or to facilitate wiring.
Definition: MKS_COMMANDS.hpp:433
@ GO_HOME
Start the homing sequence.
Definition: MKS_COMMANDS.hpp:395
@ SET_WORKING_CURRENT
Sets the maximum current the driver is allowed to push through the motor (working current).
Definition: MKS_COMMANDS.hpp:175
@ SET_DIR_MODE
Sets the Dir pin mode.
Definition: MKS_COMMANDS.hpp:233
@ SEEK_POS_BY_STEPS
Run the motor to a specific position in steps.
Definition: MKS_COMMANDS.hpp:678