mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-23 12:04:19 +00:00
merging
This commit is contained in:
commit
84d9cf7339
@ -20,9 +20,6 @@
|
||||
// if unwanted behavior is observed on a user's machine when running at very slow speeds.
|
||||
#define MINIMUM_PLANNER_SPEED 2.0 // (mm/sec)
|
||||
|
||||
// If defined the movements slow down when the look ahead buffer is only half full
|
||||
#define SLOWDOWN
|
||||
|
||||
// BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
|
||||
|
||||
//// The following define selects which electronics board you have. Please choose the one that matches your setup
|
||||
@ -65,11 +62,11 @@
|
||||
|
||||
#define BED_CHECK_INTERVAL 5000 //ms
|
||||
|
||||
//// Experimental watchdog and minimal temp
|
||||
// The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
|
||||
// If the temperature has not increased at the end of that period, the target temperature is set to zero. It can be reset with another M104/M109
|
||||
/// CURRENTLY NOT IMPLEMENTED AND UNUSEABLE
|
||||
//#define WATCHPERIOD 5000 //5 seconds
|
||||
//// Heating sanity check:
|
||||
// This waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
|
||||
// If the temperature has not increased at the end of that period, the target temperature is set to zero.
|
||||
// It can be reset with another M104/M109
|
||||
//#define WATCHPERIOD 20000 //20 seconds
|
||||
|
||||
// Actual temperature must be close to target for this long before M109 returns success
|
||||
#define TEMP_RESIDENCY_TIME 30 // (seconds)
|
||||
@ -163,6 +160,14 @@
|
||||
#endif
|
||||
#endif // PIDTEMP
|
||||
|
||||
// extruder run-out prevention.
|
||||
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
|
||||
//#define EXTRUDER_RUNOUT_PREVENT
|
||||
#define EXTRUDER_RUNOUT_MINTEMP 190
|
||||
#define EXTRUDER_RUNOUT_SECONDS 30.
|
||||
#define EXTRUDER_RUNOUT_ESTEPS 14. //mm filament
|
||||
#define EXTRUDER_RUNOUT_SPEED 1500. //extrusion speed
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//=============================Mechanical Settings===========================
|
||||
@ -250,7 +255,12 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
|
||||
#define DEFAULT_XYJERK 20.0 // (mm/sec)
|
||||
#define DEFAULT_ZJERK 0.4 // (mm/sec)
|
||||
|
||||
// If defined the movements slow down when the look ahead buffer is only half full
|
||||
#define SLOWDOWN
|
||||
|
||||
//default stepper release if idle
|
||||
#define DEFAULT_STEPPER_DEACTIVE_TIME 60
|
||||
#define DEFAULT_STEPPER_DEACTIVE_COMMAND "M84 X Y E" //z stays powered
|
||||
|
||||
|
||||
//===========================================================================
|
||||
@ -303,6 +313,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
|
||||
//#define ULTRA_LCD //general lcd support, also 16x2
|
||||
//#define SDSUPPORT // Enable SD Card Support in Hardware Console
|
||||
#define SD_FINISHED_STEPPERRELEASE true //if sd support and the file is finished: disable steppers?
|
||||
#define SD_FINISHED_RELEASECOMMAND "M84 X Y E" // no z because of layer shift.
|
||||
|
||||
#define ULTIPANEL
|
||||
#ifdef ULTIPANEL
|
||||
@ -339,6 +350,11 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
|
||||
#define AUTOTEMP_OLDWEIGHT 0.98
|
||||
#endif
|
||||
|
||||
//this prevents dangerous Extruder moves, i.e. if the temperature is under the limit
|
||||
//can be software-disabled for whatever purposes by
|
||||
#define PREVENT_DANGEROUS_EXTRUDE
|
||||
#define EXTRUDE_MINTEMP 190
|
||||
#define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances.
|
||||
|
||||
const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
// Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
|
||||
// Licence: GPL
|
||||
#define HardwareSerial_h // trick to disable the standard HWserial
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#if ARDUINO >= 100
|
||||
#include "Arduino.h"
|
||||
@ -147,6 +148,7 @@ 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;
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <EEPROM.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "EEPROMwrite.h"
|
||||
#include "fastio.h"
|
||||
#include "Configuration.h"
|
||||
@ -39,7 +41,7 @@
|
||||
#include "motion_control.h"
|
||||
#include "cardreader.h"
|
||||
#include "watchdog.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
#define VERSION_STRING "1.0.0 Beta 1"
|
||||
@ -108,6 +110,7 @@
|
||||
// M206 - set additional homeing offset
|
||||
// M220 - set speed factor override percentage S:factor in percent
|
||||
// M301 - Set PID parameters P I and D
|
||||
// M302 - Allow cold extrudes
|
||||
// M400 - Finish all moves
|
||||
// M500 - stores paramters in EEPROM
|
||||
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
|
||||
@ -135,7 +138,7 @@ volatile bool feedmultiplychanged=false;
|
||||
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=============================
|
||||
@ -175,7 +178,8 @@ const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42
|
||||
//Inactivity shutdown variables
|
||||
static unsigned long previous_millis_cmd = 0;
|
||||
static unsigned long max_inactive_time = 0;
|
||||
static unsigned long stepper_inactive_time = 0;
|
||||
static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000;
|
||||
static unsigned long last_stepperdisabled_time=30*1000; //first release check after 30 seconds
|
||||
|
||||
static unsigned long starttime=0;
|
||||
static unsigned long stoptime=0;
|
||||
@ -232,7 +236,9 @@ void setup()
|
||||
SERIAL_PROTOCOLLNPGM("start");
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOPGM("Free Memory:");
|
||||
SERIAL_ECHOLN(freeMemory());
|
||||
SERIAL_ECHO(freeMemory());
|
||||
SERIAL_ECHOPGM(" PlannerBufferBytes:");
|
||||
SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE);
|
||||
for(int8_t i = 0; i < BUFSIZE; i++)
|
||||
{
|
||||
fromsd[i] = false;
|
||||
@ -498,19 +504,16 @@ FORCE_INLINE void process_commands()
|
||||
case 1: // G1
|
||||
get_coordinates(); // For X Y Z E F
|
||||
prepare_move();
|
||||
previous_millis_cmd = millis();
|
||||
//ClearToSend();
|
||||
return;
|
||||
//break;
|
||||
case 2: // G2 - CW ARC
|
||||
get_arc_coordinates();
|
||||
prepare_arc_move(true);
|
||||
previous_millis_cmd = millis();
|
||||
return;
|
||||
case 3: // G3 - CCW ARC
|
||||
get_arc_coordinates();
|
||||
prepare_arc_move(false);
|
||||
previous_millis_cmd = millis();
|
||||
return;
|
||||
case 4: // G4 dwell
|
||||
LCD_MESSAGEPGM("DWELL...");
|
||||
@ -520,7 +523,7 @@ FORCE_INLINE void process_commands()
|
||||
|
||||
st_synchronize();
|
||||
codenum += millis(); // keep track of when we started waiting
|
||||
|
||||
previous_millis_cmd = millis();
|
||||
while(millis() < codenum ){
|
||||
manage_heater();
|
||||
}
|
||||
@ -540,34 +543,53 @@ FORCE_INLINE void process_commands()
|
||||
#ifdef QUICK_HOME
|
||||
if( code_seen(axis_codes[0]) && code_seen(axis_codes[1]) ) //first diagonal move
|
||||
{
|
||||
current_position[X_AXIS] = 0; current_position[Y_AXIS] = 0;
|
||||
current_position[X_AXIS] = 0;current_position[Y_AXIS] = 0;
|
||||
|
||||
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||
destination[X_AXIS] = 1.5 * X_MAX_LENGTH * X_HOME_DIR;
|
||||
destination[Y_AXIS] = 1.5 * Y_MAX_LENGTH * Y_HOME_DIR;
|
||||
feedrate =homing_feedrate[X_AXIS];
|
||||
destination[X_AXIS] = 1.5 * X_MAX_LENGTH * X_HOME_DIR;destination[Y_AXIS] = 1.5 * Y_MAX_LENGTH * Y_HOME_DIR;
|
||||
feedrate = homing_feedrate[X_AXIS];
|
||||
if(homing_feedrate[Y_AXIS]<feedrate)
|
||||
feedrate =homing_feedrate[Y_AXIS];
|
||||
prepare_move();
|
||||
current_position[X_AXIS] = 0; current_position[Y_AXIS] = 0;
|
||||
prepare_move();
|
||||
|
||||
current_position[X_AXIS] = (X_HOME_DIR == -1) ? 0 : X_MAX_LENGTH;
|
||||
current_position[Y_AXIS] = (Y_HOME_DIR == -1) ? 0 : 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];
|
||||
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
|
||||
|
||||
if((home_all_axis) || (code_seen(axis_codes[X_AXIS])))
|
||||
{
|
||||
HOMEAXIS(X);
|
||||
current_position[0]=code_value()+add_homeing[0];
|
||||
}
|
||||
|
||||
if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
|
||||
HOMEAXIS(Y);
|
||||
current_position[1]=code_value()+add_homeing[1];
|
||||
}
|
||||
|
||||
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
|
||||
HOMEAXIS(Z);
|
||||
current_position[2]=code_value()+add_homeing[2];
|
||||
}
|
||||
}
|
||||
|
||||
if(code_seen(axis_codes[X_AXIS]))
|
||||
{
|
||||
current_position[0]=code_value()+add_homeing[0];
|
||||
}
|
||||
|
||||
if(code_seen(axis_codes[Y_AXIS])) {
|
||||
current_position[1]=code_value()+add_homeing[1];
|
||||
}
|
||||
|
||||
if(code_seen(axis_codes[Z_AXIS])) {
|
||||
current_position[2]=code_value()+add_homeing[2];
|
||||
}
|
||||
#ifdef ENDSTOPS_ONLY_FOR_HOMING
|
||||
enable_endstops(false);
|
||||
#endif
|
||||
@ -817,6 +839,7 @@ FORCE_INLINE 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 */
|
||||
@ -830,6 +853,7 @@ FORCE_INLINE void process_commands()
|
||||
}
|
||||
LCD_MESSAGEPGM("Heating done.");
|
||||
starttime=millis();
|
||||
previous_millis_cmd = millis();
|
||||
}
|
||||
break;
|
||||
case 190: // M190 - Wait for bed heater to reach target.
|
||||
@ -853,6 +877,7 @@ FORCE_INLINE void process_commands()
|
||||
manage_heater();
|
||||
}
|
||||
LCD_MESSAGEPGM("Bed done.");
|
||||
previous_millis_cmd = millis();
|
||||
#endif
|
||||
break;
|
||||
|
||||
@ -896,20 +921,25 @@ FORCE_INLINE void process_commands()
|
||||
}
|
||||
else
|
||||
{
|
||||
#if ((E_ENABLE_PIN != X_ENABLE_PIN) && (E_ENABLE_PIN != Y_ENABLE_PIN)) // Only enable on boards that have seperate ENABLE_PINS
|
||||
if(code_seen('E')) {
|
||||
st_synchronize();
|
||||
LCD_MESSAGEPGM("Free Move");
|
||||
bool all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2]))|| (code_seen(axis_codes[3])));
|
||||
if(all_axis)
|
||||
{
|
||||
disable_e0();
|
||||
disable_e1();
|
||||
disable_e2();
|
||||
}
|
||||
else {
|
||||
finishAndDisableSteppers();
|
||||
}
|
||||
#else
|
||||
finishAndDisableSteppers();
|
||||
#endif
|
||||
else
|
||||
{
|
||||
st_synchronize();
|
||||
if(code_seen('X')) disable_x();
|
||||
if(code_seen('Y')) disable_y();
|
||||
if(code_seen('Z')) disable_z();
|
||||
#if ((E_ENABLE_PIN != X_ENABLE_PIN) && (E_ENABLE_PIN != Y_ENABLE_PIN)) // Only enable on boards that have seperate ENABLE_PINS
|
||||
if(code_seen('E')) disable_e();
|
||||
#endif
|
||||
LCD_MESSAGEPGM("Partial Release");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 85: // M85
|
||||
@ -979,7 +1009,11 @@ FORCE_INLINE void process_commands()
|
||||
case 201: // M201
|
||||
for(int8_t i=0; i < NUM_AXIS; i++)
|
||||
{
|
||||
if(code_seen(axis_codes[i])) axis_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
|
||||
if(code_seen(axis_codes[i]))
|
||||
{
|
||||
max_acceleration_units_per_sq_second[i] = code_value();
|
||||
axis_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
|
||||
}
|
||||
}
|
||||
break;
|
||||
#if 0 // Not used for Sprinter/grbl gen6
|
||||
@ -1049,6 +1083,12 @@ FORCE_INLINE void process_commands()
|
||||
}
|
||||
break;
|
||||
#endif //PIDTEMP
|
||||
|
||||
case 302: // finish all moves
|
||||
{
|
||||
allow_cold_extrudes(true);
|
||||
}
|
||||
break;
|
||||
case 400: // finish all moves
|
||||
{
|
||||
st_synchronize();
|
||||
@ -1146,6 +1186,7 @@ FORCE_INLINE 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;
|
||||
@ -1162,6 +1203,7 @@ void prepare_move()
|
||||
for(int8_t i=0; i < NUM_AXIS; i++) {
|
||||
current_position[i] = destination[i];
|
||||
}
|
||||
previous_millis_cmd = millis();
|
||||
}
|
||||
|
||||
void prepare_arc_move(char isclockwise) {
|
||||
@ -1176,6 +1218,7 @@ void prepare_arc_move(char isclockwise) {
|
||||
for(int8_t i=0; i < NUM_AXIS; i++) {
|
||||
current_position[i] = destination[i];
|
||||
}
|
||||
previous_millis_cmd = millis();
|
||||
}
|
||||
|
||||
void manage_inactivity(byte debug)
|
||||
@ -1183,16 +1226,38 @@ void manage_inactivity(byte debug)
|
||||
if( (millis()-previous_millis_cmd) > max_inactive_time )
|
||||
if(max_inactive_time)
|
||||
kill();
|
||||
if( (millis()-previous_millis_cmd) > stepper_inactive_time )
|
||||
if(stepper_inactive_time)
|
||||
{
|
||||
disable_x();
|
||||
disable_y();
|
||||
disable_z();
|
||||
disable_e0();
|
||||
disable_e1();
|
||||
disable_e2();
|
||||
if(stepper_inactive_time)
|
||||
if( (millis()-last_stepperdisabled_time) > stepper_inactive_time )
|
||||
{
|
||||
if(previous_millis_cmd>last_stepperdisabled_time)
|
||||
last_stepperdisabled_time=previous_millis_cmd;
|
||||
else
|
||||
{
|
||||
if( (X_ENABLE_ON && (READ(X_ENABLE_PIN)!=0)) || (!X_ENABLE_ON && READ(X_ENABLE_PIN)==0) )
|
||||
enquecommand(DEFAULT_STEPPER_DEACTIVE_COMMAND);
|
||||
last_stepperdisabled_time=millis();
|
||||
}
|
||||
}
|
||||
#ifdef EXTRUDER_RUNOUT_PREVENT
|
||||
if( (millis()-previous_millis_cmd) > EXTRUDER_RUNOUT_SECONDS*1000 )
|
||||
if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)
|
||||
{
|
||||
bool oldstatus=READ(E_ENABLE_PIN);
|
||||
enable_e();
|
||||
float oldepos=current_position[E_AXIS];
|
||||
float oldedes=destination[E_AXIS];
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
|
||||
current_position[E_AXIS]+EXTRUDER_RUNOUT_EXTRUDE*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS],
|
||||
EXTRUDER_RUNOUT_SPEED/60.*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], active_extruder);
|
||||
current_position[E_AXIS]=oldepos;
|
||||
destination[E_AXIS]=oldedes;
|
||||
plan_set_e_position(oldepos);
|
||||
previous_millis_cmd=millis();
|
||||
//enquecommand(DEFAULT_STEPPER_DEACTIVE_COMMAND);
|
||||
st_synchronize();
|
||||
WRITE(E_ENABLE_PIN,oldstatus);
|
||||
}
|
||||
#endif
|
||||
check_axes_activity();
|
||||
}
|
||||
|
||||
@ -1215,4 +1280,4 @@ void kill()
|
||||
while(1); // Wait for reset
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
bool cardOK ;
|
||||
char filename[11];
|
||||
bool filenameIsDir;
|
||||
int lastnr; //last number of the autostart;
|
||||
private:
|
||||
SdFile root,*curDir,workDir,workDirParent,workDirParentParent;
|
||||
Sd2Card card;
|
||||
|
@ -14,6 +14,7 @@ CardReader::CardReader()
|
||||
autostart_atmillis=0;
|
||||
|
||||
autostart_stilltocheck=true; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
|
||||
lastnr=0;
|
||||
//power to SD reader
|
||||
#if SDPOWER > -1
|
||||
SET_OUTPUT(SDPOWER);
|
||||
@ -334,7 +335,7 @@ void CardReader::checkautostart(bool force)
|
||||
if(!cardOK) //fail
|
||||
return;
|
||||
}
|
||||
static int lastnr=0;
|
||||
|
||||
char autoname[30];
|
||||
sprintf(autoname,"auto%i.g",lastnr);
|
||||
for(int8_t i=0;i<(int)strlen(autoname);i++)
|
||||
@ -431,10 +432,13 @@ void CardReader::updir()
|
||||
|
||||
void CardReader::printingHasFinished()
|
||||
{
|
||||
quickStop();
|
||||
sdprinting = false;
|
||||
stop_heating_wait=true;
|
||||
if(SD_FINISHED_STEPPERRELEASE)
|
||||
{
|
||||
finishAndDisableSteppers();
|
||||
//finishAndDisableSteppers();
|
||||
enquecommand(SD_FINISHED_RELEASECOMMAND);
|
||||
}
|
||||
autotempShutdown();
|
||||
}
|
||||
|
@ -103,7 +103,9 @@ volatile unsigned char block_buffer_tail; // Index of the block to pro
|
||||
//===========================================================================
|
||||
//=============================private variables ============================
|
||||
//===========================================================================
|
||||
|
||||
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
||||
bool allow_cold_extrude=false;
|
||||
#endif
|
||||
#ifdef XY_FREQUENCY_LIMIT
|
||||
// Used for the frequency limit
|
||||
static unsigned char old_direction_bits = 0; // Old direction bits. Used for speed calculations
|
||||
@ -462,7 +464,23 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
|
||||
target[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]);
|
||||
target[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]);
|
||||
target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]);
|
||||
target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]);
|
||||
target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]);
|
||||
|
||||
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
||||
if(target[E_AXIS]!=position[E_AXIS])
|
||||
if(degHotend(active_extruder)<EXTRUDE_MINTEMP && !allow_cold_extrude)
|
||||
{
|
||||
position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOLNPGM(" cold extrusion prevented");
|
||||
}
|
||||
if(labs(target[E_AXIS]-position[E_AXIS])>axis_steps_per_unit[E_AXIS]*EXTRUDE_MAXLENGTH)
|
||||
{
|
||||
position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOLNPGM(" too long extrusion prevented");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Prepare to set up new block
|
||||
block_t *block = &block_buffer[block_buffer_head];
|
||||
@ -778,3 +796,9 @@ uint8_t movesplanned()
|
||||
return (block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
|
||||
}
|
||||
|
||||
void allow_cold_extrudes(bool allow)
|
||||
{
|
||||
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
||||
allow_cold_extrude=allow;
|
||||
#endif
|
||||
}
|
||||
|
@ -128,4 +128,16 @@ FORCE_INLINE block_t *plan_get_current_block()
|
||||
block->busy = true;
|
||||
return(block);
|
||||
}
|
||||
|
||||
// Gets the current block. Returns NULL if buffer empty
|
||||
FORCE_INLINE bool blocks_queued()
|
||||
{
|
||||
if (block_buffer_head == block_buffer_tail) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
void allow_cold_extrudes(bool allow);
|
||||
#endif
|
||||
|
@ -757,14 +757,15 @@ void st_init()
|
||||
sei();
|
||||
}
|
||||
|
||||
|
||||
// Block until all buffered steps are executed
|
||||
void st_synchronize()
|
||||
{
|
||||
while(plan_get_current_block()) {
|
||||
while( blocks_queued()) {
|
||||
manage_heater();
|
||||
manage_inactivity(1);
|
||||
LCD_STATUS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void st_set_position(const long &x, const long &y, const long &z, const long &e)
|
||||
@ -804,3 +805,12 @@ void finishAndDisableSteppers()
|
||||
disable_e1();
|
||||
disable_e2();
|
||||
}
|
||||
|
||||
void quickStop()
|
||||
{
|
||||
DISABLE_STEPPER_DRIVER_INTERRUPT();
|
||||
while(blocks_queued())
|
||||
plan_discard_current_block();
|
||||
ENABLE_STEPPER_DRIVER_INTERRUPT();
|
||||
}
|
||||
|
||||
|
@ -67,5 +67,5 @@ void finishAndDisableSteppers();
|
||||
|
||||
extern block_t *current_block; // A pointer to the block currently being traced
|
||||
|
||||
|
||||
void quickStop();
|
||||
#endif
|
||||
|
@ -85,6 +85,7 @@ static unsigned long previous_millis_bed_heater;
|
||||
|
||||
#ifdef WATCHPERIOD
|
||||
static int watch_raw[EXTRUDERS] = { -1000 }; // the first value used for all
|
||||
static int watch_oldtemp[3] = {0,0,0};
|
||||
static unsigned long watchmillis = 0;
|
||||
#endif //WATCHPERIOD
|
||||
|
||||
@ -213,7 +214,20 @@ void manage_heater()
|
||||
soft_pwm[e] = 0;
|
||||
}
|
||||
} // End extruder for loop
|
||||
|
||||
|
||||
#ifdef WATCHPERIOD
|
||||
if(watchmillis && millis() - watchmillis > WATCHPERIOD){
|
||||
if(watch_oldtemp[TEMPSENSOR_HOTEND_0] >= degHotend(active_extruder)){
|
||||
setTargetHotend(0,active_extruder);
|
||||
LCD_MESSAGEPGM("Heating failed");
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOLN("Heating failed");
|
||||
}else{
|
||||
watchmillis = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
|
||||
return;
|
||||
previous_millis_bed_heater = millis();
|
||||
@ -493,6 +507,7 @@ void setWatch()
|
||||
for (int e = 0; e < EXTRUDERS; e++)
|
||||
{
|
||||
if(isHeatingHotend(e))
|
||||
watch_oldtemp[TEMPSENSOR_HOTEND_0] = degHotend(0);
|
||||
{
|
||||
t = max(t,millis());
|
||||
watch_raw[e] = current_raw[e];
|
||||
|
@ -1,144 +1,145 @@
|
||||
/*
|
||||
temperature.h - temperature controller
|
||||
Part of Marlin
|
||||
|
||||
Copyright (c) 2011 Erik van der Zalm
|
||||
|
||||
Grbl is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Grbl is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef temperature_h
|
||||
#define temperature_h
|
||||
|
||||
#include "Marlin.h"
|
||||
#include "fastio.h"
|
||||
#ifdef PID_ADD_EXTRUSION_RATE
|
||||
#include "stepper.h"
|
||||
#endif
|
||||
|
||||
// public functions
|
||||
void tp_init(); //initialise the heating
|
||||
void manage_heater(); //it is critical that this is called periodically.
|
||||
|
||||
//low leven conversion routines
|
||||
// do not use this routines and variables outsie of temperature.cpp
|
||||
int temp2analog(int celsius, uint8_t e);
|
||||
int temp2analogBed(int celsius);
|
||||
float analog2temp(int raw, uint8_t e);
|
||||
float analog2tempBed(int raw);
|
||||
extern int target_raw[EXTRUDERS];
|
||||
extern int heatingtarget_raw[EXTRUDERS];
|
||||
extern int current_raw[EXTRUDERS];
|
||||
extern int target_raw_bed;
|
||||
extern int current_raw_bed;
|
||||
extern float Kp,Ki,Kd,Kc;
|
||||
|
||||
#ifdef PIDTEMP
|
||||
extern float pid_setpoint[EXTRUDERS];
|
||||
#endif
|
||||
|
||||
#ifdef WATCHPERIOD
|
||||
extern int watch_raw[EXTRUDERS] ;
|
||||
extern unsigned long watchmillis;
|
||||
#endif
|
||||
|
||||
|
||||
//high level conversion routines, for use outside of temperature.cpp
|
||||
//inline so that there is no performance decrease.
|
||||
//deg=degreeCelsius
|
||||
|
||||
FORCE_INLINE float degHotend(uint8_t extruder) {
|
||||
return analog2temp(current_raw[extruder], extruder);
|
||||
};
|
||||
|
||||
FORCE_INLINE float degBed() {
|
||||
return analog2tempBed(current_raw_bed);
|
||||
};
|
||||
|
||||
FORCE_INLINE float degTargetHotend(uint8_t extruder) {
|
||||
return analog2temp(target_raw[extruder], extruder);
|
||||
};
|
||||
|
||||
FORCE_INLINE float degTargetBed() {
|
||||
return analog2tempBed(target_raw_bed);
|
||||
};
|
||||
|
||||
FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) {
|
||||
target_raw[extruder] = temp2analog(celsius, extruder);
|
||||
#ifdef PIDTEMP
|
||||
pid_setpoint[extruder] = celsius;
|
||||
#endif //PIDTEMP
|
||||
};
|
||||
|
||||
FORCE_INLINE void setTargetBed(const float &celsius) {
|
||||
target_raw_bed = temp2analogBed(celsius);
|
||||
};
|
||||
|
||||
FORCE_INLINE bool isHeatingHotend(uint8_t extruder){
|
||||
return target_raw[extruder] > current_raw[extruder];
|
||||
};
|
||||
|
||||
FORCE_INLINE bool isHeatingBed() {
|
||||
return target_raw_bed > current_raw_bed;
|
||||
};
|
||||
|
||||
FORCE_INLINE bool isCoolingHotend(uint8_t extruder) {
|
||||
return target_raw[extruder] < current_raw[extruder];
|
||||
};
|
||||
|
||||
FORCE_INLINE bool isCoolingBed() {
|
||||
return target_raw_bed < current_raw_bed;
|
||||
};
|
||||
|
||||
#define degHotend0() degHotend(0)
|
||||
#define degTargetHotend0() degTargetHotend(0)
|
||||
#define setTargetHotend0(_celsius) setTargetHotend((_celsius), 0)
|
||||
#define isHeatingHotend0() isHeatingHotend(0)
|
||||
#define isCoolingHotend0() isCoolingHotend(0)
|
||||
#if EXTRUDERS > 1
|
||||
#define degHotend1() degHotend(1)
|
||||
#define degTargetHotend1() degTargetHotend(1)
|
||||
#define setTargetHotend1(_celsius) setTargetHotend((_celsius), 1)
|
||||
#define isHeatingHotend1() isHeatingHotend(1)
|
||||
#define isCoolingHotend1() isCoolingHotend(1)
|
||||
#endif
|
||||
#if EXTRUDERS > 2
|
||||
#define degHotend2() degHotend(2)
|
||||
#define degTargetHotend2() degTargetHotend(2)
|
||||
#define setTargetHotend2(_celsius) setTargetHotend((_celsius), 2)
|
||||
#define isHeatingHotend2() isHeatingHotend(2)
|
||||
#define isCoolingHotend2() isCoolingHotend(2)
|
||||
#endif
|
||||
#if EXTRUDERS > 3
|
||||
#error Invalid number of extruders
|
||||
#endif
|
||||
|
||||
FORCE_INLINE void autotempShutdown(){
|
||||
#ifdef AUTOTEMP
|
||||
if(autotemp_enabled)
|
||||
{
|
||||
autotemp_enabled=false;
|
||||
if(degTargetHotend(ACTIVE_EXTRUDER)>autotemp_min)
|
||||
setTargetHotend(0,ACTIVE_EXTRUDER);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int getHeaterPower(int heater);
|
||||
void disable_heater();
|
||||
void setWatch();
|
||||
void updatePID();
|
||||
|
||||
#endif
|
||||
/*
|
||||
temperature.h - temperature controller
|
||||
Part of Marlin
|
||||
|
||||
Copyright (c) 2011 Erik van der Zalm
|
||||
|
||||
Grbl is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Grbl is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef temperature_h
|
||||
#define temperature_h
|
||||
|
||||
#include "Marlin.h"
|
||||
#include "fastio.h"
|
||||
#include "planner.h"
|
||||
#ifdef PID_ADD_EXTRUSION_RATE
|
||||
#include "stepper.h"
|
||||
#endif
|
||||
|
||||
// public functions
|
||||
void tp_init(); //initialise the heating
|
||||
void manage_heater(); //it is critical that this is called periodically.
|
||||
|
||||
//low leven conversion routines
|
||||
// do not use this routines and variables outsie of temperature.cpp
|
||||
int temp2analog(int celsius, uint8_t e);
|
||||
int temp2analogBed(int celsius);
|
||||
float analog2temp(int raw, uint8_t e);
|
||||
float analog2tempBed(int raw);
|
||||
extern int target_raw[EXTRUDERS];
|
||||
extern int heatingtarget_raw[EXTRUDERS];
|
||||
extern int current_raw[EXTRUDERS];
|
||||
extern int target_raw_bed;
|
||||
extern int current_raw_bed;
|
||||
extern float Kp,Ki,Kd,Kc;
|
||||
|
||||
#ifdef PIDTEMP
|
||||
extern float pid_setpoint[EXTRUDERS];
|
||||
#endif
|
||||
|
||||
// #ifdef WATCHPERIOD
|
||||
extern int watch_raw[EXTRUDERS] ;
|
||||
// extern unsigned long watchmillis;
|
||||
// #endif
|
||||
|
||||
|
||||
//high level conversion routines, for use outside of temperature.cpp
|
||||
//inline so that there is no performance decrease.
|
||||
//deg=degreeCelsius
|
||||
|
||||
FORCE_INLINE float degHotend(uint8_t extruder) {
|
||||
return analog2temp(current_raw[extruder], extruder);
|
||||
};
|
||||
|
||||
FORCE_INLINE float degBed() {
|
||||
return analog2tempBed(current_raw_bed);
|
||||
};
|
||||
|
||||
FORCE_INLINE float degTargetHotend(uint8_t extruder) {
|
||||
return analog2temp(target_raw[extruder], extruder);
|
||||
};
|
||||
|
||||
FORCE_INLINE float degTargetBed() {
|
||||
return analog2tempBed(target_raw_bed);
|
||||
};
|
||||
|
||||
FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) {
|
||||
target_raw[extruder] = temp2analog(celsius, extruder);
|
||||
#ifdef PIDTEMP
|
||||
pid_setpoint[extruder] = celsius;
|
||||
#endif //PIDTEMP
|
||||
};
|
||||
|
||||
FORCE_INLINE void setTargetBed(const float &celsius) {
|
||||
target_raw_bed = temp2analogBed(celsius);
|
||||
};
|
||||
|
||||
FORCE_INLINE bool isHeatingHotend(uint8_t extruder){
|
||||
return target_raw[extruder] > current_raw[extruder];
|
||||
};
|
||||
|
||||
FORCE_INLINE bool isHeatingBed() {
|
||||
return target_raw_bed > current_raw_bed;
|
||||
};
|
||||
|
||||
FORCE_INLINE bool isCoolingHotend(uint8_t extruder) {
|
||||
return target_raw[extruder] < current_raw[extruder];
|
||||
};
|
||||
|
||||
FORCE_INLINE bool isCoolingBed() {
|
||||
return target_raw_bed < current_raw_bed;
|
||||
};
|
||||
|
||||
#define degHotend0() degHotend(0)
|
||||
#define degTargetHotend0() degTargetHotend(0)
|
||||
#define setTargetHotend0(_celsius) setTargetHotend((_celsius), 0)
|
||||
#define isHeatingHotend0() isHeatingHotend(0)
|
||||
#define isCoolingHotend0() isCoolingHotend(0)
|
||||
#if EXTRUDERS > 1
|
||||
#define degHotend1() degHotend(1)
|
||||
#define degTargetHotend1() degTargetHotend(1)
|
||||
#define setTargetHotend1(_celsius) setTargetHotend((_celsius), 1)
|
||||
#define isHeatingHotend1() isHeatingHotend(1)
|
||||
#define isCoolingHotend1() isCoolingHotend(1)
|
||||
#endif
|
||||
#if EXTRUDERS > 2
|
||||
#define degHotend2() degHotend(2)
|
||||
#define degTargetHotend2() degTargetHotend(2)
|
||||
#define setTargetHotend2(_celsius) setTargetHotend((_celsius), 2)
|
||||
#define isHeatingHotend2() isHeatingHotend(2)
|
||||
#define isCoolingHotend2() isCoolingHotend(2)
|
||||
#endif
|
||||
#if EXTRUDERS > 3
|
||||
#error Invalid number of extruders
|
||||
#endif
|
||||
|
||||
FORCE_INLINE void autotempShutdown(){
|
||||
#ifdef AUTOTEMP
|
||||
if(autotemp_enabled)
|
||||
{
|
||||
autotemp_enabled=false;
|
||||
if(degTargetHotend(ACTIVE_EXTRUDER)>autotemp_min)
|
||||
setTargetHotend(0,ACTIVE_EXTRUDER);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int getHeaterPower(int heater);
|
||||
void disable_heater();
|
||||
void setWatch();
|
||||
void updatePID();
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -441,7 +441,7 @@ void MainMenu::showStatus()
|
||||
force_lcd_update=false;
|
||||
}
|
||||
|
||||
enum {ItemP_exit, ItemP_home, ItemP_origin, ItemP_preheat, ItemP_extrude, ItemP_disstep};
|
||||
enum {ItemP_exit, ItemP_autostart,ItemP_disstep,ItemP_home, ItemP_origin, ItemP_preheat, ItemP_extrude};
|
||||
|
||||
//any action must not contain a ',' character anywhere, or this breaks:
|
||||
#define MENUITEM(repaint_action, click_action) \
|
||||
@ -462,6 +462,12 @@ void MainMenu::showPrepare()
|
||||
case ItemP_exit:
|
||||
MENUITEM( lcdprintPGM(" Main \003") , BLOCK;status=Main_Menu;beepshort(); ) ;
|
||||
break;
|
||||
case ItemP_autostart:
|
||||
MENUITEM( lcdprintPGM(" Autostart") , BLOCK;card.lastnr=0;card.checkautostart(true);beepshort(); ) ;
|
||||
break;
|
||||
case ItemP_disstep:
|
||||
MENUITEM( lcdprintPGM(" Disable Steppers") , BLOCK;enquecommand("M84");beepshort(); ) ;
|
||||
break;
|
||||
case ItemP_home:
|
||||
MENUITEM( lcdprintPGM(" Auto Home") , BLOCK;enquecommand("G28 X-105 Y-105 Z0");beepshort(); ) ;
|
||||
break;
|
||||
@ -474,15 +480,14 @@ void MainMenu::showPrepare()
|
||||
case ItemP_extrude:
|
||||
MENUITEM( lcdprintPGM(" Extrude") , BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E50");beepshort(); ) ;
|
||||
break;
|
||||
case ItemP_disstep:
|
||||
MENUITEM( lcdprintPGM(" Disable Steppers") , BLOCK;enquecommand("M84");beepshort(); ) ;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
line++;
|
||||
}
|
||||
updateActiveLines(ItemP_disstep,encoderpos);
|
||||
updateActiveLines(ItemP_extrude,encoderpos);
|
||||
}
|
||||
|
||||
enum {ItemT_exit,ItemT_speed,ItemT_flow,ItemT_nozzle,ItemT_fan};
|
||||
@ -1840,4 +1845,4 @@ char *ftostr51(const float &x)
|
||||
|
||||
#endif //ULTRA_LCD
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user