yarf 0.1
Yet Another RepRap Firmware
Data Structures | Enumerations | Functions
src/input/commands.h File Reference

Implementation of g-code commands. More...

#include <stdio.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  cmd_response_t
 Data structure representing a response to a command. More...

Enumerations

enum  cmd_status { OK, INVALID, FAULT }
 Enumeration representing the status of response to a command. More...

Functions

void cmd_init (void)
 Initializes the command component.
void cmd_controlled_move (cmd_response_t *r, float x, float y, float z, float e, float f)
 G1: Controlled move (buffered)
void cmd_set_units_inches (cmd_response_t *r)
 G20: Set Units to Inches.
void cmd_set_units_millimeters (cmd_response_t *r)
 G21: Set Units to Millimeters.
void cmd_move_to_origin (cmd_response_t *r, bool x, bool y, bool z)
 G28: Move to Origin (buffered)
void cmd_set_absolute_positioning (cmd_response_t *r)
 G90: Set to absolute positioning (unbuffered)
void cmd_set_relative_positioning (cmd_response_t *r)
 G91: Set to relative positioning (unbuffered)
void cmd_set_position (cmd_response_t *r, float x, float y, float z, float e)
 G92: Set Position.
void cmd_stop_idle_hold (cmd_response_t *r)
 M84: Stop idle hold (unbuffered)
void cmd_set_extruder_temp_async (cmd_response_t *r, float c)
 M104: Set nozzle temperature (non-blocking)
void cmd_read_nozzle_and_printbed_temp (cmd_response_t *r)
 M105: Read extruder and printbed temperature.
void cmd_set_extruder_temp_sync (cmd_response_t *r, float c)
 M109: Set nozzle temperature (blocking)
void cmd_set_extruder_pwm (cmd_response_t *r, float s)
 M113: Set extruder PWM.
void cmd_get_position (cmd_response_t *r)
 M114: Get current position.
void cmd_wait (cmd_response_t *r)
 M116: Wait.
void cmd_set_printbed_temp_async (cmd_response_t *r, float c)
 M140: Set print bed temperature (non-blocking)
void cmd_select_tool (cmd_response_t *r, int tool)
 T: Select tool.

Detailed Description

Implementation of g-code commands.

Author:
Pieter Agten (pieter.agten@gmail.com)
Date:
21 sep 2011

Definition in file commands.h.


Enumeration Type Documentation

enum cmd_status

Enumeration representing the status of response to a command.

Enumerator:
OK 

The command was executed successfully.

INVALID 

The request was invalid.

FAULT 

A hardware fault took place while trying to execute the command.

Definition at line 38 of file commands.h.


Function Documentation

void cmd_controlled_move ( cmd_response_t r,
float  x,
float  y,
float  z,
float  e,
float  f 
)

G1: Controlled move (buffered)

Parameters:
rpointer to a cmd_response_t structure to write the response in
xdetermines the x coordinate of the destination position
ydetermines the y coordinate of the destination position
zdetermines the z coordinate of the destination position
edetermines the e coordinate of the destination position
fthe maximum speed of the movement in mm/min

Go in a straight line from the current position to the specified position, with a maximum feed rate of f. The x, y, z and e values are interpreted as absolute or relative coordinates, depending on whether G90 or G91 was executed.

Definition at line 153 of file commands.c.

void cmd_get_position ( cmd_response_t r)

M114: Get current position.

Parameters:
rpointer to a cmd_response_t structure to write the response in

Sends the current virtual x, y, z and e coordinates to the host.

Definition at line 301 of file commands.c.

void cmd_move_to_origin ( cmd_response_t r,
bool  x,
bool  y,
bool  z 
)

G28: Move to Origin (buffered)

Parameters:
rpointer to a cmd_response_t structure to write the response in
xwhether to move the x axis to its origin
ywhether to move the y axis to its origin
zwhether to move the z axis to its origin

This causes the machine to move one or more of its axes to its origin.

Definition at line 194 of file commands.c.

void cmd_read_nozzle_and_printbed_temp ( cmd_response_t r)

M105: Read extruder and printbed temperature.

Parameters:
rpointer to a cmd_response_t structure to write the response in

Reads the current temperature of the nozzle and the print bed in degrees celsius and sends them to the host.

