stop print statistics needs to finish, lcd_licked function improved to work with long press button, selftest bug fixed; stop print, pause print and live adjust are hidden in mesh bed leveling and auto home

This commit is contained in:
PavelSindler 2017-03-30 16:48:10 +02:00
parent 64f4181451
commit 6ffc022633
8 changed files with 159 additions and 478 deletions

View File

@ -310,9 +310,14 @@ extern void digipot_i2c_init();
#endif
//Long pause
extern int saved_feedmultiply;
extern float HotendTempBckp;
extern int fanSpeedBckp;
extern float pause_lastpos[4];
extern unsigned long pause_time;
extern bool mesh_bed_leveling_flag;
extern void calculate_volumetric_multipliers();

View File

@ -262,9 +262,14 @@ unsigned long kicktime = millis()+100000;
unsigned int usb_printing_counter;
int lcd_change_fil_state = 0;
int feedmultiplyBckp = 100;
float HotendTempBckp = 0;
int fanSpeedBckp = 0;
float pause_lastpos[4];
unsigned long pause_time = 0;
bool mesh_bed_leveling_flag = false;
unsigned char lang_selected = 0;
int8_t FarmMode = 0;
@ -1316,7 +1321,7 @@ void loop()
}
//check heater every n milliseconds
manage_heater();
manage_inactivity();
isPrintPaused ? manage_inactivity(true) : manage_inactivity(false);
checkHitEndstops();
lcd_update();
}
@ -2824,7 +2829,9 @@ void process_commands()
case 80:
case_G80:
{
// Firstly check if we know where we are
mesh_bed_leveling_flag = true;
// Firstly check if we know where we are
if ( !( axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS] ) ){
// We don't know where we are! HOME!
// Push the commands to the front of the message queue in the reverse order!
@ -2902,7 +2909,7 @@ void process_commands()
world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], XY_AXIS_FEEDRATE, active_extruder);
st_synchronize();
// Go down until endstop is hit
const float Z_CALIBRATION_THRESHOLD = 1.f;
if (! find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f)) {
@ -2993,7 +3000,8 @@ void process_commands()
custom_message = custom_message_old;
custom_message_type = custom_message_type_old;
custom_message_state = custom_message_state_old;
lcd_update(1);
mesh_bed_leveling_flag = false;
lcd_update(2);
}
break;
@ -4809,177 +4817,6 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
break;
}
#endif // CUSTOM_M_CODE_SET_Z_PROBE_OFFSET
/* case 602: //resume long pause print
{
//set hotend temp back
setTargetHotend(HotendTempBckp, active_extruder);
//set fan speed back
fanSpeed = fanSpeedBckp;
//go back to print
//Move XY back
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder);
//wait for hotend to reach target temp -> see M109
//while (abs(degHotend(active_extruder) - target_temperature(active_extruder)) > 3) delay_keep_alive;
wait_for_heater(millis());
//Move Z back
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], 15, active_extruder);
//Unretract
target[E_AXIS] = target[E_AXIS] - PAUSE_RETRACT;
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder);
//Set E position to original (should be original in this case)
plan_set_e_position(lastpos[E_AXIS]);
//Recover feed rate
feedmultiply = feedmultiplyBckp;
char cmd[9];
sprintf_P(cmd, PSTR("M220 S%i"), feedmultiplyBckp);
enquecommand(cmd);
card.startFileprint();
}break;*/
case 601: //long pause print
{
//M601 E-2 X50 Y190 Z20
// if (IS_SD_PRINTING) {
// We don't know where we are! HOME!
// Push the commands to the front of the message queue in the reverse order!
// There shall be always enough space reserved for these commands.
// repeatcommand_front(); // repeat G80 with all its parameters
// enquecommand_front_P((PSTR("G25")));
// break;
//}
float target[4];
float lastpos[4];
//statistics - need to save print time???
//keep motor currents and bed temperature and pause print
//stop_buffering = true;
//while (blocks_queued()) delay_keep_alive(50);
//tuurn off print ventilator
card.pauseSDPrint();
while (blocks_queued()) delay_keep_alive(50); //wait for empty buffer
st_synchronize();
feedmultiplyBckp = feedmultiply;
HotendTempBckp = degTargetHotend(active_extruder);
fanSpeedBckp = fanSpeed;
target[X_AXIS] = current_position[X_AXIS];
target[Y_AXIS] = current_position[Y_AXIS];
target[Z_AXIS] = current_position[Z_AXIS];
target[E_AXIS] = current_position[E_AXIS];
lastpos[X_AXIS] = current_position[X_AXIS];
lastpos[Y_AXIS] = current_position[Y_AXIS];
lastpos[Z_AXIS] = current_position[Z_AXIS];
lastpos[E_AXIS] = current_position[E_AXIS];
if (code_seen('E'))
{
target[E_AXIS] += code_value();
}
else
{
#ifdef PAUSE_RETRACT
target[E_AXIS] += PAUSE_RETRACT;
#endif
}
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 400, active_extruder);
//Lift Z
if (code_seen('Z'))
{
target[Z_AXIS] += code_value();
}
else
{
#ifdef Z_PAUSE_LIFT
target[Z_AXIS] += Z_PAUSE_LIFT;
if (target[Z_AXIS] > Z_MAX_POS) target[Z_AXIS] = Z_MAX_POS;
#endif
}
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 15, active_extruder);
//set nozzle target temperature to 0
setTargetHotend(0, 0);
setTargetHotend(0, 1);
setTargetHotend(0, 2);
//Move XY to side
if (code_seen('X'))
{
target[X_AXIS] += code_value();
}
else
{
#ifdef X_PAUSE_POS
target[X_AXIS] = X_PAUSE_POS;
#endif
}
if (code_seen('Y'))
{
target[Y_AXIS] = code_value();
}
else
{
#ifdef Y_PAUSE_POS
target[Y_AXIS] = Y_PAUSE_POS;
#endif
}
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder);
// Turn off the print fan
//SET_OUTPUT(FAN_PIN);
//WRITE(FAN_PIN, 0);
fanSpeed = 0;
st_synchronize();
/*while (!lcd_clicked()) {
delay_keep_alive(100);
}
//set hotend temp back
setTargetHotend(HotendTempBckp, active_extruder);
//go back to print
//Move XY back
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_XYFEED, active_extruder);
//wait for hotend to reach target temp -> see M109
//while (abs(degHotend(active_extruder) - target_temperature(active_extruder)) > 3) delay_keep_alive;
wait_for_heater(millis());
//Move Z back
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_ZFEED, active_extruder);
target[E_AXIS] = target[E_AXIS] - FILAMENTCHANGE_FIRSTRETRACT;
//Unretract
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder);
//Set E position to original (shoulb be original in this case)
plan_set_e_position(lastpos[E_AXIS]);
//Recover feed rate
feedmultiply = feedmultiplyBckp;
char cmd[9];
sprintf_P(cmd, PSTR("M220 S%i"), feedmultiplyBckp);
enquecommand(cmd);
//card.startFileprint();*/
}
break;
#ifdef FILAMENTCHANGEENABLE
case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
@ -5206,7 +5043,16 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
}
break;
#endif //FILAMENTCHANGEENABLE
case 601: {
if(lcd_commands_type == 0) lcd_commands_type = LCD_COMMAND_LONG_PAUSE;
}
break;
case 602: {
if(lcd_commands_type == 0) lcd_commands_type = LCD_COMMAND_LONG_PAUSE_RESUME;
}
break;
case 907: // M907 Set digital trimpot motor current using axis codes.
{
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
@ -6278,65 +6124,29 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_
void long_pause() //long pause print
{
//M601 E-2 X50 Y190 Z20
// if (IS_SD_PRINTING) {
// We don't know where we are! HOME!
// Push the commands to the front of the message queue in the reverse order!
// There shall be always enough space reserved for these commands.
// repeatcommand_front(); // repeat G80 with all its parameters
// enquecommand_front_P((PSTR("G25")));
// break;
//}
float target[4];
float lastpos[4];
//statistics - need to save print time???
//keep motor currents and bed temperature and pause print
//stop_buffering = true;
//while (blocks_queued()) delay_keep_alive(50);
//tuurn off print ventilator
st_synchronize();
feedmultiplyBckp = feedmultiply;
//save currently set parameters to global variables
saved_feedmultiply = feedmultiply;
HotendTempBckp = degTargetHotend(active_extruder);
fanSpeedBckp = fanSpeed;
pause_time += (millis() - starttime);
target[X_AXIS] = current_position[X_AXIS];
target[Y_AXIS] = current_position[Y_AXIS];
target[Z_AXIS] = current_position[Z_AXIS];
target[E_AXIS] = current_position[E_AXIS];
lastpos[X_AXIS] = current_position[X_AXIS];
lastpos[Y_AXIS] = current_position[Y_AXIS];
lastpos[Z_AXIS] = current_position[Z_AXIS];
lastpos[E_AXIS] = current_position[E_AXIS];
//save position
pause_lastpos[X_AXIS] = current_position[X_AXIS];
pause_lastpos[Y_AXIS] = current_position[Y_AXIS];
pause_lastpos[Z_AXIS] = current_position[Z_AXIS];
pause_lastpos[E_AXIS] = current_position[E_AXIS];
if (code_seen('E'))
{
target[E_AXIS] += code_value();
}
else
{
#ifdef PAUSE_RETRACT
target[E_AXIS] += PAUSE_RETRACT;
#endif
}
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 400, active_extruder);
//retract
current_position[E_AXIS] -= PAUSE_RETRACT;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400, active_extruder);
//Lift Z
if (code_seen('Z'))
{
target[Z_AXIS] += code_value();
}
else
{
#ifdef Z_PAUSE_LIFT
target[Z_AXIS] += Z_PAUSE_LIFT;
if (target[Z_AXIS] > Z_MAX_POS) target[Z_AXIS] = Z_MAX_POS;
#endif
}
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 15, active_extruder);
//lift z
current_position[Z_AXIS] += Z_PAUSE_LIFT;
if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder);
//set nozzle target temperature to 0
setTargetHotend(0, 0);
@ -6344,219 +6154,12 @@ void long_pause() //long pause print
setTargetHotend(0, 2);
//Move XY to side
if (code_seen('X'))
{
target[X_AXIS] += code_value();
}
else
{
#ifdef X_PAUSE_POS
target[X_AXIS] = X_PAUSE_POS;
#endif
}
if (code_seen('Y'))
{
target[Y_AXIS] = code_value();
}
else
{
#ifdef Y_PAUSE_POS
target[Y_AXIS] = Y_PAUSE_POS;
#endif
}
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder);
current_position[X_AXIS] = X_PAUSE_POS;
current_position[Y_AXIS] = Y_PAUSE_POS;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder);
// Turn off the print fan
//SET_OUTPUT(FAN_PIN);
//WRITE(FAN_PIN, 0);
fanSpeed = 0;
st_synchronize();
/*while (!lcd_clicked()) {
delay_keep_alive(100);
}
//set hotend temp back
setTargetHotend(HotendTempBckp, active_extruder);
//go back to print
//Move XY back
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_XYFEED, active_extruder);
//wait for hotend to reach target temp -> see M109
//while (abs(degHotend(active_extruder) - target_temperature(active_extruder)) > 3) delay_keep_alive;
wait_for_heater(millis());
//Move Z back
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_ZFEED, active_extruder);
target[E_AXIS] = target[E_AXIS] - FILAMENTCHANGE_FIRSTRETRACT;
//Unretract
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder);
//Set E position to original (shoulb be original in this case)
plan_set_e_position(lastpos[E_AXIS]);
//Recover feed rate
feedmultiply = feedmultiplyBckp;
char cmd[9];
sprintf_P(cmd, PSTR("M220 S%i"), feedmultiplyBckp);
enquecommand(cmd);
//card.startFileprint();*/
}
/*void bootloader_display() {
char i;
unsigned char lcd_rows = 4;
unsigned char lcd_cols = 20;
unsigned char display_func = 0;
unsigned char current_row = 0;
unsigned char rs_pin = 82;
unsigned char enable_pin = 18;
unsigned char d4 = 19;
unsigned char d5 = 70;
unsigned char d6 = 85;
unsigned char d7 = 71;
//initialize display
for (i = 0; i < 100; i++) delay(500); //we need at least 40ms delay after power up
display_func |= 0x08; //2 lines
// Now we pull both RS and R/W low to begin commands
// Now we pull both RS and R/W low to begin commands
digitalWrite(rs_pin, LOW);
digitalWrite(_enable_pin, LOW);
if (_rw_pin != 255) {
digitalWrite(_rw_pin, LOW);
}
//put the LCD into 4 bit or 8 bit mode
if (!(_displayfunction & LCD_8BITMODE)) {
// this is according to the hitachi HD44780 datasheet
// figure 24, pg 46
// we start in 8bit mode, try to set 4 bit mode
write4bits(0x03);
delayMicroseconds(4500); // wait min 4.1ms
// second try
write4bits(0x03);
delayMicroseconds(4500); // wait min 4.1ms
// third go!
write4bits(0x03);
delayMicroseconds(150);
// finally, set to 4-bit interface
write4bits(0x02);
}
else {
// this is according to the hitachi HD44780 datasheet
// page 45 figure 23
// Send function set command sequence
command(LCD_FUNCTIONSET | _displayfunction);
delayMicroseconds(4500); // wait more than 4.1ms
// second try
command(LCD_FUNCTIONSET | _displayfunction);
delayMicroseconds(150);
// third go
command(LCD_FUNCTIONSET | _displayfunction);
}
// finally, set # lines, font size, etc.
command(LCD_FUNCTIONSET | _displayfunction);
delayMicroseconds(60);
// turn the display on with no cursor or blinking default
_displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF;
display();
delayMicroseconds(60);
// clear it off
clear();
delayMicroseconds(3000);
// Initialize to default text direction (for romance languages)
_displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT;
// set the entry mode
command(LCD_ENTRYMODESET | _displaymode);
delayMicroseconds(60);
}
void lcd_init()
{
lcd_implementation_init();
#ifdef NEWPANEL
SET_INPUT(BTN_EN1);
SET_INPUT(BTN_EN2);
WRITE(BTN_EN1, HIGH);
WRITE(BTN_EN2, HIGH);
#if BTN_ENC > 0
SET_INPUT(BTN_ENC);
WRITE(BTN_ENC, HIGH);
#endif
#ifdef REPRAPWORLD_KEYPAD
pinMode(SHIFT_CLK, OUTPUT);
pinMode(SHIFT_LD, OUTPUT);
pinMode(SHIFT_OUT, INPUT);
WRITE(SHIFT_OUT, HIGH);
WRITE(SHIFT_LD, HIGH);
#endif
#else // Not NEWPANEL
#ifdef SR_LCD_2W_NL // Non latching 2 wire shift register
pinMode(SR_DATA_PIN, OUTPUT);
pinMode(SR_CLK_PIN, OUTPUT);
#elif defined(SHIFT_CLK)
pinMode(SHIFT_CLK, OUTPUT);
pinMode(SHIFT_LD, OUTPUT);
pinMode(SHIFT_EN, OUTPUT);
pinMode(SHIFT_OUT, INPUT);
WRITE(SHIFT_OUT, HIGH);
WRITE(SHIFT_LD, HIGH);
WRITE(SHIFT_EN, LOW);
#else
#ifdef ULTIPANEL
#error ULTIPANEL requires an encoder
#endif
#endif // SR_LCD_2W_NL
#endif//!NEWPANEL
#if defined (SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0)
pinMode(SDCARDDETECT, INPUT);
WRITE(SDCARDDETECT, HIGH);
lcd_oldcardstatus = IS_SD_INSERTED;
#endif//(SDCARDDETECT > 0)
#ifdef LCD_HAS_SLOW_BUTTONS
slow_buttons = 0;
#endif
lcd_buttons_update();
#ifdef ULTIPANEL
encoderDiff = 0;
#endif
}
//clear the display
//write message
LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7
}*/

View File

@ -996,6 +996,11 @@ const char * const MSG_FIND_BED_OFFSET_AND_SKEW_LINE2_LANG_TABLE[LANG_NUM] PROGM
MSG_FIND_BED_OFFSET_AND_SKEW_LINE2_DE
};
const char MSG_FINISHING_MOVEMENTS_EN[] PROGMEM = "Finishing movements";
const char * const MSG_FINISHING_MOVEMENTS_LANG_TABLE[1] PROGMEM = {
MSG_FINISHING_MOVEMENTS_EN
};
const char MSG_FLOW_EN[] PROGMEM = "Flow";
const char MSG_FLOW_CZ[] PROGMEM = "Prutok";
const char MSG_FLOW_IT[] PROGMEM = "Flusso";
@ -1826,6 +1831,11 @@ const char * const MSG_PRINT_ABORTED_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_PRINT_ABORTED_DE
};
const char MSG_PRINT_PAUSED_EN[] PROGMEM = "Print paused";
const char * const MSG_PRINT_PAUSED_LANG_TABLE[1] PROGMEM = {
MSG_PRINT_PAUSED_EN
};
const char MSG_PRUSA3D_EN[] PROGMEM = "prusa3d.com";
const char MSG_PRUSA3D_CZ[] PROGMEM = "prusa3d.cz";
const char MSG_PRUSA3D_PL[] PROGMEM = "prusa3d.cz";
@ -1932,6 +1942,11 @@ const char * const MSG_RESUMING_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_RESUMING_DE
};
const char MSG_RESUMING_PRINT_EN[] PROGMEM = "Resuming print";
const char * const MSG_RESUMING_PRINT_LANG_TABLE[1] PROGMEM = {
MSG_RESUMING_PRINT_EN
};
const char MSG_SD_CANT_ENTER_SUBDIR_EN[] PROGMEM = "Cannot enter subdir: ";
const char * const MSG_SD_CANT_ENTER_SUBDIR_LANG_TABLE[1] PROGMEM = {
MSG_SD_CANT_ENTER_SUBDIR_EN

View File

@ -205,6 +205,8 @@ extern const char* const MSG_FIND_BED_OFFSET_AND_SKEW_LINE1_LANG_TABLE[LANG_NUM]
#define MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 LANG_TABLE_SELECT(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1_LANG_TABLE)
extern const char* const MSG_FIND_BED_OFFSET_AND_SKEW_LINE2_LANG_TABLE[LANG_NUM];
#define MSG_FIND_BED_OFFSET_AND_SKEW_LINE2 LANG_TABLE_SELECT(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2_LANG_TABLE)
extern const char* const MSG_FINISHING_MOVEMENTS_LANG_TABLE[1];
#define MSG_FINISHING_MOVEMENTS LANG_TABLE_SELECT_EXPLICIT(MSG_FINISHING_MOVEMENTS_LANG_TABLE, 0)
extern const char* const MSG_FLOW_LANG_TABLE[LANG_NUM];
#define MSG_FLOW LANG_TABLE_SELECT(MSG_FLOW_LANG_TABLE)
extern const char* const MSG_FLOW0_LANG_TABLE[1];
@ -361,6 +363,8 @@ extern const char* const MSG_PRINTER_DISCONNECTED_LANG_TABLE[1];
#define MSG_PRINTER_DISCONNECTED LANG_TABLE_SELECT_EXPLICIT(MSG_PRINTER_DISCONNECTED_LANG_TABLE, 0)
extern const char* const MSG_PRINT_ABORTED_LANG_TABLE[LANG_NUM];
#define MSG_PRINT_ABORTED LANG_TABLE_SELECT(MSG_PRINT_ABORTED_LANG_TABLE)
extern const char* const MSG_PRINT_PAUSED_LANG_TABLE[1];
#define MSG_PRINT_PAUSED LANG_TABLE_SELECT_EXPLICIT(MSG_PRINT_PAUSED_LANG_TABLE, 0)
extern const char* const MSG_PRUSA3D_LANG_TABLE[LANG_NUM];
#define MSG_PRUSA3D LANG_TABLE_SELECT(MSG_PRUSA3D_LANG_TABLE)
extern const char* const MSG_PRUSA3D_FORUM_LANG_TABLE[LANG_NUM];
@ -383,6 +387,8 @@ extern const char* const MSG_RESUME_PRINT_LANG_TABLE[LANG_NUM];
#define MSG_RESUME_PRINT LANG_TABLE_SELECT(MSG_RESUME_PRINT_LANG_TABLE)
extern const char* const MSG_RESUMING_LANG_TABLE[LANG_NUM];
#define MSG_RESUMING LANG_TABLE_SELECT(MSG_RESUMING_LANG_TABLE)
extern const char* const MSG_RESUMING_PRINT_LANG_TABLE[1];
#define MSG_RESUMING_PRINT LANG_TABLE_SELECT_EXPLICIT(MSG_RESUMING_PRINT_LANG_TABLE, 0)
extern const char* const MSG_SD_CANT_ENTER_SUBDIR_LANG_TABLE[1];
#define MSG_SD_CANT_ENTER_SUBDIR LANG_TABLE_SELECT_EXPLICIT(MSG_SD_CANT_ENTER_SUBDIR_LANG_TABLE, 0)
extern const char* const MSG_SD_CANT_OPEN_SUBDIR_LANG_TABLE[1];

View File

@ -265,4 +265,7 @@
#define MSG_MENU_CALIBRATION "Calibration"
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]"
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]"
#define MSG_PRINTER_DISCONNECTED "Printer disconnected"
#define MSG_PRINTER_DISCONNECTED "Printer disconnected"
#define MSG_FINISHING_MOVEMENTS "Finishing movements"
#define MSG_PRINT_PAUSED "Print paused"
#define MSG_RESUMING_PRINT "Resuming print"

