From e94482c00c8d9759c07a30c22f534a9224556ab7 Mon Sep 17 00:00:00 2001 From: Michael Moon Date: Sat, 20 Nov 2010 13:11:53 +1100 Subject: [PATCH] move defines from Makefile to config.h.dist --- Makefile | 6 +++-- analog.c | 5 ++--- config.h.dist | 54 +++++++++++++++++++++++++++++++-------------- extruder/intercom.c | 3 +-- temp.c | 22 +++++++++--------- 5 files changed, 55 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index afede04..802f17b 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ MCU_TARGET = atmega644p # MCU_TARGET = atmega1280 -F_CPU = 16000000L +# F_CPU = 16000000L ############################################################################## # # @@ -59,7 +59,7 @@ F_CPU = 16000000L # # ############################################################################## -DEFS = -DF_CPU=$(F_CPU) -DHOST -DGEN3 +# DEFS = -DF_CPU=$(F_CPU) -DHOST -DGEN3 # DEFS += "-DDEBUG=1" ############################################################################## @@ -133,6 +133,8 @@ size: $(PROGRAM).elf config.h: config.h.dist @echo "Please review config.h, as config.h.dist is more recent." + @echo + @diff -bBEuF '^. [[:digit:]]. [[:upper:]]' config.h config.h.dist @false %.o: %.c config.h Makefile diff --git a/analog.c b/analog.c index 346551b..2cf3e00 100644 --- a/analog.c +++ b/analog.c @@ -3,9 +3,8 @@ #include #ifndef ANALOG_MASK - #warning define ANALOG_MASK as a bitmask of all the analog channels you wish to use - #warning defining ANALOG_MASK as zero will prevent the analog subsystem from starting - #error ANALOG_MASK not defined + #warning ANALOG_MASK not defined - analog subsystem disabled + #define ANALOG_MASK 0 #endif uint8_t adc_running_mask, adc_counter; diff --git a/config.h.dist b/config.h.dist index ac28570..fc5c322 100644 --- a/config.h.dist +++ b/config.h.dist @@ -26,6 +26,13 @@ If you want to port this to a new chip, start off with arduino.h and see how you go. */ +/* + CPU clock rate +*/ +#ifndef F_CPU + #define F_CPU 16000000L +#endif + /* Are you using the official GEN3 motherboard with separate extruder controller? */ @@ -76,30 +83,40 @@ #define E_STARTSTOP_STEPS 20 + /***************************************************************************\ * * * 2. ACCELERATION * * * +* IMPORTANT: choose only one! These algorithms choose when to step, trying * +* to use more than one will have undefined and probably * +* disastrous results! * +* * \***************************************************************************/ /* acceleration, reprap style. Each movement starts at the speed of the previous command and accelerates or decelerates linearly to reach target speed at the end of the movement. - Can also be set in Makefile */ // #define ACCELERATION_REPRAP + /* 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 - Can also be set in Makefile */ // #define ACCELERATION_RAMPING +// how fast to accelerate when using ACCELERATION_RAMPING +// smaller values give quicker acceleration +// valid range = 1 to 8,000,000; 500,000 is a good starting point +#define ACCELERATION_STEEPNESS 500000 + + /* temporal step algorithm - This algorithm causes the timer to fire when any axis needs to step, instead of synchronising to the axis with the most steps. + This algorithm causes the timer to fire when any axis needs to step, instead of synchronising to the axis with the most steps ala bresenham. This algorithm is not a type of acceleration, and I haven't worked out how to integrate acceleration with it. However it does control step timing, so acceleration algorithms seemed appropriate @@ -111,16 +128,6 @@ */ // #define ACCELERATION_TEMPORAL -// how fast to accelerate when using ACCELERATION_RAMPING -// smaller values give quicker acceleration -// valid range = 1 to 8,000,000; 500,000 is a good starting point -#define ACCELERATION_STEEPNESS 500000 - -#ifdef ACCELERATION_REPRAP - #ifdef ACCELERATION_RAMPING - #error "Can't use ACCELERATION_REPRAP and ACCELERATION_RAMPING together." - #endif -#endif /***************************************************************************\ @@ -161,7 +168,9 @@ #define PS_ON_PIN DIO9 #else - // this is official reprap motherboard pinout + /* + this is the official gen3 reprap motherboard pinout + */ #define TX_ENABLE_PIN DIO12 #define RX_ENABLE_PIN DIO13 @@ -190,6 +199,8 @@ #define SD_WRITE_PROTECT DIO3 #endif + + /***************************************************************************\ * * * 4. TEMPERATURE SENSORS * @@ -217,7 +228,7 @@ // if you selected thermistor or AD595, what pin is it on? (this value only used to fill ANALOG_MASK for you) #define TEMP_PIN_CHANNEL AIO0_PIN -// ANALOG_MASK is a bitmask of all analog channels used- if you use more than one analog input, bitwise-or them all together +// ANALOG_MASK is a bitmask of all analog channels used- if you use more than one analog input (more than one temp sensor?), bitwise-or them all together #define ANALOG_MASK MASK(TEMP_PIN_CHANNEL) // how many temperature sensors do you have? @@ -232,10 +243,10 @@ * do not affect firmware operation * * * * for GEN3 set temp_type to TT_INTERCOM, temp_pin to 0 and heater index to * -* 255 * +* 255 - the extruder manages the heater for us * * * * Types are same as TEMP_ list above- TT_MAX6675, TT_THERMISTOR, TT_AD595, * -* TT_INTERCOM. See list in temp.c. * +* TT_PT100, TT_INTERCOM. See list in temp.c. * * * \***************************************************************************/ @@ -324,6 +335,14 @@ struct { * * \***************************************************************************/ +/* + DEBUG + enables /heaps/ of extra output, and some extra M-codes. + WARNING: this WILL break most host-side talkers that expect particular responses from firmware such as reprap host and replicatorG + use with serial terminal or other suitable talker only. +*/ +// #define DEBUG + /* 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. @@ -379,6 +398,7 @@ struct { * * * list of PWM-able pins and corresponding timers * * timer1 is used for step timing so don't use OC1A/OC1B * +* they are omitted from this listing for that reason * * * * For the atmega168/328, timer/pin mappings are as follows * * * diff --git a/extruder/intercom.c b/extruder/intercom.c index 35cd1f3..7cab163 100644 --- a/extruder/intercom.c +++ b/extruder/intercom.c @@ -1,5 +1,3 @@ -#ifdef GEN3 - #include "intercom.h" #include @@ -7,6 +5,7 @@ #include "config.h" #include "delay.h" +#ifdef GEN3 #define INTERCOM_BAUD 57600 #define enable_transmit() do { WRITE(TX_ENABLE_PIN,1); WRITE(RX_ENABLE_PIN,0); } while(0) diff --git a/temp.c b/temp.c index 7a044cf..4809218 100644 --- a/temp.c +++ b/temp.c @@ -4,17 +4,6 @@ #include #include -#include "arduino.h" -#include "delay.h" -#include "debug.h" -#ifndef EXTRUDER - #include "sersendf.h" -#endif -#include "heater.h" -#ifdef GEN3 - #include "intercom.h" -#endif - typedef enum { TT_THERMISTOR, TT_MAX6675, @@ -31,6 +20,17 @@ typedef enum { #define TEMP_C #include "config.h" +#include "arduino.h" +#include "delay.h" +#include "debug.h" +#ifndef EXTRUDER + #include "sersendf.h" +#endif +#include "heater.h" +#ifdef GEN3 + #include "intercom.h" +#endif + // this struct holds the runtime sensor data- read temperatures, targets, etc struct { temp_flags_enum temp_flags;