Repetier-Firmware 0.2
Repetier/Reptier.h File Reference
#include <WProgram.h>
#include "gcode.h"
#include "fastio.h"

Go to the source code of this file.

Data Structures

struct  Extruder
 Data to drive one extruder. More...
struct  PrinterState
struct  PrintLine

Defines

#define uint   uint16_t
#define uint8   uint8_t
#define int8   int8_t
#define uint32   uint32_t
#define int32   int32_t
#define FLAG_WARMUP   1
#define FLAG_ACCELERATING   2
#define FLAG_DECELERATING   4
#define FLAG_ACCELERATION_ENABLED   8
#define FLAG_CHECK_ENDSTOPS   16
#define FLAG_SKIP_ACCELERATING   32
#define FLAG_SKIP_DEACCELERATING   64
#define FLAG_BLOCKED   128
#define FLAG_JOIN_STEPPARAMS_COMPUTED   1
#define FLAG_JOIN_END_FIXED   2
#define FLAG_JOIN_START_FIXED   4
#define FLAG_JOIN_START_RETRACT   8
#define FLAG_JOIN_END_RETRACT   16
#define FLAG_JOIN_NO_RETRACT   32
#define FLAG_JOIN_WAIT_EXTRUDER_UP   64
#define FLAG_JOIN_WAIT_EXTRUDER_DOWN   128
#define BEGIN_INTERRUPT_PROTECTED   {byte sreg=SREG;__asm volatile( "cli" ::: "memory" );
#define END_INTERRUPT_PROTECTED   SREG=sreg;}
#define ESCAPE_INTERRUPT_PROTECTED   SREG=sreg;
#define SECONDS_TO_TICKS(s)   (unsigned long)(s*(float)F_CPU)

Functions

void initExtruder ()
 Initalizes all extruder.
void extruder_select (byte ext_num)
void extruder_set_temperature (int temp_celsius)
int extruder_get_temperature ()
void heated_bed_set_temperature (int temp_celsius)
void extruder_set_direction (byte dir)
 Activates the extruder stepper and sets the direction.
void extruder_disable ()
 Disable stepper motor of current extruder.
void extruder_step ()
 Sends the high-signal to the stepper for next extruder step.
void extruder_unstep ()
 Sets stepper signal to low for current extruder.
void extruder_enable ()
int read_raw_temperature (byte type, byte pin)
int heated_bed_get_temperature ()
int conv_raw_temp (byte type, int raw_temp)
int conv_temp_raw (byte type, int temp)
void manage_temperatures (bool critical)
void process_command (GCode *code)
 Execute the command stored in com.
void manage_inactivity (byte debug)
void update_ramps_parameter ()
void finishNextSegment ()
byte get_coordinates (GCode *com)
 Sets the destination coordinates to values stored in com.
void queue_move (byte check_endstops)
void linear_move (long steps_remaining[])
void disable_x ()
 Disable stepper motor for x direction.
void disable_y ()
 Disable stepper motor for y direction.
void disable_z ()
 Disable stepper motor for z direction.
void enable_x ()
 Enable stepper motor for x direction.
void enable_y ()
 Enable stepper motor for y direction.
void enable_z ()
 Enable stepper motor for z direction.
void kill (byte only_steppers)
 Stop heater and stepper motors. Disable power,if possible.
void setupTimerInterrupt ()
long CPUDivU2 (unsigned int divisor)
 approximates division of F_CPU/divisor

Variables

Extrudercurrent_extruder
Extruder extruder []
byte manage_monitor
 Temp. we want to monitor with our host. 1+NUM_EXTRUDER is heated bed.
float axis_steps_per_unit []
 Number of steps per mm needed.
float inv_axis_steps_per_unit []
 Inverse of axis_steps_per_unit for faster conversion.
float max_feedrate []
 Maximum allowed feedrate.
float homing_feedrate []
float max_start_speed_units_per_second []
long max_acceleration_units_per_sq_second []
 X, Y, Z and E max acceleration in mm/s^2 for printing moves or retracts.
long max_travel_acceleration_units_per_sq_second []
 X, Y, Z max acceleration in mm/s^2 for travel moves.
unsigned long axis_steps_per_sqr_second []
unsigned long axis_travel_steps_per_sqr_second []
byte relative_mode
 Determines absolute (false) or relative Coordinates (true).
byte relative_mode_e
 Determines Absolute or Relative E Codes while in Absolute Coordinates mode. E is always relative in Relative Coordinates mode.
byte unit_inches
 0 = Units are mm, 1 = units are inches.
unsigned long previous_millis_cmd
unsigned long max_inactive_time
unsigned long stepper_inactive_time
PrinterState printer_state
PrintLine lines []
 Cache for print moves.
byte lines_write_pos
 Position where we write the next cached line move.
byte lines_pos
 Position for executing line movement.
volatile byte lines_count
 Number of lines cached 0 = nothing to do.
byte printmoveSeen
long baudrate
 Communication speed rate.

Define Documentation

#define BEGIN_INTERRUPT_PROTECTED   {byte sreg=SREG;__asm volatile( "cli" ::: "memory" );
#define END_INTERRUPT_PROTECTED   SREG=sreg;}
#define ESCAPE_INTERRUPT_PROTECTED   SREG=sreg;
#define FLAG_ACCELERATING   2
#define FLAG_ACCELERATION_ENABLED   8
#define FLAG_BLOCKED   128
#define FLAG_CHECK_ENDSTOPS   16
#define FLAG_DECELERATING   4
#define FLAG_JOIN_END_FIXED   2

The right speed is fixed. Don't check this block or any block to the left.

#define FLAG_JOIN_END_RETRACT   16

Wait for filament pushback, before ending move

#define FLAG_JOIN_NO_RETRACT   32

Disable retract for this line

#define FLAG_JOIN_START_FIXED   4

The left speed is fixed. Don't check left block.

#define FLAG_JOIN_START_RETRACT   8

Start filament retraction at move start

#define FLAG_JOIN_STEPPARAMS_COMPUTED   1

Are the step parameter computed

#define FLAG_JOIN_WAIT_EXTRUDER_DOWN   128

Wait for the extruder to finish it's down movement

#define FLAG_JOIN_WAIT_EXTRUDER_UP   64

Wait for the extruder to finish it's up movement

#define FLAG_SKIP_ACCELERATING   32
#define FLAG_SKIP_DEACCELERATING   64
#define FLAG_WARMUP   1

Marks the first step of a new move

#define int32   int32_t
#define int8   int8_t
#define SECONDS_TO_TICKS (   s)    (unsigned long)(s*(float)F_CPU)
#define uint   uint16_t
#define uint32   uint32_t
#define uint8   uint8_t

Function Documentation

int conv_raw_temp ( byte  type,
int  raw_temp 
)
int conv_temp_raw ( byte  type,
int  temp 
)
long CPUDivU2 ( unsigned int  divisor)

approximates division of F_CPU/divisor

In the stepper interrupt a division is needed, which is a slow operation. The result is used for timer calculation where small errors are ok. This function uses lookup tables to find a fast approximation of the result.

void disable_x ( ) [inline]

Disable stepper motor for x direction.

void disable_y ( ) [inline]

Disable stepper motor for y direction.

void disable_z ( ) [inline]

Disable stepper motor for z direction.

void enable_x ( ) [inline]

Enable stepper motor for x direction.

void enable_y ( ) [inline]

Enable stepper motor for y direction.

void enable_z ( ) [inline]

Enable stepper motor for z direction.

void extruder_disable ( )

Disable stepper motor of current extruder.

void extruder_enable ( ) [inline]
int extruder_get_temperature ( )
void extruder_select ( byte  ext_num)
void extruder_set_direction ( byte  steps) [inline]

Activates the extruder stepper and sets the direction.

void extruder_set_temperature ( int  temp_celsius)
void extruder_step ( ) [inline]

Sends the high-signal to the stepper for next extruder step.

Call this function only, if interrupts are disabled.

void extruder_unstep ( ) [inline]

Sets stepper signal to low for current extruder.

Call this function only, if interrupts are disabled.

void finishNextSegment ( )

Checks, if the next segment has its stepping parameter computed. Normally this is the case and we have nothing to do. If not, we do it here, bofore we have to do it in the interrupt routine.

byte get_coordinates ( GCode com)

Sets the destination coordinates to values stored in com.

For the computation of the destination, the following facts are considered:

  • Are units inches or mm.
  • Reltive or absolute positioning with special case only extruder relative.
  • Offset in x and y direction for multiple extruder support.
int heated_bed_get_temperature ( )
void heated_bed_set_temperature ( int  temp_celsius)
void initExtruder ( )

Initalizes all extruder.

Updates the pin configuration needed for the extruder and activates extruder 0. Starts a interrupt based analog input reader, which is used by simple thermistors for temperature reading.

void kill ( byte  only_steppers)

Stop heater and stepper motors. Disable power,if possible.

void linear_move ( long  steps_remaining[])
void manage_inactivity ( byte  debug)
void manage_temperatures ( bool  critical)
void process_command ( GCode code)

Execute the command stored in com.

void queue_move ( byte  check_endstops)

Put a move to the current destination coordinates into the movement cache. If the cache is full, the method will wait, until a place gets free. During wait communication and temperature control is enabled.

Parameters:
check_endstopsRead endstop during move.
int read_raw_temperature ( byte  type,
byte  pin 
)
void setupTimerInterrupt ( )
void update_ramps_parameter ( )

Acceleration in steps/s^3 in printing mode.

Acceleration in steps/s^2 in movement mode.


Variable Documentation

unsigned long axis_steps_per_sqr_second[]

Acceleration in steps/s^3 in printing mode.

Number of steps per mm needed.

Acceleration in steps/s^2 in movement mode.

long baudrate

Communication speed rate.

float homing_feedrate[]

Inverse of axis_steps_per_unit for faster conversion.

Cache for print moves.

volatile byte lines_count

Number of lines cached 0 = nothing to do.

byte lines_pos

Position for executing line movement.

Position where we write the next cached line move.

Temp. we want to monitor with our host. 1+NUM_EXTRUDER is heated bed.

X, Y, Z and E max acceleration in mm/s^2 for printing moves or retracts.

float max_feedrate[]

Maximum allowed feedrate.

unsigned long max_inactive_time

X, Y, Z max acceleration in mm/s^2 for travel moves.

unsigned long previous_millis_cmd

Determines absolute (false) or relative Coordinates (true).

Determines Absolute or Relative E Codes while in Absolute Coordinates mode. E is always relative in Relative Coordinates mode.

unsigned long stepper_inactive_time

0 = Units are mm, 1 = units are inches.

 All Data Structures Files Functions Variables Typedefs Friends Defines