65class Eibotboard :
public Plugin{
76 void begin(usb_serial_class *target_usb_serial);
88 void set_ratio_z(
float output_units_mm,
float input_units_steps);
105 BlockPort& output_e = target_interpolator.output_e;
106 BlockPort& output_r = target_interpolator.output_r;
107 BlockPort& output_t = target_interpolator.output_t;
118 uint8_t debug_port_identified;
119 Stream *ebb_serial_port;
120 Stream *debug_serial_port;
123 float32_t xy_conversion_mm_per_step = 25.4 / 2874.0;
124 float32_t z_conversion_mm_per_step = 1.0 / 50.0;
127 void process_character(uint8_t character);
128 void reset_input_buffer();
129 void process_command(uint16_t command_value);
130 void process_string_int32();
131 static void initialize_all_commands_struct();
133 char command_string[EBB_COMMAND_SIZE + 1];
134 uint16_t command_value;
135 void (Eibotboard::*command_function)();
138 char input_buffer[255];
139 uint8_t input_buffer_write_index;
141 uint16_t input_command_value;
142 int32_t input_parameters[EBB_MAX_NUM_INPUT_PARAMETERS];
143 uint8_t num_input_parameters;
146 uint16_t block_id = 0;
148 uint8_t block_pending_flag = 0;
149 uint8_t debug_buffer_full_flag = 0;
153 int32_t servo_position_steps = 0;
154 int32_t servo_pen_up_position_steps = 0;
155 int32_t servo_pen_down_position_steps = 0;
156 float servo_rate_up_steps_per_sec = 100;
157 float servo_rate_down_steps_per_sec = 100;
160 static struct command all_commands[];
161 void command_query_current();
162 void command_query_button();
163 void command_query_variable();
164 void command_query_pen();
165 void command_stepper_servo_configure();
166 void command_stepper_move();
167 void command_set_pen();
168 void command_version();
169 void command_generic();
172 static void set_servo_position(uint16_t pulse_duration_83_3_ns, int32_t *servo_position_register);
173 static void set_servo_rate(uint16_t pulse_rate_us_per_ms,
float *servo_rate_register);
174 void debug_report_pending_block(
bool waiting_for_slot);
186class GCodeInterface :
public Plugin{
194 void begin(Stream *target_stream);
209 void begin(usb_serial_class *target_usb_serial);
210 void begin(HardwareSerialIMXRT *target_serial, uint32_t baud, uint16_t format = 0);
233 BlockPort& output_r = target_interpolator.output_r;
234 BlockPort& output_t = target_interpolator.output_t;
242 Stream *gcode_stream;
251 uint8_t receiver_state = RECEIVER_READY;
255 char input_line_buffer[255];
256 uint8_t input_line_buffer_index;
257 void reset_input_line_buffer();
258 bool process_character(uint8_t character);
261 const char *REALTIME_LETTERS =
"\x18?~!";
262 const char *TOKEN_LETTERS =
"GMXYZEABCSTHDFPN$=";
263 static const uint8_t MAX_NUM_TOKENS = 10;
264 static const uint8_t MAX_TOKEN_SIZE = 15;
266 char token_string[MAX_TOKEN_SIZE + 1];
271 struct token tokens[MAX_NUM_TOKENS];
273 int key_token_index = -1;
275 void (GCodeInterface::*code_function)();
278 struct block inbound_block;
279 bool tokenize_block();
285 EXECUTE_INTERPOLATOR,
289 char code_string[MAX_TOKEN_SIZE + 1];
290 void (GCodeInterface::*code_function)();
294 static struct code all_codes[];
296 bool preprocess_block();
297 int8_t find_code(
char *code_string);
300 bool dispatch_block();
303 static const uint8_t BLOCK_QUEUE_SIZE = 6;
304 uint8_t block_queue_read_index = 0;
305 uint8_t block_queue_write_index = 0;
306 uint8_t block_queue_slots_remaining = BLOCK_QUEUE_SIZE;
308 bool queue_is_empty();
309 struct block* pull_block();
310 struct block block_queue[BLOCK_QUEUE_SIZE];
311 void advance_head(uint8_t* target_head);
312 void reset_block_queue();
313 uint8_t next_block_execution();
316 std::map<String, DecimalPosition> execution_tokens;
317 void execute_block(block *target_block);
318 void load_tokens(block *target_block);
324 ERROR_UNSUPPORTED_CODE,
329 void send_error(uint8_t error_type);
338 void _report_parameters();
340 void _status_report();
343 void _parser_state();
346 void execute_realtime(
char command);
349 TimeBasedInterpolator target_interpolator;
352 struct TimeBasedInterpolator::position machine_position;
353 float64_t modal_feedrate_mm_per_min = 0;