Merge pull request #748 from wolfmanjm/add/azteegx3pro

Add/azteegx3pro
master
ErikZalm 11 years ago
commit 8ebcc9dc3a

@ -52,6 +52,7 @@
// 65 = Azteeg X1 // 65 = Azteeg X1
// 66 = Melzi with ATmega1284 (MaKr3d version) // 66 = Melzi with ATmega1284 (MaKr3d version)
// 67 = Azteeg X3 // 67 = Azteeg X3
// 68 = Azteeg X3 Pro
// 7 = Ultimaker // 7 = Ultimaker
// 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare) // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
// 77 = 3Drag Controller // 77 = 3Drag Controller

@ -268,6 +268,12 @@
// Motor Current setting (Only functional when motor driver current ref pins are connected to a digital trimpot on supported boards) // Motor Current setting (Only functional when motor driver current ref pins are connected to a digital trimpot on supported boards)
#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) #define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
// uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
//#define DIGIPOT_I2C
// Number of channels available for I2C digipot, For Azteeg X3 Pro we have 8
#define DIGIPOT_I2C_NUM_CHANNELS 8
// actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
#define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}
//=========================================================================== //===========================================================================
//=============================Additional Features=========================== //=============================Additional Features===========================

@ -57,6 +57,9 @@ BUILD_DIR ?= applet
# This defines whether Liquid_TWI2 support will be built # This defines whether Liquid_TWI2 support will be built
LIQUID_TWI2 ?= 0 LIQUID_TWI2 ?= 0
# this defines if Wire is needed
WIRE ?= 0
############################################################################ ############################################################################
# Below here nothing should be changed... # Below here nothing should be changed...
@ -174,6 +177,14 @@ else ifeq ($(HARDWARE_MOTHERBOARD),301)
HARDWARE_VARIANT ?= arduino HARDWARE_VARIANT ?= arduino
MCU ?= atmega2560 MCU ?= atmega2560
# Azteeg
else ifeq ($(HARDWARE_MOTHERBOARD),67)
HARDWARE_VARIANT ?= arduino
MCU ?= atmega2560
else ifeq ($(HARDWARE_MOTHERBOARD),68)
HARDWARE_VARIANT ?= arduino
MCU ?= atmega2560
endif endif
# Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
@ -213,6 +224,10 @@ VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
endif endif
ifeq ($(WIRE), 1)
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
endif
else else
VPATH += $(HARDWARE_DIR)/libraries/LiquidCrystal VPATH += $(HARDWARE_DIR)/libraries/LiquidCrystal
VPATH += $(HARDWARE_DIR)/libraries/SPI VPATH += $(HARDWARE_DIR)/libraries/SPI
@ -221,6 +236,10 @@ VPATH += $(HARDWARE_DIR)/libraries/Wire
VPATH += $(HARDWARE_DIR)/libraries/Wire/utility VPATH += $(HARDWARE_DIR)/libraries/Wire/utility
VPATH += $(HARDWARE_DIR)/libraries/LiquidTWI2 VPATH += $(HARDWARE_DIR)/libraries/LiquidTWI2
endif endif
ifeq ($(WIRE, 1)
VPATH += $(HARDWARE_DIR)/libraries/Wire
VPATH += $(HARDWARE_DIR)/libraries/Wire/utility
endif
endif endif
ifeq ($(HARDWARE_VARIANT), arduino) ifeq ($(HARDWARE_VARIANT), arduino)
HARDWARE_SUB_VARIANT ?= mega HARDWARE_SUB_VARIANT ?= mega
@ -241,7 +260,7 @@ CXXSRC = WMath.cpp WString.cpp Print.cpp Marlin_main.cpp \
MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp \ MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp \
SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp \ SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp \
stepper.cpp temperature.cpp cardreader.cpp ConfigurationStore.cpp \ stepper.cpp temperature.cpp cardreader.cpp ConfigurationStore.cpp \
watchdog.cpp SPI.cpp Servo.cpp Tone.cpp ultralcd.cpp watchdog.cpp SPI.cpp Servo.cpp Tone.cpp ultralcd.cpp digipot_mcp4451.cpp
ifeq ($(LIQUID_TWI2), 0) ifeq ($(LIQUID_TWI2), 0)
CXXSRC += LiquidCrystal.cpp CXXSRC += LiquidCrystal.cpp
else else
@ -249,6 +268,11 @@ SRC += twi.c
CXXSRC += Wire.cpp LiquidTWI2.cpp CXXSRC += Wire.cpp LiquidTWI2.cpp
endif endif
ifeq ($(WIRE), 1)
SRC += twi.c
CXXSRC += Wire.cpp
endif
#Check for Arduino 1.0.0 or higher and use the correct sourcefiles for that version #Check for Arduino 1.0.0 or higher and use the correct sourcefiles for that version
ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true) ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
CXXSRC += main.cpp CXXSRC += main.cpp

