Browse Source

Merge remote-tracking branch 'upstream/Marlin_v1' into Marlin_v1

pull/1/head
Christian Thalhammer 13 years ago
parent
commit
cb02914687
  1. 2
      Marlin/.gitignore
  2. 75
      Marlin/Configuration.h
  3. 16
      Marlin/Configuration_adv.h
  4. 24
      Marlin/Gen7/cores/arduino/pins_arduino.c
  5. 14
      Marlin/Makefile
  6. 1
      Marlin/Marlin.h
  7. 85
      Marlin/Marlin.pde
  8. 24
      Marlin/Sanguino/cores/arduino/pins_arduino.c
  9. 6
      Marlin/Sanguino/cores/arduino/pins_arduino.h
  10. 2
      Marlin/Sanguino/cores/arduino/wiring_private.h
  11. 3
      Marlin/cardreader.cpp
  12. 339
      Marlin/language.h
  13. 12
      Marlin/motion_control.cpp
  14. 592
      Marlin/pins.h
  15. 21
      Marlin/planner.cpp
  16. 2
      Marlin/planner.h
  17. 2
      Marlin/stepper.cpp
  18. 16
      Marlin/temperature.cpp
  19. 13
      Marlin/ultralcd.h
  20. 216
      Marlin/ultralcd.pde
  21. 22
      README.md

2
Marlin/.gitignore

@ -0,0 +1,2 @@
*.o
applet/

75
Marlin/Configuration.h

@ -8,25 +8,28 @@
//User specified version info of THIS file to display in [Pronterface, etc] terminal window during startup.
//Implementation of an idea by Prof Braino to inform user that any changes made
//to THIS file by the user have been successfully uploaded into firmware.
#define STRING_VERSION_CONFIG_H "2012-02-08j" //Personal revision number for changes to THIS file.
#define STRING_CONFIG_H_AUTHOR "scuba82" //Who made the changes.
#define STRING_VERSION_CONFIG_H "2012-02-25" //Personal revision number for changes to THIS file.
#define STRING_CONFIG_H_AUTHOR "erik" //Who made the changes.
// This determines the communication speed of the printer
//#define BAUDRATE 250000
#define BAUDRATE 115200
#define BAUDRATE 250000
//#define BAUDRATE 115200
//// The following define selects which electronics board you have. Please choose the one that matches your setup
// MEGA/RAMPS up to 1.2 = 3,
// RAMPS 1.3 = 33
// Gen6 = 5,
// Gen7 custom (Alfons3 Version) = 10 "https://github.com/Alfons3/Generation_7_Electronics"
// Gen7 v1.1, v1.2 = 11
// Gen7 v1.3 = 12
// Gen7 v1.4 = 13
// MEGA/RAMPS up to 1.2 = 3
// RAMPS 1.3 = 33 (Power outputs: Extruder, Bed, Fan)
// RAMPS 1.3 = 34 (Power outputs: Extruder0, Extruder1, Bed)
// Gen6 = 5
// Gen6 deluxe = 51
// Sanguinololu 1.2 and above = 62
// Ultimaker = 7,
// Gen7 custom (Alfons3 Version) = 77, "https://github.com/Alfons3/Generation_7_Electronics"
// Gen7 v1.1, v1.2 = 78
// Gen7 v1.3 = 79
// Teensylu = 8,
// Ultimaker = 7
// Teensylu = 8
// Gen3+ =9
#define MOTHERBOARD 77
#define MOTHERBOARD 7
//===========================================================================
//=============================Thermal Settings ============================
@ -44,14 +47,14 @@
// 6 is EPCOS 100k
// 7 is 100k Honeywell thermistor 135-104LAG-J01
#define TEMP_SENSOR_0 6
#define TEMP_SENSOR_0 -1
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0
#define TEMP_SENSOR_BED 1
#define TEMP_SENSOR_BED 0
// Actual temperature must be close to target for this long before M109 returns success
#define TEMP_RESIDENCY_TIME 30 // (seconds)
#define TEMP_HYSTERESIS 3 // (C) range of +/- temperatures considered "close" to the target one
#define TEMP_RESIDENCY_TIME 10 // (seconds)
#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one
// The minimal temperature defines the temperature below which the heater will not be enabled It is used
// to check that the wiring to the thermistor is not broken.
@ -69,6 +72,7 @@
#define HEATER_2_MAXTEMP 275
#define BED_MAXTEMP 150
// PID settings:
// Comment the following line to disable PID and enable bang-bang.
#define PIDTEMP
@ -111,9 +115,9 @@
#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
const bool X_ENDSTOPS_INVERTING = false; // set to true to invert the logic of the endstops.
const bool Y_ENDSTOPS_INVERTING = false; // set to true to invert the logic of the endstops.
const bool Z_ENDSTOPS_INVERTING = false; // set to true to invert the logic of the endstops.
const bool X_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
const bool Y_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
#define X_ENABLE_ON 0
@ -127,9 +131,9 @@ const bool Z_ENDSTOPS_INVERTING = false; // set to true to invert the logic of t
#define DISABLE_Z false
#define DISABLE_E false // For all extruders
#define INVERT_X_DIR false // for Mendel set to false, for Orca set to true
#define INVERT_X_DIR true // for Mendel set to false, for Orca set to true
#define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false
#define INVERT_Z_DIR false // for Mendel set to false, for Orca set to true
#define INVERT_Z_DIR true // for Mendel set to false, for Orca set to true
#define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false
#define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false
#define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false
@ -140,19 +144,24 @@ const bool Z_ENDSTOPS_INVERTING = false; // set to true to invert the logic of t
#define Y_HOME_DIR -1
#define Z_HOME_DIR -1
#define min_software_endstops false //If true, axis won't move to coordinates less than zero.
#define min_software_endstops true //If true, axis won't move to coordinates less than HOME_POS.
#define max_software_endstops true //If true, axis won't move to coordinates greater than the defined lengths below.
#define X_MAX_LENGTH 205
#define Y_MAX_LENGTH 205
#define Z_MAX_LENGTH 200
// The position of the homing switches. Use MAX_LENGTH * -0.5 if the center should be 0, 0, 0
#define X_HOME_POS 0
#define Y_HOME_POS 0
#define Z_HOME_POS 0
//// MOVEMENT SETTINGS
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
#define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0} // set the homing speeds (mm/min)
// default settings
#define DEFAULT_AXIS_STEPS_PER_UNIT {80,80,2560,760*1.1} // default steps per unit for ultimaker
#define DEFAULT_AXIS_STEPS_PER_UNIT {78.7402,78.7402,200*8/3,760*1.1} // default steps per unit for ultimaker
#define DEFAULT_MAX_FEEDRATE {500, 500, 5, 45} // (mm/sec)
#define DEFAULT_MAX_ACCELERATION {9000,9000,100,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.
@ -173,22 +182,32 @@ const bool Z_ENDSTOPS_INVERTING = false; // set to true to invert the logic of t
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
//define this to enable eeprom support
#define EEPROM_SETTINGS
//#define EEPROM_SETTINGS
//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out:
// please keep turned on if you can.
#define EEPROM_CHITCHAT
//#define EEPROM_CHITCHAT
//LCD and SD support
//#define ULTRA_LCD //general lcd support, also 16x2
#define SDSUPPORT // Enable SD Card Support in Hardware Console
//#define SDSUPPORT // Enable SD Card Support in Hardware Console
#define ULTIPANEL
//#define ULTIPANEL
#ifdef ULTIPANEL
#define NEWPANEL //enable this if you have a click-encoder panel
#define SDSUPPORT
#define ULTRA_LCD
#define LCD_WIDTH 20
#define LCD_HEIGHT 4
// Preheat Constants
#define PLA_PREHEAT_HOTEND_TEMP 180
#define PLA_PREHEAT_HPB_TEMP 70
#define PLA_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255
#define ABS_PREHEAT_HOTEND_TEMP 240
#define ABS_PREHEAT_HPB_TEMP 100
#define ABS_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255
#else //no panel but just lcd
#ifdef ULTRA_LCD
#define LCD_WIDTH 16

16
Marlin/Configuration_adv.h

@ -25,9 +25,6 @@
// if CooldownNoWait is defined M109 will not wait for the cooldown to finish
#define CooldownNoWait true
//Do not wait for M109 to finish when printing from SD card
//#define STOP_HEATING_WAIT_WHEN_SD_PRINTING
#ifdef PIDTEMP
// this adds an experimental additional term to the heatingpower, proportional to the extrusion speed.
// if Kc is choosen well, the additional required power due to increased melting should be compensated.
@ -59,6 +56,11 @@
#define EXTRUDER_RUNOUT_SPEED 1500. //extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
//These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements.
//The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET"
#define TEMP_SENSOR_AD595_OFFSET 0.0
#define TEMP_SENSOR_AD595_GAIN 1.0
//===========================================================================
//=============================Mechanical Settings===========================
//===========================================================================
@ -74,7 +76,7 @@
#define X_HOME_RETRACT_MM 5
#define Y_HOME_RETRACT_MM 5
#define Z_HOME_RETRACT_MM 1
#define QUICK_HOME //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
//#define QUICK_HOME //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
#define AXIS_RELATIVE_MODES {false, false, false, false}
@ -148,6 +150,12 @@
const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted
// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT
// in the pins.h file. When using a push button pulling the pin to ground this will need inverted. This setting should
// be commented out otherwise
#define SDCARDDETECTINVERTED
//===========================================================================
//=============================Buffers ============================
//===========================================================================

24
Marlin/Gen7/cores/arduino/pins_arduino.c

@ -67,28 +67,28 @@
const uint8_t PROGMEM port_to_mode_PGM[] =
{
NOT_A_PORT,
&DDRA,
&DDRB,
&DDRC,
&DDRD,
(uint8_t) &DDRA,
(uint8_t) &DDRB,
(uint8_t) &DDRC,
(uint8_t) &DDRD,
};
const uint8_t PROGMEM port_to_output_PGM[] =
{
NOT_A_PORT,
&PORTA,
&PORTB,
&PORTC,
&PORTD,
(uint8_t) &PORTA,
(uint8_t) &PORTB,
(uint8_t) &PORTC,
(uint8_t) &PORTD,
};
const uint8_t PROGMEM port_to_input_PGM[] =
{
NOT_A_PORT,
&PINA,
&PINB,
&PINC,
&PIND,
(uint8_t) &PINA,
(uint8_t) &PINB,
(uint8_t) &PINC,
(uint8_t) &PIND,
};
const uint8_t PROGMEM digital_pin_to_port_PGM[] =

14
Marlin/Makefile

@ -61,7 +61,7 @@ SRC = $(ARDUINO)/pins_arduino.c $(ARDUINO)/wiring.c \
$(ARDUINO)/wiring_pulse.c \
$(ARDUINO)/wiring_shift.c $(ARDUINO)/WInterrupts.c
CXXSRC = $(ARDUINO)/WMath.cpp $(ARDUINO)/WString.cpp\
$(ARDUINO)/Print.cpp Marlin.cpp MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp stepper.cpp temperature.cpp cardreader.cpp
$(ARDUINO)/Print.cpp applet/Marlin.cpp MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp stepper.cpp temperature.cpp cardreader.cpp
FORMAT = ihex
@ -138,6 +138,8 @@ all: build sizeafter
build: elf hex
applet/$(TARGET).cpp: $(TARGET).pde $(MAKEFILE)
applet/%.cpp: %.pde
# Here is the "preprocessing".
# It creates a .cpp file based with the same name as the .pde file.
# On top of the new .cpp file comes the WProgram.h header.
@ -145,11 +147,11 @@ applet/$(TARGET).cpp: $(TARGET).pde $(MAKEFILE)
# Then the .cpp file will be compiled. Errors during compile will
# refer to this new, automatically generated, file.
# Not the original .pde file you actually edit...
@echo " WR applet/$(TARGET).cpp"
@test -d applet || mkdir applet
@echo '#include "WProgram.h"' > applet/$(TARGET).cpp
@cat $(TARGET).pde >> applet/$(TARGET).cpp
@cat $(ARDUINO)/main.cpp >> applet/$(TARGET).cpp
@echo " WR $@"
@test -d $(dir $@) || mkdir $(dir $@)
@echo '#include "WProgram.h"' > $@
@cat $< >> $@
@cat $(ARDUINO)/main.cpp >> $@
elf: applet/$(TARGET).elf
hex: applet/$(TARGET).hex