View File

@ -510,18 +510,19 @@ static void lcd_status_screen()
void lcd_commands()
{
char cmd1[25];
if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE)
{
if(lcd_commands_step == 0) {
lcd_commands_step = 2;
}
if (lcd_commands_step == 2 & !blocks_queued()) {
//lcd_return_to_status();
lcd_setstatuspgm(PSTR("print paused"));
card.pauseSDPrint();
lcd_setstatuspgm(MSG_FINISHING_MOVEMENTS);
lcdDrawUpdate = 3;
lcd_commands_step = 1;
}
if (lcd_commands_step == 1 && !blocks_queued()) {
lcd_setstatuspgm(MSG_PRINT_PAUSED);
isPrintPaused = true;
long_pause();
lcd_commands_type = 0;
lcd_commands_step = 0;
@ -529,11 +530,67 @@ void lcd_commands()
}
if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE_RESUME) {
char cmd1[30];
if (lcd_commands_step == 0) {
lcdDrawUpdate = 3;
lcd_commands_step = 4;
}
if (lcd_commands_step == 1 && !blocks_queued()) { //recover feedmultiply, current
sprintf_P(cmd1, PSTR("M220 S%d"), saved_feedmultiply);
enquecommand(cmd1);
isPrintPaused = false;
card.startFileprint();
starttime = pause_time;
lcd_commands_step = 0;
lcd_commands_type = 0;
}
if (lcd_commands_step == 2 && !blocks_queued()) { //turn on fan, move Z and unretract
sprintf_P(cmd1, PSTR("M106 S%d"), fanSpeedBckp);
enquecommand(cmd1);
strcpy(cmd1, "G1 Z");
strcat(cmd1, ftostr32(pause_lastpos[Z_AXIS]));
enquecommand(cmd1);
enquecommand_P(PSTR("M83")); // set extruder to relative mode.
enquecommand_P(PSTR("G1 E" STRINGIFY(PAUSE_RETRACT))); //unretract
enquecommand_P(PSTR("G90")); //absolute positioning
lcd_commands_step = 1;
}
if (lcd_commands_step == 3 && !blocks_queued()) { //wait for nozzle to reach target temp
strcpy(cmd1, "M109 S");
strcat(cmd1, ftostr3(HotendTempBckp));
enquecommand(cmd1);
lcd_commands_step = 2;
}
if (lcd_commands_step == 4 && !blocks_queued()) { //set temperature back and move xy
strcpy(cmd1, "M104 S");
strcat(cmd1, ftostr3(HotendTempBckp));
enquecommand(cmd1);
strcpy(cmd1, "G1 X");
strcat(cmd1, ftostr32(pause_lastpos[X_AXIS]));
strcat(cmd1, " Y");
strcat(cmd1, ftostr32(pause_lastpos[Y_AXIS]));
enquecommand(cmd1);
lcd_setstatuspgm(MSG_RESUMING_PRINT);
lcd_commands_step = 3;
}
}
if (lcd_commands_type == LCD_COMMAND_STOP_PRINT) /// stop print
{
if (lcd_commands_step == 0) { lcd_commands_step = 6; custom_message = true; }
if (lcd_commands_step == 0)
{
lcd_commands_step = 6;
custom_message = true;
}
if (lcd_commands_step == 1 && !blocks_queued())
{
@ -733,18 +790,14 @@ static void lcd_return_to_status() {
static void lcd_sdcard_pause() {
card.pauseSDPrint();
isPrintPaused = true;
lcd_return_to_status();
lcdDrawUpdate = 3;
lcd_commands_type = LCD_COMMAND_LONG_PAUSE;
}
static void lcd_sdcard_resume() {
/*enquecommand_P(PSTR("M602"));
isPrintPaused = false;
lcdDrawUpdate = 3;*/
lcd_return_to_status();
lcd_commands_type = LCD_COMMAND_LONG_PAUSE_RESUME;
}
float move_menu_scale;
@ -3237,9 +3290,7 @@ static void lcd_main_menu()
}*/
if ( ( IS_SD_PRINTING || is_usb_printing ) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag)
if ( ( IS_SD_PRINTING || is_usb_printing ) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag)
{
MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z);//8
}
@ -3258,15 +3309,17 @@ static void lcd_main_menu()
{
if (card.isFileOpen())
{
if (card.sdprinting)
{
MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause);
if (mesh_bed_leveling_flag == false && homing_flag == false) {
if (card.sdprinting)
{
MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause);
}
else
{
MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume);
}
MENU_ITEM(submenu, MSG_STOP_PRINT, lcd_sdcard_stop);
}
else
{
MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume);
}
MENU_ITEM(submenu, MSG_STOP_PRINT, lcd_sdcard_stop);
}
else
{
@ -3983,7 +4036,7 @@ static bool lcd_selfcheck_check_heater(bool _isbed)
do {
_counter++;
(_counter < _cycles) ? _docycle = true : _docycle = false;
_docycle = (_counter < _cycles) ? true : false;
manage_heater();
manage_inactivity(true);
@ -3998,9 +4051,9 @@ static bool lcd_selfcheck_check_heater(bool _isbed)
int _checked_result = (_isbed) ? degBed() - _checked_snapshot : degHotend(0) - _checked_snapshot;
int _opposite_result = (_isbed) ? degHotend(0) - _opposite_snapshot : degBed() - _opposite_snapshot;
if (_opposite_result < (_isbed) ? 10 : 3)
if (_opposite_result < ((_isbed) ? 10 : 3))
{
if (_checked_result >= (_isbed) ? 3 : 10)
if (_checked_result >= ((_isbed) ? 3 : 10))
{
_stepresult = true;
}
@ -4145,15 +4198,10 @@ static bool lcd_selftest_fan_dialog(int _fan)
lcd.setCursor(0, 3); lcd.print(">");
lcd.setCursor(1, 3); lcd_printPGM(MSG_SELFTEST_FAN_NO);
int8_t enc_dif = 0;
bool _response = false;
do
{
switch (_fan)
{
case 1:
@ -4167,8 +4215,6 @@ static bool lcd_selftest_fan_dialog(int _fan)
analogWrite(FAN_PIN, 255);
break;
}
if (abs((enc_dif - encoderDiff)) > 2) {
if (enc_dif > encoderDiff) {
_result = true;
@ -4785,7 +4831,9 @@ void lcd_buzz(long duration, uint16_t freq)
bool lcd_clicked()
{
return LCD_CLICKED;
bool clicked = LCD_CLICKED;
button_pressed = false;
return clicked;
}
#endif//ULTIPANEL

View File

@ -103,6 +103,7 @@ void lcd_mylang();
extern int farm_status;
extern bool cancel_heatup;
extern bool isPrintPaused;
#ifdef FILAMENT_LCD_DISPLAY
extern unsigned long message_millis;

View File

@ -792,7 +792,7 @@ static void lcd_implementation_status_screen()
lcd.print(LCD_STR_CLOCK[0]);
if(starttime != 0)
{
uint16_t time = millis()/60000 - starttime/60000;
uint16_t time = isPrintPaused ? pause_time/60000 : millis()/60000 - starttime/60000; //is print is paused, pause also print time
lcd.print(itostr2(time/60));
lcd.print(':');
lcd.print(itostr2(time%60));