@ -235,4 +235,9 @@ extern unsigned long stoptime;
// Handling multiple extruders pins // Handling multiple extruders pins
extern uint8_t active_extruder; extern uint8_t active_extruder;
#ifdef DIGIPOT_I2C
extern void digipot_i2c_set_current( int channel, float current );
extern void digipot_i2c_init();
#endif
#endif #endif

@ -50,3 +50,7 @@
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1 #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
#include <SPI.h> #include <SPI.h>
#endif #endif
#if defined(DIGIPOT_I2C)
#include <Wire.h>
#endif

@ -50,3 +50,7 @@
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1 #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
#include <SPI.h> #include <SPI.h>
#endif #endif
#if defined(DIGIPOT_I2C)
#include <Wire.h>
#endif

@ -492,6 +492,10 @@ void setup()
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1 #if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
#endif #endif
#ifdef DIGIPOT_I2C
digipot_i2c_init();
#endif
} }
@ -2841,6 +2845,12 @@ void process_commands()
#ifdef MOTOR_CURRENT_PWM_E_PIN #ifdef MOTOR_CURRENT_PWM_E_PIN
if(code_seen('E')) digipot_current(2, code_value()); if(code_seen('E')) digipot_current(2, code_value());
#endif #endif
#ifdef DIGIPOT_I2C
// this one uses actual amps in floating point
for(int i=0;i<NUM_AXIS;i++) if(code_seen(axis_codes[i])) digipot_i2c_set_current(i, code_value());
// for each additional extruder (named B,C,D,E..., channels 4,5,6,7...)
for(int i=NUM_AXIS;i<DIGIPOT_I2C_NUM_CHANNELS;i++) if(code_seen('B'+i-NUM_AXIS)) digipot_i2c_set_current(i, code_value());
#endif
} }
break; break;
case 908: // M908 Control digital trimpot directly. case 908: // M908 Control digital trimpot directly.

@ -0,0 +1,54 @@
#include "Configuration.h"
#ifdef DIGIPOT_I2C
#include "Stream.h"
#include "utility/twi.h"
#include "Wire.h"
// Settings for the I2C based DIGIPOT (MCP4451) on Azteeg X3 Pro
#define DIGIPOT_I2C_FACTOR 106.7
#define DIGIPOT_I2C_MAX_CURRENT 2.5
static byte current_to_wiper( float current ){
return byte(ceil(float((DIGIPOT_I2C_FACTOR*current))));
}
static void i2c_send(byte addr, byte a, byte b)
{
Wire.beginTransmission(addr);
Wire.write(a);
Wire.write(b);
Wire.endTransmission();
}
// This is for the MCP4451 I2C based digipot
void digipot_i2c_set_current( int channel, float current )
{
current = min( (float) max( current, 0.0f ), DIGIPOT_I2C_MAX_CURRENT);
// these addresses are specific to Azteeg X3 Pro, can be set to others,
// In this case first digipot is at address A0=0, A1= 0, second one is at A0=0, A1= 1
byte addr= 0x2C; // channel 0-3
if(channel >= 4) {
addr= 0x2E; // channel 4-7
channel-= 4;
}
// Initial setup
i2c_send( addr, 0x40, 0xff );
i2c_send( addr, 0xA0, 0xff );
// Set actual wiper value
byte addresses[4] = { 0x00, 0x10, 0x60, 0x70 };
i2c_send( addr, addresses[channel], current_to_wiper(current) );
}
void digipot_i2c_init()
{
const float digipot_motor_current[] = DIGIPOT_I2C_MOTOR_CURRENTS;
Wire.begin();
// setup initial currents as defined in Configuration_adv.h
for(int i=0;i<=sizeof(digipot_motor_current)/sizeof(float);i++) {
digipot_i2c_set_current(i, digipot_motor_current[i]);
}
}
#endif

