merging
This commit is contained in:
commit
84d9cf7339
12 changed files with 358 additions and 203 deletions
|
@ -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,32 +543,51 @@ 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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -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();
|
||||
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)
|
||||
if( (millis()-last_stepperdisabled_time) > stepper_inactive_time )
|
||||
{
|
||||
disable_x();
|
||||
disable_y();
|
||||
disable_z();
|
||||
disable_e0();
|
||||
disable_e1();
|
||||
disable_e2();
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -464,6 +466,22 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
|
|||
target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_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,10 +757,11 @@ 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;
|
||||
|
@ -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
|
||||
|
||||
|
@ -214,6 +215,19 @@ void manage_heater()
|
|||
}
|
||||
} // 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];
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "Marlin.h"
|
||||
#include "fastio.h"
|
||||
#include "planner.h"
|
||||
#ifdef PID_ADD_EXTRUSION_RATE
|
||||
#include "stepper.h"
|
||||
#endif
|
||||
|
@ -48,10 +49,10 @@ extern float Kp,Ki,Kd,Kc;
|
|||
extern float pid_setpoint[EXTRUDERS];
|
||||
#endif
|
||||
|
||||
#ifdef WATCHPERIOD
|
||||
// #ifdef WATCHPERIOD
|
||||
extern int watch_raw[EXTRUDERS] ;
|
||||
extern unsigned long watchmillis;
|
||||
#endif
|
||||
// extern unsigned long watchmillis;
|
||||
// #endif
|
||||
|
||||
|
||||
//high level conversion routines, for use outside of temperature.cpp
|
||||
|
|
|
@ -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};
|
||||
|
|
Reference in a new issue