use constants for conditional compilation since preprocessor can't work out enums and we can't define in macros
This commit is contained in:
parent
1c723f7656
commit
e4fc55289b
116
config.h.dist
116
config.h.dist
|
|
@ -30,11 +30,6 @@
|
||||||
#define F_CPU 16000000L
|
#define F_CPU 16000000L
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
Are you using the official GEN3 motherboard with separate extruder controller?
|
|
||||||
*/
|
|
||||||
#define GEN3
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is the motherboard, as opposed to the extruder. See extruder/ directory for GEN3 extruder firmware
|
This is the motherboard, as opposed to the extruder. See extruder/ directory for GEN3 extruder firmware
|
||||||
*/
|
*/
|
||||||
|
|
@ -141,60 +136,58 @@
|
||||||
|
|
||||||
#include "arduino.h"
|
#include "arduino.h"
|
||||||
|
|
||||||
#ifndef GEN3
|
/*
|
||||||
/*
|
user defined pins
|
||||||
user defined pins
|
adjust to suit your electronics,
|
||||||
adjust to suit your electronics,
|
or adjust your electronics to suit this
|
||||||
or adjust your electronics to suit this
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
#define X_STEP_PIN AIO0
|
#define X_STEP_PIN AIO0
|
||||||
#define X_DIR_PIN AIO1
|
#define X_DIR_PIN AIO1
|
||||||
#define X_MIN_PIN AIO2
|
#define X_MIN_PIN AIO2
|
||||||
|
|
||||||
#define Y_STEP_PIN AIO3
|
#define Y_STEP_PIN AIO3
|
||||||
#define Y_DIR_PIN AIO4
|
#define Y_DIR_PIN AIO4
|
||||||
#define Y_MIN_PIN AIO5
|
#define Y_MIN_PIN AIO5
|
||||||
|
|
||||||
#define Z_STEP_PIN DIO2
|
#define Z_STEP_PIN DIO2
|
||||||
#define Z_DIR_PIN DIO3
|
#define Z_DIR_PIN DIO3
|
||||||
#define Z_MIN_PIN DIO4
|
#define Z_MIN_PIN DIO4
|
||||||
|
|
||||||
#define E_STEP_PIN DIO7
|
#define E_STEP_PIN DIO7
|
||||||
#define E_DIR_PIN DIO8
|
#define E_DIR_PIN DIO8
|
||||||
|
|
||||||
#define PS_ON_PIN DIO9
|
#define PS_ON_PIN DIO9
|
||||||
#else
|
|
||||||
/*
|
|
||||||
this is the official gen3 reprap motherboard pinout
|
|
||||||
*/
|
|
||||||
#define TX_ENABLE_PIN DIO12
|
|
||||||
#define RX_ENABLE_PIN DIO13
|
|
||||||
|
|
||||||
#define X_STEP_PIN DIO15
|
/*
|
||||||
#define X_DIR_PIN DIO18
|
this is the official gen3 reprap motherboard pinout
|
||||||
#define X_MIN_PIN DIO20
|
*/
|
||||||
#define X_MAX_PIN DIO21
|
// #define TX_ENABLE_PIN DIO12
|
||||||
#define X_ENABLE_PIN DIO19
|
// #define RX_ENABLE_PIN DIO13
|
||||||
|
//
|
||||||
#define Y_STEP_PIN DIO23
|
// #define X_STEP_PIN DIO15
|
||||||
#define Y_DIR_PIN DIO22
|
// #define X_DIR_PIN DIO18
|
||||||
#define Y_MIN_PIN AIO6
|
// #define X_MIN_PIN DIO20
|
||||||
#define Y_MAX_PIN AIO5
|
// #define X_MAX_PIN DIO21
|
||||||
#define Y_ENABLE_PIN DIO7
|
// #define X_ENABLE_PIN DIO19
|
||||||
|
//
|
||||||
#define Z_STEP_PIN AIO4
|
// #define Y_STEP_PIN DIO23
|
||||||
#define Z_DIR_PIN AIO3
|
// #define Y_DIR_PIN DIO22
|
||||||
#define Z_MIN_PIN AIO1
|
// #define Y_MIN_PIN AIO6
|
||||||
#define Z_MAX_PIN AIO0
|
// #define Y_MAX_PIN AIO5
|
||||||
#define Z_ENABLE_PIN AIO2
|
// #define Y_ENABLE_PIN DIO7
|
||||||
|
//
|
||||||
#define E_STEP_PIN DIO16
|
// #define Z_STEP_PIN AIO4
|
||||||
#define E_DIR_PIN DIO17
|
// #define Z_DIR_PIN AIO3
|
||||||
|
// #define Z_MIN_PIN AIO1
|
||||||
#define SD_CARD_DETECT DIO2
|
// #define Z_MAX_PIN AIO0
|
||||||
#define SD_WRITE_PROTECT DIO3
|
// #define Z_ENABLE_PIN AIO2
|
||||||
#endif
|
//
|
||||||
|
// #define E_STEP_PIN DIO16
|
||||||
|
// #define E_DIR_PIN DIO17
|
||||||
|
//
|
||||||
|
// #define SD_CARD_DETECT DIO2
|
||||||
|
// #define SD_WRITE_PROTECT DIO3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -217,16 +210,13 @@
|
||||||
|
|
||||||
// which temperature sensors are you using? (intercom is the gen3-style separate extruder board)
|
// which temperature sensors are you using? (intercom is the gen3-style separate extruder board)
|
||||||
// #define TEMP_MAX6675
|
// #define TEMP_MAX6675
|
||||||
// #define TEMP_THERMISTOR
|
#define TEMP_THERMISTOR
|
||||||
// #define TEMP_AD595
|
// #define TEMP_AD595
|
||||||
// #define TEMP_PT100
|
// #define TEMP_PT100
|
||||||
#define TEMP_INTERCOM
|
// #define TEMP_INTERCOM
|
||||||
|
|
||||||
// if you selected thermistor or AD595, what pin is it on? (this value only used to fill ANALOG_MASK for you)
|
// ANALOG_MASK is a bitmask of all analog channels used- bitwise-or them all together
|
||||||
#define TEMP_PIN_CHANNEL AIO0_PIN
|
#define ANALOG_MASK MASK(AIO0_PIN)
|
||||||
|
|
||||||
// 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)
|
|
||||||
|
|
||||||
/***************************************************************************\
|
/***************************************************************************\
|
||||||
* *
|
* *
|
||||||
|
|
@ -283,6 +273,12 @@ DEFINE_TEMP_SENSOR(extruder, TT_INTERCOM, 0)
|
||||||
DEFINE_HEATER(extruder, PORTD, PIND6, OCR0A)
|
DEFINE_HEATER(extruder, PORTD, PIND6, OCR0A)
|
||||||
DEFINE_HEATER(bed, PORTD, PIND5, OCR0B)
|
DEFINE_HEATER(bed, PORTD, PIND5, OCR0B)
|
||||||
|
|
||||||
|
// and now because the c preprocessor isn't as smart as it could be,
|
||||||
|
// uncomment the ones you've listed above and comment the rest
|
||||||
|
|
||||||
|
#define HEATER_EXTRUDER HEATER_extruder
|
||||||
|
#define HEATER_BED HEATER_bed
|
||||||
|
// #define HEATER_FAN HEATER_fan
|
||||||
|
|
||||||
/***************************************************************************\
|
/***************************************************************************\
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -275,15 +275,15 @@ void process_gcode_command() {
|
||||||
// M7/M106- fan on
|
// M7/M106- fan on
|
||||||
case 7:
|
case 7:
|
||||||
case 106:
|
case 106:
|
||||||
#ifdef HEATER_fan
|
#ifdef HEATER_FAN
|
||||||
heater_set(HEATER_fan, 255);
|
heater_set(HEATER_FAN, 255);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
// M107- fan off
|
// M107- fan off
|
||||||
case 9:
|
case 9:
|
||||||
case 107:
|
case 107:
|
||||||
#ifdef HEATER_fan
|
#ifdef HEATER_FAN
|
||||||
heater_set(HEATER_fan, 0);
|
heater_set(HEATER_FAN, 0);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -359,8 +359,8 @@ void process_gcode_command() {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 140: //Set heated bed temperature
|
case 140: //Set heated bed temperature
|
||||||
#ifdef HEATER_bed
|
#ifdef HEATER_BED
|
||||||
temp_set(HEATER_bed, next_target.S);
|
temp_set(HEATER_BED, next_target.S);
|
||||||
if (next_target.S)
|
if (next_target.S)
|
||||||
power_on();
|
power_on();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "delay.h"
|
#include "delay.h"
|
||||||
|
|
||||||
#ifdef GEN3
|
#ifdef TEMP_INTERCOM
|
||||||
#define INTERCOM_BAUD 57600
|
#define INTERCOM_BAUD 57600
|
||||||
|
|
||||||
#define enable_transmit() do { WRITE(TX_ENABLE_PIN,1); WRITE(RX_ENABLE_PIN,0); } while(0)
|
#define enable_transmit() do { WRITE(TX_ENABLE_PIN,1); WRITE(RX_ENABLE_PIN,0); } while(0)
|
||||||
|
|
@ -216,4 +216,4 @@ ISR(USART_UDRE_vect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* GEN3 */
|
#endif /* TEMP_INTERCOM */
|
||||||
|
|
|
||||||
11
temp.c
11
temp.c
|
|
@ -11,7 +11,7 @@
|
||||||
#include "sersendf.h"
|
#include "sersendf.h"
|
||||||
#endif
|
#endif
|
||||||
#include "heater.h"
|
#include "heater.h"
|
||||||
#ifdef GEN3
|
#ifdef TEMP_INTERCOM
|
||||||
#include "intercom.h"
|
#include "intercom.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -112,7 +112,7 @@ void temp_init() {
|
||||||
break;*/
|
break;*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GEN3
|
#ifdef TEMP_INTERCOM
|
||||||
case TT_INTERCOM:
|
case TT_INTERCOM:
|
||||||
intercom_init();
|
intercom_init();
|
||||||
update_send_cmd(0);
|
update_send_cmd(0);
|
||||||
|
|
@ -284,7 +284,7 @@ void temp_set(temp_sensor_t index, uint16_t temperature) {
|
||||||
|
|
||||||
temp_sensors_runtime[index].target_temp = temperature;
|
temp_sensors_runtime[index].target_temp = temperature;
|
||||||
temp_sensors_runtime[index].temp_residency = 0;
|
temp_sensors_runtime[index].temp_residency = 0;
|
||||||
#ifdef GEN3
|
#ifdef TEMP_INTERCOM
|
||||||
if (temp_sensors[index].temp_type == TT_INTERCOM)
|
if (temp_sensors[index].temp_type == TT_INTERCOM)
|
||||||
update_send_cmd(temperature >> 2);
|
update_send_cmd(temperature >> 2);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -308,10 +308,9 @@ void temp_print(temp_sensor_t index) {
|
||||||
c = (temp_sensors_runtime[index].last_read_temp & 3) * 25;
|
c = (temp_sensors_runtime[index].last_read_temp & 3) * 25;
|
||||||
|
|
||||||
sersendf_P(PSTR("T:%u.%u"), temp_sensors_runtime[index].last_read_temp >> 2, c);
|
sersendf_P(PSTR("T:%u.%u"), temp_sensors_runtime[index].last_read_temp >> 2, c);
|
||||||
#ifdef _HEATER_bed
|
#ifdef HEATER_BED
|
||||||
#warning heated bed enabled!
|
|
||||||
uint8_t b = 0;
|
uint8_t b = 0;
|
||||||
b = (temp_sensors_runtime[HEATER_bed].last_read_temp & 3) * 25;
|
b = (temp_sensors_runtime[HEATER_BED].last_read_temp & 3) * 25;
|
||||||
|
|
||||||
sersendf_P(PSTR(" B:%u.%u"), temp_sensors_runtime[HEATER_bed].last_read_temp >> 2 , b);
|
sersendf_P(PSTR(" B:%u.%u"), temp_sensors_runtime[HEATER_bed].last_read_temp >> 2 , b);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue