MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / encode_axes

Function encode_axes

src/ext/makerbot_driver/Encoder/Coding.py:100–119  ·  view source on GitHub ↗

Encode an array of axes names into an axis bitfield @param axes Array of axis names ['x', 'y', ...] @return bitfield containing a representation of the axes map

(axes)

Source from the content-addressed store, hash-verified

98
99
100def encode_axes(axes):
101 """
102 Encode an array of axes names into an axis bitfield
103 @param axes Array of axis names ['x', 'y', ...]
104 @return bitfield containing a representation of the axes map
105 """
106 axes_map = {
107 'x': 0x01,
108 'y': 0x02,
109 'z': 0x04,
110 'a': 0x08,
111 'b': 0x10,
112 }
113
114 bitfield = 0
115
116 for axis in axes:
117 bitfield |= axes_map[axis.lower()]
118
119 return bitfield
120
121
122def unpack_response(format, data):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected