Repetier-Firmware 0.2
Repetier02/Repetier02.pde File Reference
#include "Configuration.h"
#include "Reptier.h"

Functions

void setup ()
 Setup of the hardware.
void loop ()
void wait_until_end_of_move ()
 Waits until movement cache is empty.
void process_command (GCode *com)
 Execute the command stored in com.
void log_value (PGM_P ptr, long value)
void log_value (PGM_P ptr, float value)
void log_long_array (PGM_P ptr, long *arr)
void log_float_array (PGM_P ptr, float *arr)
void log_printLine (PrintLine *p)
void get_coordinates (GCode *com)
void queue_move ()
long bresenham_step ()
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 ()
 Stop heater and stepper motors.
 ISR (TIMER1_COMPA_vect)
 Timer interrupt routine to drive the stepper motors.
void setupTimerInterrupt ()
 Initializes the timer interrupt for the steppers.
void setTimer (unsigned long delay)
 Sets the timer 1 compare value to delay ticks.
void delayMicrosecondsInterruptible (unsigned int us)

Variables

float unit_conversion = 1
 Conversion rate from current unit into mm.
float axis_steps_per_unit [] = {XAXIS_STEPS_PER_MM,YAXIS_STEPS_PER_MM,ZAXIS_STEPS_PER_MM,0}
 Number of steps per mm needed.
float max_feedrate [] = MAX_FEEDRATE
 Maximum allowed feedrate.
float homing_feedrate [] = HOMING_FEEDRATE
bool axis_relative_modes [] = AXIS_RELATIVE_MODES
const int STEP_PIN [3] = {X_STEP_PIN, Y_STEP_PIN, Z_STEP_PIN}
float max_start_speed_units_per_second [] = MAX_START_SPEED_UNITS_PER_SECOND
 Speed we can use, without acceleration.
long max_acceleration_units_per_sq_second [] = 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 [] = MAX_TRAVEL_ACCELERATION_UNITS_PER_SQ_SECOND
 X, Y, Z max acceleration in mm/s^2 for travel moves.
unsigned long axis_max_interval []
unsigned long axis_steps_per_sqr_second []
unsigned long axis_travel_steps_per_sqr_second []
float destination [4] = {0.0, 0.0, 0.0, 0.0}
 Destination coordinates in mm from origin.
float current_position [4] = {0.0, 0.0, 0.0, 0.0}
 Destination coordinates in mm from origin.
float feedrate = 1500
 Current feedrate in mm/min.
bool relative_mode = false
 Determines absolute (false) or relative Coordinates (true).
bool relative_mode_e = false
 Determines Absolute or Relative E Codes while in Absolute Coordinates mode. E is always relative in Relative Coordinates mode.
byte debug_level = 6
 Bitfield defining debug output. 1 = echo, 2 = info, 4 = error, 8 = dry run.
bool fromsd [GCODE_BUFFER_SIZE]
unsigned long previous_millis_cmd = 0
unsigned long max_inactive_time = 0
unsigned long stepper_inactive_time = 0
PrintLine lines [MOVE_CACHE_SIZE]
 Cache for print moves.
byte lines_write_pos = 0
 Position where we write the next cached line move.
byte lines_pos = 0
 Position for executing line movement.
volatile byte lines_count = 0
 Number of lines cached 0 = nothing to do.

Function Documentation

long bresenham_step ( )

Moves the stepper motors one step. If the last step is reached, the next movement is started. The function must be called from a timer loop. It returns the time for the next call.

void delayMicrosecondsInterruptible ( unsigned int  us)
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 get_coordinates ( GCode com)

Sets the destination coordinates to values stored in com.

ISR ( TIMER1_COMPA_vect  )

Timer interrupt routine to drive the stepper motors.

void kill ( )

Stop heater and stepper motors.

void log_float_array ( PGM_P  ptr,
float *  arr 
)
void log_long_array ( PGM_P  ptr,
long *  arr 
)
void log_printLine ( PrintLine p)
void log_value ( PGM_P  ptr,
long  value 
)
void log_value ( PGM_P  ptr,
float  value 
)
void loop ( )

Main processing loop. It checks perodically for new commands, checks temperatures and executes new incoming commands.

void process_command ( GCode com)

Execute the command stored in com.

void queue_move ( )

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.

void setTimer ( unsigned long  delay)

Sets the timer 1 compare value to delay ticks.

This function sets the OCR1A compare counter and the prescaler TCCR1B to get the next interrupt at delay ticks measured from the last interrupt.

void setup ( )

Setup of the hardware.

Sets the output and input pins in accordance to your configuration. Initializes the serial interface. Interrupt routines to measure analog values and for the stepper timerloop are started.

void setupTimerInterrupt ( )

Initializes the timer interrupt for the steppers.

void wait_until_end_of_move ( )

Waits until movement cache is empty.

Some commands expect no movement, bevore they can execute. This function waits, until the steppers are stopped. In the meanwhile it buffers incoming commands and manages temperatures.


Variable Documentation

unsigned long axis_max_interval[]
Initial value:
 {F_CPU / (max_start_speed_units_per_second[0] * axis_steps_per_unit[0]),
      F_CPU / (max_start_speed_units_per_second[1] * axis_steps_per_unit[1]),
      F_CPU / (max_start_speed_units_per_second[2] * axis_steps_per_unit[2]),
      F_CPU / (max_start_speed_units_per_second[3] * axis_steps_per_unit[3])}

interval between two steps at the beginning of a ramp in Ticks

bool axis_relative_modes[] = AXIS_RELATIVE_MODES
unsigned long axis_steps_per_sqr_second[]
Initial value:

Acceleration in steps/s^3 in printing mode.

float axis_steps_per_unit[] = {XAXIS_STEPS_PER_MM,YAXIS_STEPS_PER_MM,ZAXIS_STEPS_PER_MM,0}

Number of steps per mm needed.

Initial value:

Acceleration in steps/s^2 in movement mode.

float current_position[4] = {0.0, 0.0, 0.0, 0.0}

Destination coordinates in mm from origin.

byte debug_level = 6

Bitfield defining debug output. 1 = echo, 2 = info, 4 = error, 8 = dry run.

float destination[4] = {0.0, 0.0, 0.0, 0.0}

Destination coordinates in mm from origin.

float feedrate = 1500

Current feedrate in mm/min.

bool fromsd[GCODE_BUFFER_SIZE]
float homing_feedrate[] = HOMING_FEEDRATE
PrintLine lines[MOVE_CACHE_SIZE]

Cache for print moves.

volatile byte lines_count = 0

Number of lines cached 0 = nothing to do.

byte lines_pos = 0

Position for executing line movement.

byte lines_write_pos = 0

Position where we write the next cached line move.

long max_acceleration_units_per_sq_second[] = MAX_ACCELERATION_UNITS_PER_SQ_SECOND

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

float max_feedrate[] = MAX_FEEDRATE

Maximum allowed feedrate.

unsigned long max_inactive_time = 0
float max_start_speed_units_per_second[] = MAX_START_SPEED_UNITS_PER_SECOND

Speed we can use, without acceleration.

long max_travel_acceleration_units_per_sq_second[] = MAX_TRAVEL_ACCELERATION_UNITS_PER_SQ_SECOND

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

unsigned long previous_millis_cmd = 0
bool relative_mode = false

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

bool relative_mode_e = false

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

const int STEP_PIN[3] = {X_STEP_PIN, Y_STEP_PIN, Z_STEP_PIN}
unsigned long stepper_inactive_time = 0
float unit_conversion = 1

Conversion rate from current unit into mm.

 All Data Structures Files Functions Variables Typedefs Friends Defines