@ -375,7 +375,7 @@
* Arduino Mega pin assignment * Arduino Mega pin assignment
* *
****************************************************************************************/ ****************************************************************************************/
#if MOTHERBOARD == 3 || MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 35 || MOTHERBOARD == 77 || MOTHERBOARD == 67 #if MOTHERBOARD == 3 || MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 35 || MOTHERBOARD == 77 || MOTHERBOARD == 67 || MOTHERBOARD == 68
#define KNOWN_BOARD 1 #define KNOWN_BOARD 1
//////////////////FIX THIS////////////// //////////////////FIX THIS//////////////
@ -391,7 +391,7 @@
// #define RAMPS_V_1_0 // #define RAMPS_V_1_0
#if MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 35 || MOTHERBOARD == 77 || MOTHERBOARD == 67 #if MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 35 || MOTHERBOARD == 77 || MOTHERBOARD == 67 || MOTHERBOARD == 68
#define LARGE_FLASH true #define LARGE_FLASH true
@ -472,12 +472,26 @@
#define E1_DIR_PIN 34 #define E1_DIR_PIN 34
#define E1_ENABLE_PIN 30 #define E1_ENABLE_PIN 30
#if MOTHERBOARD == 68
#define E2_STEP_PIN 23
#define E2_DIR_PIN 25
#define E2_ENABLE_PIN 40
#define E3_STEP_PIN 27
#define E3_DIR_PIN 29
#define E3_ENABLE_PIN 41
#define E4_STEP_PIN 43
#define E4_DIR_PIN 37
#define E4_ENABLE_PIN 42
#endif
#define SDPOWER -1 #define SDPOWER -1
#define SDSS 53 #define SDSS 53
#define LED_PIN 13 #define LED_PIN 13
#endif #endif
#if MOTHERBOARD == 33 || MOTHERBOARD == 35 || MOTHERBOARD == 67 #if MOTHERBOARD == 33 || MOTHERBOARD == 35 || MOTHERBOARD == 67 || MOTHERBOARD == 68
#define FAN_PIN 9 // (Sprinter config) #define FAN_PIN 9 // (Sprinter config)
#else #else
#define FAN_PIN 4 // IO pin. Buffer needed #define FAN_PIN 4 // IO pin. Buffer needed
@ -511,17 +525,33 @@
#define HEATER_1_PIN 9 // EXTRUDER 2 (FAN On Sprinter) #define HEATER_1_PIN 9 // EXTRUDER 2 (FAN On Sprinter)
#endif #endif
#define HEATER_2_PIN -1
#if MOTHERBOARD == 77 #if MOTHERBOARD == 77
#define HEATER_0_PIN 10 #define HEATER_0_PIN 10
#define HEATER_1_PIN 12 #define HEATER_1_PIN 12
#define HEATER_2_PIN 6 #define HEATER_2_PIN 6
#elif MOTHERBOARD == 68
#define HEATER_2_PIN 16
#define HEATER_3_PIN 17
#define HEATER_4_PIN 4
#define HEATER_5_PIN 5
#define HEATER_6_PIN 6
#define HEATER_7_PIN 11
#else
#define HEATER_2_PIN -1
#endif #endif
#define TEMP_0_PIN 13 // ANALOG NUMBERING #define TEMP_0_PIN 13 // ANALOG NUMBERING
#define TEMP_1_PIN 15 // ANALOG NUMBERING #define TEMP_1_PIN 15 // ANALOG NUMBERING
#if MOTHERBOARD == 68
#define TEMP_2_PIN 12 // ANALOG NUMBERING
#define TEMP_3_PIN 11 // ANALOG NUMBERING
#define TEMP_4_PIN 10 // ANALOG NUMBERING
#define TC1 4 // ANALOG NUMBERING Thermo couple on Azteeg X3Pro
#define TC2 5 // ANALOG NUMBERING Thermo couple on Azteeg X3Pro
#else
#define TEMP_2_PIN -1 // ANALOG NUMBERING #define TEMP_2_PIN -1 // ANALOG NUMBERING
#endif
#if MOTHERBOARD == 35 #if MOTHERBOARD == 35
#define HEATER_BED_PIN -1 // NO BED #define HEATER_BED_PIN -1 // NO BED
@ -532,9 +562,8 @@
#define HEATER_BED_PIN 8 // BED #define HEATER_BED_PIN 8 // BED
#endif #endif
#endif #endif
#define TEMP_BED_PIN 14 // ANALOG NUMBERING
#define TEMP_BED_PIN 14 // ANALOG NUMBERING
#ifdef NUM_SERVOS #ifdef NUM_SERVOS
#define SERVO0_PIN 11 #define SERVO0_PIN 11
@ -552,6 +581,10 @@
#endif #endif
#endif #endif
#if MOTHERBOARD == 68
#define BEEPER 33
#endif
#ifdef TEMP_STAT_LEDS #ifdef TEMP_STAT_LEDS
#if MOTHERBOARD == 67 #if MOTHERBOARD == 67
#define STAT_LED_RED 6 #define STAT_LED_RED 6

Loading…
Cancel
Save