Definition at line 271 of file commands.c.

void cmd_select_tool ( cmd_response_t r,
int  tool 
)

T: Select tool.

Parameters:
rpointer to a cmd_response_t structure to write the response in
tool0-based index of the tool to select

Selects the extruder to build with. Yarf only supports a single extruder, so this command will send an 'invalid' response when called with any tool index other than 0.

Definition at line 369 of file commands.c.

void cmd_set_absolute_positioning ( cmd_response_t r)

G90: Set to absolute positioning (unbuffered)

Parameters:
rpointer to a cmd_response_t structure to write the response in

Definition at line 209 of file commands.c.

void cmd_set_extruder_pwm ( cmd_response_t r,
float  s 
)

M113: Set extruder PWM.

Parameters:
rpointer to a cmd_response_t structure to write the response in
spwm value to which to set the extruder motor

This command is not supported because yarf only supports stepper motors, which do not require a PWM to be set. An 'invalid' response will be sent back to the host if the s value is anything but NAN.

Definition at line 288 of file commands.c.

void cmd_set_extruder_temp_async ( cmd_response_t r,
float  c 
)

M104: Set nozzle temperature (non-blocking)

Parameters:
rpointer to a cmd_response_t structure to write the response in
ctemperature in degrees celcius to which to set the nozzle
See also:
cmd_set_extruder_temp_sync
cmd_wait

Sets the temperature of the nozzle to the specified number of degrees and returns control to the host immediately (i.e. before that temperature has been reached by the extruder).

Definition at line 259 of file commands.c.

void cmd_set_extruder_temp_sync ( cmd_response_t r,
float  c 
)

M109: Set nozzle temperature (blocking)

Parameters:
rpointer to a cmd_response_t structure to write the response in
ctemperature in degrees celcius to which to set the nozzle
See also:
cmd_set_extruder_temp_async
cmd_wait

Sets the temperature of the nozzle to the specified number of degrees and waits for it to reach that temperature before sending a response back to the host.

Definition at line 278 of file commands.c.

void cmd_set_position ( cmd_response_t r,
float  x,
float  y,
float  z,
float  e 
)

G92: Set Position.

Parameters:
rpointer to a cmd_response_t structure to write the response in
xdetermines the x coordinate of the position
ydetermines the y coordinate of the position
zdetermines the z coordinate of the position
edetermines the e coordinate of the position

Sets the current virtual position to the specified position. The x, y, z and e values are interpreted as absolute or relative coordinates, depending on whether G90 or G91 was executed.

Definition at line 225 of file commands.c.

void cmd_set_printbed_temp_async ( cmd_response_t r,
float  c 
)

M140: Set print bed temperature (non-blocking)

Parameters:
rpointer to a cmd_response_t structure to write the response in
ctemperature in degrees celcius to which to set the print bed
See also:
cmd_wait

Sets the temperature of the print bed to the specified number of degrees and returns control to the host immediately (i.e. before that temperature has been reached by the extruder).

Definition at line 357 of file commands.c.

void cmd_set_relative_positioning ( cmd_response_t r)

G91: Set to relative positioning (unbuffered)

Parameters:
rpointer to a cmd_response_t structure to write the response in

Definition at line 217 of file commands.c.

void cmd_set_units_inches ( cmd_response_t r)

G20: Set Units to Inches.

Parameters:
rpointer to a cmd_response_t structure to write the response in

This command is not supported and will send an 'invalid' response when executed.

Definition at line 179 of file commands.c.

void cmd_set_units_millimeters ( cmd_response_t r)

G21: Set Units to Millimeters.

Parameters:
rpointer to a cmd_response_t structure to write the response in

Units from now on are in millimeters.

Definition at line 186 of file commands.c.

void cmd_stop_idle_hold ( cmd_response_t r)

M84: Stop idle hold (unbuffered)

Parameters:
rpointer to a cmd_response_t structure to write the response in

Stops the idle hold on all axes (including the extruder) by disabling their stepper motors.

Definition at line 245 of file commands.c.

void cmd_wait ( cmd_response_t r)

M116: Wait.

Parameters:
rpointer to a cmd_response_t structure to write the response in

Waits for the nozzle and print bed temperatures to reach their set values.

Definition at line 339 of file commands.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines