temp.h File Reference

Teacup configuration for the CNC Control Panel project. More...

#include "config.h"
#include <stdint.h>
#include "config.h"
#include <avr/io.h>

Go to the source code of this file.

Defines

#define DEFINE_TEMP_SENSOR(name, type, pin, additional)   TEMP_SENSOR_ ## name,
#define HOST
 This is the motherboard, as opposed to the extruder.
#define STEPS_PER_M_X   333333
#define STEPS_PER_M_Y   333333
#define STEPS_PER_M_Z   333333
#define MAXIMUM_FEEDRATE_X   2000
 used for G0 rapid moves and as a cap for all other feedrates
#define MAXIMUM_FEEDRATE_Y   2000
#define MAXIMUM_FEEDRATE_Z   2000
#define SEARCH_FEEDRATE_X   60
 used when searching endstops and as default feedrate
#define SEARCH_FEEDRATE_Y   60
#define SEARCH_FEEDRATE_Z   60
#define X_MIN   0.0
 Soft axis limits, in mm.
#define X_MAX   720.0
#define Y_MIN   0.0
#define Y_MAX   420.0
#define Z_MIN   0.0
#define Z_MAX   110.0
#define ACCELERATION_RAMPING
 acceleration and deceleration ramping.
#define ACCELERATION   50.
 how fast to accelerate when using ACCELERATION_RAMPING.
#define _READ(IO)   (IO ## _RPORT & MASK(IO ## _PIN))
 Read a pin.
#define _WRITE(IO, v)   do { if (v) { IO ## _WPORT |= MASK(IO ## _PIN); } else { IO ## _WPORT &= ~MASK(IO ## _PIN); }; } while (0)
 write to a pin
#define _TOGGLE(IO)   do { IO ## _RPORT = MASK(IO ## _PIN); } while (0)
 toggle a pin
#define _SET_INPUT(IO)   do { IO ## _DDR &= ~MASK(IO ## _PIN); } while (0)
 set pin as input
#define _SET_OUTPUT(IO)   do { IO ## _DDR |= MASK(IO ## _PIN); } while (0)
 set pin as output
#define _GET_INPUT(IO)   ((IO ## _DDR & MASK(IO ## _PIN)) == 0)
 check if pin is an input
#define _GET_OUTPUT(IO)   ((IO ## _DDR & MASK(IO ## _PIN)) != 0)
 check if pin is an output
#define READ(IO)   _READ(IO)
 Read a pin wrapper.
#define WRITE(IO, v)   _WRITE(IO, v)
 Write to a pin wrapper.
#define TOGGLE(IO)   _TOGGLE(IO)
 toggle a pin wrapper
#define SET_INPUT(IO)   _SET_INPUT(IO)
 set pin as input wrapper
#define SET_OUTPUT(IO)   _SET_OUTPUT(IO)
 set pin as output wrapper
#define GET_INPUT(IO)   _GET_INPUT(IO)
 check if pin is an input wrapper
#define GET_OUTPUT(IO)   _GET_OUTPUT(IO)
 check if pin is an output wrapper
#define X_STEP_PIN   AIO0
#define X_DIR_PIN   AIO1
#define X_MIN_PIN   AIO2
#define X_INVERT_DIR   1
#define X_INVERT_MIN   1
#define Y_STEP_PIN   AIO3
#define Y_DIR_PIN   AIO4
#define Y_MIN_PIN   AIO5
#define Y_INVERT_MIN   1
#define Z_STEP_PIN   DIO2
#define Z_DIR_PIN   DIO4
#define Z_MIN_PIN   DIO7
#define Z_INVERT_MIN   1
#define CHARGEPUMP_PIN   DIO3
#define ESTOP_IN_PIN   DIO8
#define ESTOP_INVERT_IN   1
#define BAUD   115200
 Baud rate for the connection to the host.
#define XONXOFF
 Xon/Xoff flow control.
#define MOVEBUFFER_SIZE   8
 move buffer size, in number of moves note that each move takes a fair chunk of ram (69 bytes as of this writing) so don't make the buffer too big - a bigger serial readbuffer may help more than increasing this unless your gcodes are more than 70 characters long on average.
#define USE_WATCHDOG
 Teacup implements a watchdog, which has to be reset every 250ms or it will reboot the controller.
#define STEP_INTERRUPT_INTERRUPTIBLE   0
 this option makes the step interrupt interruptible (nested).