1
Marlin/Marlin.h

@ -175,7 +175,6 @@ extern float homing_feedrate[];
extern bool axis_relative_modes[];
extern float current_position[NUM_AXIS] ;
extern float add_homeing[3];
extern bool stop_heating_wait;
// Handling multiple extruders pins
extern uint8_t active_extruder;

85
Marlin/Marlin.pde

@ -35,8 +35,9 @@
#include "cardreader.h"
#include "watchdog.h"
#include "EEPROMwrite.h"
#include "language.h"
#define VERSION_STRING "1.0.0 RC1"
#define VERSION_STRING "1.0.0 RC2"
// look here for descriptions of gcodes: http://linuxcnc.org/handbook/gcode/g-code.html
// http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
@ -97,7 +98,8 @@
// M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2 also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate
// M205 - advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
// M206 - set additional homeing offset
// M220 - set speed factor override percentage S:factor in percent
// M220 S<factor in percent>- set speed factor override percentage
// M221 S<factor in percent>- set extrude factor override percentage
// M240 - Trigger a camera to take a photograph
// M301 - Set PID parameters P I and D
// M302 - Allow cold extrudes
@ -125,10 +127,10 @@ bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
volatile int feedmultiply=100; //100->1 200->2
int saved_feedmultiply;
volatile bool feedmultiplychanged=false;
volatile int extrudemultiply=100; //100->1 200->2
float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
float add_homeing[3]={0,0,0};
uint8_t active_extruder = 0;
bool stop_heating_wait=false;
//===========================================================================
//=============================private variables=============================
@ -249,6 +251,16 @@ void setup()
MYSERIAL.begin(BAUDRATE);
SERIAL_PROTOCOLLNPGM("start");
SERIAL_ECHO_START;
// Check startup - does nothing if bootloader sets MCUSR to 0
byte mcu = MCUSR;
if(mcu & 1) SERIAL_ECHOLNPGM("PowerUp");
if(mcu & 2) SERIAL_ECHOLNPGM("External Reset");
if(mcu & 4) SERIAL_ECHOLNPGM("Brown out Reset");
if(mcu & 8) SERIAL_ECHOLNPGM("Watchdog Reset");
if(mcu & 32) SERIAL_ECHOLNPGM("Software Reset");
MCUSR=0;
SERIAL_ECHOPGM("Marlin: ");
SERIAL_ECHOLNPGM(VERSION_STRING);
#ifdef STRING_VERSION_CONFIG_H
@ -331,9 +343,13 @@ void get_command()
serial_char = MYSERIAL.read();
if(serial_char == '\n' || serial_char == '\r' || serial_char == ':' || serial_count >= (MAX_CMD_SIZE - 1) )
{
if(!serial_count) return; //if empty line
if(!serial_count) { //if empty line
comment_mode = false; //for new command
return;
}
cmdbuffer[bufindw][serial_count] = 0; //terminate string
if(!comment_mode){
comment_mode = false; //for new command
fromsd[bufindw] = false;
if(strstr(cmdbuffer[bufindw], "N") != NULL)
{
@ -410,9 +426,7 @@ void get_command()
}
bufindw = (bufindw + 1)%BUFSIZE;
buflen += 1;
}
comment_mode = false; //for new command
serial_count = 0; //clear buffer
}
else
@ -446,10 +460,9 @@ void get_command()
card.checkautostart(true);
}
if(serial_char=='\n')
comment_mode = false; //for new command
if(!serial_count)
{
comment_mode = false; //for new command
return; //if empty line
}
cmdbuffer[bufindw][serial_count] = 0; //terminate string
@ -458,6 +471,7 @@ void get_command()
buflen += 1;
bufindw = (bufindw + 1)%BUFSIZE;
}
comment_mode = false; //for new command
serial_count = 0; //clear buffer
}
else
@ -476,10 +490,12 @@ float code_value()
{
return (strtod(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL));
}
long code_value_long()
{
return (strtol(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL, 10));
}
bool code_seen(char code_string[]) //Return True if the string was found
{
return (strstr(cmdbuffer[bufindr], code_string) != NULL);
@ -490,6 +506,7 @@ bool code_seen(char code)
strchr_pointer = strchr(cmdbuffer[bufindr], code);
return (strchr_pointer != NULL); //Return True if a character was found
}
#define HOMEAXIS(LETTER) \
if ((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))\
{ \
@ -498,22 +515,22 @@ bool code_seen(char code)
destination[LETTER##_AXIS] = 1.5 * LETTER##_MAX_LENGTH * LETTER##_HOME_DIR; \
feedrate = homing_feedrate[LETTER##_AXIS]; \
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
st_synchronize();\
\
current_position[LETTER##_AXIS] = 0;\
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);\
destination[LETTER##_AXIS] = -LETTER##_HOME_RETRACT_MM * LETTER##_HOME_DIR;\
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
st_synchronize();\
\
destination[LETTER##_AXIS] = 2*LETTER##_HOME_RETRACT_MM * LETTER##_HOME_DIR;\
feedrate = homing_feedrate[LETTER##_AXIS]/2 ; \
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
st_synchronize();\
\
current_position[LETTER##_AXIS] = (LETTER##_HOME_DIR == -1) ? 0 : LETTER##_MAX_LENGTH;\
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);\
current_position[LETTER##_AXIS] = (LETTER##_HOME_DIR == -1) ? LETTER##_HOME_POS : LETTER##_MAX_LENGTH;\
destination[LETTER##_AXIS] = current_position[LETTER##_AXIS];\
feedrate = 0.0;\
st_synchronize();\
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);\
endstops_hit_on_purpose();\
}
@ -567,7 +584,7 @@ void process_commands()
feedrate = 0.0;
home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
#ifdef QUICK_HOME
if( code_seen(axis_codes[0]) && code_seen(axis_codes[1]) ) //first diagonal move
if( code_seen(axis_codes[X_AXIS]) && code_seen(axis_codes[Y_AXIS]) ) //first diagonal move
{
current_position[X_AXIS] = 0;current_position[Y_AXIS] = 0;
@ -576,17 +593,17 @@ void process_commands()
feedrate = homing_feedrate[X_AXIS];
if(homing_feedrate[Y_AXIS]<feedrate)
feedrate =homing_feedrate[Y_AXIS];
prepare_move();
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
st_synchronize();
current_position[X_AXIS] = (X_HOME_DIR == -1) ? 0 : X_MAX_LENGTH;
current_position[Y_AXIS] = (Y_HOME_DIR == -1) ? 0 : Y_MAX_LENGTH;
current_position[X_AXIS] = (X_HOME_DIR == -1) ? X_HOME_POS : X_MAX_LENGTH;
current_position[Y_AXIS] = (Y_HOME_DIR == -1) ? Y_HOME_POS : Y_MAX_LENGTH;
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
destination[X_AXIS] = current_position[X_AXIS];
destination[Y_AXIS] = current_position[Y_AXIS];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
feedrate = 0.0;
st_synchronize();
plan_set_position(0, 0, current_position[Z_AXIS], current_position[E_AXIS]);
current_position[X_AXIS] = 0;current_position[Y_AXIS] = 0;
endstops_hit_on_purpose();
}
#endif
@ -606,16 +623,24 @@ void process_commands()
if(code_seen(axis_codes[X_AXIS]))
{
current_position[0]=code_value()+add_homeing[0];
if(code_value_long() != 0) {
current_position[X_AXIS]=code_value()+add_homeing[0];
}
}
if(code_seen(axis_codes[Y_AXIS])) {
current_position[1]=code_value()+add_homeing[1];
if(code_value_long() != 0) {
current_position[Y_AXIS]=code_value()+add_homeing[1];
}
}
if(code_seen(axis_codes[Z_AXIS])) {
current_position[2]=code_value()+add_homeing[2];
if(code_value_long() != 0) {
current_position[Z_AXIS]=code_value()+add_homeing[2];
}
}
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
#ifdef ENDSTOPS_ONLY_FOR_HOMING
enable_endstops(false);
#endif
@ -880,7 +905,6 @@ void process_commands()
}
manage_heater();
LCD_STATUS;
if(stop_heating_wait) break;
#ifdef TEMP_RESIDENCY_TIME
/* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
or when current temp falls outside the hysteresis after target temp was reached */
@ -1112,8 +1136,14 @@ void process_commands()
}
}
break;
case 221: // M221 S<factor in percent>- set extrude factor override percentage
{
if(code_seen('S'))
{
extrudemultiply = code_value() ;
}
}
break;
#ifdef PIDTEMP
case 301: // M301
@ -1265,11 +1295,10 @@ void get_arc_coordinates()
void prepare_move()
{
if (min_software_endstops) {
if (destination[X_AXIS] < 0) destination[X_AXIS] = 0.0;
if (destination[Y_AXIS] < 0) destination[Y_AXIS] = 0.0;
if (destination[Z_AXIS] < 0) destination[Z_AXIS] = 0.0;
if (destination[X_AXIS] < X_HOME_POS) destination[X_AXIS] = X_HOME_POS;
if (destination[Y_AXIS] < Y_HOME_POS) destination[Y_AXIS] = Y_HOME_POS;
if (destination[Z_AXIS] < Z_HOME_POS) destination[Z_AXIS] = Z_HOME_POS;
}
if (max_software_endstops) {

24
Marlin/Sanguino/cores/arduino/pins_arduino.c

@ -67,28 +67,28 @@
const uint8_t PROGMEM port_to_mode_PGM[] =
{
NOT_A_PORT,
&DDRA,
&DDRB,
&DDRC,
&DDRD,
(uint8_t) (uint16_t) &DDRA,
(uint8_t) (uint16_t) &DDRB,
(uint8_t) (uint16_t) &DDRC,
(uint8_t) (uint16_t) &DDRD,
};
const uint8_t PROGMEM port_to_output_PGM[] =
{
NOT_A_PORT,
&PORTA,
&PORTB,
&PORTC,
&PORTD,
(uint8_t) (uint16_t) &PORTA,
(uint8_t) (uint16_t) &PORTB,
(uint8_t) (uint16_t) &PORTC,
(uint8_t) (uint16_t) &PORTD,
};
const uint8_t PROGMEM port_to_input_PGM[] =
{
NOT_A_PORT,
&PINA,
&PINB,
&PINC,
&PIND,
(uint8_t) (uint16_t) &PINA,
(uint8_t) (uint16_t) &PINB,
(uint8_t) (uint16_t) &PINC,
(uint8_t) (uint16_t) &PIND,
};
const uint8_t PROGMEM digital_pin_to_port_PGM[] =

6
Marlin/Sanguino/cores/arduino/pins_arduino.h

@ -58,8 +58,8 @@ extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];
#define digitalPinToBitMask(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM + (P) ) )
#define digitalPinToTimer(P) ( pgm_read_byte( digital_pin_to_timer_PGM + (P) ) )
#define analogInPinToBit(P) (P)
#define portOutputRegister(P) ( (volatile uint8_t *)( pgm_read_byte( port_to_output_PGM + (P))) )
#define portInputRegister(P) ( (volatile uint8_t *)( pgm_read_byte( port_to_input_PGM + (P))) )
#define portModeRegister(P) ( (volatile uint8_t *)( pgm_read_byte( port_to_mode_PGM + (P))) )
#define portOutputRegister(P) ( (volatile uint8_t *)( (uint16_t) pgm_read_byte( port_to_output_PGM + (P))) )
#define portInputRegister(P) ( (volatile uint8_t *)( (uint16_t) pgm_read_byte( port_to_input_PGM + (P))) )
#define portModeRegister(P) ( (volatile uint8_t *)( (uint16_t) pgm_read_byte( port_to_mode_PGM + (P))) )
#endif

2
Marlin/Sanguino/cores/arduino/wiring_private.h

@ -27,7 +27,7 @@
#include <math.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/delay.h>
#include <util/delay.h>
#include <stdio.h>
#include <stdarg.h>

3
Marlin/cardreader.cpp

@ -447,9 +447,6 @@ void CardReader::printingHasFinished()
st_synchronize();
quickStop();
sdprinting = false;
#ifdef STOP_HEATING_WAIT_FOR_SD_PRINTING
stop_heating_wait=true;
#endif
if(SD_FINISHED_STEPPERRELEASE)
{
//finishAndDisableSteppers();

339
Marlin/language.h

@ -0,0 +1,339 @@
#ifndef LANGUAGE_H
#define LANGUAGE_H
// Languages
// 1 Custom (For you to add your own messages)
// 2 English
// 3 French (Waiting translation)
// 4 German (Waiting translation)
// 5 Etc
#define LANGUAGE_CHOICE 1 // Pick your language from the list above
#if LANGUAGE_CHOICE == 1
// LCD Menu Messages
#define WELCOME_MSG "RepRap Ready."
#define MSG_SD_INSERTED "Card Ready"
#define MSG_SD_REMOVED "Card Initiate"
#define MSG_MAIN " Main \003"
#define MSG_AUTOSTART " Autostart"
#define MSG_DISABLE_STEPPERS " Disable Steppers"
#define MSG_AUTO_HOME " Auto Home"
#define MSG_SET_ORIGIN " Set Origin"
#define MSG_PREHEAT_PLA " Preheat PLA"
#define MSG_PREHEAT_ABS " Preheat ABS"
#define MSG_COOLDOWN " Cooldown"
#define MSG_EXTRUDE " Extrude"
#define MSG_MOVE_AXIS " Move Axis \x7E"
#define MSG_SPEED " Speed:"
#define MSG_NOZZLE " \002Nozzle:"
#define MSG_BED " \002Bed:"
#define MSG_FAN_SPEED " Fan speed:"
#define MSG_FLOW " Flow:"
#define MSG_CONTROL " Control \003"
#define MSG_MIN " \002 Min:"
#define MSG_MAX " \002 Max:"
#define MSG_FACTOR " \002 Fact:"
#define MSG_AUTOTEMP " Autotemp:"
#define MSG_ON "On "
#define MSG_OFF "Off"
#define MSG_PID_P " PID-P: "
#define MSG_PID_I " PID-I: "
#define MSG_PID_D " PID-D: "
#define MSG_PID_C " PID-C: "
#define MSG_ACC " Acc:"
#define MSG_VXY_JERK " Vxy-jerk: "
#define MSG_VMAX " Vmax "
#define MSG_X "x:"
#define MSG_Y "y:"
#define MSG_Z "z:"
#define MSG_E "e:"
#define MSG_VMIN " Vmin:"
#define MSG_VTRAV_MIN " VTrav min:"
#define MSG_AMAX " Amax "
#define MSG_A_RETRACT " A-retract:"
#define MSG_XSTEPS " Xsteps/mm:"
#define MSG_YSTEPS " Ysteps/mm:"
#define MSG_ZSTEPS " Zsteps/mm:"
#define MSG_ESTEPS " Esteps/mm:"
#define MSG_MAIN_WIDE " Main \003"
#define MSG_TEMPERATURE_WIDE " Temperature \x7E"
#define MSG_MOTION_WIDE " Motion \x7E"
#define MSG_STORE_EPROM " Store EPROM"
#define MSG_LOAD_EPROM " Load EPROM"
#define MSG_RESTORE_FAILSAFE " Restore Failsafe"
#define MSG_REFRESH "\004Refresh"
#define MSG_WATCH " Watch \003"
#define MSG_PREPARE " Prepare \x7E"
#define MSG_CONTROL_ARROW " Control \x7E"
#define MSG_TUNE " Tune \x7E"
#define MSG_STOP_PRINT " Stop Print \x7E"
#define MSG_CARD_MENU " Card Menu \x7E"
#define MSG_NO_CARD " No Card"
#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Something is wrong in the MenuStructure."
#endif
#if LANGUAGE_CHOICE == 2
// LCD Menu Messages
#define WELCOME_MSG "UltiMARLIN Ready."
#define MSG_SD_INSERTED "Card inserted"
#define MSG_SD_REMOVED "Card removed"
#define MSG_MAIN " Main \003"
#define MSG_AUTOSTART " Autostart"
#define MSG_DISABLE_STEPPERS " Disable Steppers"
#define MSG_AUTO_HOME " Auto Home"
#define MSG_SET_ORIGIN " Set Origin"
#define MSG_PREHEAT " Preheat"
#define MSG_COOLDOWN " Cooldown"
#define MSG_EXTRUDE " Extrude"
#define MSG_MOVE_AXIS " Move Axis \x7E"
#define MSG_SPEED " Speed:"
#define MSG_NOZZLE " \002Nozzle:"
#define MSG_BED " \002Bed:"
#define MSG_FAN_SPEED " Fan speed:"
#define MSG_FLOW " Flow:"
#define MSG_CONTROL " Control \003"
#define MSG_MIN " \002 Min:"
#define MSG_MAX " \002 Max:"
#define MSG_FACTOR " \002 Fact:"
#define MSG_AUTOTEMP " Autotemp:"
#define MSG_ON "On "
#define MSG_OFF "Off"
#define MSG_PID_P " PID-P: "
#define MSG_PID_I " PID-I: "
#define MSG_PID_D " PID-D: "
#define MSG_PID_C " PID-C: "
#define MSG_ACC " Acc:"
#define MSG_VXY_JERK " Vxy-jerk: "
#define MSG_VMAX " Vmax "
#define MSG_X "x:"
#define MSG_Y "y:"
#define MSG_Z "z:"
#define MSG_E "e:"
#define MSG_VMIN " Vmin:"
#define MSG_VTRAV_MIN " VTrav min:"
#define MSG_AMAX " Amax "
#define MSG_A_RETRACT " A-retract:"
#define MSG_XSTEPS " Xsteps/mm:"
#define MSG_YSTEPS " Ysteps/mm:"
#define MSG_ZSTEPS " Zsteps/mm:"
#define MSG_ESTEPS " Esteps/mm:"
#define MSG_MAIN_WIDE " Main \003"
#define MSG_TEMPERATURE_WIDE " Temperature \x7E"
#define MSG_MOTION_WIDE " Motion \x7E"
#define MSG_STORE_EPROM " Store EPROM"
#define MSG_LOAD_EPROM " Load EPROM"
#define MSG_RESTORE_FAILSAFE " Restore Failsafe"
#define MSG_REFRESH "\004Refresh"
#define MSG_WATCH " Watch \003"
#define MSG_PREPARE " Prepare \x7E"
#define MSG_CONTROL_ARROW " Control \x7E"
#define MSG_TUNE " Tune \x7E"
#define MSG_STOP_PRINT " Stop Print \x7E"
#define MSG_CARD_MENU " Card Menu \x7E"
#define MSG_NO_CARD " No Card"
#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Something is wrong in the MenuStructure."
#endif
#if LANGUAGE_CHOICE == 3
// LCD Menu Messages
#define WELCOME_MSG "RepRap Ready."
#define MSG_SD_INSERTED "Card Ready"
#define MSG_SD_REMOVED "Card Initiate"
#define MSG_MAIN " Main \003"
#define MSG_AUTOSTART " Autostart"
#define MSG_DISABLE_STEPPERS " Disable Steppers"
#define MSG_AUTO_HOME " Auto Home"
#define MSG_SET_ORIGIN " Set Origin"
#define MSG_PREHEAT " Preheat"
#define MSG_COOLDOWN " Cooldown"
#define MSG_EXTRUDE " Extrude"
#define MSG_MOVE_AXIS " Move Axis \x7E"
#define MSG_SPEED " Speed:"
#define MSG_NOZZLE " \002Nozzle:"
#define MSG_BED " \002Bed:"
#define MSG_FAN_SPEED " Fan speed:"
#define MSG_FLOW " Flow:"
#define MSG_CONTROL " Control \003"
#define MSG_MIN " \002 Min:"
#define MSG_MAX " \002 Max:"
#define MSG_FACTOR " \002 Fact:"
#define MSG_AUTOTEMP " Autotemp:"
#define MSG_ON "On "
#define MSG_OFF "Off"
#define MSG_PID_P " PID-P: "
#define MSG_PID_I " PID-I: "
#define MSG_PID_D " PID-D: "
#define MSG_PID_C " PID-C: "
#define MSG_ACC " Acc:"
#define MSG_VXY_JERK " Vxy-jerk: "
#define MSG_VMAX " Vmax "
#define MSG_X "x:"
#define MSG_Y "y:"
#define MSG_Z "z:"
#define MSG_E "e:"
#define MSG_VMIN " Vmin:"
#define MSG_VTRAV_MIN " VTrav min:"
#define MSG_AMAX " Amax "
#define MSG_A_RETRACT " A-retract:"
#define MSG_XSTEPS " Xsteps/mm:"
#define MSG_YSTEPS " Ysteps/mm:"
#define MSG_ZSTEPS " Zsteps/mm:"
#define MSG_ESTEPS " Esteps/mm:"
#define MSG_MAIN_WIDE " Main \003"
#define MSG_TEMPERATURE_WIDE " Temperature \x7E"
#define MSG_MOTION_WIDE " Motion \x7E"
#define MSG_STORE_EPROM " Store EPROM"
#define MSG_LOAD_EPROM " Load EPROM"
#define MSG_RESTORE_FAILSAFE " Restore Failsafe"
#define MSG_REFRESH "\004Refresh"
#define MSG_WATCH " Watch \003"
#define MSG_PREPARE " Prepare \x7E"
#define MSG_CONTROL_ARROW " Control \x7E"
#define MSG_TUNE " Tune \x7E"
#define MSG_STOP_PRINT " Stop Print \x7E"
#define MSG_CARD_MENU " Card Menu \x7E"
#define MSG_NO_CARD " No Card"
#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Something is wrong in the MenuStructure."
#endif
#if LANGUAGE_CHOICE == 4
// LCD Menu Messages
#define WELCOME_MSG "RepRap Ready."
#define MSG_SD_INSERTED "Card Ready"
#define MSG_SD_REMOVED "Card Initiate"
#define MSG_MAIN " Main \003"
#define MSG_AUTOSTART " Autostart"
#define MSG_DISABLE_STEPPERS " Disable Steppers"
#define MSG_AUTO_HOME " Auto Home"
#define MSG_SET_ORIGIN " Set Origin"
#define MSG_PREHEAT " Preheat"
#define MSG_COOLDOWN " Cooldown"
#define MSG_EXTRUDE " Extrude"
#define MSG_MOVE_AXIS " Move Axis \x7E"
#define MSG_SPEED " Speed:"
#define MSG_NOZZLE " \002Nozzle:"
#define MSG_BED " \002Bed:"
#define MSG_FAN_SPEED " Fan speed:"
#define MSG_FLOW " Flow:"
#define MSG_CONTROL " Control \003"
#define MSG_MIN " \002 Min:"
#define MSG_MAX " \002 Max:"
#define MSG_FACTOR " \002 Fact:"
#define MSG_AUTOTEMP " Autotemp:"
#define MSG_ON "On "
#define MSG_OFF "Off"
#define MSG_PID_P " PID-P: "
#define MSG_PID_I " PID-I: "
#define MSG_PID_D " PID-D: "
#define MSG_PID_C " PID-C: "
#define MSG_ACC " Acc:"
#define MSG_VXY_JERK " Vxy-jerk: "
#define MSG_VMAX " Vmax "
#define MSG_X "x:"
#define MSG_Y "y:"
#define MSG_Z "z:"
#define MSG_E "e:"
#define MSG_VMIN " Vmin:"
#define MSG_VTRAV_MIN " VTrav min:"
#define MSG_AMAX " Amax "
#define MSG_A_RETRACT " A-retract:"
#define MSG_XSTEPS " Xsteps/mm:"
#define MSG_YSTEPS " Ysteps/mm:"
#define MSG_ZSTEPS " Zsteps/mm:"
#define MSG_ESTEPS " Esteps/mm:"
#define MSG_MAIN_WIDE " Main \003"
#define MSG_TEMPERATURE_WIDE " Temperature \x7E"
#define MSG_MOTION_WIDE " Motion \x7E"
#define MSG_STORE_EPROM " Store EPROM"
#define MSG_LOAD_EPROM " Load EPROM"
#define MSG_RESTORE_FAILSAFE " Restore Failsafe"
#define MSG_REFRESH "\004Refresh"
#define MSG_WATCH " Watch \003"
#define MSG_PREPARE " Prepare \x7E"
#define MSG_CONTROL_ARROW " Control \x7E"
#define MSG_TUNE " Tune \x7E"
#define MSG_STOP_PRINT " Stop Print \x7E"
#define MSG_CARD_MENU " Card Menu \x7E"
#define MSG_NO_CARD " No Card"
#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Something is wrong in the MenuStructure."
#endif
#if LANGUAGE_CHOICE == 5
// LCD Menu Messages
#define WELCOME_MSG "RepRap Ready."
#define MSG_SD_INSERTED "Card Ready"
#define MSG_SD_REMOVED "Card Initiate"
#define MSG_MAIN " Main \003"
#define MSG_AUTOSTART " Autostart"
#define MSG_DISABLE_STEPPERS " Disable Steppers"
#define MSG_AUTO_HOME " Auto Home"
#define MSG_SET_ORIGIN " Set Origin"
#define MSG_PREHEAT " Preheat"
#define MSG_COOLDOWN " Cooldown"
#define MSG_EXTRUDE " Extrude"
#define MSG_MOVE_AXIS " Move Axis \x7E"
#define MSG_SPEED " Speed:"
#define MSG_NOZZLE " \002Nozzle:"
#define MSG_BED " \002Bed:"
#define MSG_FAN_SPEED " Fan speed:"
#define MSG_FLOW " Flow:"
#define MSG_CONTROL " Control \003"
#define MSG_MIN " \002 Min:"
#define MSG_MAX " \002 Max:"
#define MSG_FACTOR " \002 Fact:"
#define MSG_AUTOTEMP " Autotemp:"
#define MSG_ON "On "
#define MSG_OFF "Off"
#define MSG_PID_P " PID-P: "
#define MSG_PID_I " PID-I: "
#define MSG_PID_D " PID-D: "
#define MSG_PID_C " PID-C: "
#define MSG_ACC " Acc:"
#define MSG_VXY_JERK " Vxy-jerk: "
#define MSG_VMAX " Vmax "
#define MSG_X "x:"
#define MSG_Y "y:"
#define MSG_Z "z:"
#define MSG_E "e:"
#define MSG_VMIN " Vmin:"
#define MSG_VTRAV_MIN " VTrav min:"
#define MSG_AMAX " Amax "
#define MSG_A_RETRACT " A-retract:"
#define MSG_XSTEPS " Xsteps/mm:"
#define MSG_YSTEPS " Ysteps/mm:"
#define MSG_ZSTEPS " Zsteps/mm:"
#define MSG_ESTEPS " Esteps/mm:"
#define MSG_MAIN_WIDE " Main \003"
#define MSG_TEMPERATURE_WIDE " Temperature \x7E"
#define MSG_MOTION_WIDE " Motion \x7E"
#define MSG_STORE_EPROM " Store EPROM"
#define MSG_LOAD_EPROM " Load EPROM"
#define MSG_RESTORE_FAILSAFE " Restore Failsafe"
#define MSG_REFRESH "\004Refresh"
#define MSG_WATCH " Watch \003"
#define MSG_PREPARE " Prepare \x7E"
#define MSG_CONTROL_ARROW " Control \x7E"
#define MSG_TUNE " Tune \x7E"
#define MSG_STOP_PRINT " Stop Print \x7E"
#define MSG_CARD_MENU " Card Menu \x7E"
#define MSG_NO_CARD " No Card"
#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Something is wrong in the MenuStructure."
#endif
#endif // ifndef LANGUAGE_H

12
Marlin/motion_control.cpp

@ -122,6 +122,18 @@ void mc_arc(float *position, float *target, float *offset, uint8_t axis_0, uint8
arc_target[axis_1] = center_axis1 + r_axis1;
arc_target[axis_linear] += linear_per_segment;
arc_target[E_AXIS] += extruder_per_segment;
if (min_software_endstops) {
if (arc_target[X_AXIS] < X_HOME_POS) arc_target[X_AXIS] = X_HOME_POS;
if (arc_target[Y_AXIS] < Y_HOME_POS) arc_target[Y_AXIS] = Y_HOME_POS;
if (arc_target[Z_AXIS] < Z_HOME_POS) arc_target[Z_AXIS] = Z_HOME_POS;
}
if (max_software_endstops) {
if (arc_target[X_AXIS] > X_MAX_LENGTH) arc_target[X_AXIS] = X_MAX_LENGTH;
if (arc_target[Y_AXIS] > Y_MAX_LENGTH) arc_target[Y_AXIS] = Y_MAX_LENGTH;
if (arc_target[Z_AXIS] > Z_MAX_LENGTH) arc_target[Z_AXIS] = Z_MAX_LENGTH;
}
plan_buffer_line(arc_target[X_AXIS], arc_target[Y_AXIS], arc_target[Z_AXIS], arc_target[E_AXIS], feed_rate, extruder);
}

592
Marlin/pins.h

@ -45,225 +45,195 @@
#endif /* 99 */
/****************************************************************************************
* Arduino pin assignment
* Gen7 v1.1, v1.2, v1.3, v1.4 pin assignment
*
* ATMega168
* +-\/-+
* PC6 1| |28 PC5 (AI 5 / D19)
* (D 0) PD0 2| |27 PC4 (AI 4 / D18)
* (D 1) PD1 3| |26 PC3 (AI 3 / D17)
* (D 2) PD2 4| |25 PC2 (AI 2 / D16)
* PWM+ (D 3) PD3 5| |24 PC1 (AI 1 / D15)
* (D 4) PD4 6| |23 PC0 (AI 0 / D14)
* VCC 7| |22 GND
* GND 8| |21 AREF
* PB6 9| |20 AVCC
* PB7 10| |19 PB5 (D 13)
* PWM+ (D 5) PD5 11| |18 PB4 (D 12)
* PWM+ (D 6) PD6 12| |17 PB3 (D 11) PWM
* (D 7) PD7 13| |16 PB2 (D 10) PWM
* (D 8) PB0 14| |15 PB1 (D 9) PWM
* +----+
****************************************************************************************/
#if MOTHERBOARD == 0
#define KNOWN_BOARD 1
#ifndef __AVR_ATmega168__
#error Oops! Make sure you have 'Arduino Diecimila' selected from the boards menu.
#endif
#define X_STEP_PIN 2
#define X_DIR_PIN 3
#define X_ENABLE_PIN -1
#define X_MIN_PIN 4
#define X_MAX_PIN 9
#define Y_STEP_PIN 10
#define Y_DIR_PIN 7
#define Y_ENABLE_PIN -1
#define Y_MIN_PIN 8
#define Y_MAX_PIN 13
#define Z_STEP_PIN 19
#define Z_DIR_PIN 18
#define Z_ENABLE_PIN 5
#define Z_MIN_PIN 17
#define Z_MAX_PIN 16
#define E0_STEP_PIN 11
#define E0_DIR_PIN 12
#define E0_ENABLE_PIN -1
#define SDPOWER -1
#define SDSS -1
#define LED_PIN -1
#define FAN_PIN -1
#define PS_ON_PIN 15
#define KILL_PIN -1
#if MOTHERBOARD == 13
#define MOTHERBOARD 11
#define GEN7_VERSION 14 // v1.4
#endif
#define HEATER_0_PIN 6
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define TEMP_0_PIN 0 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
#define TEMP_1_PIN -1 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
#define TEMP_2_PIN -1 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
#define HEATER_BED_PIN -1
#define TEMP_BED_PIN -1
#if MOTHERBOARD == 12
#define MOTHERBOARD 11
#define GEN7_VERSION 13 // v1.3
#endif
#if MOTHERBOARD == 11
#define KNOWN_BOARD
#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega1284P__)
#error Oops! Make sure you have 'Gen7' selected from the 'Tools -> Boards' menu.
/****************************************************************************************
* Sanguino/RepRap Motherboard with direct-drive extruders
*
* ATMega644P
*
* +---\/---+
* (D 0) PB0 1| |40 PA0 (AI 0 / D31)
* (D 1) PB1 2| |39 PA1 (AI 1 / D30)
* INT2 (D 2) PB2 3| |38 PA2 (AI 2 / D29)
* PWM (D 3) PB3 4| |37 PA3 (AI 3 / D28)
* PWM (D 4) PB4 5| |36 PA4 (AI 4 / D27)
* MOSI (D 5) PB5 6| |35 PA5 (AI 5 / D26)
* MISO (D 6) PB6 7| |34 PA6 (AI 6 / D25)
* SCK (D 7) PB7 8| |33 PA7 (AI 7 / D24)
* RST 9| |32 AREF
* VCC 10| |31 GND
* GND 11| |30 AVCC
* XTAL2 12| |29 PC7 (D 23)
* XTAL1 13| |28 PC6 (D 22)
* RX0 (D 8) PD0 14| |27 PC5 (D 21) TDI
* TX0 (D 9) PD1 15| |26 PC4 (D 20) TDO
* INT0 RX1 (D 10) PD2 16| |25 PC3 (D 19) TMS
* INT1 TX1 (D 11) PD3 17| |24 PC2 (D 18) TCK
* PWM (D 12) PD4 18| |23 PC1 (D 17) SDA
* PWM (D 13) PD5 19| |22 PC0 (D 16) SCL
* PWM (D 14) PD6 20| |21 PD7 (D 15) PWM
* +--------+
*
****************************************************************************************/
#if MOTHERBOARD == 1
#define KNOWN_BOARD 1
#endif
#ifndef __AVR_ATmega644P__
#error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
#ifndef GEN7_VERSION
#define GEN7_VERSION 12 // v1.x
#endif
#define X_STEP_PIN 15
//x axis pins
#define X_STEP_PIN 19
#define X_DIR_PIN 18
#define X_ENABLE_PIN 19
#define X_MIN_PIN 20
#define X_MAX_PIN 21
#define X_ENABLE_PIN 24
#define X_MIN_PIN 7
#define X_MAX_PIN -1
//y axis pins
#define Y_STEP_PIN 23
#define Y_DIR_PIN 22
#define Y_ENABLE_PIN 19
#define Y_MIN_PIN 25
#define Y_MAX_PIN 26
#define Y_ENABLE_PIN 24
#define Y_MIN_PIN 5
#define Y_MAX_PIN -1
#define Z_STEP_PIN 29
#define Z_DIR_PIN 30
#define Z_ENABLE_PIN 31
#define Z_MIN_PIN 2
#define Z_MAX_PIN 1
//z axis pins
#define Z_STEP_PIN 26
#define Z_DIR_PIN 25
#define Z_ENABLE_PIN 24
#define Z_MIN_PIN 1
#define Z_MAX_PIN 0
#define E0_STEP_PIN 12
#define E0_DIR_PIN 16
#define E0_ENABLE_PIN 3
//extruder pins
#define E0_STEP_PIN 28
#define E0_DIR_PIN 27
#define E0_ENABLE_PIN 24
#define SDPOWER -1
#define SDSS -1
#define LED_PIN 0
#define FAN_PIN -1
#define PS_ON_PIN -1
#define KILL_PIN -1
#define TEMP_0_PIN 1
#define TEMP_1_PIN -1
#define TEMP_2_PIN -1
#define TEMP_BED_PIN 2
#define HEATER_0_PIN 14
#define HEATER_0_PIN 4
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define TEMP_0_PIN 4 //D27 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
#define TEMP_1_PIN -1
#define TEMP_2_PIN -1
#define HEATER_BED_PIN -1
#define TEMP_BED_PIN -1
/* Unused (1) (2) (3) 4 5 6 7 8 9 10 11 12 13 (14) (15) (16) 17 (18) (19) (20) (21) (22) (23) 24 (25) (26) (27) 28 (29) (30) (31) */
#define HEATER_BED_PIN 3
#define SDPOWER -1
#define SDSS -1 // SCL pin of I2C header
#define LED_PIN -1
#if (GEN7_VERSION >= 13)
// Gen7 v1.3 removed the fan pin
#define FAN_PIN -1
#else
#define FAN_PIN 31
#endif
#define PS_ON_PIN 15
#if (GEN7_VERSION < 14)
// Gen 1.3 and earlier supplied thermistor power via PS_ON
// Need to ignore the bad thermistor readings on those units
#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
#endif
/****************************************************************************************
* RepRap Motherboard ****---NOOOOOO RS485/EXTRUDER CONTROLLER!!!!!!!!!!!!!!!!!---*******
//our pin for debugging.
#define DEBUG_PIN 0
//our RS485 pins
#define TX_ENABLE_PIN 12
#define RX_ENABLE_PIN 13
#endif
/*******************************************************************************
*********
* Gen7 Alfons3 pin assignment
*
****************************************************************************************/
#if MOTHERBOARD == 2
#define KNOWN_BOARD 1
********************************************************************************
********/
/* These Pins are assigned for the modified GEN7 Board from Alfons3 Please review the pins and adjust it for your needs*/
#if MOTHERBOARD == 10
#define KNOWN_BOARD
#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega1284P__)
#error Oops! Make sure you have 'Gen7' selected from the 'Tools -> Boards' menu.
#ifndef __AVR_ATmega644P__
#error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
#endif
#define X_STEP_PIN 15
#define X_DIR_PIN 18
#define X_ENABLE_PIN 19
#define X_MIN_PIN 20
#define X_MAX_PIN 21
//x axis pins
#define X_STEP_PIN 21 //different from stanard GEN7
#define X_DIR_PIN 20 //different from stanard GEN7
#define X_ENABLE_PIN 24
#define X_MIN_PIN 0
#define X_MAX_PIN -1
#define Y_STEP_PIN 23
#define Y_DIR_PIN 22
#define Y_ENABLE_PIN 24
#define Y_MIN_PIN 25
#define Y_MAX_PIN 26
//y axis pins
#define Y_STEP_PIN 23
#define Y_DIR_PIN 22
#define Y_ENABLE_PIN 24
#define Y_MIN_PIN 1
#define Y_MAX_PIN -1
#define Z_STEP_PINN 27
#define Z_DIR_PINN 28
#define Z_ENABLE_PIN 29
#define Z_MIN_PIN 30
#define Z_MAX_PIN 31
//z axis pins
#define Z_STEP_PIN 26
#define Z_DIR_PIN 25
#define Z_ENABLE_PIN 24
#define Z_MIN_PIN 2
#define Z_MAX_PIN -1
#define E0_STEP_PIN 17
#define E0_DIR_PIN 16
#define E0_ENABLE_PIN -1
//extruder pins
#define E0_STEP_PIN 28
#define E0_DIR_PIN 27
#define E0_ENABLE_PIN 24
#define SDPOWER -1
#define SDSS 4
#define LED_PIN 0
#define TEMP_0_PIN 2
#define TEMP_1_PIN -1
#define TEMP_2_PIN -1
#define TEMP_BED_PIN 1 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 34 bed)
#define SD_CARD_WRITE 2
#define SD_CARD_DETECT 3
#define SD_CARD_SELECT 4
#define HEATER_0_PIN 4
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define HEATER_BED_PIN 3 // (bed)
//our RS485 pins
#define TX_ENABLE_PIN 12
#define RX_ENABLE_PIN 13
#define SDPOWER -1
#define SDSS 31 // SCL pin of I2C header || CS Pin for SD Card support
#define LED_PIN -1
//pin for controlling the PSU.
#define PS_ON_PIN 14
#define FAN_PIN -1
#define PS_ON_PIN 19
//our pin for debugging.
#define FAN_PIN -1
#define KILL_PIN -1
#define DEBUG_PIN -1
#define HEATER_0_PIN -1
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define TEMP_0_PIN -1 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
#define TEMP_1_PIN -1
#define TEMP_2_PIN -1
#define HEATER_BED_PIN -1
#define TEMP_BED_PIN -1
//our RS485 pins
//#define TX_ENABLE_PIN 12
//#define RX_ENABLE_PIN 13
#define BEEPER -1
#define SDCARDDETECT -1
#define SUICIDE_PIN -1 //has to be defined; otherwise Power_off doesn't work
//Pins for 4bit LCD Support
#define LCD_PINS_RS 18
#define LCD_PINS_ENABLE 17
#define LCD_PINS_D4 16
#define LCD_PINS_D5 15
#define LCD_PINS_D6 13
#define LCD_PINS_D7 14
//buttons are directly attached
#define BTN_EN1 11
#define BTN_EN2 10
#define BTN_ENC 12 //the click
#define BLEN_C 2
#define BLEN_B 1
#define BLEN_A 0
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#endif
/****************************************************************************************
* Arduino Mega pin assignment
*
****************************************************************************************/
#if MOTHERBOARD == 33
#define MOTHERBOARD 3
#define RAMPS_V_1_3
#endif
#if MOTHERBOARD == 3
#if MOTHERBOARD == 3 || MOTHERBOARD == 33 || MOTHERBOARD == 34
#define KNOWN_BOARD 1
//////////////////FIX THIS//////////////
@ -277,7 +247,7 @@
// #define RAMPS_V_1_3
// #define RAMPS_V_1_0
#ifdef RAMPS_V_1_3
#ifdef MOTHERBOARD == 33 || MOTHERBOARD == 34
#define X_STEP_PIN 54
#define X_DIR_PIN 55
@ -295,7 +265,7 @@
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19 //19
#define Z_MAX_PIN 19
#define E0_STEP_PIN 26
#define E0_DIR_PIN 28
@ -308,19 +278,96 @@
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13
#define FAN_PIN 4
#if MOTHERBOARD == 33
#define FAN_PIN 9 // (Sprinter config)
#else
#define FAN_PIN 4 // IO pin. Buffer needed
#endif
#define PS_ON_PIN 12
#define KILL_PIN -1
#define HEATER_0_PIN 10 // EXTRUDER 1
#define HEATER_1_PIN 9 // EXTRUDER 2
#define HEATER_2_PIN -1 // EXTRUDER 2
#if MOTHERBOARD == 33
#define HEATER_1_PIN -1
#else
#define HEATER_1_PIN 9 // EXTRUDER 2 (FAN On Sprinter)
#endif
#define HEATER_2_PIN -1
#define TEMP_0_PIN 13 // ANALOG NUMBERING
#define TEMP_1_PIN 15 // ANALOG NUMBERING
#define TEMP_2_PIN -1 // ANALOG NUMBERING
#define HEATER_BED_PIN 8 // BED
#define TEMP_BED_PIN 14 // ANALOG NUMBERING
#ifdef ULTRA_LCD
#ifdef NEWPANEL
//arduino pin which triggers an piezzo beeper
#define BEEPER 33 // Beeper on AUX-4
#define LCD_PINS_RS 16
#define LCD_PINS_ENABLE 17
#define LCD_PINS_D4 23
#define LCD_PINS_D5 25
#define LCD_PINS_D6 27
#define LCD_PINS_D7 29
//buttons are directly attached using AUX-2
#define BTN_EN1 44
#define BTN_EN2 42
#define BTN_ENC 64 //the click
#define BLEN_C 2
#define BLEN_B 1
#define BLEN_A 0
#define SDCARDDETECT 31 // Ramps does not use this port
//encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#else //old style panel with shift register
//arduino pin witch triggers an piezzo beeper
#define BEEPER 33 No Beeper added
//buttons are attached to a shift register
// Not wired this yet
//#define SHIFT_CLK 38
//#define SHIFT_LD 42
//#define SHIFT_OUT 40
//#define SHIFT_EN 17
#define LCD_PINS_RS 16
#define LCD_PINS_ENABLE 17
#define LCD_PINS_D4 23
#define LCD_PINS_D5 25
#define LCD_PINS_D6 27
#define LCD_PINS_D7 29
//encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
//bits in the shift register that carry the buttons for:
// left up center down right red
#define BL_LE 7
#define BL_UP 6
#define BL_MI 5
#define BL_DW 4
#define BL_RI 3
#define BL_ST 2
#define BLEN_B 1
#define BLEN_A 0
#endif
#endif //ULTRA_LCD
#else // RAMPS_V_1_1 or RAMPS_V_1_2 as default
@ -440,11 +487,13 @@
* Gen6 pin assignment
*
****************************************************************************************/
#if MOTHERBOARD == 5
#if MOTHERBOARD == 5 || MOTHERBOARD == 51
#define KNOWN_BOARD 1
#ifndef __AVR_ATmega644P__
#error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
#ifndef __AVR_ATmega1284P__
#error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
#endif
#endif
//x axis pins
@ -474,13 +523,19 @@
#define E0_ENABLE_PIN 3 //Added @ EJE Electronics 20100715
#define TEMP_0_PIN 5 //changed @ rkoeppl 20110410
#define TEMP_1_PIN -1 //changed @ rkoeppl 20110410
#define TEMP_2_PIN -1 //changed @ rkoeppl 20110410
#define HEATER_0_PIN 14 //changed @ rkoeppl 20110410
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#if MOTHERBOARD == 5
#define HEATER_BED_PIN -1 //changed @ rkoeppl 20110410
#define TEMP_BED_PIN -1 //changed @ rkoeppl 20110410
#else
#define HEATER_BED_PIN 1 //changed @ rkoeppl 20110410
#define TEMP_BED_PIN 0 //changed @ rkoeppl 20110410
#endif
#define SDPOWER -1
#define SDSS 17
#define LED_PIN -1 //changed @ rkoeppl 20110410
@ -502,14 +557,17 @@
*
****************************************************************************************/
#if MOTHERBOARD == 62
#undef MOTHERBOARD
#define MOTHERBOARD 6
#define SANGUINOLOLU_V_1_2
#endif
#if MOTHERBOARD == 6
#define KNOWN_BOARD 1
#ifndef __AVR_ATmega644P__
#ifndef __AVR_ATmega1284P__
#error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
#endif
#endif
#define X_STEP_PIN 15
#define X_DIR_PIN 21
@ -567,180 +625,6 @@
#endif
/****************************************************************************************
* Gen7 v1.1, v1.2, v1.3 pin assignment
*
****************************************************************************************/
#if MOTHERBOARD == 79
#define MOTHERBOARD 78
#define GEN7_V_1_3
#endif
#if MOTHERBOARD == 78
#define KNOWN_BOARD
#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega1284P__)
#error Oops! Make sure you have 'Gen7' selected from the 'Tools -> Boards' menu.
#endif
//x axis pins
#define X_STEP_PIN 19
#define X_DIR_PIN 18
#define X_ENABLE_PIN 24
#define X_MIN_PIN 7
#define X_MAX_PIN -1
//y axis pins
#define Y_STEP_PIN 23
#define Y_DIR_PIN 22
#define Y_ENABLE_PIN 24
#define Y_MIN_PIN 5
#define Y_MAX_PIN -1
//z axis pins
#define Z_STEP_PIN 26
#define Z_DIR_PIN 25
#define Z_ENABLE_PIN 24
#define Z_MIN_PIN 1
#define Z_MAX_PIN -1
//extruder pins
#define E0_STEP_PIN 28
#define E0_DIR_PIN 27
#define E0_ENABLE_PIN 24
#define TEMP_0_PIN 1
#define TEMP_1_PIN -1
#define TEMP_2_PIN -1
#define TEMP_BED_PIN 2
#define HEATER_0_PIN 4
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define HEATER_BED_PIN 3
#define SDPOWER -1
#define SDSS -1 // SCL pin of I2C header
#define LED_PIN -1
#ifdef GEN7_V_1_3
// Gen7 v1.3 removed the fan pin
#define FAN_PIN -1
#else
#define FAN_PIN 31
#endif
#define PS_ON_PIN 15
//our pin for debugging.
#define DEBUG_PIN 0
//our RS485 pins
#define TX_ENABLE_PIN 12
#define RX_ENABLE_PIN 13
#endif
/*******************************************************************************
*********
* Gen7 Alfons3 pin assignment
*
********************************************************************************
********/
/* These Pins are assigned for the modified GEN7 Board from Alfons3 Please review the pins and adjust it for your needs*/
#if MOTHERBOARD == 77
#define KNOWN_BOARD
#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega1284P__)
#error Oops! Make sure you have 'Gen7' selected from the 'Tools -> Boards' menu.
#endif
//x axis pins
#define X_STEP_PIN 21 //different from stanard GEN7
#define X_DIR_PIN 20 //different from stanard GEN7
#define X_ENABLE_PIN 24
#define X_MIN_PIN 0
#define X_MAX_PIN -1
//y axis pins
#define Y_STEP_PIN 23
#define Y_DIR_PIN 22
#define Y_ENABLE_PIN 24
#define Y_MIN_PIN 1
#define Y_MAX_PIN -1
//z axis pins
#define Z_STEP_PIN 26
#define Z_DIR_PIN 25
#define Z_ENABLE_PIN 24
#define Z_MIN_PIN 2
#define Z_MAX_PIN -1
//extruder pins
#define E0_STEP_PIN 28
#define E0_DIR_PIN 27
#define E0_ENABLE_PIN 24
#define TEMP_0_PIN 2
#define TEMP_1_PIN -1
#define TEMP_2_PIN -1
#define TEMP_BED_PIN 1 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 34 bed)
#define HEATER_0_PIN 4
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define HEATER_BED_PIN 3 // (bed)
#define SDPOWER -1
#define SDSS 31 // SCL pin of I2C header || CS Pin for SD Card support
#define LED_PIN -1
#define FAN_PIN -1
#define PS_ON_PIN 19
//our pin for debugging.
#define DEBUG_PIN -1
//our RS485 pins
//#define TX_ENABLE_PIN 12
//#define RX_ENABLE_PIN 13
#define BEEPER -1
#define SDCARDDETECT -1
#define SUICIDE_PIN -1 //has to be defined; otherwise Power_off doesn't work
//Pins for 4bit LCD Support
#define LCD_PINS_RS 18
#define LCD_PINS_ENABLE 17
#define LCD_PINS_D4 16
#define LCD_PINS_D5 15
#define LCD_PINS_D6 13
#define LCD_PINS_D7 14
//buttons are directly attached
#define BTN_EN1 11
#define BTN_EN2 10
#define BTN_ENC 12 //the click
#define BLEN_C 2
#define BLEN_B 1
#define BLEN_A 0
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#endif
#if MOTHERBOARD == 7
#define KNOWN_BOARD
@ -1003,8 +887,10 @@
#define MOTHERBOARD 6
#define KNOWN_BOARD 1
#ifndef __AVR_ATmega644P__
#ifndef __AVR_ATmega1284P__
#error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
#endif
#endif
#define X_STEP_PIN 15
#define X_DIR_PIN 18

21
Marlin/planner.cpp

@ -81,6 +81,8 @@ long position[4]; //rescaled from extern when axis_steps_per_unit are changed
static float previous_speed[4]; // Speed of previous path line segment
static float previous_nominal_speed; // Nominal speed of previous path line segment
extern volatile int extrudemultiply; // Sets extrude multiply factor (in percent)
#ifdef AUTOTEMP
float autotemp_max=250;
float autotemp_min=210;
@ -439,7 +441,7 @@ float junction_deviation = 0.1;
// Add a new linear movement to the buffer. steps_x, _y and _z is the absolute position in
// mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration
// calculation the caller must also provide the physical length of the line in millimeters.
void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder)
void plan_buffer_line(float &x, float &y, float &z, float &e, float feed_rate, uint8_t &extruder)
{
// Calculate the buffer head after we push this byte
int next_buffer_head = next_block_index(block_buffer_head);
@ -488,6 +490,8 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
block->steps_y = labs(target[Y_AXIS]-position[Y_AXIS]);
block->steps_z = labs(target[Z_AXIS]-position[Z_AXIS]);
block->steps_e = labs(target[E_AXIS]-position[E_AXIS]);
block->steps_e *= extrudemultiply;
block->steps_e /= 100;
block->step_event_count = max(block->steps_x, max(block->steps_y, max(block->steps_z, block->steps_e)));
// Bail if this is a zero-length block
@ -512,11 +516,18 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
// Enable all
if(block->steps_e != 0) { enable_e0();enable_e1();enable_e2(); }
// slow down when de buffer starts to empty, rather than wait at the corner for a buffer refill
int moves_queued=(block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
#ifdef SLOWDOWN
if(moves_queued < (BLOCK_BUFFER_SIZE * 0.5) && moves_queued > 1) feed_rate = feed_rate*moves_queued / (BLOCK_BUFFER_SIZE * 0.5);
#endif
float delta_mm[4];
delta_mm[X_AXIS] = (target[X_AXIS]-position[X_AXIS])/axis_steps_per_unit[X_AXIS];
delta_mm[Y_AXIS] = (target[Y_AXIS]-position[Y_AXIS])/axis_steps_per_unit[Y_AXIS];
delta_mm[Z_AXIS] = (target[Z_AXIS]-position[Z_AXIS])/axis_steps_per_unit[Z_AXIS];
delta_mm[E_AXIS] = (target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS];
delta_mm[E_AXIS] = ((target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS])*extrudemultiply/100.0;
if ( block->steps_x == 0 && block->steps_y == 0 && block->steps_z == 0 ) {
block->millimeters = abs(delta_mm[E_AXIS]);
} else {
@ -537,12 +548,6 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
if(feed_rate<minimumfeedrate) feed_rate=minimumfeedrate;
}
// slow down when de buffer starts to empty, rather than wait at the corner for a buffer refill
int moves_queued=(block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
#ifdef SLOWDOWN
if(moves_queued < (BLOCK_BUFFER_SIZE * 0.5) && moves_queued > 1) feed_rate = feed_rate*moves_queued / (BLOCK_BUFFER_SIZE * 0.5);
#endif
/*
// segment time im micro seconds
long segment_time = lround(1000000.0/inverse_second);

2
Marlin/planner.h

@ -67,7 +67,7 @@ void plan_init();
// Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in
// millimaters. Feed rate specifies the speed of the motion.
void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder);
void plan_buffer_line(float &x, float &y, float &z, float &e, float feed_rate, uint8_t &extruder);
// Set position. Used for G92 instructions.
void plan_set_position(const float &x, const float &y, const float &z, const float &e);

2
Marlin/stepper.cpp

@ -432,7 +432,7 @@ ISR(TIMER1_COMPA_vect)
}
else { // +direction
NORM_E_DIR();
count_direction[E_AXIS]=-1;
count_direction[E_AXIS]=1;
}
#endif //!ADVANCE

16
Marlin/temperature.cpp

@ -312,7 +312,7 @@ int temp2analog(int celsius, uint8_t e) {
return (1023 * OVERSAMPLENR) - raw;
}
return celsius * (1024.0 / (5.0 * 100.0) ) * OVERSAMPLENR;
return ((celsius-TEMP_SENSOR_AD595_OFFSET)/TEMP_SENSOR_AD595_GAIN) * (1024.0 / (5.0 * 100.0) ) * OVERSAMPLENR;
}
// Takes bed temperature value as input and returns corresponding raw value.
@ -342,7 +342,7 @@ int temp2analogBed(int celsius) {
return (1023 * OVERSAMPLENR) - raw;
#elif defined BED_USES_AD595
return lround(celsius * (1024.0 * OVERSAMPLENR/ (5.0 * 100.0) ) );
return lround(((celsius-TEMP_SENSOR_AD595_OFFSET)/TEMP_SENSOR_AD595_GAIN) * (1024.0 * OVERSAMPLENR/ (5.0 * 100.0) ) );
#else
#warning No heater-type defined for the bed.
return 0;
@ -390,7 +390,7 @@ float analog2temp(int raw, uint8_t e) {
return celsius;
}
return raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR;
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
}
// Derived from RepRap FiveD extruder::getTemperature()
@ -421,7 +421,7 @@ float analog2tempBed(int raw) {
return celsius;
#elif defined BED_USES_AD595
return raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR;
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
#else
#warning No heater-type defined for the bed.
#endif
@ -851,18 +851,18 @@ ISR(TIMER0_COMPB_vect)
for(unsigned char e = 0; e < EXTRUDERS; e++) {
if(current_raw[e] >= maxttemp[e]) {
target_raw[e] = 0;
#if (PS_ON != -1)
{
max_temp_error(e);
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
{
kill();;
}
#endif
}
if(current_raw[e] <= minttemp[e]) {
target_raw[e] = 0;
#if (PS_ON != -1)
{
min_temp_error(e);
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
{
kill();
}
#endif

13
Marlin/ultralcd.h

@ -9,18 +9,11 @@
void beep();
void buttons_check();
#define LCD_UPDATE_INTERVAL 100
#define STATUSTIMEOUT 15000
extern LiquidCrystal lcd;
#ifdef NEWPANEL
#define EN_C (1<<BLEN_C)
#define EN_B (1<<BLEN_B)
#define EN_A (1<<BLEN_A)
@ -28,10 +21,12 @@
#define CLICKED (buttons&EN_C)
#define BLOCK {blocking=millis()+blocktime;}
#if (SDCARDDETECT > -1)
{
#ifdef SDCARDDETECTINVERTED
#define CARDINSERTED (READ(SDCARDDETECT)!=0)
#else
#define CARDINSERTED (READ(SDCARDDETECT)==0)
}
#endif
#endif //SDCARDTETECTINVERTED
#else

216
Marlin/ultralcd.pde

@ -9,6 +9,8 @@
extern volatile int feedmultiply;
extern volatile bool feedmultiplychanged;
extern volatile int extrudemultiply;
extern long position[4];
extern CardReader card;
@ -122,7 +124,7 @@ void lcd_init()
lcd.createChar(3,uplevel);
lcd.createChar(4,refresh);
lcd.createChar(5,folder);
LCD_MESSAGEPGM("UltiMarlin ready.");
LCD_MESSAGEPGM(WELCOME_MSG);
}
@ -372,7 +374,7 @@ void MainMenu::showStatus()
if((currentz!=oldzpos)||force_lcd_update)
{
lcd.setCursor(10,1);
lcdprintPGM("Z:");lcd.print(ftostr32(current_position[2]));
lcdprintPGM("Z:");lcd.print(ftostr52(current_position[2]));
oldzpos=currentz;
}
static int oldfeedmultiply=0;
@ -411,7 +413,6 @@ void MainMenu::showStatus()
lcd.setCursor(7,2);
lcd.print(itostr3((int)percent));
lcdprintPGM("%SD");
}
#else //smaller LCDS----------------------------------
@ -457,7 +458,7 @@ void MainMenu::showStatus()
force_lcd_update=false;
}
enum {ItemP_exit, ItemP_autostart,ItemP_disstep,ItemP_home, ItemP_origin, ItemP_preheat, ItemP_cooldown,/*ItemP_extrude,*/ItemP_move};
enum {ItemP_exit, ItemP_autostart,ItemP_disstep,ItemP_home, ItemP_origin, ItemP_preheat_pla, ItemP_preheat_abs, ItemP_cooldown,/*ItemP_extrude,*/ItemP_move};
//any action must not contain a ',' character anywhere, or this breaks:
#define MENUITEM(repaint_action, click_action) \
@ -476,31 +477,34 @@ void MainMenu::showPrepare()
switch(i)
{
case ItemP_exit:
MENUITEM( lcdprintPGM(" Main \003") , BLOCK;status=Main_Menu;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
break;
case ItemP_autostart:
MENUITEM( lcdprintPGM(" Autostart") , BLOCK;card.lastnr=0;card.setroot();card.checkautostart(true);beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_AUTOSTART) , BLOCK;card.lastnr=0;card.setroot();card.checkautostart(true);beepshort(); ) ;
break;
case ItemP_disstep:
MENUITEM( lcdprintPGM(" Disable Steppers") , BLOCK;enquecommand("M84");beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_DISABLE_STEPPERS) , BLOCK;enquecommand("M84");beepshort(); ) ;
break;
case ItemP_home:
MENUITEM( lcdprintPGM(" Auto Home") , BLOCK;enquecommand("G28 X0 Y0 Z0");beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_AUTO_HOME) , BLOCK;enquecommand("G28");beepshort(); ) ;
break;
case ItemP_origin:
MENUITEM( lcdprintPGM(" Set Origin") , BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_SET_ORIGIN) , BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ;
break;
case ItemP_preheat:
MENUITEM( lcdprintPGM(" Preheat") , BLOCK;setTargetHotend0(227);setTargetBed(105);beepshort(); ) ;
case ItemP_preheat_pla:
MENUITEM( lcdprintPGM(MSG_PREHEAT_PLA) , BLOCK;setTargetHotend0(PLA_PREHEAT_HOTEND_TEMP);setTargetBed(PLA_PREHEAT_HPB_TEMP);analogWrite(FAN_PIN, PLA_PREHEAT_FAN_SPEED); beepshort(); ) ;
break;
case ItemP_preheat_abs:
MENUITEM( lcdprintPGM(MSG_PREHEAT_ABS) , BLOCK;setTargetHotend0(ABS_PREHEAT_HOTEND_TEMP);setTargetBed(ABS_PREHEAT_HPB_TEMP); analogWrite(FAN_PIN, ABS_PREHEAT_FAN_SPEED); beepshort(); ) ;
break;
case ItemP_cooldown:
MENUITEM( lcdprintPGM(" Cooldown") , BLOCK;setTargetHotend0(0);setTargetBed(0);beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_COOLDOWN) , BLOCK;setTargetHotend0(0);setTargetBed(0);beepshort(); ) ;
break;
// case ItemP_extrude:
// MENUITEM( lcdprintPGM(" Extrude") , BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E50");beepshort(); ) ;
// break;
case ItemP_move:
MENUITEM( lcdprintPGM(" Move Axis \x7E") , BLOCK;status=Sub_PrepareMove;beepshort(); );
MENUITEM( lcdprintPGM(MSG_MOVE_AXIS) , BLOCK;status=Sub_PrepareMove;beepshort(); );
break;
default:
break;
@ -533,7 +537,7 @@ void MainMenu::showAxisMove()
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" X:");
lcd.setCursor(13,line);lcd.print(ftostr32(current_position[X_AXIS]));
lcd.setCursor(11,line);lcd.print(ftostr52(current_position[X_AXIS]));
}
if((activeline!=line) )
@ -569,7 +573,7 @@ void MainMenu::showAxisMove()
oldencoderpos=encoderpos;
encoderpos=0;
}
lcd.setCursor(13,line);lcd.print(ftostr32(current_position[X_AXIS]));
lcd.setCursor(11,line);lcd.print(ftostr52(current_position[X_AXIS]));
}
}
break;
@ -578,7 +582,7 @@ void MainMenu::showAxisMove()
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Y:");
lcd.setCursor(13,line);lcd.print(ftostr32(current_position[Y_AXIS]));
lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Y_AXIS]));
}
if((activeline!=line) )
@ -614,7 +618,7 @@ void MainMenu::showAxisMove()
oldencoderpos=encoderpos;
encoderpos=0;
}
lcd.setCursor(13,line);lcd.print(ftostr32(current_position[Y_AXIS]));
lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Y_AXIS]));
}
}
break;
@ -623,7 +627,7 @@ void MainMenu::showAxisMove()
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Z:");
lcd.setCursor(13,line);lcd.print(ftostr32(current_position[Z_AXIS]));
lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Z_AXIS]));
}
if((activeline!=line) )
@ -659,12 +663,12 @@ void MainMenu::showAxisMove()
oldencoderpos=encoderpos;
encoderpos=0;
}
lcd.setCursor(13,line);lcd.print(ftostr32(current_position[Z_AXIS]));
lcd.setCursor(11,line);lcd.print(ftostr52(current_position[Z_AXIS]));
}
}
break;
case ItemAM_E:
MENUITEM( lcdprintPGM(" Extrude") , BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E5");beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_EXTRUDE) , BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E5");beepshort(); ) ;
break;
default:
break;
@ -690,20 +694,20 @@ void MainMenu::showTune()
switch(i)
{
case ItemT_exit:
MENUITEM( lcdprintPGM(" Main \003") , BLOCK;status=Main_Menu;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
break;
case ItemT_speed:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Speed:");
lcd.setCursor(0,line);lcdprintPGM(MSG_SPEED);
lcd.setCursor(13,line);lcd.print(ftostr3(feedmultiply));
}
if((activeline!=line) )
break;
if(CLICKED) //nalogWrite(FAN_PIN, fanpwm);
if(CLICKED) //AnalogWrite(FAN_PIN, fanpwm);
{
linechanging=!linechanging;
if(linechanging)
@ -731,7 +735,7 @@ void MainMenu::showTune()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002Nozzle:");
lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE);
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
}
@ -765,7 +769,7 @@ void MainMenu::showTune()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002Bed:");
lcd.setCursor(0,line);lcdprintPGM(MSG_BED);
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
}
@ -836,7 +840,7 @@ void MainMenu::showTune()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Flow:");
lcd.setCursor(0,line);lcdprintPGM(MSG_FLOW);
lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[3]));
}
@ -917,13 +921,13 @@ void MainMenu::showControlTemp()
switch(i)
{
case ItemCT_exit:
MENUITEM( lcdprintPGM(" Control \003") , BLOCK;status=Main_Control;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
break;
case ItemCT_nozzle:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002Nozzle:");
lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE);
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
}
@ -958,7 +962,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002 Min:");
lcd.setCursor(0,line);lcdprintPGM(MSG_MIN);
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_min));
}
@ -992,7 +996,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002 Max:");
lcd.setCursor(0,line);lcdprintPGM(MSG_MAX);
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
}
@ -1026,7 +1030,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002 Fact:");
lcd.setCursor(0,line);lcdprintPGM(MSG_FACTOR);
lcd.setCursor(13,line);lcd.print(ftostr32(autotemp_factor));
}
@ -1060,12 +1064,12 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Autotemp:");
lcd.setCursor(0,line);lcdprintPGM(MSG_AUTOTEMP);
lcd.setCursor(13,line);
if(autotemp_enabled)
lcdprintPGM("On");
lcdprintPGM(MSG_ON);
else
lcdprintPGM("Off");
lcdprintPGM(MSG_OFF);
}
if((activeline!=line) )
@ -1076,9 +1080,9 @@ void MainMenu::showControlTemp()
autotemp_enabled=!autotemp_enabled;
lcd.setCursor(13,line);
if(autotemp_enabled)
lcdprintPGM("On ");
lcdprintPGM(MSG_ON);
else
lcdprintPGM("Off");
lcdprintPGM(MSG_OFF);
BLOCK;
}
@ -1089,7 +1093,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002Bed:");
lcd.setCursor(0,line);lcdprintPGM(MSG_BED);
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
}
@ -1123,7 +1127,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Fan speed:");
lcd.setCursor(0,line);lcdprintPGM(MSG_FAN_SPEED);
lcd.setCursor(13,line);lcd.print(ftostr3(fanpwm));
}
@ -1193,7 +1197,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" PID-I: ");
lcd.setCursor(0,line);lcdprintPGM(MSG_PID_I);
lcd.setCursor(13,line);lcd.print(ftostr51(Ki/PID_dT));
}
@ -1228,7 +1232,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" PID-D: ");
lcd.setCursor(0,line);lcdprintPGM(MSG_PID_D);
lcd.setCursor(13,line);lcd.print(itostr4(Kd*PID_dT));
}
@ -1265,7 +1269,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" PID-C: ");
lcd.setCursor(0,line);lcdprintPGM(MSG_PID_C);
lcd.setCursor(13,line);lcd.print(itostr3(Kc));
}
@ -1331,13 +1335,13 @@ void MainMenu::showControlMotion()
switch(i)
{
case ItemCM_exit:
MENUITEM( lcdprintPGM(" Control \003") , BLOCK;status=Main_Control;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
break;
case ItemCM_acc:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Acc:");
lcd.setCursor(0,line);lcdprintPGM(MSG_ACC);
lcd.setCursor(13,line);lcd.print(itostr3(acceleration/100));lcdprintPGM("00");
}
@ -1371,7 +1375,7 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Vxy-jerk: ");
lcd.setCursor(0,line);lcdprintPGM(MSG_VXY_JERK);
lcd.setCursor(13,line);lcd.print(itostr3(max_xy_jerk));
}
@ -1410,11 +1414,11 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Vmax ");
if(i==ItemCM_vmaxx)lcdprintPGM("x:");
if(i==ItemCM_vmaxy)lcdprintPGM("y:");
if(i==ItemCM_vmaxz)lcdprintPGM("z:");
if(i==ItemCM_vmaxe)lcdprintPGM("e:");
lcd.setCursor(0,line);lcdprintPGM(MSG_VMAX);
if(i==ItemCM_vmaxx)lcdprintPGM(MSG_X);
if(i==ItemCM_vmaxy)lcdprintPGM(MSG_Y);
if(i==ItemCM_vmaxz)lcdprintPGM(MSG_Z);
if(i==ItemCM_vmaxe)lcdprintPGM(MSG_E);
lcd.setCursor(13,line);lcd.print(itostr3(max_feedrate[i-ItemCM_vmaxx]));
}
@ -1450,7 +1454,7 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Vmin:");
lcd.setCursor(0,line);lcdprintPGM(MSG_VMIN);
lcd.setCursor(13,line);lcd.print(itostr3(minimumfeedrate));
}
@ -1485,7 +1489,7 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" VTrav min:");
lcd.setCursor(0,line);lcdprintPGM(MSG_VTRAV_MIN);
lcd.setCursor(13,line);lcd.print(itostr3(mintravelfeedrate));
}
@ -1525,10 +1529,10 @@ void MainMenu::showControlMotion()
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Amax ");
if(i==ItemCM_amaxx)lcdprintPGM("x:");
if(i==ItemCM_amaxy)lcdprintPGM("y:");
if(i==ItemCM_amaxz)lcdprintPGM("z:");
if(i==ItemCM_amaxe)lcdprintPGM("e:");
if(i==ItemCM_amaxx)lcdprintPGM(MSG_X);
if(i==ItemCM_amaxy)lcdprintPGM(MSG_Y);
if(i==ItemCM_amaxz)lcdprintPGM(MSG_Z);
if(i==ItemCM_amaxe)lcdprintPGM(MSG_E);
lcd.setCursor(13,line);lcd.print(itostr3(max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100));lcdprintPGM("00");
}
@ -1562,7 +1566,7 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" A-retract:");
lcd.setCursor(0,line);lcdprintPGM(MSG_A_RETRACT);
lcd.setCursor(13,line);lcd.print(ftostr3(retract_acceleration/100));lcdprintPGM("00");
}
@ -1597,8 +1601,8 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" X steps/mm:");
lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[0]));
lcd.setCursor(0,line);lcdprintPGM(MSG_XSTEPS);
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[0]));
}
if((activeline!=line) )
@ -1609,16 +1613,15 @@ void MainMenu::showControlMotion()
linechanging=!linechanging;
if(linechanging)
{
encoderpos=(int)axis_steps_per_unit[0];
encoderpos=(int)(axis_steps_per_unit[0]*100.0);
}
else
{
float factor=float(encoderpos)/float(axis_steps_per_unit[0]);
float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[0]);
position[X_AXIS]=lround(position[X_AXIS]*factor);
//current_position[3]*=factor;
axis_steps_per_unit[X_AXIS]= encoderpos;
axis_steps_per_unit[X_AXIS]= encoderpos/100.0;
encoderpos=activeline*lcdslow;
}
BLOCK;
beepshort();
@ -1626,8 +1629,8 @@ void MainMenu::showControlMotion()
if(linechanging)
{
if(encoderpos<5) encoderpos=5;
if(encoderpos>9999) encoderpos=9999;
lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
if(encoderpos>99999) encoderpos=99999;
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
}
}break;
@ -1635,8 +1638,8 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Y steps/mm:");
lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[1]));
lcd.setCursor(0,line);lcdprintPGM(MSG_YSTEPS);
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[1]));
}
if((activeline!=line) )
@ -1647,14 +1650,14 @@ void MainMenu::showControlMotion()
linechanging=!linechanging;
if(linechanging)
{
encoderpos=(int)axis_steps_per_unit[1];
encoderpos=(int)(axis_steps_per_unit[1]*100.0);
}
else
{
float factor=float(encoderpos)/float(axis_steps_per_unit[1]);
float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[1]);
position[Y_AXIS]=lround(position[Y_AXIS]*factor);
//current_position[3]*=factor;
axis_steps_per_unit[Y_AXIS]= encoderpos;
axis_steps_per_unit[Y_AXIS]= encoderpos/100.0;
encoderpos=activeline*lcdslow;
}
@ -1665,7 +1668,7 @@ void MainMenu::showControlMotion()
{
if(encoderpos<5) encoderpos=5;
if(encoderpos>9999) encoderpos=9999;
lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
}
}break;
@ -1673,8 +1676,8 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Z steps/mm:");
lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[2]));
lcd.setCursor(0,line);lcdprintPGM(MSG_ZSTEPS);
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[2]));
}
if((activeline!=line) )
@ -1685,14 +1688,14 @@ void MainMenu::showControlMotion()
linechanging=!linechanging;
if(linechanging)
{
encoderpos=(int)axis_steps_per_unit[2];
encoderpos=(int)(axis_steps_per_unit[2]*100.0);
}
else
{
float factor=float(encoderpos)/float(axis_steps_per_unit[2]);
float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[2]);
position[Z_AXIS]=lround(position[Z_AXIS]*factor);
//current_position[3]*=factor;
axis_steps_per_unit[Z_AXIS]= encoderpos;
axis_steps_per_unit[Z_AXIS]= encoderpos/100.0;
encoderpos=activeline*lcdslow;
}
@ -1703,7 +1706,7 @@ void MainMenu::showControlMotion()
{
if(encoderpos<5) encoderpos=5;
if(encoderpos>9999) encoderpos=9999;
lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
}
}break;
@ -1712,8 +1715,8 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" E steps/mm:");
lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[3]));
lcd.setCursor(0,line);lcdprintPGM(MSG_ESTEPS);
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[3]));
}
if((activeline!=line) )
@ -1724,14 +1727,14 @@ void MainMenu::showControlMotion()
linechanging=!linechanging;
if(linechanging)
{
encoderpos=(int)axis_steps_per_unit[3];
encoderpos=(int)(axis_steps_per_unit[3]*100.0);
}
else
{
float factor=float(encoderpos)/float(axis_steps_per_unit[3]);
float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[3]);
position[E_AXIS]=lround(position[E_AXIS]*factor);
//current_position[3]*=factor;
axis_steps_per_unit[E_AXIS]= encoderpos;
axis_steps_per_unit[E_AXIS]= encoderpos/100.0;
encoderpos=activeline*lcdslow;
}
@ -1742,7 +1745,7 @@ void MainMenu::showControlMotion()
{
if(encoderpos<5) encoderpos=5;
if(encoderpos>9999) encoderpos=9999;
lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
}
}break;
@ -1769,19 +1772,19 @@ void MainMenu::showControl()
switch(i)
{
case ItemC_exit:
MENUITEM( lcdprintPGM(" Main \003") , BLOCK;status=Main_Menu;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_MAIN_WIDE) , BLOCK;status=Main_Menu;beepshort(); ) ;
break;
case ItemC_temp:
MENUITEM( lcdprintPGM(" Temperature \x7E") , BLOCK;status=Sub_TempControl;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_TEMPERATURE_WIDE) , BLOCK;status=Sub_TempControl;beepshort(); ) ;
break;
case ItemC_move:
MENUITEM( lcdprintPGM(" Motion \x7E") , BLOCK;status=Sub_MotionControl;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_MOTION_WIDE) , BLOCK;status=Sub_MotionControl;beepshort(); ) ;
break;
case ItemC_store:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Store EPROM");
lcd.setCursor(0,line);lcdprintPGM(MSG_STORE_EPROM);
}
if((activeline==line) && CLICKED)
{
@ -1795,7 +1798,7 @@ void MainMenu::showControl()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Load EPROM");
lcd.setCursor(0,line);lcdprintPGM(MSG_LOAD_EPROM);
}
if((activeline==line) && CLICKED)
{
@ -1809,7 +1812,7 @@ void MainMenu::showControl()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Restore Failsafe");
lcd.setCursor(0,line);lcdprintPGM(MSG_RESTORE_FAILSAFE);
}
if((activeline==line) && CLICKED)
{
@ -1856,7 +1859,7 @@ void MainMenu::showSD()
switch(i)
{
case 0:
MENUITEM( lcdprintPGM(" Main \003") , BLOCK;status=Main_Menu;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
break;
// case 1:
// {
@ -1887,7 +1890,7 @@ void MainMenu::showSD()
// }
// }break;
case 1:
MENUITEM( lcd.print(" ");card.getWorkDirName();if(card.filename[0]=='/') lcdprintPGM("\004Refresh");else {lcd.print("\005");lcd.print(card.filename);lcd.print("/..");} , BLOCK;card.updir();enforceupdate=true;lineoffset=0;beepshort(); ) ;
MENUITEM( lcd.print(" ");card.getWorkDirName();if(card.filename[0]=='/') lcdprintPGM(MSG_REFRESH);else {lcd.print("\005");lcd.print(card.filename);lcd.print("/..");} , BLOCK;card.updir();enforceupdate=true;lineoffset=0;beepshort(); ) ;
break;
default:
@ -1974,14 +1977,14 @@ void MainMenu::showMainMenu()
switch(line)
{
case ItemM_watch:
MENUITEM( lcdprintPGM(" Watch \003") , BLOCK;status=Main_Status;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_WATCH) , BLOCK;status=Main_Status;beepshort(); ) ;
break;
case ItemM_prepare:
MENUITEM( if(!tune) lcdprintPGM(" Prepare \x7E");else lcdprintPGM(" Tune \x7E"); , BLOCK;status=Main_Prepare;beepshort(); ) ;
MENUITEM( if(!tune) lcdprintPGM(MSG_PREPARE);else lcdprintPGM(MSG_TUNE); , BLOCK;status=Main_Prepare;beepshort(); ) ;
break;
case ItemM_control:
MENUITEM( lcdprintPGM(" Control \x7E") , BLOCK;status=Main_Control;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_CONTROL_ARROW) , BLOCK;status=Main_Control;beepshort(); ) ;
break;
#ifdef SDSUPPORT
case ItemM_file:
@ -1996,13 +1999,13 @@ void MainMenu::showMainMenu()
#endif
{
if(card.sdprinting)
lcdprintPGM(" Stop Print \x7E");
lcdprintPGM(MSG_STOP_PRINT);
else
lcdprintPGM(" Card Menu \x7E");
lcdprintPGM(MSG_CARD_MENU);
}
else
{
lcdprintPGM(" No Card");
lcdprintPGM(MSG_NO_CARD);
}
}
#ifdef CARDINSERTED
@ -2022,7 +2025,7 @@ void MainMenu::showMainMenu()
#endif
default:
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("Something is wrong in the MenuStructure.");
SERIAL_ERRORLNPGM(MSG_SERIAL_ERROR_MENU_STRUCTURE);
break;
}
}
@ -2043,12 +2046,12 @@ void MainMenu::update()
if(CARDINSERTED)
{
card.initsd();
LCD_MESSAGEPGM("Card inserted");
LCD_MESSAGEPGM(MSG_SD_INSERTED);
}
else
{
card.release();
LCD_MESSAGEPGM("Card removed");
LCD_MESSAGEPGM(MSG_SD_REMOVED);
}
}
#endif
@ -2223,6 +2226,21 @@ char *ftostr51(const float &x)
return conv;
}
// convert float to string with +123.45 format
char *ftostr52(const float &x)
{
int xx=x*100;
conv[0]=(xx>=0)?'+':'-';
xx=abs(xx);
conv[1]=(xx/10000)%10+'0';
conv[2]=(xx/1000)%10+'0';
conv[3]=(xx/100)%10+'0';
conv[4]='.';
conv[5]=(xx/10)%10+'0';
conv[6]=(xx)%10+'0';
conv[7]=0;
return conv;
}
#endif //ULTRA_LCD

22
README.md

@ -1,26 +1,6 @@
SCUBA82's fork:
-----------------
The main goal of my fork is porting the brilliant Marlin firmware to GEN7 Boards.
I'm working on a 16MHz GEN7 board and have only tested with this configuration.
But there were reports about successfully running it at 20 MHz. Expect 25% faster moves and maybe some other issues.
Using lcd and sdcard support on an ATMega644(P) is not possible cause the sketch is way too big for its memory.
I switched to an ATMega1284P which has double size program memory. Unfortunately it's not supported in Arduino IDE out of the box but expect a tutorial on how to compile for it soon.
For the necessary pin breakouts I used Alfons3 design of GEN7 (https://github.com/Alfons3/Generation_7_Electronics) with an additional breakout for pin A0/D31.
I'll publish my desing as soon as possible.
You have to use different chip fuses to get Marlin running.
The fuses I'm using are lfuse: 0xF7 hfuse: 0xD4 efuse: 0xFD
For questions take a look into http://forums.reprap.org/read.php?181,118329 or send me an e-mail: christian_thalhammer@gmx.at
Expect this fork to be highly experimental.
WARNING:
--------
THIS IS RELEASE CANDIDATE 1 FOR MARLIN 1.0.0
THIS IS RELEASE CANDIDATE 2 FOR MARLIN 1.0.0
The configuration is now split in two files
Configuration.h for the normal settings

Loading…
Cancel
Save