File syn_gcode.c¶
FileList > motor > syn_gcode.c
Go to the source code of this file
G-Code & NIST RS-274 Motion Interpreter and Controller Implementation.
#include "syn_gcode.h"#include <ctype.h>#include <math.h>#include <string.h>
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_gcode_execute_block (SYN_GCode_Controller * ctrl, const SYN_GCode_Block * block) Execute a parsed G-Code block on the controller. |
| SYN_Status | syn_gcode_execute_line (SYN_GCode_Controller * ctrl, const char * line) Parse and execute an ASCII G-Code line in one step. |
| SYN_Status | syn_gcode_init (SYN_GCode_Controller * ctrl, const SYN_GCode_Config * cfg) Initialize G-Code Controller. |
| SYN_Status | syn_gcode_parse_line (const char * line, SYN_GCode_Block * block) Parse a single ASCII G-Code line into a command block. |
| bool | syn_gcode_step (SYN_GCode_Controller * ctrl, SYN_Vector3F * out_pos) Step the active motion move generated by the G-code controller. |
| SYN_PT_Status | syn_gcode_task_pt (SYN_PT * pt, SYN_Task * task) Protothread continuation function for syn_sched . |
Public Static Functions¶
| Type | Name |
|---|---|
| const char * | parse_float_val (const char * p, float * out_val) Parse floating point number from G-code word. |
| const char * | parse_uint_val (const char * p, uint32_t * out_val) Parse unsigned integer from G-code word. |
| const char * | skip_whitespace (const char * p) Skip whitespace characters in G-code string. |
Macros¶
| Type | Name |
|---|---|
| define | SYN_GCODE_DEFAULT_ACCEL 500.0fDefault acceleration in mm/s^2. |
| define | SYN_GCODE_DEFAULT_FEEDRATE 100.0fDefault feedrate in mm/min. |
| define | SYN_GCODE_DEFAULT_JERK 2000.0fDefault jerk in mm/s^3. |
| define | SYN_GCODE_DEFAULT_STEP_RES 0.001fDefault step resolution in seconds. |
Public Functions Documentation¶
function syn_gcode_execute_block¶
Execute a parsed G-Code block on the controller.
Parameters:
ctrlController instance.blockParsed block to execute.
Returns:
SYN_OK on success.
function syn_gcode_execute_line¶
Parse and execute an ASCII G-Code line in one step.
Parameters:
ctrlController instance.lineNull-terminated ASCII string line.
Returns:
SYN_OK on success.
function syn_gcode_init¶
Initialize G-Code Controller.
Parameters:
ctrlController instance.cfgConfiguration parameters.
Returns:
SYN_OK on success, SYN_INVALID_PARAM on invalid argument.
function syn_gcode_parse_line¶
Parse a single ASCII G-Code line into a command block.
Parameters:
lineNull-terminated ASCII string line.blockOutput parsed block structure.
Returns:
SYN_OK on success, SYN_INVALID_PARAM on malformed line.
function syn_gcode_step¶
Step the active motion move generated by the G-code controller.
Parameters:
ctrlController instance.out_posOutput calculated position after step.
Returns:
true if move active and advanced, false if move complete / idle.
function syn_gcode_task_pt¶
Protothread continuation function for syn_sched .
Parameters:
ptProtothread continuation structure.taskTask handle containing SYN_GCode_Controller in user_data.
Returns:
SYN_PT_Status continuation status.
Public Static Functions Documentation¶
function parse_float_val¶
Parse floating point number from G-code word.
Parameters:
pPointer to number start.out_valPointer to receive parsed float.
Returns:
Pointer after parsed number, or NULL on parse error.
function parse_uint_val¶
Parse unsigned integer from G-code word.
Parameters:
pPointer to integer start.out_valPointer to receive parsed unsigned integer.
Returns:
Pointer after parsed integer, or NULL on parse error.
function skip_whitespace¶
Skip whitespace characters in G-code string.
Parameters:
pPointer to input string.
Returns:
Pointer to next non-whitespace character.
Macro Definition Documentation¶
define SYN_GCODE_DEFAULT_ACCEL¶
Default acceleration in mm/s^2.
define SYN_GCODE_DEFAULT_FEEDRATE¶
Default feedrate in mm/min.
define SYN_GCODE_DEFAULT_JERK¶
Default jerk in mm/s^3.
define SYN_GCODE_DEFAULT_STEP_RES¶
Default step resolution in seconds.
The documentation for this class was generated from the following file src/syntropic/motor/syn_gcode.c