#define ENDSTOP_STEPS   4
 number of steps to run into the endstops intentionally As Endstops trigger false alarm sometimes, Teacup debounces them by counting a number of consecutive positives.
#define temp_tick   temp_sensor_tick

Enumerations

enum  temp_sensor_t
enum  temp_type_t {
  TT_THERMISTOR, TT_MAX6675, TT_AD595, TT_PT100,
  TT_INTERCOM, TT_DUMMY
}

Functions

void temp_init (void)
 set up temp sensors. Currently only the 'intercom' sensor needs initialisation.
void temp_sensor_tick (void)
 called every 10ms from clock.c - check all temp sensors that are ready for checking
uint8_t temp_achieved (void)
 report whether all temp sensors are reading their target temperatures used for M109 and friends
void temp_set (temp_sensor_t index, uint16_t temperature)
 specify a target temperature
uint16_t temp_get (temp_sensor_t index)
 return most recent reading for a sensor
void temp_print (temp_sensor_t index)
 send temperatures to host

Detailed Description

Teacup configuration for the CNC Control Panel project.

pin definitions and I/O macros

Note:
this is configured for an Arduino Uno talking to a Heiz Zero3 controller connected to a Heiz High-Z S-720 CNC mill.

why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html


Define Documentation

#define ACCELERATION   50.

how fast to accelerate when using ACCELERATION_RAMPING.

given in mm/s^2, decimal allowed, useful range 1. to 10'000. Start with 10. for milling (high precision) or 1000. for printing

#define ACCELERATION_RAMPING

acceleration and deceleration ramping.

Each movement starts at (almost) no speed, linearly accelerates to target speed and decelerates just in time to smoothly stop at the target. alternative to ACCELERATION_REPRAP

#define BAUD   115200

Baud rate for the connection to the host.

Usually 115200, other common values are 19200, 38400 or 57600.

#define ENDSTOP_STEPS   4

number of steps to run into the endstops intentionally As Endstops trigger false alarm sometimes, Teacup debounces them by counting a number of consecutive positives.

Valid range is 1...255. Use 4 or less for reliable endstops, 8 or even more for flaky ones.

TODO: investigate removing this altogether. The S-720 has reed switch endstops that are also buffered on the Zero3, I don't expect it to send any false positives.

#define HOST

This is the motherboard, as opposed to the extruder.

See extruder/ directory for GEN3 extruder firmware

#define MOVEBUFFER_SIZE   8

move buffer size, in number of moves note that each move takes a fair chunk of ram (69 bytes as of this writing) so don't make the buffer too big - a bigger serial readbuffer may help more than increasing this unless your gcodes are more than 70 characters long on average.

however, a larger movebuffer will probably help with lots of short consecutive moves, as each move takes a bunch of math (hence time) to set up so a longer buffer allows more of the math to be done during preceding longer moves

#define STEP_INTERRUPT_INTERRUPTIBLE   0

this option makes the step interrupt interruptible (nested).

this should help immensely with dropped serial characters, but may also make debugging infuriating due to the complexities arising from nested interrupts

Note:
disable this option if you're using a '168 or for some reason your ram usage is above 90%. This option hugely increases likelihood of stack smashing.
#define USE_WATCHDOG

Teacup implements a watchdog, which has to be reset every 250ms or it will reboot the controller.

As rebooting (and letting the GCode sending application trying to continue the build with a then different Home point) is probably even worse than just hanging, and there is no better restore code in place, this is disabled for now.

TODO: add reboot type check, if caused by watchdog send XOFF to the host and lock-up -- otherwise the above scenario applies and we don't want that on a metal-handling machine like this one.

#define X_MIN   0.0

Soft axis limits, in mm.

Define them to your machine's size relative to what your host considers to be the origin.

#define XONXOFF

Xon/Xoff flow control.

Redundant when using RepRap Host for sending GCode, but mandatory when sending GCode files with a plain terminal emulator, like GtkTerm (Linux), CoolTerm (Mac) or HyperTerminal (Windows).


Function Documentation

uint16_t temp_get ( temp_sensor_t  index  ) 

return most recent reading for a sensor

Parameters:
index sensor to read
void temp_print ( temp_sensor_t  index  ) 

send temperatures to host

Parameters:
index sensor value to send
void temp_set ( temp_sensor_t  index,
uint16_t  temperature 
)

specify a target temperature

Parameters:
index sensor to set a target for
temperature target temperature to aim for
 All Data Structures Files Functions Variables Defines
Generated on Mon Jul 30 16:33:59 2012 for Teacup by  doxygen 1.6.3