forked from ardyesp/ESPWebDAV
-
Notifications
You must be signed in to change notification settings - Fork 49
/
gcode.h
53 lines (43 loc) · 1.3 KB
/
gcode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef _GCODE_H_
#define _GCODE_H_
#define MAX_CMD_SIZE 96
#define BUFSIZE 4
/**
* GCode
*
* - Handle gcode
*/
class Gcode {
public:
void Handle();
private:
void _commit_command(bool say_ok);
bool _enqueuecommand(const char* cmd, bool say_ok=false);
void get_serial_commands();
void gcode_M50();
void gcode_M51();
void gcode_M52();
void gcode_M53();
void process_parsed_command();
void process_next_command();
/**
* GCode Command Queue
* A simple ring buffer of BUFSIZE command strings.
*
* Commands are copied into this buffer by the command injectors
* (immediate, serial, sd card) and they are processed sequentially by
* the main loop. The process_next_command function parses the next
* command and hands off execution to individual handler functions.
*/
unsigned char commands_in_queue = 0, // Count of commands in the queue
cmd_queue_index_r = 0, // Ring buffer read (out) position
cmd_queue_index_w = 0; // Ring buffer write (in) position
unsigned long command_sd_pos[BUFSIZE];
volatile unsigned long current_command_sd_pos;
char command_queue[BUFSIZE][MAX_CMD_SIZE];
bool send_ok[BUFSIZE];
// Number of characters read in the current line of serial input
int serial_count; // = 0;
};
extern Gcode gcode;
#endif