def queue_point_new_ext(self, position, dda_rate, relative_axes, distance, feedrate): """ Queue a position with the new style! Moves to a certain position over a given duration with either relative or absolute positioning. Relative vs. Absolute positioning is done on an axis to axis basis. @param list position: A 5 dimentional position in steps specifying where each axis should move to @param int dda_rate: Steps per second along the master axis @param list relative_axes: Array of axes whose coordinates should be considered relative @param float distance: distance in millimeters moved in (x,y,z) space OR if distance(x,y,z) == 0, then max(distance(A),distance(B)) @param float feedrate: the actual feedrate in units of millimeters/second """ if len(position) != self.extendedPointLength: raise PointLengthError(len(position)) payload = struct.pack( '<BiiiiiIBfh', host_action_command_dict['QUEUE_POINT_NEW_EXT'], position[0], position[1], position[2], position[3], position[4], dda_rate, Encoder.encode_axes(relative_axes), float(distance), int(float(feedrate)*64.0) ) self.writer.send_action_payload(payload)
def recall_home_positions(self, axes): """ Recall and move to the home positions written to the EEPROM @param axes: Array of axis names ['x', 'y', ...] whose position should be saved """ payload = struct.pack( '<BB', host_action_command_dict['RECALL_HOME_POSITIONS'], Encoder.encode_axes(axes) ) self.writer.send_action_payload(payload)
def store_home_positions(self, axes): """ Write the current axes locations to the EEPROM as the home position @param list axes: Array of axis names ['x', 'y', ...] whose position should be saved """ payload = struct.pack( '<BB', host_action_command_dict['STORE_HOME_POSITIONS'], Encoder.encode_axes(axes) ) self.writer.send_action_payload(payload)
def find_axes_maximums(self, axes, rate, timeout): """ Move the toolhead in the positive direction, along the specified axes, until an endstop is reached or a timeout occurs. @param list axes: Array of axis names ['x', 'y', ...] to move @param double rate: Movement rate, in steps/?? @param double timeout: Amount of time to move in seconds before halting the command """ payload = struct.pack( '<BBIH', host_action_command_dict['FIND_AXES_MAXIMUMS'], Encoder.encode_axes(axes), rate, timeout ) self.writer.send_action_payload(payload)
def toggle_axes(self, axes, enable): """ Used to explicitly power steppers on or off. @param list axes: Array of axis names ['x', 'y', ...] to configure @param boolean enable: If true, enable all selected axes. Otherwise, disable the selected axes. """ axes_bitfield = Encoder.encode_axes(axes) if enable: axes_bitfield |= 0x80 payload = struct.pack( '<BB', host_action_command_dict['ENABLE_AXES'], axes_bitfield ) self.writer.send_action_payload(payload)
def queue_extended_point_new(self, position, duration, relative_axes): """ Queue a position with the new style! Moves to a certain position over a given duration with either relative or absolute positioning. Relative vs. Absolute positioning is done on an axis to axis basis. @param list position: A 5 dimentional position in steps specifying where each axis should move to @param int duration: The total duration of the move in miliseconds @param list relative_axes: Array of axes whose coordinates should be considered relative """ if len(position) != self.extendedPointLength: raise PointLengthError(len(position)) payload = struct.pack( '<BiiiiiIB', host_action_command_dict['QUEUE_EXTENDED_POINT_NEW'], position[0], position[1], position[2], position[3], position[4], duration, Encoder.encode_axes(relative_axes) ) self.writer.send_action_payload(payload)